User manual

old releases - latest release - trunk

Rangefinders

2D-rangefinder sensors are natively supported in peekabot. Its type identifier is rangefinder.

How the range data is visualized is configurable through a mode parameter. Making it suitable for a wide range of sensor devices, with laser rangefinders and sonars being two examples.

Measurements that lie outside the range $(lower\_bound,upper\_bound)$ are rejected as "invalid" and put in a separate group and marked in a different color.

Input data

Rangefinders accept an array of floats or doubles from clients. Mixing different data types in the same reading is not allowed.

Sending datatypes other than float or double, or mixing them, results in undefined behaviour.

Parameters

The parameter's type is shown in parantheses after the parameter name.

mode (string)
The visualization mode to use. Must be dots or discs. See Visualization modes for more documentation on the available modes.
Default: dots
samples (int)
The number of data points per scan. Sending a different number of data samples results in undefined behaviour.
Default: 361
start_angle (float)
The angle of the first data point, in degrees.
Default: -90
end_angle (float)
The angle of the last data point, in degrees.
Default: 90
angle_uncertainty (float)
The angular uncertainty, in degrees. E.g. if your particular device is an optical rangefinder with a beam opening of 1 degree, you should put 0.5 here.
Default: 0
dist_uncertainty_prop (float)
Proportional distance uncertainty.
The total uncertainty $\sigma(d)$ in distance for a measurement $d$ is calculated according to:
$\sigma(d)=d \cdot c_{dist\_uncertainty\_prop} + c_{dist\_uncertainty\_const}$
Default: 0
dist_uncertainty_const (float)
Constant distance uncertainty, in meters.
Default: 0
lower_bound (float)
The exclusive lower bound on distance for valid measurements, in meters.
Default: std::numeric_limits<float>::min()
upper_bound (float)
The exclusive upper bound on distance for valid measurements, in meters.
Default: std::numeric_limits<float>::max()
offset (float)
The distance each measurement is offset from the sensor's origin. E.g. if you have a sonar ring, each sonar and measurement will be offset a (typically positive) distance from the sensor object's origin. Given in meters.
Default: 0
valid_color (color)
The default color to use for valid readings.
Default: blue (0,0,1)
invalid_color (color)
The default color to use for invalid readings.
Default: red (1,0,0)

Parameter templates

None currently available.

Visualization modes

dots
Each range sample is visualized as a dot with distance and angular uncertainties indicated by lines. This is typically used for laser scanners.
Visualization of uncertainties can be toggled in the GUI, or turned off altogether by setting all uncertainty parameters to zero.
discs
Each range sample is visualized as a black semi-transparent line from the measurement's origin (the sensor's origin plus an distance offset, specified by the offset param) with a disc at the end of that line signifying the angular uncertainty/beam width. The distance uncertainty is shown as a line perpendicular to the disc.
It's good for visualizing low sample-density data and rangings with high angular uncertainty, such as sonars.
Note that this mode is rather resource intensive when many samples are used.

Examples

Below is an example of how to define a laser rangefinder in your robot definition file:

 <sensor type="rangefinder">
   <name>scanner</name>

   <transform>
     <translate system="world">0.34 0 0.58</translate>
   </transform>

   <children>
     <model>
       <file>sick_lms.pbmf</file>
     </model>
   </children>

   <params>
     <string name="mode">dots</string>
     <int name="samples">181</int>
     <float name="angle_uncertainty">0.5</float>
     <float name="dist_uncertainty_prop">0.002</float>
     <float name="dist_uncertainty_const">0.01</float>
     <float name="lower_bound">0.05</float>
     <float name="upper_bound">8</float>
     <color name="invalid_color" r="1" g="0" b="1"/>
   </params>
 </sensor>

In the client, feed the sensor data by doing:

 float dists[361];
 ...
 peekabot::SensorProxy p;
 ...
 p.write(dists, 361); // buffer data to be sent
 p.update(); // send and update