Functions | |
void | sfGradInit (void) |
Initializes the gradient. More... | |
void | sfGradInitRes (int res, int turnRadius) |
Initializes the gradient,. More... | |
void | sfGradSetMap (void *p) |
Sets the map with an mcObject. More... | |
void | sfGradUseArtifacts (int useArtifacts) |
Whether the gradient module should use artifacts (.wld files). | |
void | sfGradUseMap (int useMap) |
Whether the gradient module should use grid maps (.map files). | |
void | sfGradUseSonar (int useSonar) |
Whether the gradient module should use sonar data. | |
void | sfGradUseLaser (int useLaser) |
Whether the gradient module should use laser data. | |
void | sfGradSetGoal (float x, float y) |
Sets the Gradient goal to this global point (in mm). The goal can be changed at any time. | |
void | sfGradSetSpeed (int high, int mid, int back) |
Sets the speed the robot travels at. More... | |
void | sfGradDoGoal (int which) |
Whether the robot should be going to a goal or not. | |
void | sfGradStop (void) |
Stops the robot going to goal and stops the robot. | |
int | sfGradStatus (void) |
Gets the status of the gradient module. More... | |
int | sfGradIsActive (void) |
Gets if the gradient module is active or not. | |
void | sfGradObsParams (int keepout, int decay) |
Resets keep-out distance and decay distance; in mm. More... | |
void | sfGradSetDone (int close, int done) |
Set how close we need to be to a goal to slow done or be done. More... | |
int | sfGradGetCanBack (void) |
Gets if the grad action can back up, 0 = no, 1 = when appropriate, 2 = always. More... | |
void | sfGradSetCanBack (int canBack) |
Gets if the grad action can back up, 0 = no, 1 = when appropriate, 2 = always. More... | |
void | sfGradSetTurnRadius (int turnRadius) |
Sets the turn radius needed to let it turn instead of back, make it back with sfGradSetCanBack. More... | |
int | sfGradGetTurnRadius (void) |
Gets the turn radius needed to let it turn instead of back, make sure it is allowed to back up with with sfGradGetCanBack. More... | |
void | sfGradSetAcc (int acc) |
Sets the acceleration used in driving the robot. | |
void | sfGradSetPnum (int n) |
Set number of propagations, mostly for show. | |
void | sfGradSetMax (int width, int height) |
Sets the size of the gradient window. More... | |
void | sfGradUseFinalApproach (int which) |
Use the final approach action or not. | |
void | sfGradSetFinalApproachSpeed (int speed) |
Sets the final approach speed. | |
int | sfGradGetFinalApproachSpeed (void) |
Gets the final approach speed. |
Gradient Path Planning is a process for determining optimal paths for the robot, in real time. These paths can take into account both local obstacles, sensed by sonars and/or laser range-finder devices; and global map information such as the location of walls and other structural obstacles. At each sync cycle (100 ms), the Gradient module calculates the lowest-cost path from a goal point or set of goal points to the robot. The algorithm starts by considering a local neighborhood connecting the robot and the goal or goals, and then expands its search if no path is found. There is a user-settable limit on the size of the neighborhood considered.
Gradient uses a square-cell grid as a cost field for determining good paths. You can set the grid resolution; a typical resolution is 10 mm. The maximum size of the grid can also be set.
Costs are calculated from a set of obstacles, obtained from pre-existing maps and from local sensor readings. Here are the obstacles sources:
1. Artifacts in a world map. Load a world map, and call sfGradUseArtifacts(true).
2. A grid map created from the laser navigation software. A grid map is typically loaded into the localization system using mcLoadScanMap(). To access this map from the gradient module, use sfGradSetMap(mcGetObject()). Finally, turn on grid map use by calling sfGradUseMap(true).
Grid maps and world maps may both be used at the same time.
3. Laser and sonar readings. These can be turned on and off with sfGradUseLaser() and sfGradUseSonar().
The cost field radiates outward from obstacles, to create a safety cushion for the robot. You can adjust this cushion using sfGradObsParams().
There is a local controllers, implemented as an action (SfGradAction), that drives the robot along the gradient path. This action controls the speed of the robot in a parameterized fashion, and can be set with sfGradSetSpeed. A further refinement for rectangular robots is the ability to back up when appropriate; this behavior is controlled by sfGradSetCanBack and sfGradSetTurnRadius. If the robot needs to turn more than 45 degrees to follow the path, it will see if its turn radius is clear. If it isn't, it will try to back up if possible, and turn around when it is clear of obstacles.
Some relevant samples Colbert load files: flgrad.act - basic gradient, without localization for localization with respect to a world, look at flloc.act scan.act - localization and gradient using a grid map (from the Laser Localization/Navigation module).
You can also use the gradient for a final approach to a given position, to do this call sfGradUseFinalApproach... you will also want to adjust the gradient obstacle parameters with sfGradObsParams and the done distance with sfGradSetDone (the close dist is ignored for the final approach). You may want to set the speed with sfGradSetFinalApproachSpeed.
|
Gets if the grad action can back up, 0 = no, 1 = when appropriate, 2 = always.
|
|
Gets the turn radius needed to let it turn instead of back, make sure it is allowed to back up with with sfGradGetCanBack.
|
|
Initializes the gradient. Initializes the Gradient module. Should be called right after loading the Gradient library. |
|
Initializes the gradient,.
|
|
Resets keep-out distance and decay distance; in mm. This sets the distance away from obstacles the gradient algorithm will stay. (These set fcost and fdecay on my_grad, see the header file for SfGrad.h and class SfGradGrid for the information about this in C++).
|
|
Gets if the grad action can back up, 0 = no, 1 = when appropriate, 2 = always.
|
|
Set how close we need to be to a goal to slow done or be done.
|
|
Sets the map with an mcObject. Sets the grid map that the gradient will use. Typically the map is taken from the localization module using a call to mcGetObject(), so that the gradient will use the same map that localization is. NOTE: The resolution of the map must be the same as that of the gradient routines (sfGradInit call). |
|
Sets the size of the gradient window. Sets the maximum size (in mm) of the neighborhood considered by the Gradient module. The neighborhood will expand until it reaches this size, in searching for a valid path.
|
|
Sets the speed the robot travels at. Sets the speed the gradient module will use for different circumstances.
|
|
Sets the turn radius needed to let it turn instead of back, make it back with sfGradSetCanBack.
|
|
Gets the status of the gradient module.
|