Sensors

This page describes the predefined sensors and their parameters.

Sensor definition and common parameters

A sensor is attached to a vehicle by adding an XML block with the tag name <sensor>.... </sensor> inside:

  • the <vehicle>...</vehicle> that instantiates a particular robot, or

  • the <vehicle:class> to have all vehicles of that type with the same sensors installed.

All sensors, via the common base C++ class mvsim::SensorBase, have the common parameters below, with their meaning explained in the XML comments.

<!--
 ``class``: One of the registered sensor classes.
 ``name``: A name for the sensor, must be unique for each robot. If not provided,
           an automatic name will be generated. The name is important since it is
           used when publishing the sensor ROS or ZMQ topics.
-->
<sensor class="camera" name="camera1">
        <!-- Period (in seconds) between each sensor observation.
             Mathematical expressions can be used with $f{} to specify rates in Hz.
         -->
        <sensor_period>0.1</sensor_period>
        <!-- <sensor_period>$f{1/20.0}</sensor_period> -->

        <!-- See notes below -->
        <visual>
                ...
        </visual>

        <!-- Publish sensor on MVSIM ZMQ topic? (Note, **not** related to ROS at all) -->
        <!-- <publish>
                <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
        </publish> -->
</sensor>

The <visual> tag is explained in the World XML definition of VisualObject, and the <publish> tag in World XML definition of Simulable entities, since those tags are common to sensors and many other entities.

Also, note that you can use the XML-level variables ${PARENT_NAME} and ${NAME} anywhere inside the sensor definition tag to refer to the parent vehicle and own sensor names, respectively.

Each sensor class has its own additional parameters, listed in the next sections.

3D LiDARs

HELIOS 32 (26 deg FOV)

sensor preview in MVSim
To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/helios-32-FOV-26.sensor.xml"
  sensor_x="0.10" sensor_z="0.30"
  sensor_std_noise="0.005"
  sensor_name="lidar1"
  sensor_rate="10.0"
/>
All parameters available in helios-32-FOV-26.sensor.xml

File: mvsim_tutorial/definitions/helios-32-FOV-26.sensor.xml

<sensor class="lidar3d" name="${sensor_name|lidar1}">
    <pose_3d> ${sensor_x|0.5}  ${sensor_y|0.0}  ${sensor_z|0.7}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>

    <!-- vert_fov_degrees: If defined, a symmetric vertical FOV is used.
         The alternative is using a custom list of angles in "vertical_ray_angles"
    -->
    <!-- <vert_fov_degrees>${vert_fov_degrees|70}</vert_fov_degrees> -->

    <vert_nrays>32</vert_nrays>
    <vertical_ray_angles>-16 -14.5 -13 -12.5 -11 -9.5 -8 -7 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 6.0 8.0 10.0</vertical_ray_angles>

    <!-- Horizontal / azimuth angular resolution:
        The rotation of the Helios sensor configurable: 5 / 10 / 20 Hz
        Firing timing of the sensor is fixed at 55.296 μs (=18.084 kHz).

        Set the "sensor_rate" (Hz) variable from the parent XML to automatically
        adjust the number of points per horizontal line.
    -->
    <sensor_period>$f{1.0/${sensor_rate|10}}</sensor_period>
    <horz_nrays>$f{(1.0/${sensor_rate|10})/55.296e-6}</horz_nrays>

    <!-- 1.0=minimum (faster), larger values=potentially finer details captured -->
    <horz_resolution_factor>${horz_resolution_factor|1.0}</horz_resolution_factor>
    <vert_resolution_factor>${vert_resolution_factor|1.0}</vert_resolution_factor>

    <!-- Depth ratio (0 to 1) between adjacent depth image to allow linear interpolation of ranges -->
    <max_vert_relative_depth_to_interpolate>${max_vert_relative_depth_to_interpolate|0.3}</max_vert_relative_depth_to_interpolate>
    <max_horz_relative_depth_to_interpolate>${max_horz_relative_depth_to_interpolate|0.1}</max_horz_relative_depth_to_interpolate>

    <range_std_noise>${sensor_std_noise|0.005}</range_std_noise>
    <!-- Realistic error model, used by mvsim-dataset-gen only (all 0: disabled) -->
    <range_std_noise_per_meter>${sensor_range_std_noise_per_meter|0}</range_std_noise_per_meter>
    <beam_divergence_deg>${sensor_beam_divergence_deg|0}</beam_divergence_deg>
    <max_incidence_deg>${sensor_max_incidence_deg|0}</max_incidence_deg>
    <mixed_pixel_probability>${sensor_mixed_pixel_probability|0}</mixed_pixel_probability>
    <beam_elevation_std_deg>${sensor_beam_elevation_std_deg|0}</beam_elevation_std_deg>
    <beam_azimuth_std_deg>${sensor_beam_azimuth_std_deg|0}</beam_azimuth_std_deg>
    <beam_range_bias_std>${sensor_beam_range_bias_std|0}</beam_range_bias_std>
    <calibration_seed>${sensor_calibration_seed|0}</calibration_seed>
    <min_range>${min_range|0.20}</min_range>
    <max_range>${max_range|110.0}</max_range>
    
    <visual> <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/velodyne-vlp16.dae</model_uri> <model_roll>90</model_roll> </visual>

    <generate_intensity>${generate_intensity|false}</generate_intensity>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>
</sensor>

HELIOS 32 (31 deg FOV)

sensor preview in MVSim
To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/helios-32-FOV-31.sensor.xml"
  sensor_x="0.10" sensor_z="0.30"
  sensor_std_noise="0.005"
  sensor_name="lidar1"
  sensor_rate="10.0"
/>
All parameters available in helios-32-FOV-31.sensor.xml

File: mvsim_tutorial/definitions/helios-32-FOV-31.sensor.xml

