Skip to content

NPS Ray based Sonar

Bruce Allen edited this page May 7, 2020 · 13 revisions

Here we examine simulating Sonar using the Gazebo GpuRaySensor sensor. We start with a single-beam plugin prototype with the expectation of expanding to offer a ray trace plugin.

Background

References

  • Gazebo 9 API: http://osrf-distributions.s3.amazonaws.com/gazebo/api/9.0.0/index.html

  • Gazebo 9 source code: Download Version 9.0 from http://gazebosim.org/download and unzip. Some files of interest include:

    gazebo/sensors/GpuRaySensor.cc
    gazebo/sensors/GpuRaySensor.hh
    gazebo/sensors/GpuRaySensorPrivate.hh
    plugins/GpuRayPlugin.cc
    plugins/GpuRayPlugin.hh
    
  • Ros Melodic source online: https://github.com/ros-simulation/gazebo_ros_pkgs/tree/melodic-devel/gazebo_plugins.

  • ROS Melodic source download: Clone gazebo_ros_pkgs and checkout branch melodic-devel:

    git clone https://github.com/ros-simulation/gazebo_ros_pkgs.git
    git checkout melodic-devel
    

    Some files of interest:

    gazebo_plugins/src/gazebo_ros_laser.cpp
    gazebo_plugins/src/gazebo_ros_gpu_laser.cpp
    gazebo_plugins/src/gazebo_ros_block_laser.cpp
    gazebo_plugins/src/gazebo_ros_range.cpp
    
    gazebo_plugins/include/gazebo_plugins/gazebo_ros_gpu_laser.h
    gazebo_plugins/include/gazebo_plugins/gazebo_ros_block_laser.h
    gazebo_plugins/include/gazebo_plugins/gazebo_ros_laser.h
    gazebo_plugins/include/gazebo_plugins/gazebo_ros_range.h
    

SDF

The SDF tag for the <ray> sensor is at http://sdformat.org/spec?ver=1.7&elem=sensor. Tag <ray> will be replaced by <lidar>. Their contents are the same:

  • scan
    • horizontal
      • samples
      • resolution
      • min_angle
      • max_angle
    • vertical
      • samples
      • resolution
      • min_angle
      • max_angle
    • range
      • min
      • max
      • resolution
    • noise
      • type
      • mean
      • stddev

Horizontal and vertical scan settings are defined. For one ray trace, set vertical samples to 1. For resolution equal to sample resolution, use 1. Set min_angle, max_angle, and samples for three horizontal samples at -0.1°, 0.0°, and 0.1°.

Message

Gazebo message is C++ type ConstLaserScanStampedPtr, type gazebo.msgs.LaserScanStamped, see gazebo/msgs/laserscan_stamped.proto.

ROS message is C++ type sensor_msgs::LaserScan, see http://docs.ros.org/melodic/api/sensor_msgs/html/msg/LaserScan.html.

Single Beam Sonar

Using gazebo_ros_gpu_laser as a template, we create nps_single_beam_sonar to produce one Sonar point calculated from three points obtained from Gazebo's GpuRaySensor sensor. This work is (will be) in https://github.com/Field-Robotics-Lab/uw_sensors_gazebo.

Clone this wiki locally