this allows a script which converts ArduPilot targets into a wire protocol to send to a gimbal to tell ArduPilot what sorts of targets the script/gimbal can understand.
For example, if the gimbal being controlled can understand a lat/lng/alt, the script can tell ArduPilot that with the new method call.
this allows a script which converts ArduPilot targets into a wire protocol to send to a gimbal to tell ArduPilot what sorts of targets the script/gimbal can understand.
For example, if the gimbal being controlled can understand a lat/lng/alt, the script can tell ArduPilot that with the new method call.
Any commit that updates a submodule pointer must contain no other
changed paths — no other files, no other submodules.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The driver fix (cap wire-data lengths before using as buffer/loop
bounds) means the 10-byte fixed copy is replaced by a length-bounded
copy, so the CRC byte is no longer reachable. The padding workaround
is no longer needed.
This reverts commit 5861babc0a7.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Topotek gimbal_version_analyse: data_buf_len comes from char_to_hex(_msg_buff[5]),
which returns 255 for an invalid hex byte. Return early on that value to reject
the malformed packet; a valid length field is always a hex digit.
Viewpro QUERY_MODEL handler: cap the memcpy to MIN(buffer, data_bytes_received-1)
so a short response cannot cause stale bytes from a previous packet to appear in
_model_name.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The static qualifier on model_name in Siyi and Topotek was wrong: static locals
are shared across all class instances, so two gimbals of the same type would
write into the same buffer. The {} initialiser was also misleading — on a static
local it fires only once at program start, not on each call. Use a plain
stack-allocated buffer (matching Viewpro) so it is correctly zero-initialised
on every call and is instance-safe.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace hardcoded buffer sizes (32, 140) with MAVLINK_MSG_CAMERA_INFORMATION_FIELD_*_LEN
defines in Siyi, Viewpro, Topotek, and Xacti backends. Use strncpy_noterm (which omits
the null terminator only when the string fills the field, as MAVLink allows) in place of
strncpy for copies into vendor_name and model_name send buffers. Also cap the Topotek
gimbal_model_name_analyse strncpy to sizeof(_model_name)-1 to ensure null termination,
and document _model_name as always null-terminated in both Viewpro and Topotek headers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
we prepared a buffer on the stack of the correct length but didn't use it.
The mavlink bindings memcpy out of this buffer according to the spec-defined length, so a buffer of at least that length should be supplied
The _model_name member in Viewpro and Topotek drivers holds a
null-terminated ASCII string, so char[] is the correct type.
Using uint8_t[] required pervasive (char*) and (const char*) casts
at every point of use. Switch to char[] and remove the now-redundant
casts, adding (const uint8_t*) only where the MAVLink API requires it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Making _msg_buff_data_start static constexpr allowed the compiler to
constant-fold the source pointer in the strncpy call, exposing a
-Wstringop-truncation warning: the source buffer extends 62 bytes but
only 10 are copied. The truncation is intentional (bounding to the
destination size), so replace with memcpy + explicit null terminator
to make the intent clear and silence the warning.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The debug flag, contrary to its documentation, enables a debug build,
increasing the size of the binary and changing its contents. Fix the
documentation to describe what it actually does.
Then add the same flag as waf to just add symbols without changing the
actual binary.
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
Address review feedback and follow-up self-review findings.
- Remove the unused polling path
- Fix the FS_G_4000DPS register setting
- Switch counter-based timing checks to wall-clock based logic
- Tighten FIFO buffer allocation/lifetime handling
- Clean up related initialization and SPI transfer documentation
- Replace file-scope constexpr definitions with #define macros for register addresses, bit masks, and scaling factors, matching the style used by other IMU drivers in this library.
- Keep the register and configuration definitions to preserve a clear mapping to the datasheet, even when some are not used in the current code path.
- Avoid unused-const-variable warnings under Clang.
- Rename LSM6DSV_EXPERIMENTAL_PRIMARY_FIFO to LSM6DSV_USE_FIFO for clarity and consistency.
- Remove the unused _accel_range_g member.
No change to the default runtime behavior.
Add SPI device and IMU probe line for the LSM6DSV16X on Pixhawk6C.
The driver auto-detects the chip via WHOAMI so both ICM42688 and
LSM6DSV16X boards are supported without a board type change.