Reprint :

Original 2016-09-04 qqfly Nao
ah !

Part I sports planning
The reading volume of popular science articles is thousands .

Since the last article , Back office received a lot of replies , Ask how to do motion planning on your robot . Every reply is too troublesome , In addition, there are many holes to be filled in the actual robot motion planning , So I'm going to push one “
Introduction to sports planning ” Of .

But because I'm here ROS MoveIt Development on , It is also recommended for those who do not have the foundation of sports planning to use it directly MoveIt To get started . So we have to introduce it first ROS. in addition , Yesterday I was in Zhihu Q & A “
What kind of system or platform to develop robot / Machine arm ? ”( Click on the end to read the original , Check Zhihu Q & A ) Added to ROS Related content of , It can be arranged in official account. .


Put one first ROS Industrial One year clip video .

ROS It's been released for eight years , Very popular in foreign scientific research institutions . at present , Several big men led by Southwest Research Institute began to try to ROS Application in industrial robot , The video above is ROS-I Progress in the first anniversary of the project .

To make it clear ROS, I will ROS What is it? , Why use ROS, How to use ROS Three aspects .

△ From this year 《 Robot vision and Application 》 Courseware made by the course itself

What is it?

ROS yes Robot Operating System Abbreviation of , It was originally a robotics project at Stanford University , Later by Willow
Garage Company development , Currently by OSRF(Open Source Robotics Foundation, Inc) Open source projects maintained by the company .

1, First, an operating system

according to wikipedia definition ,OS is system software that manages computer hardware and
software resources and provides common services for computer
programs. In other words, the operating system is used to manage computer hardware and software resources , And provide some public service system software . and ROS He also claims to be a OS.

△ computer OS And robots OS Comparison diagram

As shown in the figure above , The computer's operating system encapsulates the computer's hardware , The application software runs on the operating system , It doesn't matter what kind of hardware products the computer uses . This can greatly improve the efficiency of software development ( Otherwise, everyone can only write a compilation ).

Homology ,ROS The hardware of the robot is encapsulated , Different robots , Different sensors , stay ROS It can be expressed in the same way (topic etc. ), For upper application ( Sports planning, etc ) call .

2, It is a cross platform modular software communication mechanism

ROS Using nodes (Node) The concept of represents an application , Different node Through pre-defined format messages (Topic), service (Service)
, action (Action) To connect .

△ROS Distribution characteristics

△ Characteristics of three communication modes

The advantages and disadvantages of the three communication modes can be seen in the table above , Because many modular programming tools have similar functions , It's not going to be expanded here .

Based on this modular communication mechanism , Developers can easily replace , Update some modules in the system ; You can also replace it with a node written by yourself ROS Individual modules of , Very suitable for algorithm development .

in addition ,ROS Cross platform , On different computers , Different operating systems , No programming language , Used on different robots .

3, Is a series of open source tools

△ Several ROS Tool diagram : Upper left rqt_plot, Upper right rqt_graph, Bottom left Rviz, lower right TF

As shown in the figure above ,ROS Provides a series of very useful tools for developers , Can greatly improve the efficiency of our development .

rqt_plot: You can draw any Topic Value curve of ;

rqt_graph: The connection state between nodes can be drawn , And in use Topic etc. ;

TF:TF yes Transform Short for , Use it , We can know the position and orientation of each link coordinate system in real time , The relative positions of two coordinate systems can also be calculated .

Rviz: Super large 3D Visualization tools , Robot model can be displayed ,3D film , Various text icons , It is also very convenient for secondary development ;

△ stay Rviz Robot model shown in ,3D Point cloud , Object model, etc

△ stay Rviz Convenient interaction function can also be realized in

besides ,ROS There are many other useful open source tools waiting to be explored .

4, It's a series of state-of-the-art algorithms

△ROS Including many advanced robot open source projects

except ROS outside , There are many excellent robot open source projects in the world , however ROS They are gradually being included in their own categories . for example :

