Skip to content

Commit

Permalink
SITL: use distinct source system for gimbal
Browse files Browse the repository at this point in the history
gimbal was sending mavlink into ArduPilot with the target system's own sysid/compid tuple.  ArduPilot was simply discarding these as its own messages being looped back to it
  • Loading branch information
peterbarker committed Jul 20, 2024
1 parent 16a9e53 commit 2584cfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/SITL/SIM_Gimbal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void Gimbal::param_send(const struct gimbal_param *p)
param_value.param_type = MAV_PARAM_TYPE_REAL32;

uint16_t len = mavlink_msg_param_value_encode_status(vehicle_system_id,
vehicle_component_id,
gimbal_component_id,
&mavlink.status,
&msg, &param_value);

Expand Down Expand Up @@ -364,7 +364,7 @@ void Gimbal::send_report(void)
heartbeat.custom_mode = 0;

len = mavlink_msg_heartbeat_encode_status(vehicle_system_id,
vehicle_component_id,
gimbal_component_id,
&mavlink.status,
&msg, &heartbeat);

Expand Down Expand Up @@ -394,7 +394,7 @@ void Gimbal::send_report(void)
gimbal_report.joint_az = joint_angles.z;

len = mavlink_msg_gimbal_report_encode_status(vehicle_system_id,
vehicle_component_id,
gimbal_component_id,
&mavlink.status,
&msg, &gimbal_report);

Expand Down
3 changes: 3 additions & 0 deletions libraries/SITL/SIM_Gimbal.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class Gimbal {
uint32_t param_send_last_ms;
uint8_t param_send_idx;

// component ID we send from:
const uint8_t gimbal_component_id = 154; // MAV_COMP_ID_GIMBAL

void send_report(void);
void param_send(const struct gimbal_param *p);
struct gimbal_param *param_find(const char *name);
Expand Down

0 comments on commit 2584cfd

Please sign in to comment.