Klamp't  0.9.0
RealTimeRRTPlanner.h
1 #ifndef REAL_TIME_RRT_PLANNER_H
2 #define REAL_TIME_RRT_PLANNER_H
3 
4 #include "RealTimePlanner.h"
5 #include <KrisLibrary/planning/MotionPlanner.h>
6 
7 namespace Klampt {
8 
12 {
13 public:
15  virtual ~DynamicRRTPlanner() { }
16  virtual void SetGoal(shared_ptr<PlannerObjectiveBase> newgoal);
17  Vector& MakeState(const Config& q,const Config& dq);
18  Vector& MakeState(const Config& q);
19  RRTPlanner::Node* TryIKExtend(RRTPlanner::Node* node,bool search=true);
20 
21  //perform lazy collision checking of the path up to n
22  //ndelete allows you to check if any nodes are deleted
23  //pass in nodes to check, they will be set to NULL if they lie in the
24  //deleted subtree
25  bool CheckPath(RRTPlanner::Node* n,vector<RRTPlanner::Node*>& ndelete,Timer& timer,Real cutoff);
26  virtual int PlanFrom(ParabolicRamp::DynamicPath& path,Real cutoff);
27  Real EvaluateNodePathCost(RRTPlanner::Node* n);
28 
29  //settings
30  shared_ptr<RampCSpaceAdaptor> stateSpace;
31  Real delta;
32  Real smoothTime;
33  Real ikSolveProbability;
34 
35  //temporary state
36  int iteration;
37  shared_ptr<RRTPlanner> rrt;
38  vector<RRTPlanner::Node*> existingNodes;
39  Vector tempV;
40 };
41 
47 {
48 public:
49  struct NodeData
50  {
51  Real t;
52  Config q,dq;
53 
54  bool reachable;
55  int depth;
56  Real sumPathCost,terminalCost,totalCost;
57  };
58  struct EdgeData
59  {
60  Real cost;
61  shared_ptr<RampEdgeChecker> e;
62  };
63  typedef Graph::TreeNode<NodeData,EdgeData> Node;
64 
66  virtual ~DynamicHybridTreePlanner() { }
67  virtual void SetGoal(shared_ptr<PlannerObjectiveBase> newgoal);
68  Node* AddChild(Node* node,const Config& q);
69  Node* AddChild(Node* node,const ParabolicRamp::ParabolicRampND& ramp);
70  Node* AddChild(Node* node,const ParabolicRamp::DynamicPath& path);
71  Node* AddChild(Node* node,shared_ptr<RampEdgeChecker>& e);
72  //uses a local optimization to extend the tree from the given node.
73  //if search is true, finds a parent node that gives a good fit, otherwise
74  //adds the ik extension as a child of node.
75  Node* TryIKExtend(Node* node,bool search=true);
76  //finds the closest node to q (within the costBranch level set)
77  Node* Closest(const Config& q,Real costBranch=Inf);
78  //extends the tree towards q (within the costBranch level set)
79  Node* ExtendToward(const Config& q,Real costBranch=Inf);
80  //splits an edge p->n in the tree at interpolant u
81  Node* SplitEdge(Node* p,Node* n,Real u);
82 
83  //perform lazy collision checking of the path up to n
84  //split can be set to a pointer to retrieve the last reachable
85  //node.
86  bool CheckPath(Node* n,Timer& timer,Real cutoff,Node** split=NULL);
87  virtual int PlanFrom(ParabolicRamp::DynamicPath& path,Real cutoff);
88 
89  //settings
90  unique_ptr<RampCSpaceAdaptor> stateSpace;
91  Real delta;
92  Real smoothTime;
93  Real ikSolveProbability;
94 
95  //temporary state
96  int iteration;
97  unique_ptr<Node> root;
98  vector<Node*> nodes;
99 };
100 
101 } //namespace Klampt
102 
103 #endif
Dynamic RRT planner – not recently tested.
Definition: RealTimeRRTPlanner.h:11
A base class for a motion planner that generates dynamic paths. The output should always respect join...
Definition: RealTimePlanner.h:26
Solves for optimal trajectores for a velocity-bounded ND system.
Definition: ParabolicRamp.h:110
A bounded-velocity, bounded-acceleration trajectory consisting of parabolic ramps.
Definition: DynamicPath.h:114
virtual int PlanFrom(ParabolicRamp::DynamicPath &path, Real cutoff)
Definition: RealTimeRRTPlanner.h:58
The preferred dynamic sampling-based planner for realtime planning. Will alternate sampling-based pla...
Definition: RealTimeRRTPlanner.h:46
Definition: RealTimeRRTPlanner.h:49
Definition: ContactDistance.h:6