Commit Graph

41060 Commits

Author SHA1 Message Date
bresch aba2eac0df ekf2: publish GNSS, rng and EV height biases 2022-08-24 09:16:11 -04:00
bresch 6833c7e311 ekf2: adjust ekf2 aid parameters in configs 2022-08-24 09:16:11 -04:00
bresch 8962cf2d25 ekf2: GPS, baro and range finder control parameters
Also remove the legacy "range aid" than can be achieved by setting the
height reference to range finder and the range finder control parameter
to "conditional".

Conditional range aiding cal also be set when the height reference isn't
the range finder. This prevents the ratchetting effect due to switching
between references.
2022-08-24 09:16:11 -04:00
bresch 578e1339ca ekf2: re-implement range aid
range aid simply forces the range finder to be the height reference when
starting
2022-08-24 09:16:11 -04:00
bresch 88ac5ea210 ekf2_test: add test case for accel clipping handling 2022-08-24 09:16:11 -04:00
bresch 375753eba8 ekf2_test: add inertial nav falling detection tests 2022-08-24 09:16:11 -04:00
bresch 66ce1a002b ekf2_test: rename VisionHeight -> ExternalVisionHeight 2022-08-24 09:16:11 -04:00
bresch 82ec7a495a ekf2: refactor inertial nav falling check 2022-08-24 09:16:11 -04:00
bresch f9188b2a14 ekf2: refactor vertical acceleration check for multiple height sources 2022-08-24 09:16:11 -04:00
bresch 8fd79688c0 ekf2: enable multiple height sources fusion
Instead of having a single height source fused into the EKF and the
other ones "waiting" for a failure or the primary sensor, fuse all
sources in EKF2 at the same time. To prevent the sources from fighting against each
other, the "primary" source is set as reference and the other ones are
running a bias estimator in order to make all the secondary height
sources converge to the primary one.

If the reference isn't available, another one is automatically selected
from a priority list. This secondary reference keeps its current bias
estimate but stops updating it in order to be the new reference as close
as possible to the primary one.
2022-08-24 09:16:11 -04:00
bresch f5f31006a0 Ekf2: create HeightBiasEstimator class
Contains some logic common to all height bias estimators
2022-08-24 09:16:11 -04:00
JacobCrabill 57125a4c8f cyphal: Fix FMUv5 config; throw error if no CAN driver exists 2022-08-23 21:24:24 -04:00
huiyulhy c81efd0174 Fix velocity smoothing functional test 2022-08-23 21:11:35 -04:00
Beat Küng 7b810bb776 boards: update px4 io binary 2022-08-23 21:07:18 -04:00
Beat Küng b260df711c Makefile: force serial build for px4io_update 2022-08-23 21:07:18 -04:00
Beat Küng bae275898b rc/sbus: restart parser after sucessful decoding & increase time limit
Instead of directly passing the next packet to the parser after successful
parsing, switch the state to SBUS2_DECODE_STATE_SBUS_START and search for
the start byte again.

The timeout is increased as the IO main loop also takes a bit of time
(max ~0.7ms).

Tested on v5x with Futaba R7008SB (60Hz update rate) and FrSky X8R (111Hz
update rate).

Background:
When using the Futaba R7008SB, I noticed there's additional bytes added in
between packets. Often it's a null byte, but sometimes more. There's some
consistency but I did not find any documentation for it.
Sample data:
a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 34 00 0f 05 ec
1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 04 00 c0 8b
00 0f 04 ec 1f a8 fb 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00
14 00 0f 04 ec 1f a8 fb 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80
00 24 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10
80 00 34 00 0f 05 ec 1f 30 60 bf 1c bd 07 16 5b 81 05 d4 a0 06 20 00 01 08
40 00 02 10 80 00 34 00 0f 07 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01
08 40 00 02 10 80 00 04 00 03 c0 31 00 0f 05 fc 1f a8 fb 07 16 5b 81 05 d4
a0 06 20 00 01 08 40 00 02 10 80 00 14 00 0f 05 fc 1f a8 fb 07 16 5b 81 05
d4 a0 06 20 00 01 08 40 00 02 10 80 00 24 00 0f 04 ec 1f a8 fd 07 16 5b 81
05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 34 00 0f 04 ec 1f a8 fd 07 16 5b
81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 04 00 03 c4 00 00 0f 04 ec 1f
a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 14 00 0f 04 ec
1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 24 00 0f 04
ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 34 00 0f
05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 04 00
03 c0 31 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02
10 80 00 14 00 0f 05 fc 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00
02 10 80 00 24 00 0f 05 fc 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40
00 02 10 80 00 34 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08
40 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80
00 04 00 03 c0 31 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08
40 00 02 10 80 00 14 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01
08 40 00 02 10 80 00 24 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00
01 08 40 00 02 10 80 00 34 00 0f 05 f4 1f a8 fb 07 16 5b 81 05 d4 a0 06 20
00 01 08 40 00 02 10 80 00 04 00 03 c4 00 00 b0 60 7f 1c bd 07 16 5b 81 05
d4 a0 06 20 00 01 08 40 00 02 10 80 00 14 00 0f 05 ec 1f a8 fd 07 16 5b 81
05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 24 00 0f 05 ec 1f a8 fd 07 16 5b
81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 34 00 0f 05 ec 1f a8 fb 07 16
5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 04 00 03 c0 31 00 b0 60 bf
1c bd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 14 00 0f 04 f4
1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 24 00 30 70
7f 1c bd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 34 00 0f 05
f4 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10 80 00 04 00 03
c4 00 00 0f 05 fc 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01 08 40 00 02 10
80 00 14 00 0f 05 ec 1f b0 60 bf 1c bd 07 16 5b 81 05 d4 a0 06 20 00 01 08
40 00 02 10 80 00 14 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00 01
08 40 00 02 10 80 00 24 00 0f 05 ec 1f a8 fd 07 16 5b 81 05 d4 a0 06 20 00