<sensor class="lidar3d" name="${sensor_name|lidar1}">
    <pose_3d> ${sensor_x|0.5}  ${sensor_y|0.0}  ${sensor_z|0.7}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>

    <!-- vert_fov_degrees: If defined, a symmetric vertical FOV is used.
         The alternative is using a custom list of angles in "vertical_ray_angles"
    -->
    <!-- <vert_fov_degrees>${vert_fov_degrees|70}</vert_fov_degrees> -->

    <vert_nrays>32</vert_nrays>
    <vertical_ray_angles>15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16</vertical_ray_angles>

    <!-- Horizontal / azimuth angular resolution:
        The rotation of the Helios sensor configurable: 5 / 10 / 20 Hz
        Firing timing of the sensor is fixed at 55.296 μs (=18.084 kHz).

        Set the "sensor_rate" (Hz) variable from the parent XML to automatically
        adjust the number of points per horizontal line.
    -->
    <sensor_period>$f{1.0/${sensor_rate|10}}</sensor_period>
    <horz_nrays>$f{(1.0/${sensor_rate|10})/55.296e-6}</horz_nrays>

    <!-- 1.0=minimum (faster), larger values=potentially finer details captured -->
    <horz_resolution_factor>${horz_resolution_factor|1.0}</horz_resolution_factor>
    <vert_resolution_factor>${vert_resolution_factor|1.0}</vert_resolution_factor>

    <!-- Depth ratio (0 to 1) between adjacent depth image to allow linear interpolation of ranges -->
    <max_vert_relative_depth_to_interpolate>${max_vert_relative_depth_to_interpolate|0.3}</max_vert_relative_depth_to_interpolate>
    <max_horz_relative_depth_to_interpolate>${max_horz_relative_depth_to_interpolate|0.1}</max_horz_relative_depth_to_interpolate>

    <range_std_noise>${sensor_std_noise|0.005}</range_std_noise>
    <!-- Realistic error model, used by mvsim-dataset-gen only (all 0: disabled) -->
    <range_std_noise_per_meter>${sensor_range_std_noise_per_meter|0}</range_std_noise_per_meter>
    <beam_divergence_deg>${sensor_beam_divergence_deg|0}</beam_divergence_deg>
    <max_incidence_deg>${sensor_max_incidence_deg|0}</max_incidence_deg>
    <mixed_pixel_probability>${sensor_mixed_pixel_probability|0}</mixed_pixel_probability>
    <beam_elevation_std_deg>${sensor_beam_elevation_std_deg|0}</beam_elevation_std_deg>
    <beam_azimuth_std_deg>${sensor_beam_azimuth_std_deg|0}</beam_azimuth_std_deg>
    <beam_range_bias_std>${sensor_beam_range_bias_std|0}</beam_range_bias_std>
    <calibration_seed>${sensor_calibration_seed|0}</calibration_seed>
    <min_range>${min_range|0.20}</min_range>
    <max_range>${max_range|110.0}</max_range>
    
    <visual> <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/velodyne-vlp16.dae</model_uri> <model_roll>90</model_roll> </visual>

    <generate_intensity>${generate_intensity|false}</generate_intensity>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>
</sensor>

HELIOS 32 (70 deg FOV)

sensor preview in MVSim
To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/helios-32-FOV-70.sensor.xml"
  sensor_x="0.10" sensor_z="0.30"
  sensor_std_noise="0.005"
  sensor_name="lidar1"
  sensor_rate="10.0"
/>
All parameters available in helios-32-FOV-70.sensor.xml

File: mvsim_tutorial/definitions/helios-32-FOV-70.sensor.xml

<sensor class="lidar3d" name="${sensor_name|lidar1}">
    <pose_3d> ${sensor_x|0.5}  ${sensor_y|0.0}  ${sensor_z|0.7}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>

    <!-- vert_fov_degrees: If defined, a symmetric vertical FOV is used.
         The alternative is using a custom list of angles in "vertical_ray_angles"
    -->
    <!-- <vert_fov_degrees>${vert_fov_degrees|70}</vert_fov_degrees> -->

    <vert_nrays>32</vert_nrays>
    <vertical_ray_angles>-55.020 -52.081 -49.142 -46.204 -43.265 -40.326 -37.387 -34.449 -31.510 -28.571 -25.632 -22.694 -19.755 -16.816 -13.877 -10.939 -8.000 -6.667 -5.333 -4.000 -2.667 -1.333  0.000 1.333 2.667 4.000 5.333 6.667 8.754 10.841 12.929 15</vertical_ray_angles>

    <!-- Horizontal / azimuth angular resolution:
        The rotation of the Helios sensor configurable: 5 / 10 / 20 Hz
        Firing timing of the sensor is fixed at 55.296 μs (=18.084 kHz).

        Set the "sensor_rate" (Hz) variable from the parent XML to automatically
        adjust the number of points per horizontal line.
    -->
    <sensor_period>$f{1.0/${sensor_rate|10}}</sensor_period>
    <horz_nrays>$f{(1.0/${sensor_rate|10})/55.296e-6}</horz_nrays>

    <!-- 1.0=minimum (faster), larger values=potentially finer details captured -->
    <horz_resolution_factor>${horz_resolution_factor|1.0}</horz_resolution_factor>
    <vert_resolution_factor>${vert_resolution_factor|1.0}</vert_resolution_factor>

    <!-- Depth ratio (0 to 1) between adjacent depth image to allow linear interpolation of ranges -->
    <max_vert_relative_depth_to_interpolate>${max_vert_relative_depth_to_interpolate|0.3}</max_vert_relative_depth_to_interpolate>
    <max_horz_relative_depth_to_interpolate>${max_horz_relative_depth_to_interpolate|0.1}</max_horz_relative_depth_to_interpolate>

    <range_std_noise>${sensor_std_noise|0.005}</range_std_noise>
    <!-- Realistic error model, used by mvsim-dataset-gen only (all 0: disabled) -->
    <range_std_noise_per_meter>${sensor_range_std_noise_per_meter|0}</range_std_noise_per_meter>
    <beam_divergence_deg>${sensor_beam_divergence_deg|0}</beam_divergence_deg>
    <max_incidence_deg>${sensor_max_incidence_deg|0}</max_incidence_deg>
    <mixed_pixel_probability>${sensor_mixed_pixel_probability|0}</mixed_pixel_probability>
    <beam_elevation_std_deg>${sensor_beam_elevation_std_deg|0}</beam_elevation_std_deg>
    <beam_azimuth_std_deg>${sensor_beam_azimuth_std_deg|0}</beam_azimuth_std_deg>
    <beam_range_bias_std>${sensor_beam_range_bias_std|0}</beam_range_bias_std>
    <calibration_seed>${sensor_calibration_seed|0}</calibration_seed>
    <min_range>${min_range|0.20}</min_range>
    <max_range>${max_range|110.0}</max_range>
    
    <visual> <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/velodyne-vlp16.dae</model_uri> <model_roll>90</model_roll> </visual>

    <generate_intensity>${generate_intensity|false}</generate_intensity>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>
