mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
Do not run transition flight task when not enable altitude control
This commit is contained in:
@@ -44,8 +44,6 @@ bool FlightTaskTransition::updateInitialize()
|
|||||||
|
|
||||||
bool FlightTaskTransition::activate(const vehicle_local_position_setpoint_s &last_setpoint)
|
bool FlightTaskTransition::activate(const vehicle_local_position_setpoint_s &last_setpoint)
|
||||||
{
|
{
|
||||||
_transition_altitude = PX4_ISFINITE(last_setpoint.z) ? last_setpoint.z : _position(2);
|
|
||||||
_transition_yaw = PX4_ISFINITE(last_setpoint.yaw) ? last_setpoint.yaw : _yaw;
|
|
||||||
return FlightTask::activate(last_setpoint);
|
return FlightTask::activate(last_setpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,4 @@ public:
|
|||||||
bool activate(const vehicle_local_position_setpoint_s &last_setpoint) override;
|
bool activate(const vehicle_local_position_setpoint_s &last_setpoint) override;
|
||||||
bool updateInitialize() override;
|
bool updateInitialize() override;
|
||||||
bool update() override;
|
bool update() override;
|
||||||
|
|
||||||
private:
|
|
||||||
float _transition_altitude = 0.0f;
|
|
||||||
float _transition_yaw = 0.0f;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -171,7 +171,8 @@ void FlightModeManager::start_flight_task()
|
|||||||
_flight_tasks.switchTask(FlightTaskIndex::None);
|
_flight_tasks.switchTask(FlightTaskIndex::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_vehicle_status_sub.get().in_transition_mode) {
|
// Only run transition flight task if altitude control is enabled (e.g. in Altitdue, Position, Auto flight mode)
|
||||||
|
if (_vehicle_status_sub.get().in_transition_mode && _vehicle_control_mode_sub.get().flag_control_altitude_enabled) {
|
||||||
|
|
||||||
should_disable_task = false;
|
should_disable_task = false;
|
||||||
FlightTaskError error = _flight_tasks.switchTask(FlightTaskIndex::Transition);
|
FlightTaskError error = _flight_tasks.switchTask(FlightTaskIndex::Transition);
|
||||||
|
|||||||
Reference in New Issue
Block a user