57 VelocitySmoothing(
float initial_accel = 0.f,
float initial_vel = 0.f,
float initial_pos = 0.f);
66 void reset(
float accel,
float vel,
float pos);
84 void integrate(
float &accel_setpoint_smooth,
float &vel_setpoint_smooth,
float &pos_setpoint_smooth);
85 void integrate(
float dt,
float integration_scale_factor,
float &accel_setpoint_smooth,
float &vel_setpoint_smooth,
86 float &pos_setpoint_smooth);
89 float getMaxJerk()
const {
return _max_jerk; }
90 void setMaxJerk(
float max_jerk) { _max_jerk = max_jerk; }
92 float getMaxAccel()
const {
return _max_accel; }
93 void setMaxAccel(
float max_accel) { _max_accel = max_accel; }
95 float getMaxVel()
const {
return _max_vel; }
96 void setMaxVel(
float max_vel) { _max_vel = max_vel; }
98 float getCurrentJerk()
const {
return _jerk; }
99 void setCurrentAcceleration(
const float accel) { _accel = accel; }
100 float getCurrentAcceleration()
const {
return _accel; }
101 void setCurrentVelocity(
const float vel) { _vel = vel; }
102 float getCurrentVelocity()
const {
return _vel; }
103 void setCurrentPosition(
const float pos) { _pos = pos; }
104 float getCurrentPosition()
const {
return _pos; }
115 float getTotalTime()
const {
return _T1 + _T2 + _T3; }
116 float getT1()
const {
return _T1; }
117 float getT2()
const {
return _T2; }
118 float getT3()
const {
return _T3; }
119 float getVelSp()
const {
return _vel_sp; }
132 inline float computeT1(
float accel_prev,
float vel_prev,
float vel_setpoint,
float max_jerk);
136 inline float computeT1(
float T123,
float accel_prev,
float vel_prev,
float vel_setpoint,
float max_jerk);
137 inline float saturateT1ForAccel(
float accel_prev,
float max_jerk,
float T1);
141 inline float computeT2(
float T1,
float T3,
float accel_prev,
float vel_prev,
float vel_setpoint,
float max_jerk);
145 inline float computeT2(
float T123,
float T1,
float T3);
149 inline float computeT3(
float T1,
float accel_prev,
float max_jerk);
154 inline void integrateT(
float dt,
float jerk,
float accel_prev,
float vel_prev,
float pos_prev,
155 float &accel_out,
float &vel_out,
float &pos_out);
162 float _max_jerk = 22.f;
163 float _max_accel = 8.f;
164 float _max_vel = 6.f;
172 float _max_jerk_T1 = 0.f;
179 static constexpr
float max_pos_err = 1.f;
void reset(float accel, float vel, float pos)
Reset the state.
Definition: VelocitySmoothing.cpp:46
void integrate(float &accel_setpoint_smooth, float &vel_setpoint_smooth, float &pos_setpoint_smooth)
Generate the trajectory (acceleration, velocity and position) by integrating the current jerk...
Definition: VelocitySmoothing.cpp:234
static void timeSynchronization(VelocitySmoothing *traj, int n_traj)
Synchronize several trajectories to have the same total time.
Definition: VelocitySmoothing.cpp:282
TODO: document the algorithm |T1| T2 |T3| __| |____ __ Jerk |_| / \ Acceleration ___/ ___ ;" / / V...
Definition: VelocitySmoothing.hpp:54
void updateDurations(float dt, float vel_setpoint)
Compute T1, T2, T3 depending on the current state and velocity setpoint.
Definition: VelocitySmoothing.cpp:196