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:
Julian Oes
2024-06-06 15:32:50 +12:00
parent b9aa8818a4
commit 3710a9ef6e
4 changed files with 10 additions and 14 deletions
+4 -2
View File
@@ -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",