-
Notifications
You must be signed in to change notification settings - Fork 74
Gazebo ROS Ray Sensors
ROS provides Ray sensors along with its other sensors under gazebo_ros_pkgs in its repository at https://github.com/ros-simulation/gazebo_ros_pkgs under gazebo_plugins. A tutorial overview of ROS plugins is at http://gazebosim.org/tutorials?tut=ros_gzplugins. We are interested in Ray-based plugins that produce point cloud messages of type sensor_msgs/PointCloud2
or sensor_msgs/PointCloud
.
These ray sensors publish these sensor 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 detect using either Physics (non-gpu) or graphics (gpu).
Documentation about ROS Ray sensors is here: https://github.com/ros-simulation/gazebo_ros_pkgs/wiki/ROS-2-Migration:-Ray-sensors. Here are some key points:
- 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.
Here is a top-down approach for working with the gazebo_ros_block_laser plugin:
- Top: 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.
- Lower top: 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 2D view that we are targeting.
- Middle: Adjust retro values. Specifically, we can reduce measured retro values for points above and below the multi-ray scan line. I recommend this.
- Low: Modify the ROS gazebo_ros_block_laser plugin to modify range and retro values before sending them up. 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.
- Lower: Modify Gazebo code in MultiRayShape or RayShape (MultiRayShape manages an array of RayShape) to adjust how range and retro values are calculated.
- Even lower: See how gazebo/physics/ode/ODEMultiRayShape.cc calls SetLength and SetRetro on RayShape. We would add code down hear if we wanted to model ray reflections.