Klamp't  0.9.0
4 #include "JointTrackingController.h"
5 #include <Klampt/Modeling/DynamicPath.h>
6 #include <KrisLibrary/spline/PiecewisePolynomial.h>
7 #include <list>
9 namespace Klampt {
39 {
40 public:
42  virtual ~PolynomialMotionQueue() {}
45  void SetLimits(const RobotModel& robot);
47  void SetConstant(const Config& x);
49  void SetPath(const Spline::PiecewisePolynomialND& path);
51  void SetPath(const ParabolicRamp::DynamicPath& path);
54  void SetPiecewiseLinear(const vector<Config>& milestones,const vector<Real>& times);
57  void SetPiecewiseCubic(const vector<Config>& milestones,const vector<Vector>& velocities,const vector<Real>& times);
61  void SetPiecewiseLinearRamp(const vector<Config>& milestones);
63  void Advance(Real dt);
67  void Append(const Spline::PiecewisePolynomialND& path);
69  void Append(const ParabolicRamp::DynamicPath& path);
72  void AppendLinear(const Config& config,Real dt);
75  void AppendCubic(const Config& x,const Config& v,Real dt);
77  void AppendRamp(const Config& x);
80  void AppendLinearRamp(const Config& x);
83  void AppendRamp(const Config& x,const Vector& v);
85  void GetPath(Spline::PiecewisePolynomialND& path) const;
88  void Cut(Real time,bool relative=true);
90  Real CurTime() const;
92  Config CurConfig() const;
94  Config CurVelocity() const;
96  Config Endpoint() const;
98  Vector EndpointVelocity() const;
101  void Eval(Real time,Config& x,bool relative=true) const;
104  void Deriv(Real time,Config& dx,bool relative=true) const;
106  bool Done() const;
108  Real TimeRemaining() const;
110  Real pathOffset;
111  Spline::PiecewisePolynomialND path;
115  Vector qMin,qMax,velMax,accMax;
116 };
125 {
126  public:
128  virtual ~PolynomialPathController() {}
130  virtual const char* Type() const { return "PolynomialPathController"; }
131  virtual void GetDesiredState(Config& q_des,Vector& dq_des);
132  virtual void Update(Real dt);
133  virtual void Reset();
134  virtual bool ReadState(File& f);
135  virtual bool WriteState(File& f) const;
137  //commands
138  virtual vector<string> Commands() const;
139  virtual bool SendCommand(const string& name,const string& str);
140 };
142 } //namespace Klampt
144 #endif
Vector qMin
Definition: PathController.h:115
A motion queue that runs on a piecewise polynomial path. Can be commanded to reach configurations (wi...
Definition: PathController.h:38
void AppendLinearRamp(const Config &x)
void Deriv(Real time, Config &dx, bool relative=true) const
Config CurConfig() const
Returns the configuration at the current time y(t0)
A controller base class that reads out a desired servo position and velocity using the method GetDesi...
Definition: JointTrackingController.h:11
void SetPiecewiseLinear(const vector< Config > &milestones, const vector< Real > &times)
A bounded-velocity, bounded-acceleration trajectory consisting of parabolic ramps.
Definition: DynamicPath.h:114
A controller that uses a piecewise polynomial trajectory.
Definition: PathController.h:124
Config CurVelocity() const
Returns the velocity at the current time y&#39;(t0)
void SetPiecewiseLinearRamp(const vector< Config > &milestones)
Vector EndpointVelocity() const
Returns the velocity at the end time y&#39;(t0+T)
void Cut(Real time, bool relative=true)
void AppendCubic(const Config &x, const Config &v, Real dt)
void Advance(Real dt)
Moves forward the internal time marker.
void AppendRamp(const Config &x)
Appends a time-optimal ramp from the end configuration/velocity to x.
Config Endpoint() const
Returns the configuration at the end time y(t0+T)
bool Done() const
Returns true if there is no more trajectory to be executed.
void SetPiecewiseCubic(const vector< Config > &milestones, const vector< Vector > &velocities, const vector< Real > &times)
The main robot type used in RobotSim.
Definition: Robot.h:83
void AppendLinear(const Config &config, Real dt)
void Append(const Spline::PiecewisePolynomialND &path)
void Eval(Real time, Config &x, bool relative=true) const
Real TimeRemaining() const
Returns the duration of the trajectory remaining to be executed.
void SetConstant(const Config &x)
Sets a constant trajectory.
Real CurTime() const
Returns the current time t0.
void GetPath(Spline::PiecewisePolynomialND &path) const
Retrieves the path, defined on the range [t0,t0+T].
void SetLimits(const RobotModel &robot)
void SetPath(const Spline::PiecewisePolynomialND &path)
Sets the trajectory from a PiecewisePolynomialND.
Definition: ContactDistance.h:6