CasPathPlanner
From CAS-Robotics
Contents |
About CasPathPlanner
This is a simple library that can be used for path planning in narrow and cluttered environments. It uses an efficient sampling technique to construct a search space that can be used for finding a path using AStar algorithm. A simplified collision detection method is also also used that is based on expanding the obstacles with a suitable radius that can still allow the robot to pass through the narrowest passage. The current version is still the first release and even though it works well in generating paths and is stable you can still expect some bugs so please report any bugs you can find.
Compilation
Just download the Library from here. Extract it and then compile it using:
make all make test make install
The first make will generate the library file called libPathPlanner.so that you can use to link to your program. The second make will compile an example program that uses this library, and a Konsole utility that you can use as described in the "Command Line Usage" section below. Make install will copy the library file into the /usr/local/lib and copy the include files to /usr/local/include/pathplanner.
Linking to the Library
In order to link the library to your code, you will have to :
- Specify the location of the Library's header files by adding the /usr/local/include/pathplanner to your includes.
- Add the location of libPathPlanner.so (/usr/local/lib)to the LD_LIBRARY_PATH environment variable or explicitly specify the location of the file while compiling it using g++.
g++ -I/usr/local/include/pathplanner `pkg-config --libs --cflags gtk+-2.0 ` test/test.cpp -o plannerTest -L/usr/local/lib -lPathPlanner
Command Line Usage
usage: ./pathPlanner --argument <type> --h or --help shows this usage help --c or --configFile <fileName> reads the configuration parameters from the file --m or --map <fileName> Specifies the map filename to be used --n or --negateColor <bool> if false then white color is free, if true then white color is occupied --r or --mapResolution <float> Specifies the map pixel resolution to be used --nP or --narrowestPassage <float> Specifies the narrowest passage in the map --rC or --robotCenter <float float> Specifies the robot's Center of Rotation in respect to the center of Area --rH or --robotHeight <float> Specifies the robot's Height --rW or --robotWidth <float> Specifies the robot's Width --dG or --distanceToGoal <float> Specifies the distance to the goal to end the search --bL or --bridgeLength <float> Specifies the length of the bridge test. --bR or --bridgeResolution <float> Specifies the resolution of the bridge test sampling. --bC or --bridgeConnectionRadius <float> Specifies the distance for connecting bridge samples. --gC or --regularGridConnectionRadius <float> Specifies the distance for connecting regular grid samples. --gR or --regularGridResolution <float> Specifies the resolution for regular grid sampling. --oP or --obstaclePenalty <float> Specifies the distance to obstacle to start penalizing. --s or --start <float float float> Specifies the X Y and Phi start Pose --e or --end <float float float> Specifies the X Y and Phi end Pose Examples: ./pathPlanner --map casarea.png --r 0.05 --s 5.721 -4.324 180 --e -6.5 6.5 180 --n 0 --rC -0.3 0 --rW 0.5 --rH 0.9 --nP 1 ./pathPlanner --configFile src/planner.config
Usage Example
#include "pathplanner.h"
using namespace CasPlanner;
int main( int argc, char ** argv )
{
bool negate = false;
Pose start(5.721,-4.324,DTOR(180)),end(-9.5,-4.3,DTOR(180));
double robotH=0.9,robotW=0.5,narrowestPath=0.987,mapRes= 0.05;
double distanceToGoal = 0.4,bridgeLen=2.5,bridgeRes=0.1,regGridLen=0.2,regGridConRad=0.4,obstPenalty=3.0,bridgeConRad=0.5;
Point robotCenter(-0.3f,0.0f);
Robot *robot= new Robot(string("Robot"),robotH,robotW,narrowestPath,robotCenter);
Map *map = new Map("include/casarea.png",mapRes,negate);
PathPlanner * pathPlanner = new PathPlanner(robot,map,distanceToGoal,bridgeLen,bridgeRes,regGridLen,regGridConRad,obstPenalty,bridgeConRad);
pathPlanner->enableBridgeTest(true);
pathPlanner->enableRegGrid(true);
pathPlanner->enableObstPen(true);
pathPlanner->enableExpObst(true);
/*
* Search Space generation, Please note that you will need
* to generate only one search space for each map. After
* the Search Space generation you can search for as many paths
* as you want.
*/
pathPlanner->generateSpace();
pathPlanner->printNodeList();
pathPlanner->findPath(start,end,METRIC);
/*
* Draws the Search Space and the Path into the map image and saves
* them into two different images ending with _searchSpace.png and
* _path.png
*/
pathPlanner->drawSearchSpace();
pathPlanner->drawPath();
delete robot;
delete map;
delete pathPlanner;
return 1;
}
