Klamp't  0.8.1
RampCSpace.h
1 #ifndef RAMP_CSPACE_H
2 #define RAMP_CSPACE_H
3 
5 #include <Klampt/Modeling/DynamicPath.h>
6 #include <KrisLibrary/planning/CSpace.h>
7 #include <KrisLibrary/planning/EdgePlanner.h>
8 #include <KrisLibrary/planning/KinodynamicSpace.h>
9 
16 class RampCSpaceAdaptor : public CSpace
17 {
18 public:
19  RampCSpaceAdaptor(CSpace* cspace,const Vector& velMax,const Vector& accMax);
20  virtual int NumDimensions() const;
21  virtual bool IsFeasible(const State& s);
22  virtual void Sample(State& s);
23  virtual EdgePlannerPtr LocalPlanner(const State& a,const State& b);
24  virtual Real Distance(const State& x, const State& y);
25  virtual void Interpolate(const State& x,const State& y,Real u,State& out);
26  virtual void Properties(PropertyMap& props) const;
27  bool IsFeasible(const Config& q,const Config& dq);
28 
29  CSpace* cspace;
30  std::vector<Real> qMin,qMax;
31  std::vector<Real> velMax,accMax;
32  Real visibilityTolerance;
33 };
34 
35 class RampInterpolator: public Interpolator
36 {
37 public:
39  virtual const Config& Start() const;
40  virtual const Config& End() const;
41  virtual CSpace* Space() const;
42  virtual void Eval(Real u,Config& x) const;
43  virtual Real Length() const;
44 
46 };
47 
48 class RampPathInterpolator: public Interpolator
49 {
50 public:
52  virtual const Config& Start() const;
53  virtual const Config& End() const;
54  virtual CSpace* Space() const;
55  virtual void Eval(Real u,Config& x) const;
56  virtual Real Length() const;
57 
59 };
60 
62 class RampEdgeChecker : public EdgePlanner
63 {
64 public:
65  RampEdgeChecker(RampCSpaceAdaptor* _space,const State& a,const State& b);
68  virtual ~RampEdgeChecker() {}
69  virtual bool IsVisible();
70  virtual void Eval(Real u,Config& x) const;
71  virtual Real Length() const;
72  virtual const Config& Start() const { return start; }
73  virtual const Config& End() const { return goal; }
74  virtual CSpace* Space() const { return space; }
75  virtual EdgePlannerPtr Copy() const;
76  virtual EdgePlannerPtr ReverseCopy() const;
77  Real Duration() const;
78  bool IsValid() const;
79 
80  RampCSpaceAdaptor* space;
82  State start,goal;
83  int checked;
84 };
85 
88 {
89 public:
90  CSpaceFeasibilityChecker(CSpace* _space) : space(_space) {}
91  virtual bool ConfigFeasible(const ParabolicRamp::Vector& x) { return space->IsFeasible(x); }
92  virtual bool SegmentFeasible(const ParabolicRamp::Vector& a,const ParabolicRamp::Vector& b) {
93  EdgePlannerPtr e=IsVisible(space,a,b);
94  if(e) return true;
95  else return false;
96  }
97  CSpace* space;
98 };
99 
100 
101 #endif //RAMP_CSPACE_H
adapter for the ParabolicRamp feasibility checking routines
Definition: RampCSpace.h:87
Edge planner class for the RampCSpaceAdaptor.
Definition: RampCSpace.h:62
Solves for optimal trajectores for a velocity-bounded ND system.
Definition: ParabolicRamp.h:110
A CSpace where configurations are given by (q,dq) config, velocity pairs. Local paths are time-optima...
Definition: RampCSpace.h:16
A bounded-velocity, bounded-acceleration trajectory consisting of parabolic ramps.
Definition: DynamicPath.h:114
Definition: RampCSpace.h:48
A base class for a feasibility checker.
Definition: DynamicPath.h:41
Functions for optimal acceleration-bounded trajectories.
Definition: RampCSpace.h:35