|
PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <ManualSmoothingZ.hpp>
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... | |
Definition at line 55 of file ManualSmoothingZ.hpp.
| 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.
|
default |
|
inline |
Get user intention.
Definition at line 79 of file ManualSmoothingZ.hpp.
Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().
|
inline |
Get max accleration.
Definition at line 73 of file ManualSmoothingZ.hpp.
Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), SmoothZTest::brakeUpward(), and updateAcceleration().
|
inline |
Definition at line 86 of file ManualSmoothingZ.hpp.
Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().
|
inline |
Definition at line 85 of file ManualSmoothingZ.hpp.
Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().
|
inline |
Definition at line 87 of file ManualSmoothingZ.hpp.
Referenced by SmoothZTest::accelerateDownwardFromBrake(), SmoothZTest::accelerateUpwardFromBrake(), SmoothZTest::brakeDownward(), and SmoothZTest::brakeUpward().
|
private |
Set maximum acceleration.
The maximum acceleration depends on the desired direction (up vs down).
Definition at line 116 of file ManualSmoothingZ.cpp.
References _max_acceleration, _stick, _vel_sp_prev, f(), and FLT_EPSILON.
Referenced by updateAcceleration().
| void ManualSmoothingZ::smoothVelFromSticks | ( | float & | vel_sp, |
| const float | dt | ||
| ) |
Smooth velocity setpoint based on flight direction.
| 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. |
| dt | time 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().
|
private |
Computes the velocity setpoint change limit.
This method computes the limit with which the velocity setpoint change is limited.
| vel_sp | current velocity setpoint |
| dt | delta-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().
|
private |
Add delay to velocity setpoint change.
This method is used to smooth the velocity setpoint change.
| vel_sp | current velocity setpoint |
| dt | delta-time |
Definition at line 145 of file ManualSmoothingZ.cpp.
References _acc_state_dependent, _vel_sp_prev, and FLT_EPSILON.
Referenced by smoothVelFromSticks().
|
private |
acceleration that depends on _intention
Definition at line 124 of file ManualSmoothingZ.hpp.
Referenced by ManualSmoothingZ(), updateAcceleration(), and velocitySlewRate().
|
private |
User intention.
Definition at line 119 of file ManualSmoothingZ.hpp.
Referenced by updateAcceleration().
|
private |
can be up or down maximum acceleration
Definition at line 125 of file ManualSmoothingZ.hpp.
Referenced by ManualSmoothingZ(), and setMaxAcceleration().
|
private |
stick input (dependency injection)
Definition at line 122 of file ManualSmoothingZ.hpp.
Referenced by setMaxAcceleration(), and updateAcceleration().
|
private |
vehicle velocity (dependency injection)
Definition at line 121 of file ManualSmoothingZ.hpp.
Referenced by updateAcceleration().
|
private |
previous velocity setpoint
Definition at line 126 of file ManualSmoothingZ.hpp.
Referenced by setMaxAcceleration(), smoothVelFromSticks(), updateAcceleration(), and velocitySlewRate().