mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-05 10:00:34 +08:00
gimbal: fix auto RC and MAVLink mode
This fixes various edge cases when input is set to both: RC and MAVLink gimbal protocol v2. Specifically: - We no longer immediately reset primary control if there is no update, otherwise this will reset immediately after an commands. - Talking of commands: GIMBAL_MANAGER_CONFIGURE no longer switches control to MAVLink but only an actual incoming setpoint command does. - And incoming setpoint command only triggers UpdatedActiveOnce which means we will check RC again afterwards and if there is big movement switch back to RC. That's the intuitive thing to do until we have better reporting about who/what is in control. - Also, with RC we no longer always set us to be in control but only on major movement.
This commit is contained in:
@@ -856,7 +856,9 @@ InputMavlinkGimbalV2::_process_command(ControlData &control_data, const vehicle_
|
||||
control_data.compid_primary_control = new_compid_primary_control;
|
||||
}
|
||||
|
||||
return UpdateResult::UpdatedActive;
|
||||
// Just doing the configuration doesn't mean there is actually an update to use yet.
|
||||
// After that we still need to have an actual setpoint.
|
||||
return UpdateResult::NoUpdate;
|
||||
|
||||
// TODO: support secondary control
|
||||
// TODO: support gimbal device id for multiple gimbals
|
||||
@@ -880,7 +882,7 @@ InputMavlinkGimbalV2::_process_command(ControlData &control_data, const vehicle_
|
||||
_ack_vehicle_command(vehicle_command,
|
||||
vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED);
|
||||
|
||||
return UpdateResult::UpdatedActive;
|
||||
return UpdateResult::UpdatedActiveOnce;
|
||||
|
||||
} else {
|
||||
PX4_INFO("GIMBAL_MANAGER_PITCHYAW from %d/%d denied, in control: %d/%d",
|
||||
|
||||
Reference in New Issue
Block a user