Commit Graph
125 Commits
Author SHA1 Message Date
Peter BarkerandClaude Fable 5 1ee3fdd774 AP_Mount: only set ROI target if home-alt POI calculation succeeds
calculate_poi_at_home_alt() can fail (no AHRS location, gimbal pointing
above the horizon, target beyond 5km); its result was used regardless,
locking the gimbal onto a default-constructed Location.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-16 14:16:19 +09:00
Peter BarkerandClaude Fable 5 9924bcbd66 AP_Mount: fix POI-lock build on boards without terrain
dc9edc7aaa enabled AP_MOUNT_POI_LOCK_ENABLED on all >1MB boards, but
update_poi_lock_target() calls calculate_poi_at_home_alt() and
get_poi(), which are only compiled in when
AP_MOUNT_POI_TO_LATLONALT_ENABLED is set; that option additionally
requires AP_TERRAIN_AVAILABLE, so >1MB boards without filesystem-backed
terrain (e.g. BeastH7) failed to compile.

calculate_poi_at_home_alt() has no terrain dependency, so compile it in
whenever AP_MOUNT_POI_LOCK_ENABLED is set, and only attempt the
terrain-intersection get_poi() refinement when
AP_MOUNT_POI_TO_LATLONALT_ENABLED is set.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-16 14:16:19 +09:00
Peter Barker 241f3566e0 AP_Mount: add support for MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET 2026-06-03 09:54:28 +10:00
Peter Barker 6e37731eef AP_Mount: handle no-valid-RC-input and RC failsafe 2026-05-14 12:40:21 +10:00
Peter BarkerandClaude Sonnet 4.6 3a92dded1e AP_Mount: factor send_camera_information into base class
Move the common mavlink_msg_camera_information_send call into
AP_Mount_Backend::send_camera_information(), following the same pattern as
send_gimbal_device_attitude_status(). Backends supply their specific data
via virtual getter overrides: get_camera_vendor_name(), get_camera_model_name(),
get_camera_firmware_version(), get_camera_focal_length_mm(), get_camera_lens_id(),
and get_camera_cap_flags(). Backends suppress sending by leaving
has_camera_information() returning false (the base class default); backends
with a known camera override it to return true. Siyi's previous
!_fw_version.received guard is dropped — the message now sends with
fw_version=0 until the version is received.

Also fixes the misaligned parameter comments in Viewpro's send call (focal_length
was labelled as sensor_size_h), since there is now only one copy of those comments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 08:46:03 +09:00
Peter BarkerandClaude Sonnet 4.6 7ae671e53f AP_Mount: gate get_angle/rate_target behind AP_SCRIPTING_ENABLED; scripting backend fully self-contained
get_angle_target() and get_rate_target() in AP_Mount_Backend and AP_Mount
are now declared and defined only when AP_SCRIPTING_ENABLED is set,
matching the existing treatment of get_location_target().

AP_Mount_Backend::write_log() read mnt_target directly when scripting is
not compiled in, avoiding the dependency on those methods.

AP_Mount_Scripting gains its own ScriptTargetType enum and
_angle_target/_rate_target members.  send_target_angles() and
send_target_rates() now store the pushed target into those members.
get_angle_target() / get_rate_target() overrides return the stored values,
removing the previous hack of stamping mnt_target.target_type = ANGLE
inside send_target_angles().  _script_target_type is reset to NONE at the
top of each update() cycle so stale targets are never returned.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 15:46:16 +09:00
Peter BarkerandClaude Sonnet 4.6 14d09599de AP_Mount: fix scripting backend for non-angle target modes
Scripting backends (e.g. mount-djirs2-driver.lua) poll get_angle_target()
and get_rate_target() rather than receiving pushed targets.  Before this
fix, get_angle_target() returned false for RETRACT, NEUTRAL, and LOCATION
modes because it only checked target_type == ANGLE, even though
send_target_to_gimbal() had already written the converted angle into
mnt_target.angle_rad.

