#include <HokuyoURG.h>
Public Member Functions | |
HokuyoURG (int=1, int=19200, int=44, int=725, int=3, bool=true) | |
bool | scan (void) |
perform a scan within the specified range of angles and resolution | |
bool | scanSnd (void) |
snd request for a scan | |
bool | scanRcv (void) |
rcv and parse results from a scan | |
unsigned int | getRangeByEl (const int &) |
get the given range reading | |
unsigned int | getRangeByBearing (const float &) |
get the range at the given bearing | |
int | getNumRangeVals (void) |
get the number of range values to be returned. this corresponds to the number of relevant elements in dist | |
bool | isLastScanSuccess (void) |
returns boolean indicating success (or not) of last scan | |
float | stepToAngUnits (int steps) |
convert step units to to angle units (deg) | |
float | stepnumToBearing (float step) |
convert step to angle (deg) | |
float | indexToStepnum (int index) |
returns the middle step in the cluster (may be between clusters) | |
float | indexToBearing (int index) |
convert the index of the array dist[] to an angle (deg) of the range scan | |
float | bearingToStepnum (float ang) |
convert a bearing (deg) to corresponding step num | |
float | angToStepUnits (float ang) |
convert angle units (deg) to step units | |
float | bearingToIndex (float bearing) |
convert the index of the array dist[] to a bearing (deg) of the range scan | |
bool | calcForceVector (void) |
calculate the force vector experienced by the robot using the current scan data i.e. the repellance from objects | |
bool | getForceVec (Crd< float > *) |
conduct a scan and then calculate force vector | |
void | setupCones (const int &num) |
NOT IMPLEMENTED YET: divide space into 'num' cones, no space between cones. | |
bool | setupCones (const int &num, const float &wd) |
divide space into 'num' cones, 'angWd' radians wide each | |
void | setupCones (const std::vector< float > &vAngs) |
NOT IMPLEMENTED YET: divide space into cones centred at angles in 'vAngs', no space between cones. | |
void | setupCones (const std::vector< float > &vAngs, const float &angWd) |
NOT IMPLEMENTED YET: divide space into cones centred at angles in 'vAngs', 'angWd' radians wide each. | |
int | getClosestRange (const int &) |
get the closest range within cone | |
float | getAvgRange (const int &) |
get the average range within cone | |
Public Attributes | |
Crd< float > | fvec |
maximum of 769 | |
CrdP< float > | fvecP |
force vector | |
Static Public Attributes | |
const int | rawMAX_gr = 4000 |
maximum 255 -> corresponds to 4000mm (for fvec) |
The laser scans in the acw direction, from -135 degrees, to 135 degrees,
Where straight ahead is 0 degrees.
The range values are set in the public int array dist[]
( maximum element given by getNumRangeVals() )
The main functions to be used are:
General
----------------------
scan() : to perform a scan (this has a 50ms sleep)
scanSnd() and scanRcv() : if you want the sleep to be external
getNumRangeVals() : to get the maximum number of range values returned
indexToBearing() : to convert the range reading index into an angle
isLastScanSuccess() : to find out if the last scan was a success
There are other conversion functions for conversions between array index, laser scan step, and bearing.
The raw values are in (mm).
Force Vector Functions
----------------------
calcForceVector() : to calculate the force vector from the previous scan
getForceVec() : to scan and calculate force vector
Cone Functions
----------------------
The laser scan can be divided into conic segments using the setupCones() functions.
Then it is possible to obtain the closest or average range in a cone using: getClosestRange() and getAvgRange()
|
initialise data structures and serial communications
|
|
calculate the force vector experienced by the robot using the current scan data i.e. the repellance from objects
|
|
conduct a scan and then calculate force vector
|
|
get the range at the given bearing there may be approximations if this is used. there may not be a range value for this bearing exactly |
|
get the given range reading warning: not protected by mutex. assume that the functions that call this take responsibility. |
|
perform a scan within the specified range of angles and resolution Sets an internal boolean to indicate success.
|
|
rcv and parse results from a scan Sets an internal boolean to indicate success.
|
|
snd request for a scan
|
|
divide space into 'num' cones, 'angWd' radians wide each divide space into 'nCone' cones, 'angWd' degs wide each centred on 0 degrees (straigth ahead) if there is an uneven number of steps over the total arc, extra one at the end |