</sensor>

OUSTER OS1

sensor preview in MVSim
To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/ouster-os1.sensor"
  sensor_x="0.10" sensor_z="0.30"
  sensor_std_noise="0.005"
  sensor_name="lidar1"
  sensor_period_sec="0.10"
/>
All parameters available in ouster-os1.sensor.xml

File: mvsim_tutorial/definitions/ouster-os1.sensor.xml

<sensor class="lidar3d" name="${sensor_name|lidar1}">
    <pose_3d> ${sensor_x|0.5}  ${sensor_y|0.0}  ${sensor_z|0.7}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>

    <vert_nrays>${vert_nrays|128}</vert_nrays>

    <!-- Vertical FOV:
         - OS0: 90deg
         - OS1: 45deg
         - OS2: 22.5deg
    -->
    <vert_fov_degrees>${vert_fov_degrees|22.5}</vert_fov_degrees>

    <!-- Horizontal / azimuth angular resolution:

        Modes (number of "columns per lidar frame" x frame rate):
        - 512 x {10,20} Hz
        - 1024 x {10,20} Hz
        - 2048 x 10 Hz
    -->
    <sensor_period>${sensor_period_sec|0.10}</sensor_period>
    <horz_nrays>${sensor_horz_nrays|1024}</horz_nrays>

    <!-- 1.0=minimum (faster), larger values=potentially finer details captured -->
    <horz_resolution_factor>${horz_resolution_factor|1.0}</horz_resolution_factor>
    <vert_resolution_factor>${vert_resolution_factor|1.0}</vert_resolution_factor>

    <!-- Depth ratio (0 to 1) between adjacent depth image to allow linear interpolation of ranges -->
    <max_vert_relative_depth_to_interpolate>${max_vert_relative_depth_to_interpolate|0.3}</max_vert_relative_depth_to_interpolate>
    <max_horz_relative_depth_to_interpolate>${max_horz_relative_depth_to_interpolate|0.1}</max_horz_relative_depth_to_interpolate>

    <range_std_noise>${sensor_std_noise|0.005}</range_std_noise>
    <!-- Realistic error model, used by mvsim-dataset-gen only (all 0: disabled) -->
    <range_std_noise_per_meter>${sensor_range_std_noise_per_meter|0}</range_std_noise_per_meter>
    <beam_divergence_deg>${sensor_beam_divergence_deg|0}</beam_divergence_deg>
    <max_incidence_deg>${sensor_max_incidence_deg|0}</max_incidence_deg>
    <mixed_pixel_probability>${sensor_mixed_pixel_probability|0}</mixed_pixel_probability>
    <beam_elevation_std_deg>${sensor_beam_elevation_std_deg|0}</beam_elevation_std_deg>
    <beam_azimuth_std_deg>${sensor_beam_azimuth_std_deg|0}</beam_azimuth_std_deg>
    <beam_range_bias_std>${sensor_beam_range_bias_std|0}</beam_range_bias_std>
    <calibration_seed>${sensor_calibration_seed|0}</calibration_seed>
    <min_range>${min_range|0.5}</min_range>
    <max_range>${max_range|90.0}</max_range>
    
    <visual> <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/velodyne-vlp16.dae</model_uri> <model_roll>90</model_roll> </visual>

    <generate_intensity>${generate_intensity|false}</generate_intensity>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>
</sensor>

OUSTER Rev8 (RGB)

Ouster Rev8 3D LiDAR with per-point RGB color, as the “native color” models of that sensor family. Default: OS1 (45 deg vertical FOV), 128 channels, 1024 columns at 10 Hz. Other models and modes are set with the include variables (e.g. vert_fov_degrees="90" for an OS0, vert_nrays="256" sensor_horz_nrays="4096" sensor_period_sec="0.2" for the 4096x256 at 5 Hz mode).

Each point has the fields x y z intensity t ring color_r color_g color_b, with the color (uint8) of the rendered scene where the ray hits, from the same render used for the ranges. The ROS 2 node publishes them as a PointCloud2 with a packed rgb float32 field (as PCL and ouster-ros with point_type: xyzrgb do), so RViz shows it with the RGB8 color transformer. See the demo_ouster_rev8 demo world.

To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/ouster-rev8.sensor.xml"
  sensor_x="0.0" sensor_z="0.55"
  sensor_name="lidar1"
/>
All parameters available in ouster-rev8.sensor.xml

File: mvsim_tutorial/definitions/ouster-rev8.sensor.xml