Fix by calling send_target_to_gimbal() from AP_Mount_Scripting::update()
(matching every other backend) and implementing send_target_angles() to
stamp mnt_target.target_type = ANGLE after send_target_to_gimbal() has
written the converted value into mnt_target.angle_rad.  This makes
get_angle_target() return the converted value without any changes to the
base class.

Declare NATIVE_ANGLES_AND_RATES_ONLY so that RATE targets are not
converted to angles internally; the Lua script receives them via
get_rate_target() and performs its own integration.  send_target_rates()
is a no-op because mnt_target.target_type stays RATE, which is all
get_rate_target() checks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 15:46:16 +09:00
Bob Long 801375751c AP_Mount: fix get_angle_target for converted cmds
If a backend gets the target mode converted to angle, get_angle_target
will return the converted angles. This fixes scripting backends that
relied on get_angle_target
2026-04-02 15:46:16 +09:00
Karen Simeon df03e4636c AP_Mount_Backend: set RC rate yaw_is_ef flag 2026-03-27 22:47:43 +11:00
Karen Simeon 1cc1f162a0 AP_Mount_Backend: process clear roi in send_target_to_gimbal 2026-02-21 08:10:51 +11:00
Karen Simeon a2a2b2705b AP_Mount_Backend: move send_target_location for set_roi to send_target_gimbal 2026-02-21 08:10:51 +11:00
Karen Simeon 361455c7ac AP_Mount_MAVLink: forward MAV_CMD_DO_SET_ROI_LOCATION to gimbal 2026-02-21 08:10:51 +11:00
Henry Wurzburg 9058697b3e AP_Mount: add ability to compute POI as a fallback without Terrain enabled 2026-02-04 22:55:57 +11:00
Willian Galvani 006c460177 AP_Mount: check FPV_LOCK bit for both angle and rate modes 2026-01-26 19:46:57 -05:00
Henry Wurzburg eec2cfb885 AP_Mount: add mount POI lock Aux Func/Switch 2026-01-19 18:29:05 -05:00
Henry Wurzburg a04997d1e4 AP_Mount:add roll/pitch bf lock to select gimbals 2026-01-08 09:05:59 +11:00
Peter Barker 7ff7f887e5 AP_Mount: add MountTargetType::RETRACTED / MountTargetType::NEUTRAL 2026-01-06 08:35:44 +09:00
Peter Barker 2bca55e747 AP_Mount: move mavlink target timeout into update_mnt_target 2026-01-06 08:31:50 +09:00
Henry Wurzburg cef6eb7802 AP_Mount:make FPV_LOCK option not require reboot on deselect 2025-12-26 18:19:59 -06:00
Henry Wurzburg f71059d6d6 AP_Mount:Ehance yaw_lock to use captured heading 2025-12-24 09:10:18 +09:00
Peter Barker b2b274ac26 AP_Mount: remove "fresh" as a concept
each of the affected gimbals can already send angle data at the rate at which we call these functions; we don't need to treat the retracted and neutral positions any more specially than we treat normal angle targets
2025-12-23 09:06:28 +09:00
Peter Barker c6cea72c53 AP_Mount: add send_target_to_gimbal on AP_Mount_Backend
calls virtual methods which sends commands to the gimbal
2025-12-20 18:55:39 +11:00
Peter Barker 4210dc0190 AP_Mount: split MountTarget into MountAngleTarget and MountRateTarget 2025-12-19 23:05:44 +11:00
Peter Barker b627fdaa91 AP_Mount: inline get_rc_target
this doesn't really buy us anything, we can just update the mount target directly
2025-12-18 09:21:37 +09:00
Peter Barker c93df648c0 AP_Mount: use update_mnt_target in SToRM32s, XFRobot and CADDx
the only difference between these and the method which was previously factored up was the setting of this boolean flag indicating there was changed data to send to the gimbal.

This PR preserves the existing bug where there's up to a 1 second pause between retract mode being entered and the command being sent to the mount.
2025-12-16 11:04:12 +11:00
Peter Barker d9f8b46ffb AP_Mount: create an update_mnt_target method to factor code up 2025-12-09 08:55:13 +09:00
Henry Wurzburg 733ba5beac AP_Mount: CADDX mount R/P earth frame lock options and control 2025-12-02 13:58:02 +09:00
Peter Barker deeb977ff1 AP_Mount: make AP_Logger quiet_nanf methods static 2025-11-29 13:30:48 -06:00
neo-0007 c8fd61f218 AP_Mount: fix get_location_target and remove unnecessary state variables
Fix the broken get_location_target method and move it up to generic
backend so that can be used by all backends

