KrisLibrary  1.0.0
planning/Path.h
1 #ifndef MILESTONE_PATH_H
2 #define MILESTONE_PATH_H
3 
4 #include "CSpace.h"
5 #include "EdgePlanner.h"
6 #include <list>
7 
8 //forward declaration
10 
19 {
20 public:
21  MilestonePath();
22  ~MilestonePath();
23 
24  virtual void Eval(Real u,Config& q) const { Eval2(u,q); }
25  virtual Real Length() const;
26  virtual const Config& Start() const { return edges.front()->Start(); }
27  virtual const Config& End() const { return edges.back()->End(); }
28 
29  const Config& GetMilestone(int milestone) const;
30  void SetMilestone(int milestone,const Config& x);
33  bool CheckSetMilestone(int milestone,const Config& x);
34  inline CSpace* Space(int i=0) const { assert(!edges.empty()); return edges[i]->Space(); }
35  inline int NumMilestones() const { return (int)edges.size()+1; }
36  inline int NumEdges() const { return (int)edges.size(); }
37  bool IsValid();
39  void Concat(const MilestonePath& path);
41  void CreateEdgesFromMilestones(CSpace* space,const std::vector<Config>& milestones);
43  bool InitializeEdgePlans();
45  bool IsFeasible();
49  int Eval2(Real t, Config& c) const;
52  int Shortcut();
55  int Shortcut(ObjectiveFunctionalBase* objective);
58  int Reduce(int numIters);
61  int Reduce(int numIters,ObjectiveFunctionalBase* objective);
65  void Splice(int start,int goal,const MilestonePath& path);
68  void Discretize(Real h);
70  int DiscretizeEdge(int e,Real h);
72  void DiscretizeEdge(int e,const std::vector<Real>& u);
74  bool Load(std::istream& in,CSpace* space);
76  bool Save(std::ostream& out);
77 
78  std::vector<EdgePlannerPtr> edges;
79 };
80 
81 #endif
bool IsFeasible()
Checks the feasibility of all milestones and edges, returns true if so.
Definition: Path.cpp:41
void CreateEdgesFromMilestones(CSpace *space, const std::vector< Config > &milestones)
Create the path that connects the milestones in the given workspace.
Definition: Path.cpp:32
Vector Config
an alias for Vector
Definition: RobotKinematics3D.h:14
Motion planning configuration space base class. The configuration space implements an interpolation s...
Definition: CSpace.h:39
void Discretize(Real h)
Definition: Path.cpp:202
void Concat(const MilestonePath &path)
Adds the path onto the end of this one.
Definition: Path.cpp:15
A sequence of locally planned paths between milestones.
Definition: planning/Path.h:18
void Splice(int start, int goal, const MilestonePath &path)
Definition: Path.cpp:350
A base class for all 1D interpolators.
Definition: Interpolator.h:10
bool Save(std::ostream &out)
Saves the intermediate milestones.
Definition: Path.cpp:378
bool CheckSetMilestone(int milestone, const Config &x)
Definition: Path.cpp:317
int DiscretizeEdge(int e, Real h)
Discretizes only the given edge. Returns the number of new segments.
Definition: Path.cpp:210
int Eval2(Real t, Config &c) const
Definition: Path.cpp:56
int Shortcut()
Definition: Path.cpp:70
bool InitializeEdgePlans()
Checks the feasibility of all edges, returns true if they all succeed.
Definition: Path.cpp:23
bool Load(std::istream &in, CSpace *space)
Loads the intermediate milestones, and creates the edges from the given space.
Definition: Path.cpp:360
int Reduce(int numIters)
Definition: Path.cpp:117
A base class for objective functionals of the form J[x,u] = sum_0^N-1 L(xi,ui) dt + Phi(xN) ...
Definition: Objective.h:18