Virtual range sensors

 

We have added virtual range sensors to the trunk version of UWSim. Virtual range sensors measure the distance to the nearest obstacle along the X axis of their local frame. They can be attached to vehicles, in a similar way to virtual cameras. This is an example of how to include it into your scene XML file:    

    <rangeSensor>
      <name>sonar</name>
      <relativeTo>part0</relativeTo>
      <range>10</range>
      <visible>1</visible>
      <position>
        <x>-0.3</x>
        <y>0</y>
        <z>0</z>
      </position> 
      <orientation>
        <r>0</r>
        <p>1.57</p>
        <y>0</y>
      </orientation>
    </rangeSensor>

The example above adds a virtual range sensor at the given position and orientation with respect to part0, with a maximum range of 10m. The visible tag indicates whether to render the beam in the UWSim scene or not. The measured distance can be published in ROS by adding the following lines inside the rosInterfaces block of your XML:

    <RangeSensorToROSRange>
      <name>sonar</name>
      <topic> /g500/range </topic>
      <rate>10</rate>
    </RangeSensorToROSRange>