![Page 1: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/1.jpg)
ROS 1.0, “Box Turtle” ReleaseKen Conley ([email protected])
![Page 2: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/2.jpg)
Helpful Hints
Learn the UNIX command-line, ROS is heavily based on it
Learn YAML, which is a format that is heavily used within ROS
![Page 3: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/3.jpg)
ROS’ 3 Layers
computation graph: how programs run
file system: how program files are organized and built
repositories: how files are distributed online
![Page 4: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/4.jpg)
ROS for Sharing
ROS is designed for sharing code, which affects its design at each of these levels.
![Page 5: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/5.jpg)
ROS
GraphName service
Parameter ServerNodes
FilesystemPackages
Message formatsBuild system
Community*-ros-pkg code repositories
WikiDistributions
![Page 6: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/6.jpg)
Community Level
![Page 7: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/7.jpg)
Repositories
Federated model
Easy to contribute and control your code
Open Source, mostly BSD
Mostly SVN access, some GIT
![Page 8: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/8.jpg)
Wiki/ros.org
Indexes all known ROS repositoriesWiki: http://ros.org/wiki
ros.org/browse: Search for ROS software
![Page 9: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/9.jpg)
roslocate
Command-line tool to search for and download source code for ROS packages
$ roslocate describe package-name$ roslocate svn package-name$ roslocate repo package-name$ roslocate search keyword
$ svn co `roslocate svn package-name`
![Page 10: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/10.jpg)
roslocate
$ roslocate search irobotirobot_create_2_1
$ roslocate svn irobot_createhttp://brown-ros-pkg.googlecode.com/svn/trunk/rlab/irobot_create
$ svn co `roslocate svn irobot_create`
![Page 11: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/11.jpg)
Filesystem Level
![Page 12: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/12.jpg)
Packages and Stacks
A package is a directory with a manifest.xml file.
A stack is a directory with a stack.xml file.
A package inside of a stack's directory is part of that stack.
![Page 13: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/13.jpg)
PackagesCan contain anything: libraries, Nodes, Messages, tools
Goldilocks principal: enough functionality to be useful, but not so much as to be heavyweight
Many packages = smaller, easier-to-use code, but...
... many packages = MANY (1000+)
![Page 14: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/14.jpg)
Package tools
$ rospack list
$ rospack find turtlesim
$ rospack depends-on1 turtlesim
$ roscd turtlesim
$ cat manifest.xml
$ rosmake turtlesim
![Page 15: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/15.jpg)
Stacks
Release with version numbers
• Stored in CMakeLists.txt
Collect similar packages that work together
• ROS, navigation, vision_opencv
![Page 16: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/16.jpg)
Stack tools
$ rosstack list
$ rostack find navigation
$ roscd navigation
$ ls
$ cat stack.xml
$ cat CMakeLists.txt
![Page 17: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/17.jpg)
roscreate-pkg
roscreate-pkg package-name dependency1...N$ mkdir ~/workspace$ export ROS_PACKAGE_PATH=~/workspace:$ROS_PACKAGE_PATH$ cd ~/workspace$ roscreate-pkg workshop rospy turtlesim
![Page 18: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/18.jpg)
rosdep
$ rosdep install package-name
Install system dependencies
rosdep.yaml: OS+version -> OS packagewxwidgets:
ubuntu: libwxgtk2.8-dev
![Page 19: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/19.jpg)
msg/Message Description
Simple text files (IDL) compiled to C++, Python, LISP...
package-name/msg/*.msg
Types
int8, int16, int32, int64 (plus uint*)float32, float64stringtime, durationvariable-length array[]fixed-length array[C]Message
![Page 20: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/20.jpg)
srv/Service Description
package-name/srv/*.msg
Request msg + Response msg
Uses ‘---’ separator between the two, otherwise identical to msg files.
![Page 21: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/21.jpg)
rosmsg/rossrv demo
$ rosmsg show Transform
$ rossrv package nav_msgs
$ rossrv show nav_msgs/GetPlan
![Page 22: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/22.jpg)
Create your own msg$ roscd workshop$ mkdir msg$ echo "int64 num" > msg/Num.msg
$ rosmsg show workshop/Numint64 num
$ vi CMakeLists.txt[uncomment rosbuild_genmsg() line]
$ rosmake workshop
![Page 23: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/23.jpg)
Graph Level
![Page 24: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/24.jpg)
Names
• Syntax:
• /global-name
• relative-name
• ~local-name
• "Pushing down"
• relative-name -> foo/relative-name
• Wiki page
![Page 25: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/25.jpg)
Master, roscore
Master
• Name service for ROS (Topics + Services)
roscore
• Master
• rosout: logs debugging messages
![Page 26: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/26.jpg)
Nodes
Executable file within a ROS Package
Publish or Subscribe to Topics
Can also provide Services
Have a unique name, e.g. /hokuyo
Name can be remapped at runtime
$ rosrun hokuyo_node hokuyo_node __name:=base_hokuyo
![Page 27: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/27.jpg)
Node tools
rosrun
rosnode
rxgraph: interactive graph
roslaunch: launch many nodes<roslaunch>
<node pkg="foo" type="bar" name="talker" />
<node pkg="foo" type="baz" name="listener" /> </roslaunch>
![Page 28: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/28.jpg)
rosrun
$ roscore
$ rosrun turtlesim turtlesim_node
![Page 29: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/29.jpg)
rosnode
$ rosnode list
$ rosnode ping turtle1
$ rosnode info turtle1
![Page 30: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/30.jpg)
rxgraph
$ rxgraph
$ rxgraph -t
![Page 31: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/31.jpg)
Topics
Publisher sends Messages to Subscribers
• Usually TCP/IP transport (UDP in roscpp)
• We don't send messages over XML-RPC
Uniquely named
• Can be remapped at runtime$ rosrun hokuyo_node hokuyo_node laser:=base_laser
![Page 32: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/32.jpg)
rostopic
Get information about a ROS topic, including printing messages currently being published
$ rostopic list$ rostopic echo topic-name$ rostopic hz topic-name $ rostopic type topic-name
![Page 33: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/33.jpg)
rostopic
$ rostopic list$ rostopic echo turtle1/pose$ rostopic hz turtle1/pose$ rostopic type turtle1/pose
$ rostopic pub turtle1/command_velocity turtlesim/Velocity 10.0 10.0
(If time): mimic remapping demo
![Page 34: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/34.jpg)
Services
RPC
Can be 'persistent', i.e. keep alive connection
Can send custom headers
![Page 35: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/35.jpg)
rosservice
$ rosservice list
$ rosservice type turtle1/set_pen
$ rosservice type turtle1/set_pen | rossrv show
$ rosservice call set_pen 255 0 0 4 0
![Page 36: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/36.jpg)
ParametersStored on central Parameter Server (the Master)Unique Names
• Can be remapped at runtime
• Local parameters ~param_name
• ~param_name = /node_name/param_name
• Set at runtime• $ rosrun mypkg mynode _param_name:=1
Types: integers, floats, boolean, dictionaries, mapsNamespaces = Dictionary of dictionaries
![Page 37: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/37.jpg)
rosparam
Get and set parameters from command-line arguments or YAML files
$ rosparam get parameter-name$ rosparam set parameter-name$ rosparam load yaml-file [namespace]$ rosparam dump yaml-file
Can use within roslaunch
![Page 38: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/38.jpg)
rosparam
$ rosparam set background_g 0$ rosparam get background_g0$ rosservice call clear$ rosparam set gains "p: 1.0i: 2.0d: 3.0"$ rosparam get gains/p1.0$ rosparam get gains{d: 3.0, i: 2.0, p: 1.0}$ rosparam dump params.yaml$ rosparam load params.yaml copy$ rosparam get /
![Page 39: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/39.jpg)
roslaunch
Nodes:
• /talker
• /listener
Topics:
• /topic_name
<roslaunch> <node pkg="foo" type="bar" name="talker" /> <node pkg="foo" type="baz" name="listener" /></roslaunch>
![Page 40: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/40.jpg)
“Pushing down”Nodes:
• /wg/talker
• /wg/listener
• /stanford/talker
• /stanford/listener
Topics:
• /wg/topic_name
• /stanford/topic_name
<roslaunch> <group ns="wg"> <node pkg="foo" type="bar" name="talker" /> <node pkg="foo" type="baz" name="listener" /> </group> <group ns="stanford"> <node pkg="foo" type="bar" name="talker" /> <node pkg="foo" type="baz" name="listener" /> </group> </roslaunch>
![Page 41: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/41.jpg)
More
rxplot: plot fields from topics
rosbag: logging and playback of topics
rxbag: visualize bag files
roswtf: general problem diagnosis tool
rosbash: roscp, rosls, rosed, rospd
rostest: roslaunch for running tests
![Page 42: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/42.jpg)
More (ros-pkg)rviz: Robot Visualizer
tf: coordinate system
navigation: 2D+ navigation stack
opencv
actionlib: actions for ROS
More on the way (point cloud library, arm_navigation)
![Page 43: ROS 1.0, “Box Turtle” Release Ken Conley (kwc@willowgarage ...library.isr.ist.utl.pt/...2010_ROS_Tutorial_Tools.pdf · download source code for ROS packages $ roslocate describe](https://reader033.vdocuments.us/reader033/viewer/2022060722/6081f572d115105d7445988b/html5/thumbnails/43.jpg)
ROS core
Morgan Quigley (Stanford)Brian Gerkey, Josh Faust, Ken Conley, Tully Foote, Jeremy Leibs, Tim Field, Bhaskara Marthi (Willow Garage)