Programming for Robotics Introduction to ROS Course 1 Dominic Jud, Martin Wermelinger, Prof. Dr. Marco Hutter Dominic Jud | | 18.02.2020 1
Overview ▪ ▪ ▪ Course 1 Course 3 Course 5 Dominic Jud Dominic Jud Harmish & Max ANYbotics AG ▪ ▪ ▪ ROS architecture & philosophy TF Transformation System Case study ▪ ▪ ROS master, nodes, and topics rqt User Interface ▪ ▪ Console commands Robot models (URDF) ▪ ▪ Catkin workspace and build system Simulation descriptions (SDF) ▪ Launch-files ▪ Gazebo simulator ▪ ▪ Course 2 Course 4 ▪ ▪ ROS package structure Martin Wermelinger ROS services Martin Wermelinger ▪ ▪ Integration and programming with Eclipse ROS actions (actionlib) ▪ ▪ ROS C++ client library (roscpp) ROS time ▪ ▪ ROS subscribers and publishers ROS bags ▪ ROS parameter server ▪ RViz visualization Dominic Jud | | 18.02.2020 2
Course Structure Course 1 Course 2 Course 3 Course 4 Course 5 Deadline for Ex. 4. Deadline for Ex. 1. Deadline for Ex. 2. Deadline for Ex. 3. Lecture 1 Multiple Choice Test Lecture 2 Lecture 3 Lecture 4 Exercise 1 Intro. Exercise 2 Intro. Exercise 3 Intro. Exercise 4 Intro. Case Study Exercise 5 Intro. Exercise 1 Exercise 2 Exercise 3 Exercise 4 Exercise 5 Deadline for Ex. 5. Dominic Jud | | 18.02.2020 3
Evaluation – Exercises ▪ Each exercise has several check questions ▪ Each exercise counts for 10% of the final grade (50 % in total) ▪ We encourage team work, but every student has to show the results on his own PC and is evaluated individually ▪ Exercises are checked by the teaching assistants when you are ready, but latest the following course day in the morning (08:15 – 08:45, except for exercise 5) ▪ Let the teaching assistant know once you are ready to present your results ▪ The lectures start at 08:45 Dominic Jud | | 18.02.2020 4
Evaluation – Multiple Choice Test ▪ The test counts for 50 % of the final grade ▪ Duration: 45min ▪ The multiple choice test takes place at the last course day: 28.02.2020 at 08:45, HG G1 Dominic Jud | | 18.02.2020 5
Overview Course 1 ▪ ROS architecture & philosophy ▪ ROS master, nodes, and topics ▪ Console commands ▪ Catkin workspace and build system ▪ Launch-files ▪ Gazebo simulator Dominic Jud | | 18.02.2020 6
What is ROS? ROS = Robot Operating System ros.org ▪ Process ▪ Simulation ▪ Control ▪ Package organization management ▪ Visualization ▪ Planning ▪ Software distribution ▪ Inter-process ▪ Graphical user ▪ Perception ▪ Documentation communication interface ▪ Mapping ▪ Tutorials ▪ Device drivers ▪ Data logging ▪ Manipulation Dominic Jud | | 18.02.2020 7
History of ROS ▪ Originally developed in 2007 at the Stanford Artificial Intelligence Laboratory ▪ Since 2013 managed by OSRF ▪ Today used by many robots, universities and companies ▪ De facto standard for robot programming ros.org Dominic Jud | | 18.02.2020 8
ROS Philosophy ▪ Peer to peer Individual programs communicate over defined API (ROS messages , services , etc.). ▪ Distributed Programs can be run on multiple computers and communicate over the network. ▪ Multi-lingual ROS modules can be written in any language for which a client library exists (C++, Python, MATLAB, Java, etc.). ▪ Light-weight Stand-alone libraries are wrapped around with a thin ROS layer. ▪ Free and open-source Most ROS software is open-source and free to use. Dominic Jud | | 18.02.2020 9
ROS Master ROS Master ▪ Manages the communication between nodes (processes) ▪ Every node registers at startup with the master Start a master with > roscore More info http://wiki.ros.org/Master Dominic Jud | | 18.02.2020 10
ROS Nodes ROS Master ▪ Single-purpose, executable program ▪ Individually compiled, executed, and Registration Registration managed ▪ Organized in packages Node 1 Node 2 Run a node with > rosrun package_name node_name See active nodes with > rosnode list Retrieve information about a node with More info > rosnode info node_name http://wiki.ros.org/rosnode Dominic Jud | | 18.02.2020 11
ROS Topics ROS Master ▪ Nodes communicate over topics ▪ Nodes can publish or subscribe to a topic Registration Registration ▪ Typically, 1 publisher and n subscribers Informs about ▪ Topic is a name for a stream of messages connection Node 1 Node 2 Messages Publisher Subscriber List active topics with > rostopic list Subscribe Publish topic Subscribe and print the contents of a topic with Subscribe > rostopic echo /topic Show information about a topic with More info > rostopic info /topic http://wiki.ros.org/rostopic Dominic Jud | | 18.02.2020 12
ROS Messages ROS Master ▪ Data structure defining the type of a topic ▪ Comprised of a nested structure of integers, Registration Registration floats, booleans, strings etc. and arrays of objects ▪ Defined in *.msg files Node 1 Node 2 Publisher Subscriber See the type of a topic > rostopic type /topic Subscribe Publish topic Subscribe Publish a message to a topic Message definition *.msg > rostopic pub /topic type data int number double width More info string description http://wiki.ros.org/Messages etc. Dominic Jud | | 18.02.2020 13
ROS Messages Pose Stamped Example geometry_msgs/PoseStamped.msg geometry_msgs/Point.msg std_msgs/Header header float64 x uint32 seq float64 y time stamp float64 z string frame_id geometry_msgs/Pose pose geometry_msgs/Point position sensor_msgs/Image.msg float64 x float64 y std_msgs/Header header float64 z uint32 seq geometry_msgs/Quaternion orientation time stamp float64 x string frame_id float64 y uint32 height float64 z uint32 width float64 w string encoding uint8 is_bigendian uint32 step uint8[] data Dominic Jud | | 18.02.2020 14
Example Console Tab Nr. 1 – Starting a roscore Start a roscore with > roscore Dominic Jud | | 18.02.2020 15
Example Console Tab Nr. 2 – Starting a talker node Run a talker demo node with > rosrun roscpp_tutorials talker Dominic Jud | | 18.02.2020 16
Example Console Tab Nr. 3 – Analyze talker node See the list of active nodes > rosnode list Show information about the talker node > rosnode info /talker See information about the chatter topic > rostopic info /chatter Dominic Jud | | 18.02.2020 17
Example Console Tab Nr. 3 – Analyze chatter topic Check the type of the chatter topic > rostopic type /chatter Show the message contents of the topic > rostopic echo /chatter Analyze the frequency > rostopic hz /chatter Dominic Jud | | 18.02.2020 18
Example Console Tab Nr. 4 – Starting a listener node Run a listener demo node with > rosrun roscpp_tutorials listener Dominic Jud | | 18.02.2020 19
Example Console Tab Nr. 3 – Analyze See the new listener node with > rosnode list Show the connection of the nodes over the chatter topic with > rostopic info /chatter Dominic Jud | | 18.02.2020 20
Example Console Tab Nr. 3 – Publish Message from Console Close the talker node in console nr. 2 with Ctrl + C Publish your own message with > rostopic pub /chatter std_msgs/String "data: 'ETH Zurich ROS Course'" Check the output of the listener in console nr. 4 Dominic Jud | | 18.02.2020 21
ROS Workspace Environment ▪ Defines context for the current workspace This is already ▪ Default workspace loaded with setup in the > source /opt/ros/kinetic/setup.bash provided installation. Overlay your catkin workspace with > cd ~/catkin_ws See setup with > source devel/setup.bash > cat ~/.bashrc Check your workspace with > echo $ROS_PACKAGE_PATH More info http://wiki.ros.org/kinetic/Installation/Ubuntu http://wiki.ros.org/catkin/workspaces Dominic Jud | | 18.02.2020 22
catkin Build System ▪ catkin is the ROS build system to generate executables, libraries, and interfaces The catkin ▪ We suggest to use the Catkin Command Line Tools command line tools are pre- ➔ Use catkin build instead of catkin_make installed in the provided Navigate to your catkin workspace with installation. > cd ~/catkin_ws Build a package with > catkin build package_name More info Whenever you build a new package, update your environment ! http://wiki.ros.org/catkin/Tutorials > source devel/setup.bash https://catkin-tools.readthedocs.io/ Dominic Jud | | 18.02.2020 23
catkin Build System The catkin workspace contains the following spaces Don’t touch Don’t touch Work here The source space contains The build space is where The development (devel) the source code. This is where CMake is invoked to build the space is where built targets you can clone, create, and packages in the source are placed (prior to being edit source code for the space. Cache information and installed). packages you want to build. other intermediate files are kept here. If necessary, clean the entire build and devel space with More info > catkin clean http://wiki.ros.org/catkin/workspaces Dominic Jud | | 18.02.2020 24
Recommend
More recommend