mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
commander: run arming checks on _offboard_control_mode_sub update
This commit is contained in:
parent
6ee2252b8c
commit
3d1da597dd
@ -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
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user