PX4 Firmware
PX4 Autopilot Software http://px4.io
ManualVelocitySmoothingZ Class Referencefinal

#include <ManualVelocitySmoothingZ.hpp>

Collaboration diagram for ManualVelocitySmoothingZ:

Public Member Functions

 ManualVelocitySmoothingZ ()=default
 
 ~ManualVelocitySmoothingZ ()=default
 
void reset (float accel, float vel, float pos)
 
void update (float dt, float velocity_target)
 
void setVelSpFeedback (const float fb)
 
void setMaxJerk (const float max_jerk)
 
void setMaxAccelUp (const float max_accel_up)
 
void setMaxAccelDown (const float max_accel_down)
 
void setMaxVelUp (const float max_vel_up)
 
void setMaxVelDown (const float max_vel_down)
 
float getCurrentJerk () const
 
float getCurrentAcceleration () const
 
void setCurrentVelocity (const float vel)
 
float getCurrentVelocity () const
 
void setCurrentPosition (const float pos)
 
float getCurrentPosition () const
 
void setCurrentPositionEstimate (float pos)
 

Private Member Functions

void resetPositionLock ()
 
void updateTrajectories (float dt)
 
void updateTrajConstraints (float vel_target)
 
void checkPositionLock (float velocity_target)
 
void updateTrajDurations (float velocity_target)
 

Private Attributes

VelocitySmoothing _trajectory
 Trajectory in z direction. More...
 
bool _position_lock_active {false}
 
float _position_setpoint_locked
 
float _velocity_setpoint_feedback
 
float _position_estimate
 
struct {
   float   j
 
   float   a
 
   float   v
 
