BasicControllers.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2017
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <cmath>
26 #include <type_traits>
27 
29 
32 // #define DEBUG_POS_CTRL
33 #ifdef DEBUG_POS_CTRL
34 #include <boost/circular_buffer.hpp>
35 #endif
36 
37 
38 namespace armarx
39 {
41  T
42  periodicClamp(T value, T periodLo, T periodHi)
43  {
44  float dist = periodHi - periodLo;
45  return std::fmod(value - periodLo + dist, dist) + periodLo;
46  }
47 
49  std::pair<T, T>
50  pq(T p, T q)
51  {
52  T a = -p / 2;
53  T b = std::sqrt(std::pow(p / 2, 2) - q);
54  return {a + b, a - b};
55  }
56 
57  struct deltas
58  {
59  float dv;
60  float dx;
61  float dt;
62  };
63 
64  inline deltas
65  accelerateToVelocity(float v0, float acc, float vt)
66  {
67  acc = std::abs(acc);
68  deltas d;
69  d.dv = vt - v0;
70  d.dt = std::abs(d.dv / acc);
71  d.dx = sign(d.dv) * d.dv * d.dv / 2.f / acc + v0 * d.dt;
72  return d;
73  }
74 
75  std::array<deltas, 3> trapeze(float v0, float acc, float vMax, float dec, float vt, float dx);
76 
77  inline float
78  trapezeArea(float v0, float vmax, float dt1, float dt2, float dt3)
79  {
80  return (v0 + vmax) / 2 * dt1 + dt2 * vmax + dt3 * vmax * 0.5;
81  }
82 
83  inline void
85  float v0,
86  float vmax,
87  float dec,
88  std::array<deltas, 3> trapeze,
89  float newDt,
90  float& newV,
91  float& newAcc,
92  float& newDec)
93  {
94 
95 
96  float oldDt = trapeze.at(0).dt + trapeze.at(1).dt + trapeze.at(2).dt;
97  float dt0 = trapeze.at(0).dt;
98  float dt1 = trapeze.at(1).dt;
99  float dt2 = trapeze.at(2).dt;
100  float area = trapezeArea(v0, vmax, dt0, dt1, dt2);
101  dt1 += newDt - oldDt;
102  newV = (-dt0 * v0 + 2 * area) / (dt0 + 2 * dt1 + dt2);
103  newAcc = (newV - v0) / dt0;
104  newDec = newV / dt2;
105 
106  if (newV < std::abs(v0))
107  {
108  dt0 = v0 / dec;
109  dt1 = newDt - dt0;
110  deltas d = accelerateToVelocity(v0, dec, 0);
111  newV = (distance - d.dx) / dt1;
112  newAcc = dec;
113  newDec = dec;
114 
115  // // float oldDt = trapeze.at(0).dt + trapeze.at(1).dt + trapeze.at(2).dt;
116  // // dt0 = trapeze.at(0).dt;
117  // // dt1 = trapeze.at(1).dt;
118  // // dt2 = trapeze.at(2).dt;
119  // // area = trapezeArea(v0, newV, dt0, dt1, dt2);
120  // // auto v_pair = pq(dt1*dec, -(area*dec+v0*v0*0.5f));
121  // auto v_pair = pq(-newDt * dec - v0, area * dec - v0 * v0 * 0.5f);
122  // if (std::isfinite(v_pair.first) && std::isfinite(v_pair.second))
123  // {
124  // newV = std::abs(v_pair.first) < std::abs(v_pair.second) ? v_pair.first : v_pair.second;
125  // }
126  // else if (std::isfinite(v_pair.first))
127  // {
128  // newV = v_pair.first;
129  // }
130  // else if (std::isfinite(v_pair.second))
131  // {
132  // newV = v_pair.second;
133  // }
134  // // float f = (v0+newV)/2*((newV-v0)/dec) + dt1*newV + (newV/dec)*newV*0.5;
135  // dt0 = std::abs(newV - v0) / dec;
136  // dt1 = (newDt - std::abs(newV - v0) / dec - (newV / dec));
137  // dt2 = (newV / dec);
138 
139  // float f = (v0 + newV) / 2 * (std::abs(newV - v0) / dec);
140  // f += (newDt - std::abs(newV - v0) / dec - (newV / dec)) * newV;
141  // f += (newV / dec) * newV * 0.5;
142 
143  // newAcc = dec;
144  // newDec = dec;
145  }
146  }
147 
148  std::array<deltas, 3>
149  trapezeWithDt(float v0, float acc, float vMax, float dec, float vt, float dx, float dt);
150 
151  /**
152  * @param v0 The initial velocity.
153  * @param deceleration The deceleration.
154  * @return The braking distance given the parameters.
155  */
156  inline float
157  brakingDistance(float v0, float deceleration)
158  {
159  return accelerateToVelocity(std::abs(v0), std::abs(deceleration), 0).dx;
160  }
161 
162  inline float
163  angleDistance(float angle1, float angle2)
164  {
165  return M_PI - std::fabs(std::fmod(std::fabs(angle1 - angle2), M_PI * 2) - M_PI);
166  }
167 
169  {
170  float dt;
171  float maxDt;
172  float currentV;
173  float targetV;
174  float maxV;
178 
179  bool validParameters() const;
180  float run() const;
181  float estimateTime() const;
182  };
183 
185  {
186 
187  struct Output
188  {
189  double velocity;
190  double acceleration;
191  double jerk;
192  };
193 
194  // config
195  float maxDt;
196  float maxV;
197  float jerk;
199 
200  // state
201  float dt;
202  float currentV;
203  float currentAcc;
204  float targetV;
205 
206 
207  bool validParameters() const;
208  Output run() const;
209  };
210 
211  typedef std::shared_ptr<class RampedAccelerationVelocityControllerConfiguration>
213  typedef std::shared_ptr<const RampedAccelerationVelocityControllerConfiguration>
215 
217  {
218  public:
220 
223  float jerk;
224  float maxDt;
226  };
227 
230  {
231 
235  // double positionLimitLoHard;
236  // double positionLimitHiHard;
237  double deceleration;
238  bool validParameters() const;
239  Output run() const;
240  };
241 
243  float maxDt,
244  const float currentV,
245  float targetV,
246  float maxV,
247  float acceleration,
248  float deceleration,
249  float directSetVLimit);
250 
251  /**
252  * @brief Performs velocity control while staying in positional bounds, obeying acceleration / deceleration and staying below a velocity bound.
253  *
254  * we can have 4 cases:
255  * 1. we need to decelerate now or we will violate the position limits (maybe we still will violate them. e.f. if we already violate them or the robot can't brake fast enough)
256  * 2. we directly set v and ignore acc/dec (if |currentV - targetV| <= directSetVLimit)
257  * 3. we need to accelerate (if currentV and targetV have same sign and |currentV| < |currentV|)
258  * 4. we need to decelerate (other cases)
259  * @param dt The time in seconds until the next call is made. (use the time since the last call as an approximate)
260  * @param maxDt Limits dt in case the given approximation has a sudden high value.
261  * @param currentV
262  * @param targetV
263  * @param maxV
264  * @param acceleration
265  * @param deceleration
266  * @param directSetVLimit In case |currentV - targetV| <= directSetVLimit this function will return targetV (if the position bounds are not violated)
267  * @param currentPosition
268  * @param positionLimitLo
269  * @param positionLimitHi
270  * @return The next velocity.
271  */
274  {
275 
279  // float positionLimitLoHard;
280  // float positionLimitHiHard;
281 
282  bool validParameters() const;
283  float run() const;
284  };
285 
287  float maxDt,
288  float currentV,
289  float targetV,
290  float maxV,
291  float acceleration,
292  float deceleration,
293  float directSetVLimit,
294  float currentPosition,
295  float positionLimitLoSoft,
296  float positionLimitHiSoft,
297  float positionLimitLoHard,
298  float positionLimitHiHard);
299 
301  {
302  float dt;
303  float maxDt;
304  float currentV;
305  float maxV;
310  float pControlPosErrorLimit = 0.01;
312  0.002; // if target is below this threshold, PID controller will be used
313  float accuracy = 0.001;
314  std::shared_ptr<PIDController> pid;
315  // float p;
317  float calculateProportionalGain() const;
318  bool validParameters() const;
319  float run() const;
320  float estimateTime() const;
321 #ifdef DEBUG_POS_CTRL
322  mutable bool PIDModeActive = false;
323 
324  struct HelpStruct
325  {
326  float currentPosition;
327  float targetVelocityPID;
328  float targetVelocityRAMP;
329  float currentV;
330  float currentError;
331  long timestamp;
332  };
333 
334  mutable boost::circular_buffer<HelpStruct> buffer;
335  mutable int eventHappeningCounter = -1;
336 #endif
337 
338  public:
339  bool getCurrentlyPIDActive() const;
340 
341  private:
342  mutable bool currentlyPIDActive = false;
343  };
344 
346  {
347  enum class State
348  {
349  Unknown = -1,
352  Keep,
355  PCtrl
356  };
357 
358  struct Output
359  {
360  double velocity;
361  double acceleration;
362  double jerk;
363  };
364 
365  double dt;
366  double maxDt;
367  double currentV;
368  double currentAcc;
369  double maxV;
370  double acceleration;
371  double deceleration;
372  double jerk;
374 
375  protected:
377 
378  public:
379  double getTargetPosition() const;
380  void setTargetPosition(double value);
381 
382  double pControlPosErrorLimit = 0.01;
384  0.002; // if target is below this threshold, PID controller will be used
385  double accuracy = 0.001;
386  double p;
387  bool usePIDAtEnd = true;
390  bool validParameters() const;
391  Output run();
392  double estimateTime() const;
393  double calculateProportionalGain() const;
394 
395 
396  std::pair<State, Output> calcState() const;
397 #ifdef DEBUG_POS_CTRL
398  mutable bool PIDModeActive = false;
399 
400  struct HelpStruct
401  {
402  double currentPosition;
403  double targetVelocityPID;
404  double targetVelocityRAMP;
405  double currentV;
406  double currentError;
407  long timestamp;
408  };
409 
410  mutable boost::circular_buffer<HelpStruct> buffer;
411  mutable int eventHappeningCounter = -1;
412 #endif
413  };
414 
416  float maxDt,
417  float currentV,
418  float maxV,
419  float acceleration,
420  float deceleration,
421  float currentPosition,
422  float targetPosition,
423  float p);
424 
427  {
430 
431  bool validParameters() const;
432  float run() const;
433  };
434 
436  float maxDt,
437  float currentV,
438  float maxV,
439  float acceleration,
440  float deceleration,
441  float currentPosition,
442  float targetPosition,
443  float p,
444  float positionLimitLo,
445  float positionLimitHi);
446 
449  {
450  // float direction;
453  float run() const;
454  };
455 
457  float dt,
458  float maxDt,
459  float currentV,
460  float maxV,
461  float acceleration,
462  float deceleration,
463  float currentPosition,
464  float targetPosition,
465  float pControlPosErrorLimit,
466  float p,
467  float& direction,
468  float positionPeriodLo,
469  float positionPeriodHi);
470 
472  {
473  public:
474  struct State
475  {
476  double t, s, v, a;
477  };
478 
480  {
481  double t0, s0, v0, a0;
482  };
483 
484  struct Output
485  {
486  double position;
487  double velocity;
488  double acceleration;
489  double jerk;
490  };
491 
492  double dt;
493  double maxDt;
495  double currentV;
496  double currentAcc;
497  double maxV;
499  double desiredJerk;
500  double p = 1.0;
501  double phase2SwitchDistance = 0.1;
502  double phase2SwitchMaxRemainingTime = 0.2; // seconds
503  double p_adjust_ratio = 0.8;
504  // PIDControllerPtr pid;
505  protected:
506  double currentP_Phase3 = -1;
507  double currentP_Phase2 = -1;
509  double finishTime = 0;
510  double currentTime = 0;
511  std::unique_ptr<FixedMinJerkState> fixedMinJerkState;
512 
513  public:
514  void reset();
515  double getTargetPosition() const;
516  void setTargetPosition(double value);
517 
518  Output run();
519  };
520 } // namespace armarx
armarx::MinJerkPositionController::State::v
double v
Definition: BasicControllers.h:476
armarx::PositionThroughVelocityControllerWithAccelerationBounds::acceleration
float acceleration
Definition: BasicControllers.h:306
armarx::PositionThroughVelocityControllerWithAccelerationRamps::estimateTime
double estimateTime() const
Definition: BasicControllers.cpp:1130
armarx::PositionThroughVelocityControllerWithAccelerationRamps::p
double p
Definition: BasicControllers.h:386
GfxTL::sqrt
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
Definition: VectorXD.h:662
armarx::PositionThroughVelocityControllerWithAccelerationBounds::targetPosition
float targetPosition
Definition: BasicControllers.h:309
armarx::VelocityControllerWithRampedAcceleration::Output
Definition: BasicControllers.h:187
armarx::MinJerkPositionController::State::t
double t
Definition: BasicControllers.h:476
armarx::PositionThroughVelocityControllerWithAccelerationRamps::maxV
double maxV
Definition: BasicControllers.h:369
armarx::positionThroughVelocityControlWithAccelerationBoundsAndPeriodicPosition
float positionThroughVelocityControlWithAccelerationBoundsAndPeriodicPosition(float dt, float maxDt, float currentV, float maxV, float acceleration, float deceleration, float currentPosition, float targetPosition, float pControlPosErrorLimit, float p, float &direction, float positionPeriodLo, float positionPeriodHi)
Definition: BasicControllers.cpp:284
armarx::brakingDistance
float brakingDistance(float v0, float deceleration)
Definition: BasicControllers.h:157
armarx::MinJerkPositionController::Output::velocity
double velocity
Definition: BasicControllers.h:487
armarx::angleDistance
float angleDistance(float angle1, float angle2)
Definition: BasicControllers.h:163
algorithm.h
armarx::RampedAccelerationVelocityControllerConfiguration::maxDecelerationRad
float maxDecelerationRad
Definition: BasicControllers.h:222
MathUtils.h
armarx::RampedAccelerationVelocityControllerConfiguration::directSetVLimit
float directSetVLimit
Definition: BasicControllers.h:225
armarx::deltas::dv
float dv
Definition: BasicControllers.h:59
armarx::deltas::dt
float dt
Definition: BasicControllers.h:61
armarx::VelocityControllerWithRampedAcceleration::Output::acceleration
double acceleration
Definition: BasicControllers.h:190
armarx::PositionThroughVelocityControllerWithAccelerationBounds::pControlVelLimit
float pControlVelLimit
Definition: BasicControllers.h:311
armarx::MinJerkPositionController::FixedMinJerkState::s0
double s0
Definition: BasicControllers.h:481
armarx::VelocityControllerWithRampedAcceleration::Output::jerk
double jerk
Definition: BasicControllers.h:191
armarx::PositionThroughVelocityControllerWithAccelerationRamps::calcState
std::pair< State, Output > calcState() const
Definition: BasicControllers.cpp:1149
armarx::MinJerkPositionController::currentTime
double currentTime
Definition: BasicControllers.h:510
armarx::PositionThroughVelocityControllerWithAccelerationRamps::State::PCtrl
@ PCtrl
armarx::positionThroughVelocityControlWithAccelerationAndPositionBounds
float positionThroughVelocityControlWithAccelerationAndPositionBounds(float dt, float maxDt, float currentV, float maxV, float acceleration, float deceleration, float currentPosition, float targetPosition, float p, float positionLimitLo, float positionLimitHi)
Definition: BasicControllers.cpp:222
armarx::PositionThroughVelocityControllerWithAccelerationAndPositionBounds
Definition: BasicControllers.h:425
armarx::PositionThroughVelocityControllerWithAccelerationBoundsAndPeriodicPosition
Definition: BasicControllers.h:447
armarx::VelocityControllerWithRampedAccelerationAndPositionBounds::validParameters
bool validParameters() const
Definition: BasicControllers.cpp:1425
armarx::PositionThroughVelocityControllerWithAccelerationRamps::run
Output run()
Definition: BasicControllers.cpp:991
armarx::PositionThroughVelocityControllerWithAccelerationRamps::usePIDAtEnd
bool usePIDAtEnd
Definition: BasicControllers.h:387
armarx::MinJerkPositionController::currentP_Phase3
double currentP_Phase3
Definition: BasicControllers.h:506
armarx::PositionThroughVelocityControllerWithAccelerationRamps::currentAcc
double currentAcc
Definition: BasicControllers.h:368
armarx::MinJerkPositionController::fixedMinJerkState
std::unique_ptr< FixedMinJerkState > fixedMinJerkState
Definition: BasicControllers.h:511
armarx::VelocityControllerWithAccelerationAndPositionBounds::validParameters
bool validParameters() const
Definition: BasicControllers.cpp:485
armarx::MinJerkPositionController::desiredDeceleration
double desiredDeceleration
Definition: BasicControllers.h:498
armarx::MinJerkPositionController::maxDt
double maxDt
Definition: BasicControllers.h:493
armarx::PositionThroughVelocityControllerWithAccelerationRamps::Output::acceleration
double acceleration
Definition: BasicControllers.h:361
armarx::MinJerkPositionController::p_adjust_ratio
double p_adjust_ratio
Definition: BasicControllers.h:503
armarx::PositionThroughVelocityControllerWithAccelerationRamps::pControlPosErrorLimit
double pControlPosErrorLimit
Definition: BasicControllers.h:382
armarx::VelocityControllerWithAccelerationAndPositionBounds::run
float run() const
Definition: BasicControllers.cpp:494
armarx::VelocityControllerWithAccelerationAndPositionBounds
Performs velocity control while staying in positional bounds, obeying acceleration / deceleration and...
Definition: BasicControllers.h:272
armarx::PositionThroughVelocityControllerWithAccelerationRamps::State::DecAccIncJerk
@ DecAccIncJerk
armarx::RampedAccelerationVelocityControllerConfigurationCPtr
std::shared_ptr< const RampedAccelerationVelocityControllerConfiguration > RampedAccelerationVelocityControllerConfigurationCPtr
Definition: BasicControllers.h:214
armarx::VelocityControllerWithAccelerationBounds::dt
float dt
Definition: BasicControllers.h:170
armarx::sign
T sign(T t)
Definition: algorithm.h:194
armarx::MinJerkPositionController::State::a
double a
Definition: BasicControllers.h:476
armarx::PositionThroughVelocityControllerWithAccelerationBounds::deceleration
float deceleration
Definition: BasicControllers.h:307
armarx::MinJerkPositionController::State::s
double s
Definition: BasicControllers.h:476
armarx::VelocityControllerWithRampedAcceleration::maxV
float maxV
Definition: BasicControllers.h:196
armarx::VelocityControllerWithAccelerationBounds::maxV
float maxV
Definition: BasicControllers.h:174
armarx::PositionThroughVelocityControllerWithAccelerationBounds::PositionThroughVelocityControllerWithAccelerationBounds
PositionThroughVelocityControllerWithAccelerationBounds()
Definition: BasicControllers.cpp:567
armarx::VelocityControllerWithRampedAccelerationAndPositionBounds::positionLimitLoSoft
double positionLimitLoSoft
Definition: BasicControllers.h:233
armarx::PositionThroughVelocityControllerWithAccelerationRamps::State::IncAccIncJerk
@ IncAccIncJerk
armarx::RampedAccelerationVelocityControllerConfiguration::RampedAccelerationVelocityControllerConfiguration
RampedAccelerationVelocityControllerConfiguration()=default
armarx::PositionThroughVelocityControllerWithAccelerationBounds
Definition: BasicControllers.h:300
armarx::VelocityControllerWithAccelerationBounds::estimateTime
float estimateTime() const
Definition: BasicControllers.cpp:474
armarx::velocityControlWithAccelerationAndPositionBounds
float velocityControlWithAccelerationAndPositionBounds(float dt, float maxDt, float currentV, float targetV, float maxV, float acceleration, float deceleration, float directSetVLimit, float currentPosition, float positionLimitLoSoft, float positionLimitHiSoft, float positionLimitLoHard, float positionLimitHiHard)
Definition: BasicControllers.cpp:83
armarx::PositionThroughVelocityControllerWithAccelerationRamps::State::Keep
@ Keep
armarx::PositionThroughVelocityControllerWithAccelerationBounds::pControlPosErrorLimit
float pControlPosErrorLimit
Definition: BasicControllers.h:310
armarx::PositionThroughVelocityControllerWithAccelerationBounds::run
float run() const
Definition: BasicControllers.cpp:597
armarx::VelocityControllerWithAccelerationAndPositionBounds::positionLimitLoSoft
float positionLimitLoSoft
Definition: BasicControllers.h:277
armarx::deltas::dx
float dx
Definition: BasicControllers.h:60
armarx::PositionThroughVelocityControllerWithAccelerationBoundsAndPeriodicPosition::run
float run() const
Definition: BasicControllers.cpp:902
armarx::MinJerkPositionController::run
Output run()
Definition: BasicControllers.cpp:1553
armarx::MinJerkPositionController::FixedMinJerkState
Definition: BasicControllers.h:479
armarx::PositionThroughVelocityControllerWithAccelerationRamps::dt
double dt
Definition: BasicControllers.h:365
armarx::PositionThroughVelocityControllerWithAccelerationRamps::targetPosition
double targetPosition
Definition: BasicControllers.h:376
armarx::PositionThroughVelocityControllerWithAccelerationAndPositionBounds::positionLimitLo
float positionLimitLo
Definition: BasicControllers.h:428
armarx::RampedAccelerationVelocityControllerConfiguration::maxDt
float maxDt
Definition: BasicControllers.h:224
armarx::velocityControlWithAccelerationBounds
float velocityControlWithAccelerationBounds(float dt, float maxDt, const float currentV, float targetV, float maxV, float acceleration, float deceleration, float directSetVLimit)
Definition: BasicControllers.cpp:35
armarx::MinJerkPositionController::phase2SwitchMaxRemainingTime
double phase2SwitchMaxRemainingTime
Definition: BasicControllers.h:502
armarx::PositionThroughVelocityControllerWithAccelerationRamps::accuracy
double accuracy
Definition: BasicControllers.h:385
armarx::VelocityControllerWithRampedAcceleration::targetV
float targetV
Definition: BasicControllers.h:204
armarx::VelocityControllerWithAccelerationBounds::currentV
float currentV
Definition: BasicControllers.h:172
armarx::MinJerkPositionController::FixedMinJerkState::v0
double v0
Definition: BasicControllers.h:481
armarx::VelocityControllerWithRampedAcceleration::dt
float dt
Definition: BasicControllers.h:201
armarx::MinJerkPositionController::Output
Definition: BasicControllers.h:484
armarx::PositionThroughVelocityControllerWithAccelerationRamps::acceleration
double acceleration
Definition: BasicControllers.h:370
armarx::findVelocityAndAccelerationForTimeAndDistance
void findVelocityAndAccelerationForTimeAndDistance(float distance, float v0, float vmax, float dec, std::array< deltas, 3 > trapeze, float newDt, float &newV, float &newAcc, float &newDec)
Definition: BasicControllers.h:84
armarx::PositionThroughVelocityControllerWithAccelerationRamps::Output::velocity
double velocity
Definition: BasicControllers.h:360
armarx::PositionThroughVelocityControllerWithAccelerationRamps::State
State
Definition: BasicControllers.h:347
armarx::VelocityControllerWithAccelerationBounds::maxDt
float maxDt
Definition: BasicControllers.h:171
armarx::VelocityControllerWithRampedAcceleration::jerk
float jerk
Definition: BasicControllers.h:197
armarx::VelocityControllerWithAccelerationBounds::directSetVLimit
float directSetVLimit
Definition: BasicControllers.h:177
armarx::VelocityControllerWithRampedAcceleration::maxDt
float maxDt
Definition: BasicControllers.h:195
armarx::MinJerkPositionController::targetPosition
double targetPosition
Definition: BasicControllers.h:508
armarx::VelocityControllerWithAccelerationBounds::run
float run() const
Definition: BasicControllers.cpp:363
armarx::MinJerkPositionController::currentV
double currentV
Definition: BasicControllers.h:495
armarx::MinJerkPositionController::currentAcc
double currentAcc
Definition: BasicControllers.h:496
armarx::ctrlutil::a
double a(double t, double a0, double j)
Definition: CtrlUtil.h:45
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::MinJerkPositionController::p
double p
Definition: BasicControllers.h:500
armarx::PositionThroughVelocityControllerWithAccelerationRamps::State::IncAccDecJerk
@ IncAccDecJerk
armarx::abs
std::vector< T > abs(const std::vector< T > &v)
Definition: VectorHelpers.h:253
armarx::PositionThroughVelocityControllerWithAccelerationBounds::currentPosition
float currentPosition
Definition: BasicControllers.h:308
armarx::RampedAccelerationVelocityControllerConfiguration::maxVelocityRad
float maxVelocityRad
Definition: BasicControllers.h:221
M_PI
#define M_PI
Definition: MathTools.h:17
armarx::PositionThroughVelocityControllerWithAccelerationRamps::calculateProportionalGain
double calculateProportionalGain() const
Definition: BasicControllers.cpp:1137
armarx::PositionThroughVelocityControllerWithAccelerationBounds::maxV
float maxV
Definition: BasicControllers.h:305
armarx::VelocityControllerWithRampedAcceleration::Output::velocity
double velocity
Definition: BasicControllers.h:189
armarx::VelocityControllerWithRampedAccelerationAndPositionBounds
Definition: BasicControllers.h:228
armarx::PositionThroughVelocityControllerWithAccelerationBounds::currentV
float currentV
Definition: BasicControllers.h:304
armarx::PositionThroughVelocityControllerWithAccelerationBounds::getCurrentlyPIDActive
bool getCurrentlyPIDActive() const
Definition: BasicControllers.cpp:961
armarx::VelocityControllerWithRampedAccelerationAndPositionBounds::run
Output run() const
Definition: BasicControllers.cpp:1432
armarx::pq
std::pair< T, T > pq(T p, T q)
Definition: BasicControllers.h:50
armarx::periodicClamp
T periodicClamp(T value, T periodLo, T periodHi)
Definition: BasicControllers.h:42
armarx::VelocityControllerWithRampedAcceleration::run
Output run() const
Definition: BasicControllers.cpp:403
armarx::VelocityControllerWithRampedAccelerationAndPositionBounds::deceleration
double deceleration
Definition: BasicControllers.h:237
armarx::VelocityControllerWithAccelerationAndPositionBounds::positionLimitHiSoft
float positionLimitHiSoft
Definition: BasicControllers.h:278
armarx::VelocityControllerWithRampedAcceleration::currentV
float currentV
Definition: BasicControllers.h:202
armarx::MinJerkPositionController::FixedMinJerkState::a0
double a0
Definition: BasicControllers.h:481
armarx::MinJerkPositionController::finishTime
double finishTime
Definition: BasicControllers.h:509
armarx::MinJerkPositionController::Output::jerk
double jerk
Definition: BasicControllers.h:489
armarx::PositionThroughVelocityControllerWithAccelerationRamps::pControlVelLimit
double pControlVelLimit
Definition: BasicControllers.h:383
armarx::VelocityControllerWithRampedAcceleration::validParameters
bool validParameters() const
Definition: BasicControllers.cpp:397
armarx::MinJerkPositionController::phase2SwitchDistance
double phase2SwitchDistance
Definition: BasicControllers.h:501
armarx::MinJerkPositionController::Output::acceleration
double acceleration
Definition: BasicControllers.h:488
q
#define q
armarx::PositionThroughVelocityControllerWithAccelerationBounds::pid
std::shared_ptr< PIDController > pid
Definition: BasicControllers.h:314
armarx::MinJerkPositionController::currentP_Phase2
double currentP_Phase2
Definition: BasicControllers.h:507
armarx::deltas
Definition: BasicControllers.h:57
armarx::MinJerkPositionController::FixedMinJerkState::t0
double t0
Definition: BasicControllers.h:481
armarx::VelocityControllerWithAccelerationBounds::acceleration
float acceleration
Definition: BasicControllers.h:175
armarx::PositionThroughVelocityControllerWithAccelerationBounds::maxDt
float maxDt
Definition: BasicControllers.h:303
armarx::PositionThroughVelocityControllerWithAccelerationRamps::PositionThroughVelocityControllerWithAccelerationRamps
PositionThroughVelocityControllerWithAccelerationRamps()
Definition: BasicControllers.cpp:977
armarx::MinJerkPositionController::getTargetPosition
double getTargetPosition() const
Definition: BasicControllers.cpp:1280
armarx::MinJerkPositionController::Output::position
double position
Definition: BasicControllers.h:486
armarx::VelocityControllerWithRampedAcceleration::currentAcc
float currentAcc
Definition: BasicControllers.h:203
armarx::RampedAccelerationVelocityControllerConfiguration::jerk
float jerk
Definition: BasicControllers.h:223
armarx::trapeze
std::array< deltas, 3 > trapeze(float v0, float acc, float vMax, float dec, float vt, float dx)
Definition: BasicControllers.cpp:795
armarx::PositionThroughVelocityControllerWithAccelerationRamps::maxDt
double maxDt
Definition: BasicControllers.h:366
armarx::VelocityControllerWithRampedAccelerationAndPositionBounds::positionLimitHiSoft
double positionLimitHiSoft
Definition: BasicControllers.h:234
PIDController.h
armarx::RampedAccelerationVelocityControllerConfiguration
Definition: BasicControllers.h:216
armarx::PositionThroughVelocityControllerWithAccelerationBounds::estimateTime
float estimateTime() const
Definition: BasicControllers.cpp:701
armarx::VelocityControllerWithAccelerationBounds::deceleration
float deceleration
Definition: BasicControllers.h:176
armarx::PositionThroughVelocityControllerWithAccelerationBounds::accuracy
float accuracy
Definition: BasicControllers.h:313
armarx::PositionThroughVelocityControllerWithAccelerationRamps
Definition: BasicControllers.h:345
armarx::PositionThroughVelocityControllerWithAccelerationAndPositionBounds::validParameters
bool validParameters() const
Definition: BasicControllers.cpp:749
armarx::PositionThroughVelocityControllerWithAccelerationAndPositionBounds::run
float run() const
Definition: BasicControllers.cpp:758
armarx::VelocityControllerWithAccelerationAndPositionBounds::currentPosition
float currentPosition
Definition: BasicControllers.h:276
armarx::MinJerkPositionController::maxV
double maxV
Definition: BasicControllers.h:497
armarx::trapezeWithDt
std::array< deltas, 3 > trapezeWithDt(float v0, float acc, float vMax, float dec, float vt, float dx, float dt)
armarx::trapezeArea
float trapezeArea(float v0, float vmax, float dt1, float dt2, float dt3)
Definition: BasicControllers.h:78
armarx::PositionThroughVelocityControllerWithAccelerationBoundsAndPeriodicPosition::positionPeriodLo
float positionPeriodLo
Definition: BasicControllers.h:451
armarx::MinJerkPositionController::setTargetPosition
void setTargetPosition(double value)
Definition: BasicControllers.cpp:1509
armarx::PositionThroughVelocityControllerWithAccelerationRamps::jerk
double jerk
Definition: BasicControllers.h:372
armarx::PositionThroughVelocityControllerWithAccelerationRamps::deceleration
double deceleration
Definition: BasicControllers.h:371
armarx::PositionThroughVelocityControllerWithAccelerationRamps::getTargetPosition
double getTargetPosition() const
Definition: BasicControllers.cpp:955
armarx::MinJerkPositionController::desiredJerk
double desiredJerk
Definition: BasicControllers.h:499
armarx::PositionThroughVelocityControllerWithAccelerationBounds::dt
float dt
Definition: BasicControllers.h:302
armarx::PositionThroughVelocityControllerWithAccelerationRamps::Output
Definition: BasicControllers.h:358
armarx::MinJerkPositionController::reset
void reset()
Definition: BasicControllers.cpp:1269
armarx::PositionThroughVelocityControllerWithAccelerationBounds::calculateProportionalGain
float calculateProportionalGain() const
Definition: BasicControllers.cpp:577
armarx::MinJerkPositionController::currentPosition
double currentPosition
Definition: BasicControllers.h:494
armarx::VelocityControllerWithRampedAcceleration
Definition: BasicControllers.h:184
distance
double distance(const Point &a, const Point &b)
Definition: point.hpp:88
armarx::PositionThroughVelocityControllerWithAccelerationRamps::State::Unknown
@ Unknown
armarx::PositionThroughVelocityControllerWithAccelerationRamps::currentPosition
double currentPosition
Definition: BasicControllers.h:373
T
float T
Definition: UnscentedKalmanFilterTest.cpp:35
armarx::MinJerkPositionController::State
Definition: BasicControllers.h:474
armarx::PositionThroughVelocityControllerWithAccelerationRamps::Output::jerk
double jerk
Definition: BasicControllers.h:362
armarx::positionThroughVelocityControlWithAccelerationBounds
float positionThroughVelocityControlWithAccelerationBounds(float dt, float maxDt, float currentV, float maxV, float acceleration, float deceleration, float currentPosition, float targetPosition, float p)
Definition: BasicControllers.cpp:166
armarx::MinJerkPositionController::dt
double dt
Definition: BasicControllers.h:492
armarx::MinJerkPositionController
Definition: BasicControllers.h:471
armarx::RampedAccelerationVelocityControllerConfigurationPtr
std::shared_ptr< class RampedAccelerationVelocityControllerConfiguration > RampedAccelerationVelocityControllerConfigurationPtr
Definition: BasicControllers.h:212
armarx::PositionThroughVelocityControllerWithAccelerationRamps::validParameters
bool validParameters() const
Definition: BasicControllers.cpp:982
armarx::PositionThroughVelocityControllerWithAccelerationBounds::validParameters
bool validParameters() const
Definition: BasicControllers.cpp:588
armarx::accelerateToVelocity
deltas accelerateToVelocity(float v0, float acc, float vt)
Definition: BasicControllers.h:65
armarx::VelocityControllerWithAccelerationBounds::targetV
float targetV
Definition: BasicControllers.h:173
armarx::PositionThroughVelocityControllerWithAccelerationAndPositionBounds::positionLimitHi
float positionLimitHi
Definition: BasicControllers.h:429
armarx::VelocityControllerWithRampedAcceleration::directSetVLimit
float directSetVLimit
Definition: BasicControllers.h:198
armarx::VelocityControllerWithRampedAccelerationAndPositionBounds::currentPosition
double currentPosition
Definition: BasicControllers.h:232
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::PositionThroughVelocityControllerWithAccelerationRamps::currentV
double currentV
Definition: BasicControllers.h:367
dt
constexpr T dt
Definition: UnscentedKalmanFilterTest.cpp:42
armarx::VelocityControllerWithAccelerationBounds
Definition: BasicControllers.h:168
armarx::PositionThroughVelocityControllerWithAccelerationRamps::State::DecAccDecJerk
@ DecAccDecJerk
armarx::VelocityControllerWithAccelerationBounds::validParameters
bool validParameters() const
Definition: BasicControllers.cpp:356
armarx::PositionThroughVelocityControllerWithAccelerationRamps::state
State state
Definition: BasicControllers.h:388
armarx::PositionThroughVelocityControllerWithAccelerationRamps::setTargetPosition
void setTargetPosition(double value)
Definition: BasicControllers.cpp:967
armarx::PositionThroughVelocityControllerWithAccelerationBoundsAndPeriodicPosition::positionPeriodHi
float positionPeriodHi
Definition: BasicControllers.h:452