Mavlink: Implemented SET_CAMERA_ZOOM

This commit is contained in:
David Jablonski
2020-03-30 17:10:36 +02:00
committed by Julian Oes
parent 73f7243bc8
commit 6bd191a24e
8 changed files with 42 additions and 0 deletions
+21
View File
@@ -521,6 +521,27 @@ void MavlinkReceiver::handle_message_command_both(mavlink_message_t *msg, const
result = vehicle_command_ack_s::VEHICLE_RESULT_DENIED;
}
} else if (cmd_mavlink.command == MAV_CMD_SET_CAMERA_ZOOM) {
struct actuator_controls_s actuator_controls = {};
actuator_controls.timestamp = hrt_absolute_time();
for (size_t i = 0; i < 8; i++) {
actuator_controls.control[i] = NAN;
}
switch ((int)(cmd_mavlink.param1 + 0.5f)) {
case vehicle_command_s::VEHICLE_CAMERA_ZOOM_TYPE_RANGE:
actuator_controls.control[actuator_controls_s::INDEX_CAMERA_ZOOM] = cmd_mavlink.param2 / 50.0f - 1.0f;
break;
case vehicle_command_s::VEHICLE_CAMERA_ZOOM_TYPE_STEP:
case vehicle_command_s::VEHICLE_CAMERA_ZOOM_TYPE_CONTINUOUS:
case vehicle_command_s::VEHICLE_CAMERA_ZOOM_TYPE_FOCAL_LENGTH:
default:
send_ack = false;
}
_actuator_controls_pubs[actuator_controls_s::GROUP_INDEX_GIMBAL].publish(actuator_controls);
} else {
send_ack = false;