Remove flag variables that were used to determine valid or invalid
Location variables and use the initialized() method instead.

Should fix #31535

Signed-off-by: neo-0007 <hrishikeshgohain123@gmail.com>
2025-11-27 10:14:20 +11:00
Henry Wurzburg 66aafabacc AP_Mount:add warning for no location for GPS_POINT 2025-11-15 09:25:59 +09:00
Ep Pravitra cdcb27bd33 AP_Mount: send zero rate command if the rate command was not received longer than a certain time. 2025-09-16 16:26:22 +09:00
Oleksiy Protas 373d4a1e52 AP_Mount: retract servo(s) operation for all backends 2025-08-06 08:47:01 +10:00
Peter Barker 60cf43135e AP_Mount: use get_roll_deg in place of degrees(get_roll_rad) etc. 2025-08-05 09:00:08 +09:00
Peter Barker 461faa1db8 AP_Mount: rename AHRS get_roll etc accessors to include _rad 2025-06-05 17:28:41 +10:00
Peter Barker ce8bc5f3ab AP_Mount: replace ToRad with radians and ToDeg with degrees 2025-05-29 11:24:56 +10:00
Peter Barker 786df975f0 AP_Mount: remove MOUNT_CONFIGURE and MOUNT_CONTROL support 2025-01-03 14:18:25 +11:00
Peter Barker 99e314f49a AP_Mount: tidy header includes
our pattern is to include the config file and then use the relevant define, with nothing in between
2024-11-12 13:02:43 +11:00
Peter Barker dcc04d685f AP_Mount: factor out update_mnt_target_from_rc_target from servo, use it elsewhere
this gives all backends the neutral-on-RC-failsafe behaviour
2024-11-12 11:01:21 +11:00
Nick Exton 8b5539c055 AP_Mount: Clarify angle frames of set_angle_target() 2024-05-21 14:28:38 +10:00
Tim Tuxworth 495726344c AP_Mount: Do not override default mode when first connecting to RC 2024-04-12 12:18:33 +09:00
davidsastresas 0b7710420b AP_Mount: fix gimbal-device-attitude-status yaw frame flag 2024-03-26 10:49:30 +11:00
Randy Mackay affc1b4eb4 AP_Mount: get-gimbal-device-flags reports lock state 2024-03-26 10:49:30 +11:00
Randy Mackay 4755a60863 AP_Mount: RC targeting mode lock state from previous mode
This leads to smoother transitions between RC and GCS control
2024-03-26 10:49:30 +11:00
Peter Barker d33cc2847d AP_Mount: correct compilation with GCS disabled 2024-02-13 20:56:09 +11:00
Peter Barker a6db3bd069 AP_Mount: allow compilation with HAL_LOGGING_ENABLED false 2024-01-17 18:25:55 +11:00
Peter Barker 49c697221a AP_Mount: make AHRS attitude member variables private 2024-01-14 12:47:47 +11:00
davidsastresas 462eb46c8b AP_Mount.cpp: send gimbal_manager_status msg when control changes
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>

By default we are sending this message at 0.2 Hz. This is totally
fine as no more rate is needed, but whenever control changes it
is interesting to notify as soon as possible, so the rest of the
mavlink network understands the change in control as soon as
possible
2024-01-10 18:26:47 +11:00
Randy Mackay fa5e58d652 AP_Mount: switch to RC_TARGETING on RC input 2024-01-10 09:48:00 +09:00
Peter Barker 4f4e6d646c AP_Mount: validate modes before setting them 2023-11-17 11:45:38 +11:00
Andrew Tridgell 8ff2fa4fd9 AP_Mount: added gimbal rates for SIYI
this helps diagnose issues with gyro bias versus control when camera
is spinning
2023-11-16 16:57:49 +11:00