Go to the documentation of this file.
26 #include <type_traits>
34 #include <boost/circular_buffer.hpp>
44 float dist = periodHi - periodLo;
45 return std::fmod(
value - periodLo + dist, dist) + periodLo;
54 return {
a + b,
a - b};
75 std::array<deltas, 3>
trapeze(
float v0,
float acc,
float vMax,
float dec,
float vt,
float dx);
78 trapezeArea(
float v0,
float vmax,
float dt1,
float dt2,
float dt3)
80 return (v0 + vmax) / 2 * dt1 + dt2 * vmax + dt3 * vmax * 0.5;
101 dt1 += newDt - oldDt;
102 newV = (-dt0 * v0 + 2 * area) / (dt0 + 2 * dt1 + dt2);
103 newAcc = (newV - v0) / dt0;
148 std::array<deltas, 3>
149 trapezeWithDt(
float v0,
float acc,
float vMax,
float dec,
float vt,
float dx,
float dt);
165 return M_PI - std::fabs(std::fmod(std::fabs(angle1 - angle2),
M_PI * 2) -
M_PI);
211 typedef std::shared_ptr<class RampedAccelerationVelocityControllerConfiguration>
213 typedef std::shared_ptr<const RampedAccelerationVelocityControllerConfiguration>
244 const float currentV,
249 float directSetVLimit);
293 float directSetVLimit,
294 float currentPosition,
295 float positionLimitLoSoft,
296 float positionLimitHiSoft,
297 float positionLimitLoHard,
298 float positionLimitHiHard);
314 std::shared_ptr<PIDController>
pid;
321 #ifdef DEBUG_POS_CTRL
322 mutable bool PIDModeActive =
false;
327 float targetVelocityPID;
328 float targetVelocityRAMP;
334 mutable boost::circular_buffer<HelpStruct> buffer;
335 mutable int eventHappeningCounter = -1;
342 mutable bool currentlyPIDActive =
false;
396 std::pair<State, Output>
calcState()
const;
397 #ifdef DEBUG_POS_CTRL
398 mutable bool PIDModeActive =
false;
403 double targetVelocityPID;
404 double targetVelocityRAMP;
410 mutable boost::circular_buffer<HelpStruct> buffer;
411 mutable int eventHappeningCounter = -1;
421 float currentPosition,
422 float targetPosition,
441 float currentPosition,
442 float targetPosition,
444 float positionLimitLo,
445 float positionLimitHi);
463 float currentPosition,
464 float targetPosition,
465 float pControlPosErrorLimit,
468 float positionPeriodLo,
469 float positionPeriodHi);
double estimateTime() const
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
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)
float brakingDistance(float v0, float deceleration)
float angleDistance(float angle1, float angle2)
std::pair< State, Output > calcState() const
float positionThroughVelocityControlWithAccelerationAndPositionBounds(float dt, float maxDt, float currentV, float maxV, float acceleration, float deceleration, float currentPosition, float targetPosition, float p, float positionLimitLo, float positionLimitHi)
bool validParameters() const
std::unique_ptr< FixedMinJerkState > fixedMinJerkState
bool validParameters() const
double desiredDeceleration
double pControlPosErrorLimit
Performs velocity control while staying in positional bounds, obeying acceleration / deceleration and...
std::shared_ptr< const RampedAccelerationVelocityControllerConfiguration > RampedAccelerationVelocityControllerConfigurationCPtr
PositionThroughVelocityControllerWithAccelerationBounds()
double positionLimitLoSoft
RampedAccelerationVelocityControllerConfiguration()=default
float estimateTime() const
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)
float pControlPosErrorLimit
float positionLimitLoSoft
float velocityControlWithAccelerationBounds(float dt, float maxDt, const float currentV, float targetV, float maxV, float acceleration, float deceleration, float directSetVLimit)
double phase2SwitchMaxRemainingTime
void findVelocityAndAccelerationForTimeAndDistance(float distance, float v0, float vmax, float dec, std::array< deltas, 3 > trapeze, float newDt, float &newV, float &newAcc, float &newDec)
double a(double t, double a0, double j)
std::shared_ptr< Value > value()
std::vector< T > abs(const std::vector< T > &v)
double calculateProportionalGain() const
bool getCurrentlyPIDActive() const
std::pair< T, T > pq(T p, T q)
T periodicClamp(T value, T periodLo, T periodHi)
float positionLimitHiSoft
bool validParameters() const
double phase2SwitchDistance
std::shared_ptr< PIDController > pid
PositionThroughVelocityControllerWithAccelerationRamps()
double getTargetPosition() const
std::array< deltas, 3 > trapeze(float v0, float acc, float vMax, float dec, float vt, float dx)
double positionLimitHiSoft
float estimateTime() const
bool validParameters() const
std::array< deltas, 3 > trapezeWithDt(float v0, float acc, float vMax, float dec, float vt, float dx, float dt)
float trapezeArea(float v0, float vmax, float dt1, float dt2, float dt3)
void setTargetPosition(double value)
double getTargetPosition() const
float calculateProportionalGain() const
double distance(const Point &a, const Point &b)
float positionThroughVelocityControlWithAccelerationBounds(float dt, float maxDt, float currentV, float maxV, float acceleration, float deceleration, float currentPosition, float targetPosition, float p)
std::shared_ptr< class RampedAccelerationVelocityControllerConfiguration > RampedAccelerationVelocityControllerConfigurationPtr
bool validParameters() const
bool validParameters() const
deltas accelerateToVelocity(float v0, float acc, float vt)
This file offers overloads of toIce() and fromIce() functions for STL container types.
bool validParameters() const
void setTargetPosition(double value)