mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-02 05:04:08 +08:00
CA: make flight_phase class variable
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
parent
fd9d0211aa
commit
f75a0bec33
@ -338,28 +338,26 @@ ControlAllocator::Run()
|
||||
|
||||
_armed = vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED;
|
||||
|
||||
ActuatorEffectiveness::FlightPhase flight_phase{ActuatorEffectiveness::FlightPhase::HOVER_FLIGHT};
|
||||
|
||||
// Check if the current flight phase is HOVER or FIXED_WING
|
||||
if (vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
|
||||
flight_phase = ActuatorEffectiveness::FlightPhase::HOVER_FLIGHT;
|
||||
_flight_phase = ActuatorEffectiveness::FlightPhase::HOVER_FLIGHT;
|
||||
|
||||
} else {
|
||||
flight_phase = ActuatorEffectiveness::FlightPhase::FORWARD_FLIGHT;
|
||||
_flight_phase = ActuatorEffectiveness::FlightPhase::FORWARD_FLIGHT;
|
||||
}
|
||||
|
||||
// Special cases for VTOL in transition
|
||||
if (vehicle_status.is_vtol && vehicle_status.in_transition_mode) {
|
||||
if (vehicle_status.in_transition_to_fw) {
|
||||
flight_phase = ActuatorEffectiveness::FlightPhase::TRANSITION_HF_TO_FF;
|
||||
_flight_phase = ActuatorEffectiveness::FlightPhase::TRANSITION_HF_TO_FF;
|
||||
|
||||
} else {
|
||||
flight_phase = ActuatorEffectiveness::FlightPhase::TRANSITION_FF_TO_HF;
|
||||
_flight_phase = ActuatorEffectiveness::FlightPhase::TRANSITION_FF_TO_HF;
|
||||
}
|
||||
}
|
||||
|
||||
// Forward to effectiveness source
|
||||
_actuator_effectiveness->setFlightPhase(flight_phase);
|
||||
_actuator_effectiveness->setFlightPhase(_flight_phase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -209,6 +209,7 @@ private:
|
||||
ParamHandles _param_handles{};
|
||||
Params _params{};
|
||||
bool _has_slew_rate{false};
|
||||
ActuatorEffectiveness::FlightPhase _flight_phase{ActuatorEffectiveness::FlightPhase::HOVER_FLIGHT};
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamInt<px4::params::CA_AIRFRAME>) _param_ca_airframe,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user