Skip to content

Commit

Permalink
fix gimbal driver for mavlink gimbal v2 input and AUX output
Browse files Browse the repository at this point in the history
The main problem was that during initial negotiation the client would
request the gimbal_manager_information from px4 but px4 would never send
it because in this configuration the device_compid was set to 0.
  • Loading branch information
DanielePettenuzzo authored and Peize-Liu committed Mar 24, 2024
1 parent f1ed718 commit ecc1b32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/gimbal/gimbal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ static int gimbal_thread_main(int argc, char *argv[])
// Reset control as no one is active anymore, or yet.
thread_data.control_data.sysid_primary_control = 0;
thread_data.control_data.compid_primary_control = 0;
thread_data.control_data.device_compid = 0;
// If the output is set to AUX we still want the input to be able to control the gimbal
// via mavlink, so we set the device_compid to 1. This follows the mavlink spec which states
// that the gimbal_device_id should be between 1 and 6.
thread_data.control_data.device_compid = params.mnt_mode_out == 0 ? 1 : 0;
}

InputBase::UpdateResult update_result = InputBase::UpdateResult::NoUpdate;
Expand Down

0 comments on commit ecc1b32

Please sign in to comment.