3052 Commits

Author SHA1 Message Date
bresch
20cd599bb7 ekf2: fix param migration 2022-08-24 09:16:11 -04:00
bresch
b04d61c411 ekf2: param migration for rng aid, aid mask (gps) and hgt mode 2022-08-24 09:16:11 -04:00
huiyulhy
c81efd0174 Fix velocity smoothing functional test 2022-08-23 21:11:35 -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
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
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
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
bresch
021b23826d wind_replay: allow estimated local vel and GNSS vel sources
local vel by default, set --gnss to use GNSS vel instead
2022-08-18 14:09:23 +02:00
bresch
be6acb0a68 wind_est: add python script to replay wind estimator equations 2022-08-18 14:09:23 +02:00
bresch
4d21c90cbb wind_est: generate wind estimator equations for python use 2022-08-18 14:09:23 +02:00
Beat Küng
f454dcef6b ROMFS: set control allocation parameters for airframes
Removes some airframes:
- 1000_rc_fw_easystar.hil
- 10015_tbs_discovery
- 10016_3dr_iris
- 10018_tbs_endurance
- 13001_caipirinha_vtol
- 13002_firefly6
- 13003_quad_tailsitter
- 13004_quad+_tailsitter
- 13005_vtol_AAERT_quad
- 13006_vtol_standard_delta
- 13007_vtol_AAVVT_quad
- 13008_QuadRanger
- 13009_vtol_spt_ranger
- 13012_convergence
- 13050_generic_vtol_octo
- 14001_tri_y_yaw+
- 14002_tri_y_yaw-
- 15001_coax_heli
- 2105_maja
- 2200_mini_talon
- 3031_phantom
- 3032_skywalker_x5
- 3033_wingwing
- 3036_pigeon
- 3100_tbs_caipirinha
- 4003_qavr5
- 4009_qav250
- 4019_x500_v2
- 4030_3dr_solo
- 4031_3dr_quad
- 4051_s250aq
- 4072_draco
- 4080_zmr250
- 4090_nanomind
- 4100_tiltquadrotor
- 50003_aion_robotics_r1_rover
2022-08-12 09:43:12 +02:00
Beat Küng
720cf5a485 config: enable dynamic control allocation by default (SYS_CTRL_ALLOC=1) 2022-08-12 09:43:12 +02:00
Daniel Agar
bce4237963 move ekf2 Matrix helper utilities to mathlib 2022-08-05 09:58:07 -04:00
Tony Cake
f321117568
GHST: Add support for GPS Telemetry (#19953)
Add support for the basic GPS telemetry values when using the GHST protocol.

* Fix formatting in GHST GPS telemetry changes

* GHST GPS Telemetry formatting cleanup

* GHST GPS Telemetry, Last formatting change
2022-08-03 10:44:21 +02:00
RomanBapst
f11f2e9797 addressed review comments
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-08-02 15:29:25 +02:00
RomanBapst
fbd4534edc WindEstimator: reworked filter initialisation
- separate initialisation with and without airspeed

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-08-02 15:29:25 +02:00
RomanBapst
a63f1b71fe wind_estimator: added simple check for validity of synthetic airspeed
- synthetic airspeed will only be declared valid as soon as the wind variance
has dropped below a parameterized threshold. This is useful for vehicles without
an airspeed sensor which rely on synthetic airspeed but only once the vehicle
has turned sufficiently for the wind estimates to be reliable.

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-08-02 15:29:25 +02:00
Hamish Willee
30e2490d5b
Docs are now in user guide and main (#19977)
* Fix links to docs in source to point to docs on main not master

* More docs and scripts that need to point to main
2022-08-01 11:39:39 +10:00
Beat Küng
e7588d2da0 px4io+pwm_out: set the PWM rate and disarmed value when a channel is first set to a servo
This should simplify the first setup a bit.
2022-07-31 11:20:57 -04:00
Daniel Agar
9ed861e0a3 lib/mixer_module: split functions into separate headers
- this arguably improves visibility/discoverability
2022-07-28 08:08:58 +02:00
bresch
f7ff0a9961 WindEstimator: add test case for airspeed fusion singularity 2022-07-27 08:19:40 -04:00
Daniel Agar
38c02ea29a wind_estimator: cmake add symforce generation helper target (wind_estimator_generate_airspeed_fusion) 2022-07-27 08:19:40 -04:00
bresch
26190a7799 WindEstimator: use SymForce auto-generated function for airspeed fusion 2022-07-27 08:19:40 -04:00
Hamish Willee
e6eed43648
Spelling errors (#19935) 2022-07-27 14:33:16 +10:00
Taylor Nelms
21cb0ef50f Component: flash parameter storage on stm32h7. Fixes #15331.
As per the discussion in #15331, fixed issue where stm32h7 chips
    use hardware ECC bits in program memory that disallow overwriting
    32-byte flash line that has already been written. As such,
    this change allows for a variant implementation of the flashfs system
    that uses more space in the flash entry header in order to
    allow an entire line to be reserved for erasing an entry.

Signed-off-by: Taylor Nelms <tnelms@roboticresearch.com>
2022-07-25 08:19:00 +02:00
Daniel Agar
8f8615e6c2 delete CBRK_RATE_CTRL 2022-07-20 01:14:53 -04:00
Beat Küng
f22dc80ecc system: add missing includes (added indirectly via visibility.h for normal builds) 2022-07-20 01:14:04 -04:00
Thomas Stastny
87e09ad9f5 fw pos ctrl: auto landing refactor
- landing slope/curve library removed
- flare curve removed (the position setpoints will not be tracked during a flare, and were being ignored by open-loop maneuvers anyway)
- flare curve replaced by simply commanding a constant glide slope to the ground from the approach entrance, and commanding a sink rate once below flaring alt
- flare is now time-to-touchdown -based to account for differing descent rates (e.g. due to wind)
- flare pitch limits and height rate commands are ramped in from the previous iteration's values at flare onset to avoid jumpy commands
- TECS controls all aspects of the auto landing airspeed and altitude/height rate, and is only constrained by pitch and throttle limits (lessening unintuitive open loop manuever overrides)
- throttle is killed on flare
- flare is the singular point of no return during landing
- lateral manual nudging of the touchdown point is configurable via parameter, allowing the operator to nudge (via remote) either the touchdown point itself (adjusting approach vector) or shifting the entire approach path to the left or right. this helps when GCS map or GNSS uncertainties set the aircraft on a slightly offset approach"
2022-07-19 22:37:09 -04:00
Thomas Stastny
a12e40b1d8 tecs: convert tas error and soft bounds to percentage of trim airspeed 2022-07-18 10:49:27 -04:00
Thomas Stastny
1782f9cd3e tecs: zero guard ste rates and airspeed setpoint rates 2022-07-18 10:49:27 -04:00
Thomas Stastny
73010cc69b TECS: speed (only) -based underspeed detection
- underspeed condition only determined by true airspeed undershoot
- change binary underspeed condition to a continuous percent undersped
- ramp-in max throttle, pitch speed weight, and TAS setpoint reduction during underspeed to avoid jumpy commands at the true airspeed error boundary
- let true airspeed filter reach zero airspeed
2022-07-18 10:49:27 -04:00
Thomas Stastny
eed073887d remove in air vs landed knowledge from TECS
- create integral and trajectory generator reset methods
- always run TECS unless in rotary-wing mode (or in transition)
- constantly reset TECS integrals and trajectory generators when landed
2022-07-18 10:49:27 -04:00
Junwoo Hwang
1a620b450d
Change min > max notation to [min, max] in Parameters Markdown (#19911)
* Change min > max notation to [min, max] in Parameters Markdown

* Update src/lib/parameters/px4params/markdownout.py

Co-authored-by: Thomas Stastny <thomas.stastny@auterion.com>

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Thomas Stastny <thomas.stastny@auterion.com>
2022-07-14 09:13:49 +10:00
Daniel Agar
e99da22cbe delete CBRK_VELPOSERR circuit breaker 2022-07-12 13:51:13 -04:00
Daniel Agar
a73efd9c4f NuttX carry minimal c++ cmath (replacing Matrix stdlib_imports.hpp) 2022-07-12 08:05:06 -04:00
RomanBapst
92cdff6798 TECS: rename airspeed/throttle "cruise" to "trim"
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-07-12 09:07:20 +02:00
RomanBapst
b57d3c6d74 TECS: set true airspeed rate setpoint to zero if airspeed is not enabled
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-07-12 09:07:20 +02:00
RomanBapst
6dbea21ef5 TECS: renamed airspeed cruse to airspeed trim & general cleanup
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-07-12 09:07:20 +02:00
RomanBapst
461d0561b8 replace FW_THR_CRUISE with FW_THR_TRIM
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-07-12 09:07:20 +02:00
Junwoo Hwang
f66c3914f6 Give priority to power off tune over other tunes (e.g. Battery Low)
Make Power Off tune not interruptable

This solves the case of Low Battery warning tune overriding the power
off tune, as now the Power off tune is not interruptable by any other
tune unless override flag is specified

commander_helper: resolve "redundant boolean literal in ternary expression result"
2022-07-08 14:51:15 +02:00
Daniel Agar
f591988f32 drivers/actuators: modalai_esc driver
Co-authored-by: Travis Bottalico <travis@modalai.com>
Co-authored-by: akushley <akushley>
2022-07-07 10:32:52 -04:00
Daniel Agar
15223009d2 combine sensor_gps + vehicle_gps_position msgs (keeping separate topics) 2022-07-07 10:24:11 -04:00
Martina Rivizzigno
55563eba49 MPC_SPOOLUP_TIME -> COM_SPOOLUP_TIME 2022-06-24 19:44:43 +02:00
CR
ffb0097052 removed unused code - _constrainOneSide and _constrainAbs 2022-06-22 23:21:16 +02:00
Matthias Grob
479c85047f WeatherVane: Allow weathervane on multirotors not just VTOLs 2022-06-22 14:19:28 +02:00
Matthias Grob
54145cedc7 FlightTask: Weather vane cleanup
Remove the entire external yaw handler, dynamic memory allocation,
pointer passing logic. Directly instanciate the weather vane instance
in the flight tasks that support it.
2022-06-22 14:19:28 +02:00
Daniel Agar
10deb7019e enable gyro_calibration for CAN nodes
- allow saving initial gyro cal if very close to 0
2022-06-17 19:31:45 -04:00
bresch
b6f1a7aed9 migrate wind process noise parameters 2022-06-14 18:39:10 +10:00
bresch
e105869986 wind_estimator: use noise spectral density for process noise tuning
The noise spectral density, NSD, (square root of power spectral density) is a
continuous-time parameter that makes the tuning independent from the EKF
prediction rate.
NSD corresponds to the rate at which the state uncertainty increases
when no measurements are fused into the filter.
Given that the current prediction rate of the wind estimator is 1Hz, the
same tuning is obtained with the same values as before.
2022-06-14 18:39:10 +10:00
PX4 BuildBot
e86a74321e Update world_magnetic_model to latest Sat Jun 4 11:14:10 UTC 2022 2022-06-04 15:57:11 -04:00