mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 14:33:35 +08:00
Added Throw Launch feature
More details in the PR: https://github.com/PX4/PX4-Autopilot/pull/21170 Signed-off-by: Michał Barciś <mbarcis@mbarcis.net>
This commit is contained in:
committed by
Matthias Grob
parent
84577ce2c2
commit
c2b4f051f9
@@ -39,6 +39,7 @@
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <lib/geo/geo.h>
|
||||
|
||||
|
||||
void TakeoffHandling::generateInitialRampValue(float velocity_p_gain)
|
||||
{
|
||||
velocity_p_gain = math::max(velocity_p_gain, 0.01f);
|
||||
@@ -74,6 +75,9 @@ void TakeoffHandling::updateTakeoffState(const bool armed, const bool landed, co
|
||||
_takeoff_state = TakeoffState::rampup;
|
||||
_takeoff_ramp_progress = 0.f;
|
||||
|
||||
} else if (!landed) {
|
||||
_takeoff_state = TakeoffState::flight;
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -103,7 +107,6 @@ void TakeoffHandling::updateTakeoffState(const bool armed, const bool landed, co
|
||||
_takeoff_state = TakeoffState::flight;
|
||||
}
|
||||
|
||||
// TODO: need to consider free fall here
|
||||
if (!armed) {
|
||||
_takeoff_state = TakeoffState::disarmed;
|
||||
}
|
||||
|
||||
@@ -53,15 +53,15 @@ TEST(TakeoffTest, RegularTakeoffRamp)
|
||||
takeoff.updateTakeoffState(false, true, false, 1.f, false, 0);
|
||||
EXPECT_EQ(takeoff.getTakeoffState(), TakeoffState::disarmed);
|
||||
|
||||
// armed, not landed anymore, don't want takeoff
|
||||
takeoff.updateTakeoffState(true, false, false, 1.f, false, 500_ms);
|
||||
// armed, landed, don't want takeoff
|
||||
takeoff.updateTakeoffState(true, true, false, 1.f, false, 500_ms);
|
||||
EXPECT_EQ(takeoff.getTakeoffState(), TakeoffState::spoolup);
|
||||
|
||||
// armed, not landed, don't want takeoff yet, spoolup time passed
|
||||
takeoff.updateTakeoffState(true, false, false, 1.f, false, 2_s);
|
||||
// armed, landed, don't want takeoff yet, spoolup time passed
|
||||
takeoff.updateTakeoffState(true, true, false, 1.f, false, 2_s);
|
||||
EXPECT_EQ(takeoff.getTakeoffState(), TakeoffState::ready_for_takeoff);
|
||||
|
||||
// armed, not landed, want takeoff
|
||||
// armed, not landed anymore, want takeoff
|
||||
takeoff.updateTakeoffState(true, false, true, 1.f, false, 3_s);
|
||||
EXPECT_EQ(takeoff.getTakeoffState(), TakeoffState::rampup);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user