<sensor class="lidar3d" name="${sensor_name|lidar1}">
    <!--
      Ouster Rev8 3D LiDAR with per-point RGB color ("native color" models).
      Default: OS1, 128 channels, 1024 columns at 10 Hz.

      Each point has the fields: x y z intensity t ring color_r color_g color_b
      (the ROS node publishes the color as a packed "rgb" float32 field, as
      ouster-ros "xyzrgb" and PCL do).
    -->
    <pose_3d> ${sensor_x|0.0}  ${sensor_y|0.0}  ${sensor_z|0.5}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>

    <!-- Channels: 32, 64, 128 or 256 (OS-1-MAX) -->
    <vert_nrays>${vert_nrays|128}</vert_nrays>

    <!-- Vertical FOV:
         - OS0: 90deg
         - OS1: 45deg
         - OS2: 22.5deg
    -->
    <vert_fov_degrees>${vert_fov_degrees|45.0}</vert_fov_degrees>

    <!-- Horizontal resolution x frame rate (lidar modes):
        - 1024 x 10 Hz (default)
        - 2048 x 10 Hz
        - 4096 x 5 Hz  (sensor_period_sec=0.2)
    -->
    <sensor_period>${sensor_period_sec|0.10}</sensor_period>
    <horz_nrays>${sensor_horz_nrays|1024}</horz_nrays>

    <!-- 1.0=minimum (faster), larger values=potentially finer details captured -->
    <horz_resolution_factor>${horz_resolution_factor|1.0}</horz_resolution_factor>
    <vert_resolution_factor>${vert_resolution_factor|1.0}</vert_resolution_factor>

    <!-- Depth ratio (0 to 1) between adjacent depth image to allow linear interpolation of ranges -->
    <max_vert_relative_depth_to_interpolate>${max_vert_relative_depth_to_interpolate|0.3}</max_vert_relative_depth_to_interpolate>
    <max_horz_relative_depth_to_interpolate>${max_horz_relative_depth_to_interpolate|0.1}</max_horz_relative_depth_to_interpolate>

    <range_std_noise>${sensor_std_noise|0.01}</range_std_noise>
    <!-- Realistic error model, used by mvsim-dataset-gen only (all 0: disabled) -->
    <range_std_noise_per_meter>${sensor_range_std_noise_per_meter|0}</range_std_noise_per_meter>
    <beam_divergence_deg>${sensor_beam_divergence_deg|0}</beam_divergence_deg>
    <max_incidence_deg>${sensor_max_incidence_deg|0}</max_incidence_deg>
    <mixed_pixel_probability>${sensor_mixed_pixel_probability|0}</mixed_pixel_probability>
    <beam_elevation_std_deg>${sensor_beam_elevation_std_deg|0}</beam_elevation_std_deg>
    <beam_azimuth_std_deg>${sensor_beam_azimuth_std_deg|0}</beam_azimuth_std_deg>
    <beam_range_bias_std>${sensor_beam_range_bias_std|0}</beam_range_bias_std>
    <calibration_seed>${sensor_calibration_seed|0}</calibration_seed>
    <min_range>${min_range|0.5}</min_range>
    <max_range>${max_range|120.0}</max_range>

    <ignore_parent_body>${ignore_parent_body|true}</ignore_parent_body>

    <visual> <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/velodyne-vlp16.dae</model_uri> <model_roll>90</model_roll> </visual>

    <!-- Intensity from the grayscale of the scene, and per-point RGB color -->
    <generate_intensity>${generate_intensity|true}</generate_intensity>
    <generate_rgb>${generate_rgb|true}</generate_rgb>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>
</sensor>

Per-point RGB in any 3D LiDAR: add <generate_rgb>true</generate_rgb> to any lidar3d sensor. It requires reading back the rendered color image, so it is slower than a depth-only lidar (as <generate_intensity>, which takes the intensity from the grayscale of the same image). Lidars without these options render depth only. The color is taken without shadows. The offline ray tracer mvsim-dataset-gen has no colors and ignores generate_rgb.


Velodyne VLP-16

sensor preview in MVSim
To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/velodyne-vlp16.sensor"
  sensor_x="0.10" sensor_z="0.30"
  sensor_std_noise="0.005"
  sensor_name="lidar1"
  sensor_rpm="600"
/>
All parameters available in velodyne-vlp16.sensor.xml

File: mvsim_tutorial/definitions/velodyne-vlp16.sensor.xml

<sensor class="lidar3d" name="${sensor_name|lidar1}">
    <pose_3d> ${sensor_x|0.5}  ${sensor_y|0.0}  ${sensor_z|0.7}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>

    <vert_fov_degrees>${vert_fov_degrees|30}</vert_fov_degrees>
    <vert_nrays>${vert_nrays|16}</vert_nrays>

    <!-- Horizontal / azimuth angular resolution:
        The rotation of the Velodyne VLP16 ("PUCK") sensor is configurable
        between 300 RPM and 1200 RPM => 5-20 Hz.
        Firing timing of the sensor is fixed at 55.296 μs (=18.084 kHz).

        Set the "sensor_rpm" variable from the parent XML to automatically
        adjust the number of points per horizontal line, and the sensor
        rate (Hz).
    -->
    <sensor_period>$f{60.0/${sensor_rpm|600}}</sensor_period>
    <horz_nrays>$f{(60.0/${sensor_rpm|600})/55.296e-6}</horz_nrays>

    <!-- 1.0=minimum (faster), larger values=potentially finer details captured -->
    <horz_resolution_factor>${horz_resolution_factor|1.0}</horz_resolution_factor>
    <vert_resolution_factor>${vert_resolution_factor|1.0}</vert_resolution_factor>

    <!-- Depth ratio (0 to 1) between adjacent depth image to allow linear interpolation of ranges -->
    <max_vert_relative_depth_to_interpolate>${max_vert_relative_depth_to_interpolate|0.3}</max_vert_relative_depth_to_interpolate>
    <max_horz_relative_depth_to_interpolate>${max_horz_relative_depth_to_interpolate|0.1}</max_horz_relative_depth_to_interpolate>

    <range_std_noise>${sensor_std_noise|0.005}</range_std_noise>
    <!-- Realistic error model, used by mvsim-dataset-gen only (all 0: disabled) -->
    <range_std_noise_per_meter>${sensor_range_std_noise_per_meter|0}</range_std_noise_per_meter>
    <beam_divergence_deg>${sensor_beam_divergence_deg|0}</beam_divergence_deg>
    <max_incidence_deg>${sensor_max_incidence_deg|0}</max_incidence_deg>
    <mixed_pixel_probability>${sensor_mixed_pixel_probability|0}</mixed_pixel_probability>
    <beam_elevation_std_deg>${sensor_beam_elevation_std_deg|0}</beam_elevation_std_deg>
    <beam_azimuth_std_deg>${sensor_beam_azimuth_std_deg|0}</beam_azimuth_std_deg>
    <beam_range_bias_std>${sensor_beam_range_bias_std|0}</beam_range_bias_std>
    <calibration_seed>${sensor_calibration_seed|0}</calibration_seed>
    <max_range>${max_range|80.0}</max_range>
    
    <visual> <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/velodyne-vlp16.dae</model_uri> <model_roll>90</model_roll> </visual>

    <generate_intensity>${generate_intensity|false}</generate_intensity>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>
