Klamp't  0.9.0
Public Member Functions | Public Attributes | List of all members
Klampt::RealTimePlanningThread Class Reference

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.
PlannerObjectiveBaseGetObjective () 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< RealTimePlannerplanner
Thread thread

Detailed Description

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()

Member Function Documentation

PlannerObjectiveBase* Klampt::RealTimePlanningThread::GetObjective ( ) const

Gets the objective function. (You must not delete the pointer or assign it to a shared_ptr)

Real Klampt::RealTimePlanningThread::ObjectiveValue ( )

Returns the objective function value of the current trajectory update

void Klampt::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 Klampt::RealTimePlanningThread::Start ( )

Starts planning. Returns false if there was some problem, e.g., the Initial config was not set.

The documentation for this class was generated from the following file: