Repository navigation
Improve survey gimbal ownership and point tracking - #54
Conversation
Previous review (2026-10-19)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for this. I found one blocking issue in the ownership handover. When the survey is granted the gimbal, survey_clear_external() (https://github.com/ardupilot/ap_cameragimbal/pull/54/files#diff-3dbc5ed84dceb7214a2a88f740c9ce05367c9f98ffe4d140ec2965d47833cd90R82) calls stop_tracking_rate(), but that only sends a zero rate if the camera's own ROI controller produced the rate. A GIMBAL_DEVICE_SET_ATTITUDE rate the autopilot sent while the survey was waiting is not cancelled. On MT11 and the SIYI A8/ZR10 backends that rate stays latched, and the new guard (https://github.com/ardupilot/ap_cameragimbal/pull/54/files#diff-862008e059849dbb1a8cdab3af55eb729c57bbfe996836b8f379ad2c54d054bbR2177) now rejects every external stop. The survey sends nothing of its own until it has terrain/telemetry and straight flight. The companion ArduPilot branch grants the claim while a GCS rate target is active and stops sending targets, so this can happen in practice. Sending an unconditional zero rate in survey_clear_external() would fix it. Smaller points: docs/survey-mode.md (https://github.com/ardupilot/ap_cameragimbal/pull/54/files#diff-dc698906e8df9372d9cfa691c0b660ed2add2f3811f6cacf62c69b6ba557e10cR86) says a waiting survey keeps claiming through external pointing. In fact SIYI/UniGCS motion, web PTZ, ROI LOCATION and image tracking started while it waits all pause it via ca_mavlink_server_suspend_gimbal() (https://github.com/ardupilot/ap_cameragimbal/pull/54/files#diff-862008e059849dbb1a8cdab3af55eb729c57bbfe996836b8f379ad2c54d054bbR2083), the ROI handler and update_survey(), and a later grant does not resume it. Either the docs or the code should change. Also, ca_mavlink_server_survey_mode() (https://github.com/ardupilot/ap_cameragimbal/pull/54/files#diff-eb0f28c2ab056405d068f7d7a13cdeebbee275550dbfd07943d55015d3caef42R34) no longer has any callers. Not covered here: the Plane integration test, SITL for targets other than MT11, real gimbal hardware, and a companion-ArduPilot runtime. |
MT11 launchers set TMP=/run because the root filesystem is read-only. Use TMP after TMPDIR so the camera app and web server share a writable survey status path, and cover the directory precedence in CI.
Routine flight-controller setpoints could pause survey capture or replace its target. Reject external MAVLink, SIYI, UniGCS and web pointing before changing controller state while Survey is selected, including when paused. Keep internal steering and ownership-loss checks active; Photo or Video mode restores external control.
…gimbal ArduPilot now sends no gimbal targets while the camera holds the gimbal manager lease, and RC, GCS and mode-change takeover end the lease. Ignore external pointing only while the survey owns the gimbal, so a pilot or GCS takeover steers it once the survey pauses. Pause on a denied renewal after a takeover, and report a claim refused while the mount is retracted.
Track a box of the requested radius around the point with the existing rectangle tracker, and advertise CAMERA_CAP_FLAGS_HAS_TRACKING_POINT. ArduPilot now forwards track point commands, with their radius, to MAVLink cameras.
Ownership grants reject later external stops but previously only cleared rates created by the local ROI controller. Always send zero rates on survey entry and grant, and cover the latched autopilot rate and waiting-state manual takeover in SITL.
Direct MAVLink attitude and rate commands leave a pending claim running, while manual pointing, ROI LOCATION and image tracking pause it until explicitly resumed. Document that distinction and remove the unused survey-mode query superseded by the ownership check.
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head No blockers remain at 6efbc17; one minor error-path point is left. Since the last review, the latched-rate handover blocker is fixed: survey_clear_external() now always sends a zero rate. The waiting-survey docs now match the code, and the unused ca_mavlink_server_survey_mode() is gone. Minor (1)
Not fully reviewed: the Plane integration test, SITL for targets other than MT11, release builds, real gimbal hardware and a companion-ArduPilot runtime were not exercised. |
Summary
TMPDIR, thenTMP, for survey runtime status so MT11 camera-app and web processes share a writable pathMAV_CMD_CAMERA_TRACK_POINTusing the existing rectangle tracker and advertise point-tracking capabilityValidation
No additional tests were run solely while opening this PR.