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>
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>
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>
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>
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>
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
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
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.
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>
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