This was causing the parser to skip entire packets resulting in an update
rate of ~31Hz on the FMU side.
With this patch the update rate increases to 42-48Hz.

The investigation was triggered by an RC glitch with a packet containing
random channel data. It's likely, although not completely verified that
the frequent desync randomly happend to pass the CRC check with garbage
data.
2022-08-23 21:07:18 -04:00
Daniel Agar b58f70726f ekf2: scale delta angle and delta velocity bias to particular IMU sample 2022-08-23 21:06:13 -04:00
Ville Juven 213d5dac2a platforms/nuttx: Fix hard coded path for karch library
Use CONFIG_ARCH instead of arm
2022-08-23 21:05:41 -04:00
Ville Juven 4f6d523c95 mixer_module: Fix linking of mixer_module
The module has a hard dependency on mixer library, so link them together
2022-08-23 21:04:58 -04:00
bresch f89044cfbe ekf2: fix replay EKF2 start when CONSTRAINED_FLASH 2022-08-23 11:14:15 -04:00
modaltb 40149ecabc
boards: modalai_fc-v2 configure SPI6, disable unused SPI3/4 (#20093) 2022-08-22 20:58:44 -04:00
alexklimaj 913bae9924 Revert "drivers/uavcan: update libuavcan"
This reverts commit deb938fcea.
2022-08-22 20:57:06 -04:00
Daniel Agar cfc579542e
new Ignition Gazebo simulation interface architecture (#20057)
- much simpler direct interface using Ignition Transport 
 - in tree models and worlds
 - control allocation output configuration, no more magic actuator mapping to mavlink and back
 - currently requires no custom Gazebo plugins (keeping things as lightweight and simple as possible)

Co-authored-by: Jaeyoung-Lim <jalim@ethz.ch>
2022-08-22 10:58:19 -04:00
Silvan Fuhrer 889a2fddea FW Position Control: remove unnsed params
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 19:06:07 +02:00
Silvan Fuhrer e3e021a1c2 FW Attitude Control: rename att_control to angular_acceleration_setpoint
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer e595952ed4 FW Attitude Control: add @brief, @param and @return for control_attitude()
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer f67d80460f FW Attitude controller: update copyright headers
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Jaeyoung Lim bcdf61b65f Fix format 2022-08-19 09:40:48 +02:00
Silvan Fuhrer b87afb138c Update src/modules/fw_att_control/FixedwingAttitudeControl.cpp
reduce code duplication

Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
2022-08-19 09:40:48 +02:00
Jaeyoung Lim 70134296ed Fix parameter description from review comments
This commit makes the parameter description of the fixewing attitude controller more descriptive
2022-08-19 09:40:48 +02:00
Silvan Fuhrer 70d7070307 ROMFS: plane airframe: make tuning tighter
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer c54f62e17a FW attitude control: fix ff terms and constrain outputs to (-1, 1)
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer dadd4f39ad FW attitude control: fix yaw rate publishing
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer 6724e4af26 FW attitude control: manual stick input sets yaw rate setpoint, not rudder directly
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer 22067a1128 FW attitude control: set FF gains for rate controller to 0 as FF controls is handles outside
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer 57e052d02d FW attitdue controller: use allocator status for anti-windup
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer 6aab44e425 ControlAllocator: publish allocator_status from all active matrices (2 for VTOL, otherwise 1)
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer a9b848cae3 FW attitue controller: fix publishing of rate controller status
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer 5a2127d026 fixed-wing: update rate controller integrator handling
-always reset roll/pitch/yaw integrators at the same time
-reset them while waiting for launch or during FW Takeoff before Climbout
-reset wheel rate integrator only when disarmed

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer cd080289c6 FW attitude controller: constrain rates correctly
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer 15c95a7b6a FW attitude controller: improve readability and fix euler rate sp vs. body rate sp
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Silvan Fuhrer e0a998e6ad FW attitude controller: remove unused control_input.scaler
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Jaeyoung Lim 33d068cfb2 Added feedforward terms in fw att control 2022-08-19 09:40:48 +02:00
Jaeyoung Lim 958c61dbba Populate rate control setpoints properly 2022-08-19 09:40:48 +02:00
JaeyoungLim 6f24f4cd1c Update src/modules/fw_att_control/fw_att_control_params.c
Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-19 09:40:48 +02:00
Jaeyoung Lim dcff481219 Map derivative gains for rate controls 2022-08-19 09:40:48 +02:00
Jaeyoung-Lim f2877ce585 Replace rate controller with RateControlLibrary
This commit makes the fw attitude controller take share the rate controller as a library with the mc_rate_control module
2022-08-19 09:40:48 +02:00
Thomas Debrunner 44a18acd51
Fix race condition in px4io serial driver (#20005)
* px4io: prevent memory corruption on corrput io data

* px4io_serial: Prevent race between handling wait timeout case and interrupt posting semaphore
2022-08-18 17:46:47 +02:00
bresch 02c4e0361c MCPosControl: fix horizontal anti-reset windup algirithm
Since the horizontal and vertical velocity controllers are now
decoupled, it can be that the horizontal acceleration produced by the
controller is actually greater than the desired one (by design). This
condition would actually make the ARW run "backwards", degrading the
controller performance.
2022-08-18 14:19:10 +02:00
mcsauder 87a5705960 Rename math::gradual() to math::interpolate() and add unit tests to cover additional corner cases. 2022-08-18 14:18:02 +02:00