Commit Graph

36682 Commits

Author SHA1 Message Date
Thomas Watson 56593574a9 AP_DroneCAN: DNA_Server: miscellaneous cleanup 2024-07-30 09:49:43 +10:00
Thomas Watson 5e0bb99dbb AP_DroneCAN: DNA_Server: fix handling of empty entry
Replaces the check for a CRC of 0 with a check that the hwid is 0.
Substantially reduces 1/256 chance that a particular node ID couldn't be
stored.
2024-07-30 09:49:43 +10:00
Thomas Watson 9aeab7b424 AP_DroneCAN: DNA_Server: use 0 as unknown ID
Slightly reduces flash usage and probably is clearer.
2024-07-30 09:49:43 +10:00
Thomas Watson 8d57533f1c AP_DroneCAN: DNA_Server: fix cases involving use of invalid node IDs 2024-07-30 09:49:43 +10:00
Thomas Watson a9317b1a07 AP_DroneCAN: correct and validate allowed NODE range
Node IDs >= 128 don't exist, and IDs 126 and 127 are "reserved for
network maintenance tools" according to the spec.
2024-07-30 09:49:43 +10:00
Thomas Watson 485a9387b1 AP_DroneCAN: DNA_Server: clean up storage failure handling
The StorageManager read_block/write_block methods only return failure if
an out of bounds access is performed. Assert statically that this does
not happen.

Also remove the now-impossible failed to add node state.
2024-07-30 09:49:43 +10:00
Thomas Watson cd8519321b AP_DroneCAN: DNA_Server: search for valid nodes after magic check
Ensures the occupation mask doesn't get populated with junk if the magic
is not valid.
2024-07-30 09:49:43 +10:00
Thomas Watson c1f59186fa AP_DroneCAN: DNA_Server: make reset method private 2024-07-30 09:49:43 +10:00
Ian Burwell 6b4e11090c AP_Scripting: Add BQ40Z shutdown example
This example intercepts PREFLIGHT_REBOOT_SHUTDOWN COMMAND_LONG's and if
param1==2, it shuts down the BQ40Z smart battery BMS. Otherwise it
passes through the COMMAND_LONG as a COMMAND_INT (this required updating
the gcs:run_command_int to return a MAV_RESULT rather than a bool).
2024-07-30 09:40:10 +10:00
Ian Burwell 9d34fa2a5e AP_Scripting: Add I2C transfer bindings
This adds bindings for an I2CDevice's transfer() function, an example,
and removes the nil return hint from the get_device() docs as it never
actually returns nil.
2024-07-30 09:40:10 +10:00
Iampete1 838fbc2b3b AP_Param: Fix `ENABLE_DEBUG` enabled error with no embedded param 2024-07-30 08:51:09 +10:00
Bob Long 64fc60ce32 AP_HAL_SITL: initialize rcout safety state
This allows BRD_SAFETY_DEFLT=1 to work correctly for SITL.
2024-07-30 08:44:31 +10:00
BLash d7ecf5fbc5 AP_ExternalAHRS_VectorNav: Consolidate EAH3 definition to single method
Resolve SITL failures due to multiply defined logger message by pulling the call to a single method
2024-07-29 15:52:29 +10:00
BLash 1d1bb5724e AP_ExternalAHRS_VectorNav: Address review comments
Remove unnecessary header
Switch parameters to default initialization
Change pointer casting to prevent a const_cast, and remove doubled sync byte when echoing ASCII messages
Fix Valgrind report by preventing use of nmea_printf on buffers which may not be null-terminated
2024-07-29 15:52:29 +10:00
BLash 50980ee03e AP_ExternalAHRS_VectorNav: Update SIM to match new message definitions
Redefine messages to 3 INS packets, and send as appropriate
Resolve SITL failures due to too-long logger message headers
2024-07-29 15:52:29 +10:00
BLash d4ca5fe868 AP_ExternalAHRS_VectorNav: Split IMU and EKF message
In AHRS Mode, split the single message to an IMU packet and an AHRS packet; in EKF Mode, split the two messages into an IMU message, an EKF packet, and a GNSS packet.
Simplify message header definition to consolidate and eliminate the need for static asserts
Update healthy logic and use to represent new packet structure
Replace EAH3 message with messages per-packet
Add Ypr as configured output in the EKF message
2024-07-29 15:52:29 +10:00
George Zogopoulos e227187e72 AP_TECS: Converted parameter TKOFF_MODE to TKOFF_OPTIONS 2024-07-29 15:50:32 +10:00
George Zogopoulos b163e13964 AP_TECS: Fixes to reset state
These concern the TAKEOFF flight stage and address #27147.