</sensor>

RGB camera

A regular RGB (color) pin-hole camera, with optional lens distortion and pixel noise. The user must provide the camera intrinsic and extrinsic parameters:

To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/camera.sensor.xml"
        sensor_x="0.1" sensor_y="0.0" sensor_z="0.8"
        ncols="800"    nrows="600"
        cx="$f{800/2}" cy="$f{600/2}"
        fx="800" fy="800"
        sensor_period_sec="$f{1/20.0}"
        clip_min="0.02" clip_max="300"
        sensor_visual_scale="0.2"
/>

Optional lens distortion (distortion_model=plumb_bob with k1, k2, p1, p2, k3, as in OpenCV and ROS camera_info) and Gaussian pixel noise (image_noise_std, in intensity levels), both applied on the GPU while rendering. The published camera_info includes the distortion model and coefficients, so standard rectification gives back the pinhole image. They require MRPT >= 3.6.0 (loading a world that uses them fails with older versions).

Both are disabled by default. To quickly try them in all the tutorial worlds and vehicle definitions with an RGB or RGB-D camera, set the environment variables MVSIM_CAMERA_DISTORTION=plumb_bob (with k1=-0.25, k2=0.07) and/or MVSIM_CAMERA_NOISE_STD=2.0 (any noise std):

MVSIM_CAMERA_DISTORTION=plumb_bob mvsim launch mvsim_tutorial/demo_camera.world.xml

Example: a camera with barrel distortion and some pixel noise:

<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/camera.sensor.xml"
        sensor_x="0.1" sensor_y="0.0" sensor_z="0.8"
        ncols="800"    nrows="600"
        cx="$f{800/2}" cy="$f{600/2}"
        fx="500" fy="500"
        distortion_model="plumb_bob"
        k1="-0.25" k2="0.07" p1="0" p2="0" k3="0"
        image_noise_std="2.0"
/>
All parameters available in camera.sensor.xml

File: mvsim_tutorial/definitions/camera.sensor.xml

<sensor class="camera" name="${sensor_name|camera1}">
    <!--
        * pose_3d: Pose of the RGB camera sensor on the robot (+Z forward)
        See: https://docs.mrpt.org/reference/stable/class_mrpt_obs_CObservationImage.html
    -->
    <pose_3d> ${sensor_x|0.65}  ${sensor_y|0.0}  ${sensor_z|1.0}  ${sensor_yaw|-90.0} ${sensor_pitch|0} ${sensor_roll|-90.0}</pose_3d>

    <sensor_period>${sensor_period_sec|0.1}</sensor_period>

    <ncols>${ncols|640}</ncols>
    <nrows>${nrows|480}</nrows>
    <cx>${cx|320}</cx>
    <cy>${cy|240}</cy>
    <fx>${fx|400}</fx>
    <fy>${fy|400}</fy>
    <clip_min>${clip_min|1e-2}</clip_min>
    <clip_max>${clip_max|1e+4}</clip_max>
    <!-- Optional lens distortion ("none" or "plumb_bob", as OpenCV/ROS camera_info). Requires MRPT >= 3.6.0 -->
    <distortion_model>${distortion_model|none}</distortion_model>
    <k1>${k1|0}</k1> <k2>${k2|0}</k2> <p1>${p1|0}</p1> <p2>${p2|0}</p2> <k3>${k3|0}</k3>
    <!-- Optional Gaussian noise added to each pixel channel [intensity levels, 0-255]. Requires MRPT >= 3.6.0 -->
    <image_noise_std>${image_noise_std|0}</image_noise_std>

    <!-- Whether the GUI preview subwindow for this sensor starts opened (true, default) or minimized (false) -->
    <preview_win_visible>${preview_win_visible|true}</preview_win_visible>

    <visual>
      <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/simple_camera.dae</model_uri>
      <model_scale>${sensor_visual_scale|1.0}</model_scale>
    </visual>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>

</sensor>

IMU

An inertial sensor that measures (in the current version of MVSim):

  • 3D linear proper acceleration.

  • 3D angular velocity.

  • (Optionally) 3D orientation as a quaternion.

To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/imu.sensor.xml"
        sensor_x="0.0" sensor_y="0.0" sensor_z="0.0"
        sensor_period_sec="$f{1/200.0}"
/>
All parameters available in imu.sensor.xml

File: mvsim_tutorial/definitions/imu.sensor.xml

<sensor class="imu" name="${sensor_name|imu1}">
    <pose_3d> ${sensor_x|0}  ${sensor_y|0.0}  ${sensor_z|0}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>
    <sensor_period>${sensor_period_sec|0.05}</sensor_period>

    <!-- White-noise standard deviations (measurement noise / angle random walk).
         These correspond to the legacy params angular_velocity_std_noise and
         linear_acceleration_std_noise and remain backward-compatible. -->
    <angular_velocity_white_noise_std_noise>${sensor_angular_velocity_white_noise_std_noise|2e-4}</angular_velocity_white_noise_std_noise>
    <linear_acceleration_white_noise_std_noise>${sensor_linear_acceleration_white_noise_std_noise|0.017}</linear_acceleration_white_noise_std_noise>

    <!-- Bias random-walk standard deviations (in-run stability / drift).
         Units: rad/s/sqrt(s) for gyroscope, m/s²/sqrt(s) for accelerometer.
         Set to 0 to disable bias drift (default).
         See: Forster et al., "On-Manifold Preintegration for Real-Time
         Visual-Inertial Odometry", IEEE T-RO 2016. -->
    <angular_velocity_random_walk_std_noise>${sensor_angular_velocity_random_walk_std_noise|0}</angular_velocity_random_walk_std_noise>
    <linear_acceleration_random_walk_std_noise>${sensor_linear_acceleration_random_walk_std_noise|0}</linear_acceleration_random_walk_std_noise>

    <measure_orientation>${sensor_measure_orientation|false}</measure_orientation>

    <visual enabled="${sensor_custom_visual|true}">
        <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/simple_imu.dae</model_uri>
    </visual>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>
