mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 02:43:33 +08:00
Added experimental LTO kconfig option
This commit is contained in:
committed by
Daniel Agar
parent
8da02e2233
commit
108c98a691
@@ -88,7 +88,7 @@ public:
|
||||
private:
|
||||
void Run() override;
|
||||
|
||||
Takeoff _takeoff; /**< state machine and ramp to bring the vehicle off the ground without jumps */
|
||||
TakeoffHandling _takeoff; /**< state machine and ramp to bring the vehicle off the ground without jumps */
|
||||
|
||||
orb_advert_t _mavlink_log_pub{nullptr};
|
||||
|
||||
|
||||
@@ -39,14 +39,14 @@
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <lib/geo/geo.h>
|
||||
|
||||
void Takeoff::generateInitialRampValue(float velocity_p_gain)
|
||||
void TakeoffHandling::generateInitialRampValue(float velocity_p_gain)
|
||||
{
|
||||
velocity_p_gain = math::max(velocity_p_gain, 0.01f);
|
||||
_takeoff_ramp_vz_init = -CONSTANTS_ONE_G / velocity_p_gain;
|
||||
}
|
||||
|
||||
void Takeoff::updateTakeoffState(const bool armed, const bool landed, const bool want_takeoff,
|
||||
const float takeoff_desired_vz, const bool skip_takeoff, const hrt_abstime &now_us)
|
||||
void TakeoffHandling::updateTakeoffState(const bool armed, const bool landed, const bool want_takeoff,
|
||||
const float takeoff_desired_vz, const bool skip_takeoff, const hrt_abstime &now_us)
|
||||
{
|
||||
_spoolup_time_hysteresis.set_state_and_update(armed, now_us);
|
||||
|
||||
@@ -109,7 +109,7 @@ void Takeoff::updateTakeoffState(const bool armed, const bool landed, const bool
|
||||
}
|
||||
}
|
||||
|
||||
float Takeoff::updateRamp(const float dt, const float takeoff_desired_vz)
|
||||
float TakeoffHandling::updateRamp(const float dt, const float takeoff_desired_vz)
|
||||
{
|
||||
float upwards_velocity_limit = takeoff_desired_vz;
|
||||
|
||||
|
||||
@@ -53,11 +53,11 @@ enum class TakeoffState {
|
||||
flight = takeoff_status_s::TAKEOFF_STATE_FLIGHT
|
||||
};
|
||||
|
||||
class Takeoff
|
||||
class TakeoffHandling
|
||||
{
|
||||
public:
|
||||
Takeoff() = default;
|
||||
~Takeoff() = default;
|
||||
TakeoffHandling() = default;
|
||||
~TakeoffHandling() = default;
|
||||
|
||||
// initialize parameters
|
||||
void setSpoolupTime(const float seconds) { _spoolup_time_hysteresis.set_hysteresis_time_from(false, seconds * 1_s); }
|
||||
|
||||
@@ -38,13 +38,13 @@
|
||||
|
||||
TEST(TakeoffTest, Initialization)
|
||||
{
|
||||
Takeoff takeoff;
|
||||
TakeoffHandling takeoff;
|
||||
EXPECT_EQ(takeoff.getTakeoffState(), TakeoffState::disarmed);
|
||||
}
|
||||
|
||||
TEST(TakeoffTest, RegularTakeoffRamp)
|
||||
{
|
||||
Takeoff takeoff;
|
||||
TakeoffHandling takeoff;
|
||||
takeoff.setSpoolupTime(1.f);
|
||||
takeoff.setTakeoffRampTime(2.0);
|
||||
takeoff.generateInitialRampValue(CONSTANTS_ONE_G / 0.5f);
|
||||
|
||||
Reference in New Issue
Block a user