Firmware
Public Member Functions | Static Public Member Functions | List of all members
VelocitySmoothing Class Reference

TODO: document the algorithm |T1| T2 |T3|


__| |____ __ Jerk |_|


/ \ Acceleration ___/ ___


;" / / Velocity ; -—". More...

#include <VelocitySmoothing.hpp>

Public Member Functions

 VelocitySmoothing (float initial_accel=0.f, float initial_vel=0.f, float initial_pos=0.f)
 
void reset (float accel, float vel, float pos)
 Reset the state. More...
 
void updateDurations (float dt, float vel_setpoint)
 Compute T1, T2, T3 depending on the current state and velocity setpoint. More...
 
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. More...
 
void integrate (float dt, float integration_scale_factor, float &accel_setpoint_smooth, float &vel_setpoint_smooth, float &pos_setpoint_smooth)
 
float getMaxJerk () const
 
void setMaxJerk (float max_jerk)
 
float getMaxAccel () const
 
void setMaxAccel (float max_accel)
 
float getMaxVel () const
 
void setMaxVel (float max_vel)
 
float getCurrentJerk () const
 
void setCurrentAcceleration (const float accel)
 
float getCurrentAcceleration () const
 
void setCurrentVelocity (const float vel)
 
float getCurrentVelocity () const
 
void setCurrentPosition (const float pos)
 
float getCurrentPosition () const
 
float getTotalTime () const
 
float getT1 () const
 
float getT2 () const
 
float getT3 () const
 
float getVelSp () const
 

Static Public Member Functions

static void timeSynchronization (VelocitySmoothing *traj, int n_traj)
 Synchronize several trajectories to have the same total time. More...
 

Detailed Description

TODO: document the algorithm |T1| T2 |T3|


__| |____ __ Jerk |_|


/ \ Acceleration ___/ ___


;" / / Velocity ; -—".

Member Function Documentation

§ integrate()

void VelocitySmoothing::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.

Parameters
dtoptional integration period. If not given, the integration period provided during updateDuration call is used. A dt different from the one given during the computation of T1-T3 can be used to fast-forward or slow-down the trajectory.
acc_setpoint_smoothreturned smoothed acceleration setpoint
vel_setpoint_smoothreturned smoothed velocity setpoint
pos_setpoint_smoothreturned smoothed position setpoint

§ reset()

void VelocitySmoothing::reset ( float  accel,
float  vel,
float  pos 
)

Reset the state.

Parameters
accelCurrent acceleration
velCurrent velocity
posCurrent position

§ timeSynchronization()

void VelocitySmoothing::timeSynchronization ( VelocitySmoothing traj,
int  n_traj 
)
static

Synchronize several trajectories to have the same total time.

This is required to generate straight lines. The resulting total time is the one of the longest trajectory.

Parameters
trajan array of VelocitySmoothing objects
n_trajthe number of trajectories to be synchronized

§ updateDurations()

void VelocitySmoothing::updateDurations ( float  dt,
float  vel_setpoint 
)

Compute T1, T2, T3 depending on the current state and velocity setpoint.

This should be called on every cycle and before integrate().

Parameters
dtdelta time between last updateDurations() call and now [s]
vel_setpointvelocity setpoint input

The documentation for this class was generated from the following files: