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.
|
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) |
|
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.
#define INVALID_LASERRANGEFINDERID -1 |
Invalid LaserRangeFinderId is -1
Construct an LaserRangeFinder object
- Returns
- Returns the ID of the newly constructed LaserRangeFinder object.
Destroy the LaserRangeFinder object assigned to id
- Parameters
-
id | The 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
-
id | The rangefinder id. |
seq | The sequenze number. |
stamp | Time stamp. |
angle_min | Minimum angle in radians. |
angle_max | Maximum angle in radians. |
angle_increment | Angle between two scans in radians. |
time_increment | Time between two scans in s. |
scan_time | Time to scan the field of view in s. |
range_min | Minimum range in meters. |
range_max | Maximum range in meters. |
ranges | The range measurements in meters. |
numRanges | Number of range measurements |
intensities | The intensity measurements. |
numIntensities | Number of intensity measurements |
- Returns
- Returns TRUE (1) on success. Returns FALSE (0) if the given LaserRangeFinderId is invalid.
- See also
- LaserRangeFinder_numMeasurements LaserRangeFinder_grab
Grab image.
- Parameters
-
- 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
-
id | The rangefinder id. |
numRangeMeasurements | Number of range measurements. |
numIntensityMeasurements | Number 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.
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.