Skip to content

Improve survey gimbal ownership and point tracking - #54

Merged
tridge merged 6 commits into
ArduPilot:masterfrom
tridge:pr-survey2
Oct 21, 2026
Merged

tridge merged 6 commits into
ArduPilot:masterfrom
tridge:pr-survey2

Conversation

@tridge

@tridge tridge commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • use TMPDIR, then TMP, for survey runtime status so MT11 camera-app and web processes share a writable path
  • reject external MAVLink, SIYI, UniGCS, and web pointing while Survey owns the gimbal, while preserving internal survey steering
  • hand control back to pilot or GCS pointing after ownership takeover pauses the survey, and report refused claims while the mount is retracted
  • support MAV_CMD_CAMERA_TRACK_POINT using the existing rectangle tracker and advertise point-tracking capability
  • expand unit, SITL, and documentation coverage for the new behavior

Validation

  • native ARM camera-app and SITL builds passed during survey validation
  • manual-control, UniGCS time, survey lifecycle, MAVLink time, and TMP-path tests passed
  • expanded survey-control SITL coverage passed, including pointing guards, ownership takeover, mode exits, and web lease conflicts
  • moving-flight survey SITL passed at 18 m/s for 45 seconds with 40 unique captures and stream/SD pixel parity
  • point-tracking unit and SITL regression coverage is included in this branch

No additional tests were run solely while opening this PR.

@AP-Review

AP-Review commented Oct 19, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-10-19)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: REQUEST CHANGES

Reviewed at head 83de1b111d.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/ap_cameragimbal/54/1.html#prAP_CameraGimbal-54

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.
@AP-Review

Copy link
Copy Markdown

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 6efbc1740c.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/ap_cameragimbal/54/2.html#prAP_CameraGimbal-54

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)
  • camera_app/src/protocol/survey_server.inc:85: if this zero-rate write fails, nothing retries it, because owned is set anyway and later grants skip the clear, so a direct FC rate can keep driving the gimbal. Keep a pending stop and retry it, as stop_motion() in manual_control.cpp does.

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.

@tridge
tridge merged commit 8f2c50d into ArduPilot:master Oct 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants