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

Setting up the msg_range object

The distance sensor uses the message type defined in the Range class of the sensor_msgs.msg library, whose structure is as follows:

uint8 ULTRASOUND=0uint8 INFRARED=1std_msgs/Header headeruint8 radiation_typefloat32 field_of_viewfloat32 min_rangefloat32 max_rangefloat32 range

These are the fields that will be part of any message involving the data flow from the sensor, and its syntax is explained in detail in the documentation (http://docs.ros.org/api/sensor_msgs/html/msg/Range.html). All the fields are specific characteristics of the sensor except for the measurement itself, range. Hence, the following snippet gives a particular definition for our distance sensor:

msg_range = Range()msg_range.header.frame_id ...
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