6. What is ROS ?
6
http://answers.ros.org/question/12230/what-is-ros-exactly-middleware-framework-operating-system/#18055
• ROS is acronym for Robot OS, but it is not a
traditional OS like Windows, Ubuntu or Mac OS
7. What is ROS ?
7
• Before we move on, we should clarify something
• Robot software = Distributed computing system
Decision Maker
Object
Recognition
Object GraspingNavigation
8. What is ROS ?
8
• ROS is a set of tools which enables
– Easy construction of distributed computing systems
(Programs can be individually designed and easily connected at
runtime)
– Code reuse
– Configuring, starting, introspecting, debugging, visualizing, logging,
testing, and stopping distributed computing systems
9. Why is ROS preferred ?
9
• It encourages users not to reinvent the wheel
10. Why is ROS preferred ?
10
• Many open-sourced libraries
– SLAM (OpenSLAM)
– Real-time control(OROCOS)
– Path Planning (Openrave)
– Vision (OpenCV, PCL)
– 3D Simulator (Gazebo)
– 3D Visualizer (Rviz)
11. Why is ROS preferred ?
11
• Package can be written in multiple programming languages
– C++
– Python
– Lisp
• And many more experimental support
– C#, Go, Haskell, Java, Node.js, Lua, R, Ruby
– http://wiki.ros.org/Client%20Libraries
12. Can ROS be used on different robot?
12
• Of course!
• Check all robots using ROS - http://wiki.ros.org/Robots
https://vimeo.com/146183080
22. How do ROS node communicate?
• ROS master as a message hub?
– What if there are many nodes?
22
23. How do ROS node communicate?
• Let nodes communicates with each other directly
– Topic, Service, ActionLib
• If ROS does not exists
– Socket
– Shared memory
– We have to take care of these tedious work.
23
24. ROS Topic
• Publisher/Subscriber mechanism (topic == bucket)
24
Perception
Object
Recognition
Semantic Map
Camera data
Recognition result
25. rostopic
• 寫一個publisher (一直丟字串到topic_name這個topic)
– catkin_create_pkg coscup_2_topic rospy std_msgs
cd coscup_2_topic
vim src/publisher.py
chmod +x src/publisher.py
cd ../..
catkin_make
source devel/setup.bash
roscore
rosrun coscup_2_topic publisher.py
rqt_graph
rostopic echo topic_name
rostopic list
rostopic list | grep topic
25
30. Define our own msg for topic
• 創建一個只有一個int的msg
– cd ~/catkin_ws/src
cd coscup_2_topic
mkdir msg
vim msg/Num.msg
vim package.xml
vim CMakeLists.txt
cd ../..
catkin_make
source devel/setup.bash
rosmsg show coscup_2_topic/Num
30
39. ROS Service
• 建立一個自己的srv格式
– cd ~/catkin_ws/src
catkin_create_pkg coscup_3_service rospy std_msgs
cd coscup_3_service
mkdir srv
vim srv/AddTwoInts.srv
vim package.xml
vim CMakeLists.txt
cd ../..
catkin_make
source devel/setup.bash
rossrv show coscup_3_service/AddTwoInts
39
42. ROS Service
• 寫一個server
– cd coscup_3_service
vim src/add_two_ints_server.py
cd ../..
source devel/setup.bash
chmod +x src/add_two_ints_server.py
rosrun coscup_3_service add_two_ints_server.py
42
43. ROS Service
• 寫一個client,送出request給server
– cd coscup_3_service
vim src/add_two_ints_client.py
chmod +x src/add_two_ints_client.py
run coscup_3_service add_two_ints_client.py 5 6
43
44. Rviz
• An important tool for data visualization
• 先啟動你們的Rviz
– $ sudo apt-get install ros-indigo-rviz-*
– $ roscore
– $ rviz
• Will be revisited when we use Gazebo
44
45. Find out more on ROS Cheat Sheet
• https://github.com/ros/cheatsheet 45
57. Map representation
• Given sensor data zt and the poses of the sensor xt,
estimate the map
• 推導就不細講了
– http://ais.informatik.uni-
freiburg.de/teaching/ws12/mapping/pdf/slam11-gridmaps-4.pdf
57
58. Resources you can leverage
• ROS wiki
http://wiki.ros.org/
• ROS Answers
http://answers.ros.org/questions/
• Gazebo Answers
http://answers.gazebosim.org/questions/
• ROS Taipei 中文資源整理
https://hackpad.com/-ROS-Blog--lnDeWhHXH4T
58