PX4 Firmware
PX4 Autopilot Software http://px4.io
ManualSmoothingZ Class Reference

#include <ManualSmoothingZ.hpp>

Inheritance diagram for ManualSmoothingZ:
Collaboration diagram for ManualSmoothingZ:

Public Member Functions

 ManualSmoothingZ (ModuleParams *parent, const float &vel, const float &stick)
 
 ~ManualSmoothingZ ()=default
 
void smoothVelFromSticks (float &vel_sp, const float dt)
 Smooth velocity setpoint based on flight direction. More...
 
float getMaxAcceleration ()
 Get max accleration. More...
 
ManualIntentionZ getIntention ()
 Get user intention. More...
 
void overwriteAccelerationUp (float acc_max_up)
 
void overwriteAccelerationDown (float acc_max_down)
 
void overwriteJerkMax (float jerk_max)
 

Private Member Functions

void velocitySlewRate (float &vel_sp, const float dt)
 Add delay to velocity setpoint change. More...
 
void updateAcceleration (float &vel_sp, const float dt)
 Computes the velocity setpoint change limit. More...
 
void setMaxAcceleration ()
 Set maximum acceleration. More...
 

Private Attributes

ManualIntentionZ _intention {ManualIntentionZ::acceleration}
 User intention. More...
 
const float & _vel
 vehicle velocity (dependency injection) More...
 
const float & _stick
 stick input (dependency injection) More...
 
float _acc_state_dependent
 acceleration that depends on _intention More...
 
float _max_acceleration
 can be up or down maximum acceleration More...
 
float _vel_sp_prev
 previous velocity setpoint More...
 

Detailed Description

Definition at line 55 of file ManualSmoothingZ.hpp.

Constructor & Destructor Documentation

◆ ManualSmoothingZ()

ManualSmoothingZ::ManualSmoothingZ ( ModuleParams *  parent,
const float &  vel,
const float &  stick 
)

Definition at line 42 of file ManualSmoothingZ.cpp.

References _acc_state_dependent, and _max_acceleration.

◆ ~ManualSmoothingZ()

ManualSmoothingZ::~ManualSmoothingZ ( )
default

Member Function Documentation

◆ getIntention()

ManualIntentionZ ManualSmoothingZ::getIntention ( )
inline

Get user intention.

See also
ManualIntentionZ

Definition at line 79 of file ManualSmoothingZ.hpp.

Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().

Here is the caller graph for this function:

◆ getMaxAcceleration()

float ManualSmoothingZ::getMaxAcceleration ( )
inline

Get max accleration.

Definition at line 73 of file ManualSmoothingZ.hpp.

Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), SmoothZTest::brakeUpward(), and updateAcceleration().

Here is the caller graph for this function:

◆ overwriteAccelerationDown()

void ManualSmoothingZ::overwriteAccelerationDown ( float  acc_max_down)
inline

Definition at line 86 of file ManualSmoothingZ.hpp.

Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().

Here is the caller graph for this function:

◆ overwriteAccelerationUp()

void ManualSmoothingZ::overwriteAccelerationUp ( float  acc_max_up)
inline

Definition at line 85 of file ManualSmoothingZ.hpp.

Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().

Here is the caller graph for this function:

◆ overwriteJerkMax()

void ManualSmoothingZ::overwriteJerkMax ( float  jerk_max)
inline

Definition at line 87 of file ManualSmoothingZ.hpp.

Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().

Here is the caller graph for this function:

◆ setMaxAcceleration()

void ManualSmoothingZ::setMaxAcceleration ( )
private

Set maximum acceleration.

The maximum acceleration depends on the desired direction (up vs down).

See also
_max_acceleration

Definition at line 116 of file ManualSmoothingZ.cpp.

References _max_acceleration, _stick, _vel_sp_prev, f(), and FLT_EPSILON.

Referenced by updateAcceleration().

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

◆ smoothVelFromSticks()

void ManualSmoothingZ::smoothVelFromSticks ( float &  vel_sp,
const float  dt 
)

Smooth velocity setpoint based on flight direction.

Parameters
vel_sp[2]array: vel_sp[0] = current velocity set-point; vel_sp[1] = previous velocity set-point vel_sp will contain smoothed current / previous set-point.
dttime delta in seconds

Definition at line 51 of file ManualSmoothingZ.cpp.

References _vel_sp_prev, updateAcceleration(), and velocitySlewRate().

Referenced by FlightTaskManualAltitudeSmooth::_updateSetpoints(), FlightTaskManualPositionSmooth::_updateSetpoints(), SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().

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

◆ updateAcceleration()

void ManualSmoothingZ::updateAcceleration ( float &  vel_sp,
const float  dt 
)
private

Computes the velocity setpoint change limit.

This method computes the limit with which the velocity setpoint change is limited.

See also
velocitySlewRate
Parameters
vel_spcurrent velocity setpoint
dtdelta-time

Definition at line 59 of file ManualSmoothingZ.cpp.

References _acc_state_dependent, _intention, _stick, _vel, _vel_sp_prev, acceleration, brake, FLT_EPSILON, getMaxAcceleration(), and setMaxAcceleration().

Referenced by smoothVelFromSticks().

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

◆ velocitySlewRate()

void ManualSmoothingZ::velocitySlewRate ( float &  vel_sp,
const float  dt 
)
private

Add delay to velocity setpoint change.

This method is used to smooth the velocity setpoint change.

Parameters
vel_spcurrent velocity setpoint
dtdelta-time

Definition at line 145 of file ManualSmoothingZ.cpp.

References _acc_state_dependent, _vel_sp_prev, and FLT_EPSILON.

Referenced by smoothVelFromSticks().

Here is the caller graph for this function:

Member Data Documentation

◆ _acc_state_dependent

float ManualSmoothingZ::_acc_state_dependent
private

acceleration that depends on _intention

Definition at line 124 of file ManualSmoothingZ.hpp.

Referenced by ManualSmoothingZ(), updateAcceleration(), and velocitySlewRate().

◆ _intention

ManualIntentionZ ManualSmoothingZ::_intention {ManualIntentionZ::acceleration}
private

User intention.

See also
ManualIntentionZ

Definition at line 119 of file ManualSmoothingZ.hpp.

Referenced by updateAcceleration().

◆ _max_acceleration

float ManualSmoothingZ::_max_acceleration
private

can be up or down maximum acceleration

Definition at line 125 of file ManualSmoothingZ.hpp.

Referenced by ManualSmoothingZ(), and setMaxAcceleration().

◆ _stick

const float& ManualSmoothingZ::_stick
private

stick input (dependency injection)

Definition at line 122 of file ManualSmoothingZ.hpp.

Referenced by setMaxAcceleration(), and updateAcceleration().

◆ _vel

const float& ManualSmoothingZ::_vel
private

vehicle velocity (dependency injection)

Definition at line 121 of file ManualSmoothingZ.hpp.

Referenced by updateAcceleration().

◆ _vel_sp_prev

float ManualSmoothingZ::_vel_sp_prev
private

previous velocity setpoint

Definition at line 126 of file ManualSmoothingZ.hpp.

Referenced by setMaxAcceleration(), smoothVelFromSticks(), updateAcceleration(), and velocitySlewRate().


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