Skip to Content
Hands-On ROS for Robotics Programming
book

Hands-On ROS for Robotics Programming

by Bernardo Ronquillo Japón
February 2020
Intermediate to advanced
432 pages
10h 50m
English
Packt Publishing
Content preview from Hands-On ROS for Robotics Programming

Executing a single node

rosrun allows you to manually launch a node from a package. The syntax is quite simple:

$ rosrun <name_of_package> <name_of_script>

The script includes a declaration of a node. In the case of our distance-sensor.py example, this is accomplished in the following line:

rospy.init_node("distance_sensor")

Then, to launch the node, write this command in another terminal:

$ rosrun mygopigo distance-sensor.py

After these two commands, you already have a ROS functional environment that provides sensor readings. The node also prints the current measure in the terminal process, transformed into millimeters (there is no need to open another terminal to listen to the topic). The usage of millimeters is just for visualization ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering ROS for Robotics Programming

Mastering ROS for Robotics Programming

Lentin Joseph
ROS Robotics By Example - Second Edition

ROS Robotics By Example - Second Edition

Lentin Joseph, Carol Fairchild, Dr. Thomas L. Harman

Publisher Resources

ISBN: 9781838551308Supplemental Content