mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 13:02:25 +08:00
commander: run arming checks on _offboard_control_mode_sub update
This commit is contained in:
@@ -1708,6 +1708,8 @@ void Commander::run()
|
||||
|
||||
manualControlCheck();
|
||||
|
||||
offboardControlCheck();
|
||||
|
||||
// data link checks which update the status
|
||||
dataLinkCheck();
|
||||
|
||||
@@ -2407,7 +2409,6 @@ void Commander::control_status_leds(bool changed, const uint8_t battery_warning)
|
||||
void Commander::updateControlMode()
|
||||
{
|
||||
_vehicle_control_mode = {};
|
||||
_offboard_control_mode_sub.update();
|
||||
mode_util::getVehicleControlMode(_arm_state_machine.isArmed(), _vehicle_status.nav_state,
|
||||
_vehicle_status.vehicle_type, _offboard_control_mode_sub.get(), _vehicle_control_mode);
|
||||
_vehicle_control_mode.timestamp = hrt_absolute_time();
|
||||
@@ -2782,6 +2783,16 @@ void Commander::manualControlCheck()
|
||||
}
|
||||
}
|
||||
|
||||
void Commander::offboardControlCheck()
|
||||
{
|
||||
if (_offboard_control_mode_sub.update()) {
|
||||
if (_vehicle_status_flags.offboard_control_signal_lost) {
|
||||
// Run arming checks immediately to allow for offboard mode activation
|
||||
_status_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Commander::send_parachute_command()
|
||||
{
|
||||
vehicle_command_s vcmd{};
|
||||
|
||||
@@ -133,6 +133,8 @@ private:
|
||||
|
||||
void manualControlCheck();
|
||||
|
||||
void offboardControlCheck();
|
||||
|
||||
/**
|
||||
* @brief Handle incoming vehicle command relavant to Commander
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user