PS: Me and ROS Several other developers are also working to LinuxCNC Integration ROS

OROCOS: This open source project mainly focuses on the design of robot bottom controller , Including the numerical solution for the kinematics of the series manipulator KDL, Bayesian filtering , Real time control and other functions .

OpenRave: This is in ROS The platform that most people used to do sports planning before ,ROS Of which ikfast( Analytical solution of kinematics of a series manipulator ) Equal function absorption .

Player: An excellent two-dimensional simulation platform , It can be used in the simulation of planar mobile robot , Now in ROS It can be used directly in .

OpenCV: Famous machine vision open source project ,ROS Provided cv_bridge, You can OpenCV Pictures of and ROS Image format conversion of .

OMPL: Now the most famous open source project of sports planning , It has become MoveIt Part of .

Visp: An open source visual servo project , Already following ROS Perfect integration .

Gazebo: An excellent open source simulation platform , Dynamic simulation can be realized , Sensor simulation, etc , Has also been ROS absorb .

△ lower left quarter gazebo, Lower right corner Rviz

of course , Apart from absorbing other excellent open source projects ,ROS I have developed many excellent projects and libraries .

ORK: An open source database for object recognition and pose estimation , contain LineMod Equal algorithm , But the actual effect is not ideal .

△LineMod Recognition effect

PCL: An open source point cloud processing library , Originally from ROS Developed in , Later, because of its popularity , In order to make non ROS Users can also use , Just one PCL Project of .

Gmapping: This is in fact OpenSlam Project inherited ( Later, it developed and changed a lot ), utilize gmapping Can be realized laser-based
SLAM, Fast establishment of indoor 2D map .

△gmapping Building a two-dimensional map

Localization: Based on extended Kalman filter (EKF) And unscented Kalman filter (UKF) Robot positioning algorithm based on , It can fuse the positioning information of various sensors , Get a more accurate positioning effect .

△robot_localization Sketch Map

Navigation: be based on Dijkstra,A* algorithm ( Global planner ) And dynamic window method DWA( Local planner ) Mobile robot path planning module based on , Robot navigation can be realized on two-dimensional map .

△navigation Sketch Map

MoveIt: This is a module focusing on the motion planning of mobile manipulator , Next time I'll talk about the introduction of sports planning .

△MoveIt Yes UR5 Carry out sports planning

of course , In addition to these state-of-the-art algorithms ,ROS And robots , Sensor drive, etc .

5, It is the most active communication platform for robot development

in my opinion , This should be the most important point . except ROS External , Now there is a need for other projects to be replaced or partially replaced ROS Function of :OpenRave Sports planning ,V-rep simulation . But the communities for these projects are far from ROS active .

ROS Version updated regularly , Main modules are maintained by special personnel , Active Q & A area , various mail lists It's also very active , Developers are very keen on communication and sharing . If you drill down to ROS community , Can learn a lot .


, People who have used industrial robots must know , The development systems of different industrial robots are basically different , Teaching , Programming methods are different , A skilled user Motoman Probably not Kuka Mechanical arm . Even the same kind of robot , Due to firmware version update , May also cause program incompatibility ( I am here UR I met this problem on ). This greatly affects the popularization of robots .

△ Left : Teaching devices of different robots ; right :UR Incompatible firmware version

For this ,ROS Robots can be packaged in a unified way (URDF Model + Robot driven ), Users only need to ROS Write application in , Don't care about the robot's control . If all robots use this way , So robots will be widely used ( Requirements for system integrators will be reduced ).
, Now more and more robot manufacturers are trying to use it ROS, Including the four robot families with the largest industrial market share and various popular research robots ; Even like Rethink Of Baxter, Use only ROS control . Study robots without learning ROS The words , In the future, we may face the problem of not using robots .

△ use ROS Robot of