</sensor>

IMU noise model

The IMU sensor implements the standard continuous-time stochastic error model described in [Forster2016], with two independent noise components per axis for both the gyroscope and accelerometer channels:

White noise (measurement noise).

Zero-mean Gaussian noise added to every sample. Configured via the *_white_noise_std_noise parameters (standard deviation in the channel units: rad/s for gyroscope, m/s² for accelerometer).

Bias random walk (in-run stability / drift).

A slowly-varying bias modelled as a Wiener process (integral of white noise). Configured via the *_random_walk_std_noise parameters (units: rad/s/√s for gyroscope, m/s²/√s for accelerometer). Set to 0 (default) to disable bias drift.

The discrete-time update at each simulation step of duration \(\Delta t\) is:

\[\mathbf{b}_{k} = \mathbf{b}_{k-1} + \mathcal{N}\!\bigl(\mathbf{0},\;\sigma_{\mathrm{rw}}^{2}\,\Delta t\;\mathbf{I}\bigr)\]
\[\tilde{\mathbf{m}}_{k} = \mathbf{m}_{k} + \mathbf{b}_{k} + \mathcal{N}\!\bigl(\mathbf{0},\;\sigma_{w}^{2}\;\mathbf{I}\bigr)\]

The four XML parameters are:

Parameter

Default

Description

angular_velocity_white_noise_std_noise

2e-4

Gyroscope white noise σ (rad/s)

linear_acceleration_white_noise_std_noise

0.017

Accelerometer white noise σ (m/s²)

angular_velocity_random_walk_std_noise

0

Gyroscope bias random walk σ (rad/s/√s)

linear_acceleration_random_walk_std_noise

0

Accelerometer bias random walk σ (m/s²/√s)

Note

The legacy parameter names angular_velocity_std_noise and linear_acceleration_std_noise are still accepted and map to the corresponding *_white_noise_std_noise parameters.

Example — a noisy tactical-grade IMU with bias drift:

<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/imu.sensor.xml"
  sensor_x="0.0" sensor_y="0.0" sensor_z="0.0"
  sensor_period_sec="$f{1/200.0}"
  sensor_angular_velocity_white_noise_std_noise="1.7e-4"
  sensor_linear_acceleration_white_noise_std_noise="5.88e-3"
  sensor_angular_velocity_random_walk_std_noise="1.0e-5"
  sensor_linear_acceleration_random_walk_std_noise="3.0e-4"
/>
[Forster2016]

C. Forster, L. Carlone, F. Dellaert, D. Scaramuzza, “On-Manifold Preintegration for Real-Time Visual-Inertial Odometry”, IEEE Transactions on Robotics, vol. 33, no. 1, pp. 1-21, 2016.


2D laser scanner

sensor preview in MVSim

“Classical” lidars that scan obstacles in a plane only. These includes are available for these sensors:

Generic 2D LIDAR

To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.

Important parameters:

  • raytrace_3d=false (DEFAULT), Very fast simulation using approximate 2D shapes of world elements.

  • raytrace_3d=true: It uses GPU-based raytracing for exact distance calculation to world elements of arbitrary 3D shapes.

  • A tilted scan plane (sensor_pitch, sensor_roll, e.g. a LiDAR looking down to see ground-level structures) requires raytrace_3d=true: the 2D mode ignores pitch and roll (a warning is printed).

<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/lidar2d.sensor.xml"
        sensor_x="0.2" sensor_y="0" sensor_z="0.50" sensor_yaw="0"
        sensor_period_sec="0.10"
        sensor_nrays="181"
        raytrace_3d="true"
        fov_degrees="270"
        sensor_name="scanner1"
>

Example of a scanner tilted 20 degrees downward (positive pitch points it down), so its scan plane hits the ground about 1.4 m ahead:

<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/lidar2d.sensor.xml"
        sensor_x="0.2" sensor_y="0" sensor_z="0.50"
        sensor_yaw="0" sensor_pitch="20" sensor_roll="0"
        sensor_period_sec="0.10"
        raytrace_3d="true"
        fov_degrees="120"
        sensor_name="ground_scanner"
/>
All parameters available in lidar2d.sensor.xml

File: mvsim_tutorial/definitions/lidar2d.sensor.xml