   float   x
 
_state
 
float _max_accel_up {0.f}
 
float _max_accel_down {0.f}
 
float _max_vel_up {0.f}
 
float _max_vel_down {0.f}
 

Detailed Description

Definition at line 43 of file ManualVelocitySmoothingZ.hpp.

Constructor & Destructor Documentation

◆ ManualVelocitySmoothingZ()

ManualVelocitySmoothingZ::ManualVelocitySmoothingZ ( )
default

◆ ~ManualVelocitySmoothingZ()

ManualVelocitySmoothingZ::~ManualVelocitySmoothingZ ( )
default

Member Function Documentation

◆ checkPositionLock()

void ManualVelocitySmoothingZ::checkPositionLock ( float  velocity_target)
private

During a position lock -> position unlock transition, we have to make sure that the velocity setpoint is continuous. We know that the output of the position loop (part of the velocity setpoint) will suddenly become null and only the feedforward (generated by this flight task) will remain. This is why the previous input of the velocity controller is used to set current velocity of the trajectory.

Definition at line 91 of file ManualVelocitySmoothingZ.cpp.

References _position_estimate, _position_lock_active, _position_setpoint_locked, _state, _trajectory, _velocity_setpoint_feedback, FLT_EPSILON, resetPositionLock(), VelocitySmoothing::setCurrentPosition(), and VelocitySmoothing::setCurrentVelocity().

Referenced by setCurrentPositionEstimate(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrentAcceleration()

float ManualVelocitySmoothingZ::getCurrentAcceleration ( ) const
inline

Definition at line 76 of file ManualVelocitySmoothingZ.hpp.

References _state.

◆ getCurrentJerk()

float ManualVelocitySmoothingZ::getCurrentJerk ( ) const
inline

Definition at line 75 of file ManualVelocitySmoothingZ.hpp.

References _state.

◆ getCurrentPosition()

float ManualVelocitySmoothingZ::getCurrentPosition ( ) const
inline

Definition at line 88 of file ManualVelocitySmoothingZ.hpp.

References _position_setpoint_locked.

◆ getCurrentVelocity()

float ManualVelocitySmoothingZ::getCurrentVelocity ( ) const
inline

Definition at line 82 of file ManualVelocitySmoothingZ.hpp.

References _state.

◆ reset()

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

Definition at line 39 of file ManualVelocitySmoothingZ.cpp.

References _trajectory, VelocitySmoothing::reset(), and resetPositionLock().

Here is the call graph for this function:

◆ resetPositionLock()

void ManualVelocitySmoothingZ::resetPositionLock ( )
private

Definition at line 46 of file ManualVelocitySmoothingZ.cpp.

References _position_lock_active, and _position_setpoint_locked.

Referenced by checkPositionLock(), reset(), and setCurrentPositionEstimate().

Here is the caller graph for this function:

◆ setCurrentPosition()

void ManualVelocitySmoothingZ::setCurrentPosition ( const float  pos)
inline

Definition at line 83 of file ManualVelocitySmoothingZ.hpp.

References _state, _trajectory, and VelocitySmoothing::setCurrentPosition().

Here is the call graph for this function:

◆ setCurrentPositionEstimate()

void ManualVelocitySmoothingZ::setCurrentPositionEstimate ( float  pos)
inline

Definition at line 89 of file ManualVelocitySmoothingZ.hpp.

References _position_estimate, checkPositionLock(), resetPositionLock(), updateTrajConstraints(), updateTrajDurations(), and updateTrajectories().

Here is the call graph for this function:

◆ setCurrentVelocity()

void ManualVelocitySmoothingZ::setCurrentVelocity ( const float  vel)
inline

Definition at line 77 of file ManualVelocitySmoothingZ.hpp.

References _state, _trajectory, and VelocitySmoothing::setCurrentVelocity().

Here is the call graph for this function:

◆ setMaxAccelDown()

void ManualVelocitySmoothingZ::setMaxAccelDown ( const float  max_accel_down)
inline

Definition at line 62 of file ManualVelocitySmoothingZ.hpp.

References _max_accel_down.

◆ setMaxAccelUp()

void ManualVelocitySmoothingZ::setMaxAccelUp ( const float  max_accel_up)
inline

Definition at line 58 of file ManualVelocitySmoothingZ.hpp.

References _max_accel_up.

◆ setMaxJerk()

void ManualVelocitySmoothingZ::setMaxJerk ( const float  max_jerk)
inline

Definition at line 54 of file ManualVelocitySmoothingZ.hpp.

References _trajectory, and VelocitySmoothing::setMaxJerk().

Here is the call graph for this function:

◆ setMaxVelDown()

void ManualVelocitySmoothingZ::setMaxVelDown ( const float  max_vel_down)
inline

Definition at line 70 of file ManualVelocitySmoothingZ.hpp.

References _max_vel_down.

◆ setMaxVelUp()

void ManualVelocitySmoothingZ::setMaxVelUp ( const float  max_vel_up)
inline

Definition at line 66 of file ManualVelocitySmoothingZ.hpp.

References _max_vel_up.

◆ setVelSpFeedback()

void ManualVelocitySmoothingZ::setVelSpFeedback ( const float  fb)
inline

Definition at line 52 of file ManualVelocitySmoothingZ.hpp.

References _velocity_setpoint_feedback.

◆ update()

void ManualVelocitySmoothingZ::update ( float  dt,
float  velocity_target 
)

Definition at line 52 of file ManualVelocitySmoothingZ.cpp.

References _trajectory, checkPositionLock(), VelocitySmoothing::updateDurations(), updateTrajConstraints(), and updateTrajectories().

Here is the call graph for this function:

◆ updateTrajConstraints()

void ManualVelocitySmoothingZ::updateTrajConstraints ( float  vel_target)
private

Definition at line 79 of file ManualVelocitySmoothingZ.cpp.

References _max_accel_down, _max_accel_up, _max_vel_down, _max_vel_up, _trajectory, f(), VelocitySmoothing::setMaxAccel(), and VelocitySmoothing::setMaxVel().

Referenced by setCurrentPositionEstimate(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTrajDurations()

void ManualVelocitySmoothingZ::updateTrajDurations ( float  velocity_target)
private

Referenced by setCurrentPositionEstimate().

Here is the caller graph for this function:

◆ updateTrajectories()

void ManualVelocitySmoothingZ::updateTrajectories ( float  dt)
private

Definition at line 69 of file ManualVelocitySmoothingZ.cpp.

References _state, _trajectory, VelocitySmoothing::getCurrentAcceleration(), VelocitySmoothing::getCurrentJerk(), VelocitySmoothing::getCurrentPosition(), VelocitySmoothing::getCurrentVelocity(), and VelocitySmoothing::updateTraj().

Referenced by setCurrentPositionEstimate(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _max_accel_down

float ManualVelocitySmoothingZ::_max_accel_down {0.f}
private

Definition at line 115 of file ManualVelocitySmoothingZ.hpp.

Referenced by setMaxAccelDown(), and updateTrajConstraints().

◆ _max_accel_up

float ManualVelocitySmoothingZ::_max_accel_up {0.f}
private

Definition at line 114 of file ManualVelocitySmoothingZ.hpp.

Referenced by setMaxAccelUp(), and updateTrajConstraints().

◆ _max_vel_down

float ManualVelocitySmoothingZ::_max_vel_down {0.f}
private

Definition at line 117 of file ManualVelocitySmoothingZ.hpp.

Referenced by setMaxVelDown(), and updateTrajConstraints().

◆ _max_vel_up

float ManualVelocitySmoothingZ::_max_vel_up {0.f}
private

Definition at line 116 of file ManualVelocitySmoothingZ.hpp.

Referenced by setMaxVelUp(), and updateTrajConstraints().

◆ _position_estimate

float ManualVelocitySmoothingZ::_position_estimate
private

Definition at line 105 of file ManualVelocitySmoothingZ.hpp.

Referenced by checkPositionLock(), and setCurrentPositionEstimate().

◆ _position_lock_active

bool ManualVelocitySmoothingZ::_position_lock_active {false}
private

Definition at line 100 of file ManualVelocitySmoothingZ.hpp.

Referenced by checkPositionLock(), and resetPositionLock().

◆ _position_setpoint_locked

float ManualVelocitySmoothingZ::_position_setpoint_locked
private

◆ _state

◆ _trajectory

VelocitySmoothing ManualVelocitySmoothingZ::_trajectory
private

◆ _velocity_setpoint_feedback

float ManualVelocitySmoothingZ::_velocity_setpoint_feedback
private

Definition at line 104 of file ManualVelocitySmoothingZ.hpp.

Referenced by checkPositionLock(), and setVelSpFeedback().

◆ a

float ManualVelocitySmoothingZ::a

Definition at line 109 of file ManualVelocitySmoothingZ.hpp.

◆ j

float ManualVelocitySmoothingZ::j

Definition at line 108 of file ManualVelocitySmoothingZ.hpp.

◆ v

float ManualVelocitySmoothingZ::v

Definition at line 110 of file ManualVelocitySmoothingZ.hpp.

◆ x

float ManualVelocitySmoothingZ::x

Definition at line 111 of file ManualVelocitySmoothingZ.hpp.


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