also , Robot is a complex and extensive subject , Including mechanical design from bottom to top , Motor control , sensor , Trajectory planning , Kinematics and dynamics , Sports planning , machine vision , Positioning and navigation , machine learning , Advanced intelligence
wait . It is impossible for a graduate student to master all fields in a few years .

For a graduate student doing top-level planning , If not ROS The words , It often takes a long time to build the experimental system , Thus greatly squeezing the time really spent in inventing new knowledge . for example , I do sports planning , The forward and inverse kinematics of the manipulator must be solved first , Object recognition algorithm , Only when collision detection algorithm is completed can motion planning be started . Let the professional wheel maker do the work .

therefore , For researchers ,ROS It can help you build robot software system quickly , At the same time the modular design allows the first mock exam to replace one module with your own algorithm. , Let you focus on your own research points .

last , For entrepreneurs or competitors ,ROS Can help you quickly build prototype . The prototype is out , Nature has an advantage over people who only have design specifications .

To prevent suspected advertising , Let's not talk about entrepreneurship , Let's take an entrepreneurial competition we participated in last year . In less than two months, four people in our group completed the software and hardware design and production of the following supermarket shopping robot , Features include
Avoiding obstacles , Fall prevention , Personnel follow , Bluetooth correction ( Track the right people ), gesture recognition , Automatic pricing of goods , Automatic payment, etc .
Um. , My official account Nao(qRobotics) It was designed for this project .

△ Last year's work in an entrepreneurial competition MarketBot


There are many answers to this , But learning this kind of thing can only rely on their own more practice , I just give a few suggestions from my own point of view .

first , It's about understanding ROS Basic structure and development mode of . Personally, I highly recommend watching it directly ROS Tutorials on the official website ROS/Tutorials <> Of Beginner
Level( See more ), At the same time, make full use of ROS Q & a community of ROS Answers <> With each module Mail Lists, Many basic problems may have been encountered by predecessors .

, In understanding ROS After the basic structure and development mode of , Then we can see what we care about . If you are a mobile robot, go to see it Navigation course ; For object recognition, just look ORK course ; Those who do sports planning go to see it MoveIt course . This step is better to practice with a real robot ( If not , Just use it gazebo simulation ). Because the tutorial of some modules is not clear enough ( as MoveIt), Be sure to practice more , Even to see some of the source code , Make sure you can use it first ROS Realize some functions .

about ROS Connection with actual robot , It's recommended to take a closer look action( Write robot drive package),URDF( Robot description file ) 's tutorial ( perhaps ros_control). As shown below , I am SDA5F The robot wrote URDF file , And modified motoman_driver In action, Make the ROS For use in the environment MoveIt Planning and controlling the movement of dual arm robot .

△SDA5F Two arm robot and URDF Model

last , It's the advanced stage . I would like to emphasize “ROS It's just a tool
”, You will use ROS do SLAM It doesn't mean you will SLAM. For the content of their own research , We must sink into the textbooks and papers , To understand the principles behind each algorithm , Know how to adjust algorithm parameters , How to improve the algorithm , Finally, I can write some code by myself , And replace ROS Corresponding module of ( Like writing forward and inverse kinematics solutions KDL etc. ).

Do research , Communication is very important . If you improve ROS After an algorithm , It's better to package The original author exchange of , Make your own changes merge To the original project , Improve yourself and package Level of . of course , If you have any questions about the algorithm , You can also consult the author directly ,ROS Most of the contributors are willing to share and exchange .

of course , Before you ask someone , Please make sure you are fully familiar with the official Tutorials, Instead of sending a bunch of screenshots of compilation errors to others , And then ask what's going on .
The art of questioning is really important , Sometimes it's not that they don't want to talk to you , But they don't want to take you by hand Tutorials. <>


Many people are debating whether to use it ROS, Should I 产品上使用ROS,是否应该在工业中使用ROS.但是从我个人的角度上看,ROS对于服务机器人上层算法开发和研究