* Logging metadata fixes
* Disabled continuous TECS reset during takeoff
* Fixed bug in reached_speed_takeoff calculation
* Limited SPDWEIGHT=2 to only first part of takeoff climb
* _post_TO_hgt_offset set to constant
* Takeoff I-gain now defaults to 0 and is used
* Use at least TRIM_THROTTLE during the climb
* Updated description of TECS_TKOFF_IGAIN with new behaviour
* Forced max throttle while below TKOFF_LVL_ALT
* Added throttle constraints in no-airspeed mode

Additionally, set_min_throttle() has been created, that allows one to
set the minimum TECS throttle for the next update_pitch_throttle() loop.
Additionally, the throttle limits system has been reworked. TECS will
receive external throttle limits from Plane and will always take them
into account and respect them.
2024-07-29 15:50:32 +10:00
cuav-chen2 08c8ef379b HAL_ChibiOS: Added support for CUAV-7-Nano flight controller 2024-07-29 12:25:53 +10:00
Peter Barker 317fab2f19 AP_Mission: add and use an option_is_set method 2024-07-29 10:37:52 +10:00
Thomas Watson bbde876353 hwdef: remove EKF opinion from FlywooF745
No effect as lines have always been commented out, but not useful and
EKF2 is not something to encourage.

Verified no compiler output change.
2024-07-29 09:32:22 +10:00
Peter Barker 16c2e23ee7 AP_Mount: allow AP_MOUNT_BACKEND_DEFAULT_ENABLED to be overridden 2024-07-28 12:00:02 +10:00
Peter Barker debf3cb28e hwdef: SpeedyBeeF405WING: restrict mount support to the servo gimbal 2024-07-28 12:00:02 +10:00
Peter Barker 84efdd5700 hwdef: SpeedyBeeF405WING: remove landing gear support 2024-07-28 12:00:02 +10:00
Andrew Tridgell 2ce6532698 AP_Math: updated EulerAngles.pdf link 2024-07-27 11:14:10 +10:00
Andrew Tridgell 98733882f5 AP_Math: added comments and a test for euler ordering
our main euler functions did not have a comment on the ordering
convention
2024-07-27 11:14:10 +10:00
yaapu 5b7aaae008 AP_Frsky_Telem: fix for HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL = 0 2024-07-26 20:12:40 +10:00
muramura e86d5e113f AP_Filesystem: BOOL for binary types 2024-07-26 20:12:05 +10:00
Leonard Hall bb1758ecb1 AC_Autotune: Add ABORT state for consistency between tests 2024-07-26 20:11:42 +10:00
Leonard Hall bea2c5b59b AC_Autotune: Clean up Multi Variables and non functional changes 2024-07-26 20:11:42 +10:00
Peter Barker 78dc5a7b5d hwdef: FlyingMoonF427: remove MAX7456 2024-07-26 20:10:38 +10:00
Peter Barker 5b5dd638c1 hwdef: FlyingMoonH743: remove MAX7456 2024-07-26 20:10:38 +10:00
Randy Mackay 44b3217178 AP_Camera: type param desc gets topotek 2024-07-26 12:55:24 +10:00
Randy Mackay 62a03f18d8 AP_Camera: type param desc gets viewpro and xacti 2024-07-26 12:55:24 +10:00
Andy Piper a560f89b35 AP_HAL_ChibiOS: update logging docs for 2RAW H743 2024-07-26 10:39:38 +10:00
Andy Piper 74f72db4eb AP_HAL_ChibiOS: rename 2RAWH743 to IFLIGHT_2RAW_H7 2024-07-26 10:39:38 +10:00
Andy Piper 278595cf83 AP_HAL_ChibiOS: add support for sdcard to iFlight 2RAW 2024-07-26 10:39:38 +10:00
Peter Barker 7f97e897e2 AP_Camera: add sanity check for Siyi lens change 2024-07-25 12:18:51 +10:00
muramura f1e67ba747 AP_Mount: SWITCH statement to table reference 2024-07-25 12:18:51 +10:00
muramura 9f2da4a763 AP_Mission: Change division to multiplication 2024-07-25 11:33:55 +10:00
Peter Barker a0ac6f22df AP_CANManager: use a switch statement to tidy driver allocation 2024-07-25 11:09:07 +10:00
Andrew Tridgell 23f628f26b hwdef: fixes for BotBloxSwitch 2024-07-25 10:57:04 +10:00
Leonard Hall 2ab3d0b3b0 AC_AttitudeControl: Add Landed Gain Backoff 2024-07-25 09:50:35 +10:00
muramura 84ff78f5c6 AP_Notify: Perform common checks first 2024-07-25 09:50:03 +10:00
James O'Shannessy 66817e207f AP_InertialSensor: Check the gyro/accel id has not been previously registered
If the Gyro/Accel ID is already in the registered list, do not try to add it again.

