mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 09:58:28 -04:00
AC_PosControl: set_speed_z accepts positive descent speeds
This commit is contained in:
parent
466e9db1f9
commit
9f63de9b59
@ -77,6 +77,9 @@ AC_PosControl::AC_PosControl(const AP_AHRS& ahrs, const AP_InertialNav& inav,
|
|||||||
/// speed_down should be a negative number
|
/// speed_down should be a negative number
|
||||||
void AC_PosControl::set_speed_z(float speed_down, float speed_up)
|
void AC_PosControl::set_speed_z(float speed_down, float speed_up)
|
||||||
{
|
{
|
||||||
|
// ensure speed_down is always negative
|
||||||
|
speed_down = -fabs(speed_down);
|
||||||
|
|
||||||
if ((fabs(_speed_down_cms-speed_down) > 1.0f) || (fabs(_speed_up_cms-speed_up) > 1.0f)) {
|
if ((fabs(_speed_down_cms-speed_down) > 1.0f) || (fabs(_speed_up_cms-speed_up) > 1.0f)) {
|
||||||
_speed_down_cms = speed_down;
|
_speed_down_cms = speed_down;
|
||||||
_speed_up_cms = speed_up;
|
_speed_up_cms = speed_up;
|
||||||
|
@ -62,8 +62,7 @@ public:
|
|||||||
void set_alt_max(float alt) { _alt_max = alt; }
|
void set_alt_max(float alt) { _alt_max = alt; }
|
||||||
|
|
||||||
/// set_speed_z - sets maximum climb and descent rates
|
/// set_speed_z - sets maximum climb and descent rates
|
||||||
/// To-Do: call this in the main code as part of flight mode initialisation
|
/// speed_down can be positive or negative but will always be interpreted as a descent speed
|
||||||
/// speed_down should be a negative number
|
|
||||||
/// leash length will be recalculated the next time update_z_controller() is called
|
/// leash length will be recalculated the next time update_z_controller() is called
|
||||||
void set_speed_z(float speed_down, float speed_up);
|
void set_speed_z(float speed_down, float speed_up);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user