-
Notifications
You must be signed in to change notification settings - Fork 74
Gazebo ROS Ray Sensors
Gazebo ROS Ray sensors publish these messages:
-
sensor_msgs/Range
: The closest distance in the scan. -
sensor_msgs/LaserScan
: One horizontal scan from the center vertical ray. -
sensor_msgs/PointCloud
: The point cloud of range and retro values given a height, width, scan angle, and horizontal angle. -
sensor_msgs/PointCloud2
: Version 2 ofsensor_msgs/PointCloud
.
These ray sensors calculate reflection length and intensity by identifying collision points along a straight line. Collision objects may be one of either Physics (non-gpu) or graphics (gpu).
Key points about Gazebo ROS Ray sensors:
- ROS provides four ray sensors:
- gazebo_ros_laser - This publishes
sensor_msgs/LaserScan
, one horizontal scan from the center vertical ray, rather than asensor_msgs/PointCloud2
containing multiple rows. - gazebo_ros_gpu_laser - Same as gazebo_ros_laser, but is faster because it uses the GPU to identify points reflected from graphics information rather than from physics information.
- gazebo_ros_block_laser - Publishes
sensor_msgs/PointCloud
. - gazebo_ros_range - Returns the minimum range value rather than
sensor_msgs/PointCloud2
.
- gazebo_ros_laser - This publishes
- In ROS 2, there is one plugin for all of this: gazebo_ros_ray_sensor. Select ray or gpu_ray for detection approach. Select output_type, one of
Range
,LaserScan
,PointCloud
, orPointCloud2
, for the desired output. They are all compatible with GPU or Physics-based sensing.
Links:
- Documentation about ROS Ray sensors: https://github.com/ros-simulation/gazebo_ros_pkgs/wiki/ROS-2-Migration:-Ray-sensors.
- Code: https://github.com/ros-simulation/gazebo_ros_pkgs under gazebo_plugins.
- Gazebo ROS Plugin tutorial: http://gazebosim.org/tutorials?tut=ros_gzplugins.
The gazebo_ros_block_laser sensor identifies length and retro values along straight lines by performing horizontal and vertical sweeps to produce a point cloud from which shape can be inferred. Sonar, unlike laser, spreads out in distance and weakens as it spreads. To model sonar with the gazebo_ros_block_laser plugin, we turn the point cloud into a sonar ray trace sweep. This drawing shows how a point cloud is used to calculate the intensity of one sonar point:
Note that the output of this algorithm is a ray trace along a line and does not have a vertical component.
Here are some adjustments we can make:
- Adjust sensor ray parameters, see http://sdformat.org/spec?ver=1.7&elem=sensor. Here we define the horizontal and vertical angular widths and the number of rays horizontally and vertically. Each ray contributes a point to the point cloud.
- Convert the point-cloud to a 2-dimensional view. Here we can apply randomization and coloring algorithms to make the point cloud look like a particular 2D Sonar view.
- Calculate a sonar ray trace from a laser point cloud (proposed here).
- Currently, values returned for range and retro are the average of four points along the horizontal and vertical grid requested, specifically the requested point, the point to the right, the point below, and the point below and right. We may want to undo this processing.
- If we wanted to model ray reflections, we would simulate sonar transmitters at points of reflections, see gazebo/physics/ode/ODEMultiRayShape.cc where it calls SetLength and SetRetro on RayShape.