Commit Graph
14 Commits
Author SHA1 Message Date
Oleksiy Protas b874ce6e44 AP_Mount: debug macro typo 2026-06-25 18:41:52 +10: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
Peter Barker ea7df75f62 AP_Mount: use update_mnt_target in AP_Mount_Scripting
the code is identical to the original topotek code which was moved up except for some line twiddling
2025-12-12 16:12:03 +11: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
Oleksiy Protas 373d4a1e52 AP_Mount: retract servo(s) operation for all backends 2025-08-06 08:47:01 +10: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
Randy Mackay fa5e58d652 AP_Mount: switch to RC_TARGETING on RC input 2024-01-10 09:48:00 +09:00
Asif Khan fd6db1ef45 AP_Mount: add MNT log msg for mount's actual and target angles logging 2023-07-26 17:33:18 +10:00
Randy Mackay db51915e27 AP_Mount: scripting backend loses camera support
drivers should use the camera scripting backend
2023-04-13 07:04:46 +10:00
Randy Mackay 04e8fffc53 AP_Mount: add get_camera_state method 2023-02-16 16:49:51 +09:00
Randy Mackay 0f24b079e4 AP_Mount: add scripting backend 2023-01-31 17:20:37 +09:00