This stops an issue seen on a CubeOrangePlus BG3 where, during the very first boot after a parameter wipe, software incorrectly registers a fourth IMU.
The Fourth IMU is registered because the AUX IMU is the same DevID as the third ICM45686.
2024-07-25 09:49:35 +10:00
Luca Pescante 028017e38e ArduCopter/RC_Channel: add option 219
(Transmitter Tuning)
2024-07-25 09:40:13 +10:00
bugobliterator 8a4b925c71 AP_HAL_ChibiOS: add support for PPP between CubeRed Primary and Secondary 2024-07-25 09:37:16 +10:00
bugobliterator 4909ad4e4f AP_Networking: add debug code for PPP 2024-07-25 09:37:16 +10:00
bugobliterator 993d694fbb AP_HAL_ChibiOS: allow setup for low noise clock mismatch tolerant UART line 2024-07-25 09:37:16 +10:00
bugobliterator 025077b6f4 AP_HAL_ChibiOS: add support for recording UART Rx errors 2024-07-25 09:37:16 +10:00
mduclehcm 25a406e633 AP_Mount: Conditionally define `serial_instance` to fix unused variable compile error
- Wrapped the definition of `serial_instance` with preprocessor directives to ensure it is only defined when necessary.
- This resolves the compile error caused by the unused variable when no features requiring `serial_instance` are enabled.
2024-07-25 09:35:46 +10:00
Paul Riseborough 4904c718a5 AP_NavEKF3: Fix yaw alignment bug
When the  yaw is aligned to the GPS yaw, the recordYawResetsCompleted() function should be called the same as for any other yaw reset.
2024-07-25 09:34:48 +10:00
rishabsingh3003 07b6c57173 AP_TemperatureSensor: Extend analog sensor backend to 5th order polynomial 2024-07-24 17:53:08 +10:00
rishabsingh3003 3ab3388752 AP_ESC_Telem: Add ifndef before defining ESC_TELEM_MAX_ESCS 2024-07-24 17:45:24 +10:00
Randy Mackay 2b64787099 AP_Mount: topotek spelling fix 2024-07-24 17:28:24 +10:00
Randy Mackay cfd1e98333 AP_Mount: topotek safely parses version 2024-07-24 17:28:24 +10:00
Randy Mackay 1b77751aef AP_SmartRTL: add point made public 2024-07-24 17:22:44 +10:00
Henry Wurzburg 76abc6850f Filter: add "source" to option 5 2024-07-24 17:20:30 +10:00
Randy Mackay a1579bc31e SITL: integrate SlungPayload 2024-07-24 17:09:06 +10:00
Randy Mackay 5c2b758f42 SITL: add SlungPayload 2024-07-24 17:09:06 +10:00
George Zogopoulos e170710de9 SITL: Glider improvements
Fixed balloon going below ground.
Enabled glider torque logging.
2024-07-24 17:03:48 +10:00
Peter Barker 478d26d69c AP_Notify: rename LED_1 pin define to AP_NOTIFY_GPIO_LED_1_PIN 2024-07-24 09:13:50 +10:00
Peter Barker a4577685a7 AP_HAL_ChibiOS: rename LED_1 pin define to AP_NOTIFY_GPIO_LED_1_PIN 2024-07-24 09:13:50 +10:00
Peter Barker cc190f537f AP_OSD: correct compilation with AP_RRSI_ENABLED false
Co-authored-by: David Buzz <davidbuzz@gmail.com>
2024-07-24 09:11:39 +10:00
Peter Barker 1afa801b19 AP_LTM_Telem: correct compilation with AP_RRSI_ENABLED false
Co-authored-by: David Buzz <davidbuzz@gmail.com>
2024-07-24 09:11:39 +10:00
Andy Piper ccfbfddf7e AC_Fence: address minor review comments 2024-07-24 08:24:06 +10:00
Andy Piper 55075961b2 AP_Mission: address minor review comments 2024-07-24 08:24:06 +10:00
Andrew Tridgell 68f2593089 AC_Fence: fixed FENCE_AUTOENABLE=2
needs to auto-enable on takeoff complete
2024-07-24 08:24:06 +10:00
Andy Piper 5bc3727145 AC_Fence: support FENCE_OPTIONS on copter 2024-07-24 08:24:06 +10:00
Andy Piper 29a320b310 AC_Avoidance: correctly set back away speed for minimum alt fences 2024-07-24 08:24:06 +10:00
Andy Piper 37e0923ec2 AP_Arming: allow precise wording of fence pre-arm messages 2024-07-24 08:24:06 +10:00
Andy Piper f0456f29dd AC_Fence: always disable Min Alt fence on landing
allow precise pre-arm messages
2024-07-24 08:24:06 +10:00
Andy Piper 255fac215f AP_Mission: generic fence handling in missions 2024-07-24 08:24:06 +10:00
Andy Piper 04dd7de1ed AC_Fence: disable fences for landing by suppressing in the fence check rather than using a state machine
simplify takeoff auto-enablement
2024-07-24 08:24:06 +10:00
Andy Piper d5c6f3fe06 AC_Fence: add reset_fence_floor_enable() and use it in plane when landing is aborted 2024-07-24 08:24:06 +10:00
Peter Barker a4c7819117 AC_Fence: clear breach of disabled fence
skip breach checks if no fences
correct initialisation of _num_fences in the case of no fences in eeprom
2024-07-24 08:24:06 +10:00
Andy Piper 3fabec4158 AP_Arming: ensure fence enablement on arming is inverted on disarming 2024-07-24 08:24:06 +10:00
Andy Piper 174d5f07bb AC_Fence: ensure fence enablement on arming is inverted on disarming
correct detection of polyfence
2024-07-24 08:24:06 +10:00
Andy Piper f0f8187c7f AC_Fence: add ability to auto-enable fence floor while doing fence checks
control copter floor fence with autoenable
autoenable floor fence with a margin
check for manual recovery only after having checked the fences
make auto-disabling for minimum altitude fence an option
output message when fence floor auto-enabled
re-use fence floor auto-enable/disable from plane
auto-disable on landing
do not update enable parameter when controlling through mavlink
make sure get_enabled_fences() actually returns enabled fences.
make current fences enabled internal state rather than persistent
implement auto options correctly and on copter
add fence names utility
use ExpandingString for constructing fence names
correctly check whether fences are enabled or not and disable min alt for landing in all auto modes
add enable_configured() for use by mavlink and rc
add events for all fence types
make sure that auto fences are no longer candidates after manual updates
add fence debug
make sure rc switch is the ultimate authority on fences
reset auto mask when enabling or disabling fencing
ensure auto-enable on arming works as intended
simplify printing fence notices
reset autofences when auot-enablement is changed
2024-07-24 08:24:06 +10:00
Andy Piper 370b0d7b9c AP_Logger: add events for all fence types 2024-07-24 08:24:06 +10:00
Andy Piper 0288e1e79c RC_Channel: use fence enable_configured() 2024-07-24 08:24:06 +10:00
Andy Piper d16615923d AP_Frsky_Telem: use fence enable_configured() 2024-07-24 08:24:06 +10:00
Andy Piper 0c6ea4790d AP_Common: fix initialization of ExpandingString so that it can be used on the stack
zero out passed in buffers for ExpandingString
2024-07-24 08:24:06 +10:00
Andy Piper 3dbcbe0026 AP_Arming: do not enable minimim altitude fence on arming
call appropriate fence method for auto-enablement
2024-07-24 08:24:06 +10:00
Andy Piper 8287d4f2d0 AC_Avoidance: take into account minimum altitude fence when calculating climb rate 2024-07-24 08:24:06 +10:00
Andy Piper 95b39f64e3 AP_Mission: add comment about new fence API 2024-07-24 08:24:06 +10:00
Andy Piper f73154349b GCS_MAVLink: use bitmask based enablement for fences 2024-07-24 08:24:06 +10:00
Bob Long 230269bed8 HAL_ChibiOS: add adjustable wdg timeout for hwdefs
This allows the watchdog timeout to be adjusted in the hwdef.dat file,
so that critical nodes like ESCs can recover more quickly.
2024-07-23 19:53:38 +10:00
Andrew Tridgell 03bdbea77c hwdef: enable relay support in MatekL431-DShot fw
the PWM expansion boards can also be used for relay control, often
combined with PWM output
2024-07-23 18:42:56 +10:00
Rhys Mainwaring 4354072d34 SITL: SIM_Rover: add simulation for omni3 mecanum rover
Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
2024-07-23 13:27:04 +10:00
James O'Shannessy ce0ae33c5b AP_HAL_ChibiOS: Capture the case where the persistent parameter is the newer format INSn_ACC_ID
This fixes the handling of the newer INSn_* parameters when loading those stored in persistent memory.
2024-07-23 12:06:18 +10:00
James O'Shannessy c771440ea4 AP_InertialSensor: Fix persistent storing of IMU Z Scale
Fixes INSn_ACCSCAL_Z not being stored in persistent storage when bootloader is flashed.
2024-07-23 11:59:49 +10:00
xiaozhou e2cb4ba232 AP_Mount: Topotek image tracking fix
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
2024-07-23 10:51:09 +10:00
xiaozhou 69e4005bb6 AP_Mount: Topotek retrieves model name
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
2024-07-23 10:51:09 +10:00
xiaozhou 858aff5f4f AP_Mount: Topotek handles new version format
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
2024-07-23 10:51:09 +10:00
muramura 7731fc09e2 AP_HAL_SITL: If HAL_CAN_WITH_SOCKETCAN is undefined, treat it as NONE 2024-07-23 10:47:16 +10:00
Michael du Breuil edaddc0431 AP_TECS: Use aircraft stall speed
When stall prevention is enabled we were scaling from the aircraft's
minimum flight speed. However this is normally already picked as being
above the stall speed, and for a variety of reasons we may want to pin
the aircraft at a higher minimum speed. But if the aircraft was
commanded to fly to close to that minimum speed as soon as it banked for
a pattern it would command a increase in speed to keep it away from
stalling. However if your minimum speed is far from stalling this
increase was incorrect. To make it worse what this actually results in
happening is an aircraft diving for more speed (over 10 m/s on some
aircraft) as well as descending to gain that speed resulting in over 200
foot deviations in altitude control.
2024-07-23 10:37:24 +10:00
Michael du Breuil 5005809e74 AP_Vehicle: add stall speed parameter for plane 2024-07-23 10:37:24 +10:00
Thomas Watson b64ed6ca56 AP_Scripting: dynamically load some binding objects
Only create the binding object (singleton metatable/userdata or C
function reference) once the user first references a particular
singleton or userdata creation function. Once created, the object is
stored into the script's environment so it doesn't get recreated on the
next reference and there isn't any further overhead. The userdatas are
no longer shared between scripts which imposes a slight memory penalty
for multiple scripts using the same singleton but this avoids an
additional lookup time cost.

Userdata and ap_objects aren't eligible for this optimization as the C++
code might want a particular metatable at any time.

Saves ~9.3K Lua heap.
2024-07-23 10:34:52 +10:00
Thomas Watson 059af2117d AP_Scripting: place bindings into global table
The global table is then used as the __index metamethod of each state's
environment table. Avoids the overhead of loading binding objects into
each state. The binding objects are immutable from Lua so sandboxing is
not violated.

Does have the slight downside that a script can no longer know all the
binding names by enumerating _ENV.

Saves ~700B of memory per loaded script.
2024-07-23 10:34:52 +10:00