Trajectory - Add position lock-unlock logic and proper initialization from controller feedback

This commit is contained in:
bresch
2018-11-06 22:17:00 +01:00
committed by Roman Bapst
parent 84665672ad
commit 6a7ce651bc
7 changed files with 59 additions and 18 deletions
@@ -214,7 +214,7 @@ void VelocitySmoothing::updateDurations(float T123)
_T3 = T3;
}
void VelocitySmoothing::integrate(float pos, float &vel_setpoint_smooth,
void VelocitySmoothing::integrate(float &accel_setpoint_smooth, float &vel_setpoint_smooth,
float &pos_setpoint_smooth)
{
/* Integrate the trajectory */
@@ -238,14 +238,8 @@ void VelocitySmoothing::integrate(float pos, float &vel_setpoint_smooth,
_accel = accel_new;
_vel = vel_new;
/* Lock the position setpoint if the error is bigger than some value */
float x_err = pos_new - pos;
if (fabsf(x_err) <= max_pos_err) {
_pos = pos_new;
} // else: keep last position
/* set output variables */
accel_setpoint_smooth = _accel;
vel_setpoint_smooth = _vel;
pos_setpoint_smooth = _pos;
}