February 2020
Intermediate to advanced
432 pages
10h 50m
English
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 ...