Klamp't
0.8.1
|
An interface to a planning thread. More...
#include <RealTimePlanner.h>
Public Member Functions | |
void | SetStartConfig (const Config &qstart) |
Initializes the planning thread with a start configuration. | |
void | SetCSpace (SingleRobotCSpace *space) |
Initializes the planning thread with a CSpace. | |
void | SetPlanner (const shared_ptr< DynamicMotionPlannerBase > &planner) |
Sets the planner. | |
void | SetPlanner (const shared_ptr< RealTimePlanner > &planner) |
void | SetObjective (shared_ptr< PlannerObjectiveBase > newgoal) |
Set the objective function. | |
PlannerObjectiveBase * | GetObjective () const |
void | ResetCurrentPath (Real tglobal, const ParabolicRamp::DynamicPath &path) |
bool | Start () |
void | Stop () |
Stops the planning thread. | |
bool | IsPlanning () |
Returns true if a planning cycle is happening. | |
void | PausePlanning () |
Pauses planning after the current planning cycle. | |
void | BreakPlanning () |
Breaks an internal planning cycle on the existing objective. | |
void | StopPlanning () |
Stops planning. Equivalent to break and pause. | |
void | ResumePlanning () |
Resumes planning after a pause or stop. | |
bool | HasUpdate () |
Returns true if a trajectory update is available. | |
bool | SendUpdate (MotionQueueInterface *interface) |
Send the trajectory update, if one exists. | |
Real | ObjectiveValue () |
Public Attributes | |
void * | internal |
shared_ptr< RealTimePlanner > | planner |
Thread | thread |
An interface to a planning thread.
All methods are thread-safe and meant to be called by the execution thread.
Example code is as follows:
MotionQueueInterface* queue = new MyMotionQueueInterface(robot);
RealTimePlanningThread thread; thread.SetPlanner(planner) thread.SetStartConfig(qstart); thread.Start(); while(want to continue planning) { if(newObjectiveAvailable()) { thread.BreakPlanning(); //optional, if this is not called the //planner will finish an internal planning //cycle on the old objective thread.SetObjective(getObjective()); //change the cspace or planner here if needed } if(thread.SendUpdate(queue)) { printf("Planner had an update\n") } ///advance the motion queue and do whatever else you need to do here... } thread.Stop()
PlannerObjectiveBase* RealTimePlanningThread::GetObjective | ( | ) | const |
Gets the objective function. (You must not delete the pointer or assign it to a shared_ptr)
Real RealTimePlanningThread::ObjectiveValue | ( | ) |
Returns the objective function value of the current trajectory update
void RealTimePlanningThread::ResetCurrentPath | ( | Real | tglobal, |
const ParabolicRamp::DynamicPath & | path | ||
) |
If the robot's path has changed for a reason outside of the planner's control, call this
bool RealTimePlanningThread::Start | ( | ) |
Starts planning. Returns false if there was some problem, e.g., the Initial config was not set.