Skip to content

Commit

Permalink
Gimbal: send commands to gimbal component
Browse files Browse the repository at this point in the history
We shouldn't just send the commands to the vehicle because the gimbal
manager might be implemented on any component, not just the autopilot.
  • Loading branch information
julianoes authored and Davidsastresas committed Aug 19, 2024
1 parent dc26c96 commit c2ed1b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Gimbal/GimbalController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ void GimbalController::sendPitchBodyYaw(float pitch, float yaw, bool showError)
| GIMBAL_MANAGER_FLAGS_YAW_IN_VEHICLE_FRAME;

_vehicle->sendMavCommand(
_vehicle->compId(),
_activeGimbal->managerCompid()->rawValue().toUInt(),
MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW,
showError,
pitch,
Expand Down Expand Up @@ -561,7 +561,7 @@ void GimbalController::sendPitchAbsoluteYaw(float pitch, float yaw, bool showErr
| GIMBAL_MANAGER_FLAGS_YAW_IN_EARTH_FRAME;

_vehicle->sendMavCommand(
_vehicle->compId(),
_activeGimbal->managerCompid()->rawValue().toUInt(),
MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW,
showError,
pitch,
Expand Down Expand Up @@ -609,7 +609,7 @@ void GimbalController::sendPitchYawFlags(uint32_t flags)
const bool yaw_in_vehicle_frame = _yawInVehicleFrame(flags);

_vehicle->sendMavCommand(
_vehicle->compId(),
_activeGimbal->managerCompid()->rawValue().toUInt(),
MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW,
true,
_activeGimbal->absolutePitch()->rawValue().toFloat(),
Expand All @@ -628,7 +628,7 @@ void GimbalController::acquireGimbalControl()
return;
}
_vehicle->sendMavCommand(
_vehicle->compId(),
_activeGimbal->managerCompid()->rawValue().toUInt(),
MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE,
true,
_mavlink->getSystemId(), // Set us in primary control.
Expand All @@ -647,7 +647,7 @@ void GimbalController::releaseGimbalControl()
return;
}
_vehicle->sendMavCommand(
_vehicle->compId(),
_activeGimbal->managerCompid()->rawValue().toUInt(),
MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE,
true,
-3.f, // Release primary control if we have control
Expand Down

0 comments on commit c2ed1b5

Please sign in to comment.