Professional Documents
Culture Documents
Lentin Joseph
http://robocademy.com Founder/Instructor of Robocademy
Founder of Qbotics Labs
Day 4
Programming in ROS
http://robocademy.com
Agenda
• What is a ROS Package?
http://robocademy.com
Agenda
http://robocademy.com
What is a ROS Package ?
• http://wiki.ros.org/Packages
• $ catkin_create_pkg hello_world
std_msgs rospy roscpp
http://robocademy.com
Inside hello_world package
http://robocademy.com
The CMakeFile.txt
http://robocademy.com
The package Manifest
http://robocademy.com
How to build hello_world package
• Switch to ROS workspace
– $ cd ~/ros_catkin_ws
• Build the packages inside workspace
– $ catkin_make
– $ catkin_make install
• Check package is installed
– $ roscd hello_world
http://robocademy.com
How to create/build a hello_world
ROS package?
• Creating and Building a Package Demo
http://robocademy.com
ROS Client Libraries
http://robocademy.com
What are ROS client libraries ??
• ROS client libraries provide API’s to
access ROS functionalities
http://robocademy.com
roscpp client library
• http://wiki.ros.org/roscpp
http://robocademy.com
rospy client library
• rospy is a pure Python client library for
ROS.
• http://wiki.ros.org/rospy
http://robocademy.com
Other ros client libraries !!!
• roslisp – Client of Lisp
http://robocademy.com
Writing ROS Nodes using
roscpp client library
http://robocademy.com
Exercise - 1
• Write a ros node for sending “Hello_World”
message to a topic called chatter using
roscpp
http://robocademy.com
talker.cpp
http://robocademy.com
listener.cpp
http://robocademy.com
CMakeLists.txt
http://robocademy.com
Building nodes using catkin_make
http://robocademy.com
How to run ROS nodes
• rosrun command : Run a ros node
• $ roscore
• $ rosrun hello_world talker
• $rosrun hello_world listener
http://robocademy.com
ROS Launch files
http://robocademy.com
How to run both nodes together ??
• roslaunch command : roslaunch is a tool
for easily launching multiple
ROS nodes locally and remotely via SSH,
as well as setting parameters on
the Parameter Server.
• $ roscore
• $ roslaunch hello_world
talker_listener.launch
http://robocademy.com
talker_listener.launch
http://robocademy.com
Writing ROS Nodes using rospy
client library
http://robocademy.com
Exercise - 2
• Write a ros node for sending “Hello_World”
message to a topic called chatter using
rospy
http://robocademy.com
talker.py
http://robocademy.com
listener.py
http://robocademy.com
How to run ROS nodes
• rosrun command : Run a ros node
• $ roscore
• $ rosrun hello_world talker.py
• $rosrun hello_world listener.py
http://robocademy.com
How to run both nodes together ??
• roslaunch command : roslaunch is a tool
for easily launching multiple
ROS nodes locally and remotely via SSH,
as well as setting parameters on
the Parameter Server.
• $ roscore
• $ roslaunch hello_world
talker_listener_python.launch
http://robocademy.com
talker_listener_python.launch
http://robocademy.com
Command : rosbag
• Tool for Record /Playback ROS topics
• http://wiki.ros.org/rosbag
http://robocademy.com
Structure of ROS Package
CMakeLists.txt
package.xml talker.py
talker.cpp
tistener.py
listener.cpp
http://robocademy.com
Conclusion
• Discussed ROS Client libraries
http://robocademy.com