rec::robotino::api2 C interface
Macros | Typedefs | Functions
LaserRangeFinder.h File Reference

In "rec/robotino/api2/c/LaserRangeFinder.h" you can find functions for reading Robotino's laser rangefinder. More...

#include "rec/robotino/api2/c/globals.h"
#include "rec/robotino/api2/c/Com.h"

Go to the source code of this file.

Macros

#define INVALID_LASERRANGEFINDERID   -1
 

Typedefs

typedef int LaserRangeFinderId
 

Functions

DLLEXPORT LaserRangeFinderId LaserRangeFinder_construct ()
 
DLLEXPORT BOOL LaserRangeFinder_destroy (LaserRangeFinderId id)
 
DLLEXPORT BOOL LaserRangeFinder_setComId (LaserRangeFinderId id, ComId comId)
 
DLLEXPORT BOOL LaserRangeFinder_grab (LaserRangeFinderId id)
 
DLLEXPORT BOOL LaserRangeFinder_numMeasurements (LaserRangeFinderId id, unsigned int *numRangeMeasurements, unsigned int *numIntensityMeasurements)
 
DLLEXPORT BOOL LaserRangeFinder_getReadings (LaserRangeFinderId id, unsigned int *seq, unsigned int *stamp, float *angle_min, float *angle_max, float *angle_increment, float *time_increment, float *scan_time, float *range_min, float *range_max, float *ranges, unsigned int *numRanges, float *intensities, unsigned int *numIntensities)
 

Detailed Description

In "rec/robotino/api2/c/LaserRangeFinder.h" you can find functions for reading Robotino's laser rangefinder.

Use LaserRangeFinder_construct() to create a new rangefinder object. Associate the rangefinder object with a com object using LaserRangeFinder_setComId(). Use LaserRangeFinder_getReadings() to get sensor readings from Robotino's rangefinder.

Macro Definition Documentation

#define INVALID_LASERRANGEFINDERID   -1

Invalid LaserRangeFinderId is -1

Typedef Documentation

typedef int LaserRangeFinderId

LaserRangeFinderId

Function Documentation

DLLEXPORT LaserRangeFinderId LaserRangeFinder_construct ( )

Construct an LaserRangeFinder object

Returns
Returns the ID of the newly constructed LaserRangeFinder object.
DLLEXPORT BOOL LaserRangeFinder_destroy ( LaserRangeFinderId  id)

Destroy the LaserRangeFinder object assigned to id

Parameters
idThe id of the LaserRangeFinder object to be destroyed
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given LaserRangeFinderId is invalid.
DLLEXPORT BOOL LaserRangeFinder_getReadings ( LaserRangeFinderId  id,
unsigned int *  seq,
unsigned int *  stamp,
float *  angle_min,
float *  angle_max,
float *  angle_increment,
float *  time_increment,
float *  scan_time,
float *  range_min,
float *  range_max,
float *  ranges,
unsigned int *  numRanges,
float *  intensities,
unsigned int *  numIntensities 
)

Get readings from Robotino's rangefinder. Do not forget to call LaserRangeFinder_grab first. Get the number of measurements by calling LaserRangeFinder_numMeasurements() first. The following conditions must be met:

  • sizeof(ranges) >= numRangeMeasurements * sizeof(float)
  • sizeof(intensities) >= numIntensityMeasurements * sizeof(float) The easiest way to meet these conditions is to create arrays containing more elements than a rangefinder will provide readings: float range[1000]; float intensities[1000];
    Parameters
    idThe rangefinder id.
    seqThe sequenze number.
    stampTime stamp.
    angle_minMinimum angle in radians.
    angle_maxMaximum angle in radians.
    angle_incrementAngle between two scans in radians.
    time_incrementTime between two scans in s.
    scan_timeTime to scan the field of view in s.
    range_minMinimum range in meters.
    range_maxMaximum range in meters.
    rangesThe range measurements in meters.
    numRangesNumber of range measurements
    intensitiesThe intensity measurements.
    numIntensitiesNumber of intensity measurements
    Returns
    Returns TRUE (1) on success. Returns FALSE (0) if the given LaserRangeFinderId is invalid.
    See also
    LaserRangeFinder_numMeasurements LaserRangeFinder_grab
DLLEXPORT BOOL LaserRangeFinder_grab ( LaserRangeFinderId  id)

Grab image.

Parameters
idThe rangefinder id.
Returns
Returns TRUE (1) if a new sensor readings are available since the last call of LaserRangeFinder_grab. Returns FALSE (0) otherwise.
DLLEXPORT BOOL LaserRangeFinder_numMeasurements ( LaserRangeFinderId  id,
unsigned int *  numRangeMeasurements,
unsigned int *  numIntensityMeasurements 
)

Number of range and intensity measurements aquired by grab.

Parameters
idThe rangefinder id.
numRangeMeasurementsNumber of range measurements.
numIntensityMeasurementsNumber of intensity measurements.
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given LaserRangeFinderId is invalid or if no readings have been grabed up to this point in time.
DLLEXPORT BOOL LaserRangeFinder_setComId ( LaserRangeFinderId  id,
ComId  comId 
)

Associated an LaserRangeFinder object with a communication interface, i.e. binding the LaserRangeFinder to a specific Robotino

Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given LaserRangeFinderId is invalid.