<sensor class="laser" name="${sensor_name|laser1}">
    <!-- With pitch or roll (e.g. tilted to see the ground), use raytrace_3d=true -->
    <pose_3d> ${sensor_x|1.80}  ${sensor_y|0.0}  ${sensor_z|0.7}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>
    <fov_degrees>${fov_degrees|180}</fov_degrees>
    <!-- With raytrace_3d=true, each scan is rendered with OpenGL: use ~10 Hz (sensor_period_sec=0.1) -->
    <sensor_period>${sensor_period_sec|0.05}</sensor_period>
    <nrays>${sensor_nrays|181}</nrays>
    <range_std_noise>${sensor_std_noise|0.01}</range_std_noise>
    <angle_std_noise_deg>${sensor_std_noise_deg|0.01}</angle_std_noise_deg>
    <raytrace_3d>${raytrace_3d|false}</raytrace_3d>
    <max_range>${max_range|30.0}</max_range>
    
    <visual enabled="${sensor_custom_visual|true}">
        <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/hokuyo_utm30.dae</model_uri>
    </visual>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>

    <!-- Visualization of sensed points in MVSIM GUI -->
    <viz_visiblePoints>${viz_visiblePoints|true}</viz_visiblePoints>
    <viz_pointSize>${viz_pointSize|3.0}</viz_pointSize>
    <viz_visiblePlane>${viz_visiblePlane|false}</viz_visiblePlane>
    <viz_visibleLines>${viz_visibleLines|true}</viz_visibleLines>
    <viz_pointsColor>${viz_pointsColor|#ff000080}</viz_pointsColor>
    <viz_planeColor>${viz_planeColor|#0000ff10}</viz_planeColor>

</sensor>

RPLidar A2

Just like the generic Lidar above, but with a custom visualization for this particular commercial model.

To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.

Important parameter: See notes on raytrace_3d above.

<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/rplidar-a2.sensor.xml"
        sensor_x="0.2" sensor_y="0" sensor_z="0.50" sensor_yaw="0"
        sensor_period_sec="0.10"
        sensor_nrays="181"
        raytrace_3d="true"
        fov_degrees="270"
        sensor_name="scanner1"
>
All parameters available in rplidar-a2.sensor.xml

File: mvsim_tutorial/definitions/rplidar-a2.sensor.xml

<sensor class="laser" name="${sensor_name|laser1}">
    <pose_3d> ${sensor_x|1.80}  ${sensor_y|0.0}  ${sensor_z|0.7}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>
    <fov_degrees>${fov_degrees|360}</fov_degrees>

    <!-- Horizontal / azimuth angular resolution:
        The rotation of the RPLIDAR sensor is configurable
        between 5-15 Hz.
        Firing timing of the sensor is fixed at 125 μs (=8 kHz).

        Set the "sensor_rpm" variable from the parent XML to automatically
        adjust the number of points and the sensor scan rate (Hz).
    -->
    <sensor_period>$f{1/${sensor_hz|10}}</sensor_period>
    <nrays>$f{(1/${sensor_hz|10})/125e-6}</nrays>

    <range_std_noise>${sensor_std_noise|0.01}</range_std_noise>
    <angle_std_noise_deg>${sensor_std_noise_deg|0.01}</angle_std_noise_deg>

    <raytrace_3d>${raytrace_3d|false}</raytrace_3d>
    <max_range>${max_range|16.0}</max_range>
    
    <visual>
        <model_uri>https://mrpt.github.io/mvsim-models/turtlebot3.zip/turtlebot3/lds.dae</model_uri>
        <model_roll>90</model_roll>
        <model_scale>0.001</model_scale>
    </visual>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>

    <!-- Visualization of sensed points in MVSIM GUI -->
    <viz_visiblePoints>${viz_visiblePoints|true}</viz_visiblePoints>
    <viz_pointSize>${viz_pointSize|3.0}</viz_pointSize>
    <viz_visiblePlane>${viz_visiblePlane|false}</viz_visiblePlane>
    <viz_visibleLines>${viz_visibleLines|true}</viz_visibleLines>
    <viz_pointsColor>${viz_pointsColor|#ff000080}</viz_pointsColor>
    <viz_planeColor>${viz_planeColor|#0000ff10}</viz_planeColor>

</sensor>

Depth (RGBD) camera

sensor preview in MVSim

An RGB+D (color plus depth) camera sensor, similar to an Intel RealSense or ASUS Xtion / Astra. It simulates both the RGB and depth channels independently (each with its own intrinsics and clip distances) and can optionally publish to ROS the following topics:

ROS topics published by the RGBD sensor

Topic

Type

Notes

<label>_image

sensor_msgs/Image

RGB image (always published when sense_rgb=true)

<label>_points

sensor_msgs/PointCloud2

XYZ pointcloud, or XYZRGB if publish_ros_colored_pointcloud=true

<label>_depth/image_raw

sensor_msgs/Image

Depth image, 16UC1 in millimeters (0 = invalid, as REP 118) or 32FC1 in meters (NaN = invalid), see ros_depth_image_encoding. Its frame <label>_depth is a camera optical frame (+Z forward). Published when publish_ros_depth_image=true

<label>_depth/camera_info

sensor_msgs/CameraInfo

Depth camera intrinsics. Published when publish_ros_depth_image=true

To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/rgbd_camera.sensor.xml"
  sensor_x="0.2" sensor_y="0"  sensor_z="0.29"
  sensor_period_sec="0.10"
  show_3d_pointcloud="true"
  publish_ros_depth_image="true"
  publish_ros_colored_pointcloud="false"
/>

The RGB image supports the same optional lens distortion and pixel noise as the RGB camera, with the same include parameters (distortion_model, k1, …, image_noise_std, which set the rgb_* tags). The depth image is not distorted. The colors of the 3D point cloud are taken ignoring the distortion, so they are slightly misregistered near the image borders when it is enabled.

All parameters available in rgbd_camera.sensor.xml

File: mvsim_tutorial/definitions/rgbd_camera.sensor.xml

<sensor class="rgbd_camera" name="${sensor_name|camera1}">
    <!--
        * pose_3d: Pose of the depth sensor on the robot (+X forward)
        * relativePoseIntensityWRTDepth: RGB camera wrt depth sensor (+Z forward, and possibly an offset)
        See: https://docs.mrpt.org/reference/stable/class_mrpt_obs_CObservation3DRangeScan.html
    -->
    <pose_3d> ${sensor_x|0.65}  ${sensor_y|0.0}  ${sensor_z|1.0}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>
    
    <!-- the yaw=-90deg roll=-90deg rotation is required since RGB axis convention is +Z forward, depth sensor is +X forward -->
    <relativePoseIntensityWRTDepth>0.0 0.0 0.0  -90.0 0.0 -90.0</relativePoseIntensityWRTDepth>

    <sensor_period>${sensor_period_sec|0.1}</sensor_period>

    <sense_depth>${sense_depth|true}</sense_depth>
    <sense_rgb>${sense_rgb|true}</sense_rgb>
    
    <show_3d_pointcloud>${show_3d_pointcloud|false}</show_3d_pointcloud>

    <!-- Whether the GUI preview subwindow(s) for this sensor start opened (true, default) or minimized (false) -->
    <preview_win_visible>${preview_win_visible|true}</preview_win_visible>
    <!-- Whether to show the depth image preview too -->
    <preview_depth>${preview_depth|true}</preview_depth>

    <!-- ROS publishing options for depth image & colored pointcloud -->
    <publish_ros_depth_image>${publish_ros_depth_image|true}</publish_ros_depth_image>
    <!-- ROS depth image encoding: "16UC1" (millimeters) or "32FC1" (meters, NaN if invalid) -->
    <ros_depth_image_encoding>${ros_depth_image_encoding|16UC1}</ros_depth_image_encoding>
    <publish_ros_colored_pointcloud>${publish_ros_colored_pointcloud|false}</publish_ros_colored_pointcloud>

    <depth_ncols>640</depth_ncols>
    <depth_nrows>480</depth_nrows>
    <depth_cx>320</depth_cx>
    <depth_cy>240</depth_cy>
    <depth_fx>400</depth_fx>
    <depth_fy>400</depth_fy>
    <depth_resolution>1e-3</depth_resolution>
    <depth_clip_min>${depth_clip_min|0.01}</depth_clip_min>
    <depth_clip_max>${depth_clip_max|15.0}</depth_clip_max>
    <depth_noise_sigma>${depth_noise_sigma|0.05}</depth_noise_sigma>

    <rgb_ncols>640</rgb_ncols>
    <rgb_nrows>480</rgb_nrows>
    <rgb_cx>320</rgb_cx>
    <rgb_cy>240</rgb_cy>
    <rgb_fx>400</rgb_fx>
    <rgb_fy>400</rgb_fy>
    <rgb_clip_min>${rgb_clip_min|1e-2}</rgb_clip_min>
    <rgb_clip_max>${rgb_clip_max|1e+4}</rgb_clip_max>
    <!-- Optional lens distortion of the RGB image ("none" or "plumb_bob", as OpenCV/ROS camera_info). Requires MRPT >= 3.6.0 -->
    <rgb_distortion_model>${distortion_model|none}</rgb_distortion_model>
    <rgb_k1>${k1|0}</rgb_k1> <rgb_k2>${k2|0}</rgb_k2> <rgb_p1>${p1|0}</rgb_p1> <rgb_p2>${p2|0}</rgb_p2> <rgb_k3>${k3|0}</rgb_k3>
    <!-- Optional Gaussian noise added to each RGB pixel channel [intensity levels, 0-255]. Requires MRPT >= 3.6.0 -->
    <rgb_image_noise_std>${image_noise_std|0}</rgb_image_noise_std>

    <visual> <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/simple_camera.dae</model_uri> <model_pitch>90</model_pitch> </visual>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>

</sensor>

ROS publishing options

publish_ros_depth_image (default: true)

When enabled, the sensor publishes the depth channel as a separate sensor_msgs/Image message (see ros_depth_image_encoding) on the topic <label>_depth/image_raw, together with a matching sensor_msgs/CameraInfo on <label>_depth/camera_info. This matches the topic layout of real RGBD cameras such as the ASUS Xtion / Astra (/depth/image_raw).

ros_depth_image_encoding (default: 16UC1)

16UC1: depth in millimeters, 0 for invalid pixels. 32FC1: depth in meters, NaN for invalid pixels. Valid depths are limited to [depth_clip_min, depth_clip_max].

Example: depth images in meters, as floats:

<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/rgbd_camera.sensor.xml"
  sensor_name="camera1"
  publish_ros_depth_image="true"
  ros_depth_image_encoding="32FC1"
/>
# Check the encoding and the optical frame of the depth images:
ros2 topic echo --once /camera1_depth/image_raw --field encoding
ros2 topic echo --once /camera1_depth/image_raw --field header.frame_id
publish_ros_colored_pointcloud (default: false)

When enabled and the sensor has sense_rgb=true, the pointcloud published on <label>_points will include per-point RGB color (XYZRGB fields) instead of plain XYZ.


GNSS sensor (“GPS”)

A “GPS sensor” can be attached to a robot with the code shown below. For it to work, the world XML needs to have a georeference tag.

To use in your robot, copy and paste this inside a <vehicle> or <vehicle:class> tag.
<include file="$(ros2 pkg prefix mvsim)/share/mvsim/definitions/gnss.sensor.xml"
  sensor_x="0.0"  sensor_y="0.0" sensor_z="0.50"
  sensor_period_sec="1.0"
  sensor_name="gps"
  sensor_horizontal_std_noise="1.5"
  sensor_vertical_std_noise="2.5"
  />

The published sensor_msgs/NavSatFix has a position_covariance from the noise parameters, and a status from fix_type. For robustness tests, quality changes, outages and position jumps can be scheduled in simulation time with <event> tags inside the <sensor> tag (all attributes but start/end are optional):

<!-- Change fix type and noise: -->
<event start="10" end="20" fix_type="rtk_float" horizontal_std_noise="0.3" vertical_std_noise="0.5" />
<!-- No data at all: -->
<event start="30" end="35" outage="true" />
<!-- Data without a valid fix: -->
<event start="40" end="45" fix_type="no_fix" />
<!-- Position jump (East, North, Up offset, in meters): -->
<event start="50" end="60" offset="2.0 -1.0 0" />

Outages can also be defined by world regions, with the gps_no_coverage property of property regions.

All parameters available in gnss.sensor.xml

File: mvsim_tutorial/definitions/gnss.sensor.xml

<sensor class="gnss" name="${sensor_name|gps1}">
    <pose_3d> ${sensor_x|0}  ${sensor_y|0.0}  ${sensor_z|0}  ${sensor_yaw|0.0} ${sensor_pitch|0.0} ${sensor_roll|0.0}</pose_3d>
    <sensor_period>${sensor_period_sec|1.0}</sensor_period>

    <!-- Sensor 1-sigma noise [meters] -->
    <horizontal_std_noise>${sensor_horizontal_std_noise|2.0}</horizontal_std_noise>
    <vertical_std_noise>${sensor_vertical_std_noise|4.0}</vertical_std_noise>

    <!-- Reported fix type: no_fix, single, dgps, rtk_float, rtk_fixed -->
    <fix_type>${sensor_fix_type|dgps}</fix_type>

    <visual enabled="${sensor_custom_visual|true}">
        <model_uri>${MVSIM_CURRENT_FILE_DIRECTORY}/../models/simple_imu.dae</model_uri>
    </visual>

    <!-- Publish sensor on MVSIM ZMQ topic? (Note, this is **not** related to ROS at all) -->
    <publish enabled="${sensor_publish|false}">
        <publish_topic>/${PARENT_NAME}/${NAME}</publish_topic>
    </publish>
</sensor>