-
Notifications
You must be signed in to change notification settings - Fork 20.7k
AP_Mount_MAVLink: forward MAV_CMD_DO_SET_ROI_LOCATION to gimbal #32162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
492f14e
67f414c
5d9d2a7
1aabc91
c756770
aeeb3cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,9 @@ void AP_Mount_MAVLink::handle_gimbal_device_information(const mavlink_message_t | |
| const uint8_t fw_ver_revision = (info.firmware_version & 0x00FF0000) >> 16; | ||
| const uint8_t fw_ver_build = (info.firmware_version & 0xFF000000) >> 24; | ||
|
|
||
| strncpy(vendor_name, info.vendor_name, ARRAY_SIZE(vendor_name)); | ||
| strncpy(model_name, info.model_name, ARRAY_SIZE(model_name)); | ||
|
|
||
| // display gimbal info to user | ||
| GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Mount: %s %s fw:%u.%u.%u.%u", | ||
| info.vendor_name, | ||
|
|
@@ -277,4 +280,28 @@ void AP_Mount_MAVLink::send_target_angles(const MountAngleTarget &angle_rad) | |
| _link->send_message(MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE, (const char*)&pkt); | ||
| } | ||
|
|
||
| // Send MAV_CMD_DO_SET_ROI_LOCATION to gimbal | ||
| void AP_Mount_MAVLink::send_target_location(const Location &roi_loc) | ||
| { | ||
| if (_link == nullptr) { | ||
| return; | ||
| } | ||
|
|
||
| mavlink_command_int_t pkt {}; | ||
| pkt.target_system = _sysid; | ||
| pkt.target_component = _compid; | ||
|
|
||
| if (roi_loc.initialised()) { | ||
| pkt.command = MAV_CMD_DO_SET_ROI_LOCATION; | ||
| pkt.x = roi_loc.lat, // param5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 | ||
| pkt.y = roi_loc.lng, // param6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 | ||
| pkt.z = roi_loc.alt * 0.01f; // param7 / z position: global: altitude in meters (relative or absolute, depending on frame). | ||
| pkt.frame = (uint8_t)roi_loc.get_alt_frame(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does raise the question as to how to handle frames. That doesn't give any sort of frame - so when we go to add the same thing for GIMBAL_DEVICE we need to pay a bit of attention. One would usually assume AMSL here, but it's possible you could say "terrain" and let the gimbal sort itself out with a laser rangefinder. Any suggestions, @hamishwillee ? I think for the time being throwing the problem over to the camera like this will be fine. |
||
| } else { | ||
| pkt.command = MAV_CMD_DO_SET_ROI_NONE; | ||
| } | ||
|
|
||
| _link->send_message(MAVLINK_MSG_ID_COMMAND_INT, (const char*)&pkt); | ||
| } | ||
|
|
||
| #endif // HAL_MOUNT_MAVLINK_ENABLED | ||
Uh oh!
There was an error while loading. Please reload this page.