Compare commits

..

2086 Commits

Author SHA1 Message Date
Hamish Willee
7bccbfecb4
4003_qavr5 : inch in title breaks docs rendering 2021-07-15 11:49:24 +10:00
Daniel Agar
7f2acb6d59
consume PX4 ecl submodule and preserve all history 2021-07-14 07:00:52 -04:00
Blake McHale
4a436f1ac9 Add missing receive port arg to micrortps_client start 2021-07-13 21:42:10 -04:00
Daniel Agar
18dcec43d3
github actions: add standalone ecl builds and testing 2021-07-13 19:01:19 -04:00
Daniel Agar
ad11927661 ROMFS: delete redundant wing mixers
- these are nearly identical with slightly different scaling and haven't been tested for years
2021-07-13 21:12:11 +02:00
Oleg
a8bf8d42db sensors: add include for sensor_baro topic 2021-07-13 14:18:31 -04:00
Daniel Agar
06cd1c79dd logger: limit distance_sensor to 2 instances 2021-07-13 14:11:42 -04:00
Daniel Agar
3924f0ef30 ROMFS: delete Hobbyking Micro PCB 2021-07-13 14:07:45 -04:00
Jaeyoung-Lim
db1dc1c9a1 Add airframe configuration and make target for believer
This commit adds an airframe configuration and make target for believer
2021-07-13 18:04:52 +02:00
Daniel Agar
dbaed99626
cmake remove git_ecl target 2021-07-13 10:03:06 -04:00
Daniel Agar
a5f7406211
Merge entire PX4/ECL submodule and history into PX4-Autopilot 2021-07-13 10:01:09 -04:00
Daniel Agar
cd1e04d034
delete ecl submodule 2021-07-13 09:54:02 -04:00
bresch
8a0510d52e update change indicator 2021-07-13 10:49:32 +02:00
bresch
97485f131a update covariance prediction 2021-07-13 10:49:32 +02:00
bresch
2d8e183aa3 update EKF derivation auto-generated code 2021-07-13 10:49:32 +02:00
bresch
dccd662dfe EKF python derivation: use unit quaternion constraint
This produces a more numerically stable and simpler derivation as it
already contains the unit quaternion constraint
2021-07-13 10:49:32 +02:00
bresch
0bebe1a656 Add gyro bias initialization unit test 2021-07-13 10:49:32 +02:00
bresch
057a95a954 EKF_init: check for accel bias amplitude 2021-07-13 10:49:32 +02:00
bresch
9f2d1f9e27 CI: update container version 2021-07-13 10:29:05 +02:00
Oleg
76b34132a5 mavlink: fix incorrect rejection of forwarded alien commands 2021-07-12 10:34:43 +02:00
Daniel Agar
d8704cee67 platforms: px4 log build string then print (fputs) 2021-07-10 13:14:49 -04:00
Oleg
76dedfec5d mavlink: optimize message forwarding 2021-07-10 12:04:17 -04:00
DanAbara
64448e17ca Update README.md to fix broken crazyflie2.0 link 2021-07-10 12:03:30 -04:00
Daniel Agar
552ec4a37c Jenkins: hardware test rack remove Holybro Durandal
- IMUs on this particular unit no longer function
2021-07-10 12:02:45 -04:00
Daniel Agar
62144c6b6b optical_flow/paw3902: minor improvements
- configure a backup schedule when using motion interrupt otherwise the
sensor will stop publishing entirely in the dark
 - as a precaution issue full reset if sensor is stuck in a bad state
(no vaid data for an extended period)
 - update light mode change criteria to match datasheet exactly
2021-07-10 09:46:56 -04:00
David Sidrane
f5e5794930 platforms/common:SPI - fix hang on bords supporting BOARD_HAS_BUS_MANIFEST 2021-07-10 11:37:29 +02:00
Daniel Agar
d01cec192f
Makefile: remove check_px4_fmu-v2_lpe 2021-07-09 11:54:06 -04:00
Florian Achermann
d4ee5a52c9 Adjust lower bound for CAL_AIR_TUBED_MM to 1.5 mm
Below 1.5 mm the tube pressure drow compensation will result in unrealistic compensation factors causing the measured airspeed to be too high.
In addition sensirion recommends a diameter of 1.8 mm or larger for the tubes.
2021-07-09 16:10:21 +02:00
TSC21
e39e3b3418 events interface: chance uORB 'sequence' to 'event_sequence'
The reason is that sequence is an IDL reserved keyword, which results on failure when parsing with FastRTPSGen.
2021-07-09 13:24:13 +02:00
Beat Küng
5a370bf575
CI: update remaining container to 2021-05-04 2021-07-09 10:51:47 +02:00
Paul Riseborough
223ca11aed ekf2: update drag fusion parameter descriptions 2021-07-08 22:19:52 -04:00
Paul Riseborough
2d6363e0ef ekf2: Add parameter for propeller momentum drag 2021-07-08 22:19:52 -04:00
Paul Riseborough
909326e9d8 ecl: use latest version with momentum drag fusion 2021-07-08 22:19:52 -04:00
Daniel Agar
c5b1fe86ca delete deprecated BAT_* parameters 2021-07-08 22:19:12 -04:00
PX4 BuildBot
19bc1f9d02 Update submodule sitl_gazebo to latest Fri Jul 9 00:39:54 UTC 2021
- sitl_gazebo in PX4/Firmware (7144566afe509e0ad8669d4f4690d22b7e176ed3): 822050a7ab
    - sitl_gazebo current upstream: 1f3f1b1dec
    - Changes: 822050a7ab...1f3f1b1dec

    1f3f1b1 2021-06-18 Jonas Vautherin - Add plugin allowing to draw a force (e.g. liftdrag) (#771)
2021-07-08 21:56:36 -04:00
Beat Küng
7144566afe metadata.cmake: ensure events directory exists & add px4 enums 2021-07-08 16:29:37 -04:00
Beat Küng
6938b1710a fix github deploy_all.yml: explicitly call events_json
Some targets don't build it (e.g. ark can bootloader)
2021-07-08 16:29:37 -04:00
Daniel Agar
23688d8234
monocypher submodule point to px4 branch 2021-07-08 13:54:34 -04:00
Daniel Agar
bcfed93c57
github actions: fix airframe_metadata 2021-07-08 13:11:53 -04:00
Beat Küng
e644036325 drivers: use updated I2C SPI driver interface 2021-07-08 12:59:35 -04:00
Beat Küng
c5aef9d512 i2c_spi_buses: add support for multiple instances of the same device on a bus
This also simplifies the API a bit, since we anyway have to change the
drivers to pass additional information (the bus device index).

The orientation flag is merged with the rotation.
2021-07-08 12:59:35 -04:00
Daniel Agar
e4983ab88c
px4_platform_common: atomic support larger types with critical sections (on NuttX) 2021-07-08 10:56:25 -04:00
Beat Küng
32fe63916d mixers: exclude FX79.main.mix from px4_fmu-v2 2021-07-08 10:07:52 +02:00
Igor Mišić
376450ccf0 navigator: reduce traffic alert messages 2021-07-08 07:28:38 +02:00
Sam Chamberlin
496e3fe2e0
afbr-s50: added gate for processing distance measurements
updating variable naming convention

publish data when measurements are invalid, just set them to zero

add quality to distance measurements
2021-07-07 21:40:29 -04:00
Beat Küng
dfd6999643 px4/fmu-v5: disable dumpfile & motor_ramp commands in optimized.cmake
Reduce flash
2021-07-07 21:38:09 -04:00
Beat Küng
5670db033d ark/can-gps: add EXTERNAL_METADATA
It has no mavlink, so no use in adding the metadata in the first place.
2021-07-07 21:38:09 -04:00
Beat Küng
d9aec564f3 px_process_events.py: canonicalize + remove duplicate source files 2021-07-07 21:38:09 -04:00
Beat Küng
7f2bab9b0f px4/fmu-v6x: remove some modules to reduce flash 2021-07-07 21:38:09 -04:00
Beat Küng
d30720c960 airframes: exclude some mixers + airframes (HIL, vtol) from fmu-v2
To reduce flash
2021-07-07 21:38:09 -04:00
Beat Küng
e3972d563a cmake: ensure generated source files exist before extracting events
Only needed for Makefile-based builds:
gmake[3]: *** No rule to make target 'src/modules/flight_mode_manager/FlightTasks_generated.hpp', needed by 'events/px4.json'.  Stop.
2021-07-07 21:38:09 -04:00
Beat Küng
b12b884f4c ci: update container version to 2021-05-04 2021-07-07 21:38:09 -04:00
Beat Küng
c6eccd4518 requirements.txt: add jsonschema (required for events json validation) 2021-07-07 21:38:09 -04:00
Beat Küng
594f47c9f8 mission: switch to events 2021-07-07 21:38:09 -04:00
Beat Küng
38ee923658 px4io: switch to events 2021-07-07 21:38:09 -04:00
Beat Küng
7bb123c65e voted_sensors_update: switch to events 2021-07-07 21:38:09 -04:00
Beat Küng
6d26cabdbb github ci: deploy airframes metadata to s3 2021-07-07 21:38:09 -04:00
Beat Küng
ab701ae502 rtl: switch to events 2021-07-07 21:38:09 -04:00
Beat Küng
59f359f7dc events: add custom (px4-specific) enums json file 2021-07-07 21:38:09 -04:00
Beat Küng
14d3582d38 events parser: make '/* EVENT' optional, but prevent 'using namespace events'
Allows for more compact code for very simple events w/o description
2021-07-07 21:38:09 -04:00
Beat Küng
e1852a7a9a github ci: deploy events metadata 2021-07-07 21:38:09 -04:00
Beat Küng
60850fa528 metadata: add extract_events target
This will collect the events from the whole source tree
2021-07-07 21:38:09 -04:00
Beat Küng
38f3b8d356 mavlink & system: add events interface
- sending protocol
- uorb event message & template methods for argument packing
- libevents submodule to send common events and handle json files
- cmake maintains a list of all (PX4) source files for the current build
  (PX4 modules + libs), which is used to extract event metadata and
  generate a json file
2021-07-07 21:38:09 -04:00
Beat Küng
7c5838116a Tools: add parser to extract event definitions in source & generate json output
Example definition:
			/* EVENT
			 * @description
			 * test description
			 * @arg1: test
			 */
			events::send<uint8_t>(events::ID("test_event"),
					"test message", events::Log::Error, 0);
2021-07-07 21:38:09 -04:00
mcsauder
fef2c43395 Modify occurrences of control_mode to vehicle_control_mode in MulticopterPositionControl.cpp/hpp to reflect the existing naming convention in the files. 2021-07-06 22:02:15 -04:00
Daniel Agar
1ee3484827 drivers/gps: close port if configure fails
- open if necessary at beginning of each iteration
2021-07-06 22:01:24 -04:00
JacobCrabill
3143756d97 uavcan_v1: Cleanup _uavcan_subs in SubMgr
Remove hard-coding of PX4 param names - use subject name and instance
instead

Also cleanup duplicates of CANARD_PORT_ID_UNSET/MAX vars
2021-07-06 22:00:07 -04:00
JacobCrabill
8f55c960b6 uavcan_v1: Change '_PID' params to '_SUB' for clarity 2021-07-06 22:00:07 -04:00
JacobCrabill
10019bbccc fmu-v5_uavcanv1: Increase CAN FIFOSIZE to 32 2021-07-06 22:00:07 -04:00
JacobCrabill
fce809841f uavcan_v1: Revert HeapSize to 8192 2021-07-06 22:00:07 -04:00
JacobCrabill
a644cf19c5 uavcan_v1: Update SubscriptionManager
Make _uavcan_subs struct 'const' again
Refactor updateDynamicSubscriptions()
Add getSubjectName(), getInstance() to BaseSubscriber class
2021-07-06 22:00:07 -04:00
JacobCrabill
ab46b8026c uavcan_v1: Don't re-subscribe to fixed port ID subscribers 2021-07-06 22:00:07 -04:00
JacobCrabill
a99b657f03 uavcan_v1: Fix SubscriptionManager dynamic update 2021-07-06 22:00:07 -04:00
JacobCrabill
db460daf46 uavcan_v1: Bugfix: pop timed-out transfers from tx queue 2021-07-06 22:00:07 -04:00
JacobCrabill
c9f743049b uavcan_v1: Increase _uavcan_heap size 2021-07-06 22:00:07 -04:00
JacobCrabill
4ba1f966e5 uavcan_v1: Add update and print support to SubscriptionManager 2021-07-06 22:00:07 -04:00
JacobCrabill
74d0f46279 uavcan_v1: Publisher: Fix port_id update 2021-07-06 22:00:07 -04:00
Daniel Agar
1b5e65df04
gyro_fft: change default length 1024 -> 512 to decrease latency
- change default FFT length (1024 -> 512)
      - this doubles the update rate because half the number of samples are required for each
 - decrease number of peaks (4 -> 3)
      - so far 3 seems to be sufficient on most vehicles
 - increase median filter window (3 -> 5)
 - decrease SNR requirement (likely needs to be configurable)
2021-07-06 21:54:18 -04:00
Daniel Agar
ca4932cfc0 EKF: initialize vertical position and velocity variables
- otherwise checkVerticalAccelerationHealth() can fail if GPS or EV
aren't available to correctly set vertical velocity fusion time and
innovation ratio
2021-07-06 17:11:16 -04:00
Oleg Evseev
f296a41737 cdev: fixes hardfaults when device get disconnected (#17846)
check if inode is not unlinked before use
2021-07-06 12:35:47 -04:00
Daniel Agar
a5ee28883a gyro_fft: track FFT peaks and median filter frequency 2021-07-06 12:32:25 -04:00
alexklimaj
72389c2306 Increase hp work priority. Turn on SPI2 DMA for AFBR. 2021-07-06 11:35:01 -04:00
Paul Riseborough
0c15624a0c EKF: Fix clang-tidy complaint 2021-07-06 15:20:39 +02:00
Daniel Agar
9524e8ec03 drivers/px4io: mirror PWM_MAIN_OUT support 2021-07-05 21:23:04 -04:00
Daniel Agar
6dd0a58302 [at24c] free perf counter if px4_at24c_initialize fails
- add driver prefix to perf counter naming
2021-07-05 21:22:08 -04:00
murata
c9b5e488f5 NCP5623C: Change the class name to the device name 2021-07-04 14:22:20 -04:00
David Sidrane
9dee09b81b NuttX and Apps updated w/ALL backports 2021-07-02 09:08:10 -07:00
David Sidrane
962f02220a nxp_fmuk66-v3:DMA Poll not needed 2021-07-02 09:08:10 -07:00
David Sidrane
39d684958d nxp_fmuk66-e:DMA Poll not needed 2021-07-02 09:08:10 -07:00
David Sidrane
2a7c95d7ac nxp_fmuk66-v3:Use eDMA 2021-07-02 09:08:10 -07:00
David Sidrane
cd8182ba3c nxp_fmuk66-e:Use SPI DMA 2021-07-02 09:08:10 -07:00
David Sidrane
5ea4b7dc9e NuttX with Kinetis eDMA (SPI, Serial) Backports 2021-07-02 09:08:10 -07:00
Matthias Grob
acf848ba99 PWM: Draft implementation to respect PWM_OUT when loading defaults 2021-07-02 12:48:04 +02:00
Beat Küng
50b0f0e392 iridiumsbd: disable module until everything is fixed
There seem to be more issues in combination with MAVLink.
2021-07-02 12:45:18 +02:00
Beat Küng
fcf3bb5af9 fix iridiumsbd: use ModuleBase
fixes hardfaults, e.g. when device not connected
2021-07-02 12:45:18 +02:00
Beat Küng
9b7170551c ModuleBase: allow configurable timeout for wait_until_running() 2021-07-02 12:45:18 +02:00
Peter van der Perk
cf524cd2c9 [UAVCANv1] Added uORB actuator_outputs publisher 2021-07-02 00:58:38 -04:00
Beat Küng
6a44fc7cac fix vtol_att_control: set _current_max_pwm_values to current values on init 2021-07-02 00:53:42 -04:00
Beat Küng
894ecac8da px4io: ensure pwm params are loaded before any other module starts
The vtol module will read them later on.
2021-07-02 00:53:42 -04:00
alexklimaj
962c2cc960 Add fmuv6x to vscode cmake variants 2021-07-01 20:14:05 -04:00
David Sidrane
3e00450052 NuttX with SDMMC BACKPORT 2021-07-01 11:51:14 -07:00
Thies Lennart Alff
cacab75b42 define decimals for uuv_att_control gains
decimal for the uuv_att_control gain parameters was not defined. So
QGroundControl displays them as integers what is rather unhandy.
2021-07-01 11:08:16 -04:00
Daniel Agar
0aa14deb5d drivers/distance_sensor/broadcom/afbrs50: minimize IRQ_LOCK()/IRQ_UNLOCK() calls 2021-07-01 10:47:53 -04:00
Matthias Grob
62546350f1 battery: use local instead of global member battery_status message 2021-07-01 14:24:38 +02:00
Matthias Grob
fa976f84b1 battery: clear interface for determineWarning() 2021-07-01 14:24:38 +02:00
Matthias Grob
f41c294028 BatterySimulator: No need to explicitly mention throttle being set to zero 2021-07-01 14:24:38 +02:00
Matthias Grob
b824f33ae9 battery: publish measured values also when battery not connected 2021-07-01 14:24:38 +02:00
Matthias Grob
a99ddd0845 battery: don't reset on every loop iteration 2021-07-01 14:24:38 +02:00
Matthias Grob
8d74e52bb7 battery: omit separate publish() function 2021-07-01 14:24:38 +02:00
Matthias Grob
9c0c85c9e2 battery_status: naming consistency current_filtered_a -> current_average_a 2021-07-01 14:24:38 +02:00
Matthias Grob
41cc73e555 battery: simplify battery_initialized condition 2021-07-01 14:24:38 +02:00
Matthias Grob
a51d47f8e8 battery: connected check outside of determineWarning() 2021-07-01 14:24:38 +02:00
Jaeyoung-Lim
e45b862f1d Specify orientaiton of ADIS16448 IMU from rc.sensors
Specify orientaiton of ADIS16448 IMU for from the rc.sensors

WIP: Currently only handling one orientation
2021-06-30 09:34:12 -04:00
Daniel Agar
33bf4e0303 EKF: set uninitialized vel/pos/hgt test ratios to NAN
- ensure valid min is numerically larger than 0 (float32)
2021-06-30 09:30:44 -04:00
Daniel Agar
d87cd171f4 sensors/vehicle_imu: continue integrating gyro if there's a gap in data
- minor improvement that helps to determine the sensor publication rate
as soon as possible
2021-06-30 09:13:49 -04:00
Daniel Agar
7ddcb7fe3c adis16470: disable debug 2021-06-30 01:01:07 -04:00
Daniel Agar
982692f5ed ekf2: selector handle NAN test ratios as uninitilaized
- requires https://github.com/PX4/PX4-ECL/pull/1020
2021-06-29 21:36:24 -04:00
Daniel Agar
f08a22934e boards: px4_fmu-v4_test remove deleted drivers/tap_esc 2021-06-29 21:27:29 -04:00
Daniel Agar
f0d8d53da6
sensors/vehicle_imu: minor IMU integration improvements
- IMU integrator set max dt based on final return size (uint16)
 - improve integration consuming gyro as needed then integrate all available accel until caught up
 - increase required number of samples for sensor rate measurement (online Welford mean)
2021-06-29 10:43:09 -04:00
Daniel Agar
3fcd323f6a
drivers/imu/invensense: store offset registers on configure, trigger reset on any change
- this can catch subtle failures that occur after self hours of continuous operation on some units
2021-06-29 10:33:03 -04:00
alexklimaj
9d3e18dbe1 ARK Flow rev 2 add icm42688p 2021-06-25 09:44:45 -04:00
TSC21
a67e66000e protocol_splitter: including magic number on XOR for checksum 2021-06-25 13:05:24 +02:00
TSC21
4741ec25ce microRTPS: increase base message ID space to 179 2021-06-25 13:05:24 +02:00
Matthias Grob
5ac5399d83 Remove horizontal slow down close to ground
Because based on the numerous complaints it was disabled by default
(only velocities above 10m/s were limited)
and since then no one intentionally used it anymore. But
there were some minor investigations of drones not reaching
their maximum speed which always showed 10m/s.
2021-06-25 11:15:41 +02:00
Matthias Grob
055c9db178 state_machine_helper: allow takeoff and hold without any link 2021-06-25 10:46:43 +02:00
Matthias Grob
15096ead5f state_machine_helper: explicitly notify about rca and data link loss 2021-06-25 10:46:43 +02:00
Matthias Grob
bec9eef5b0 state_machine_helper: react on link losses during takeoff
The same way like in loiter. This should be further unified in the code
but at least we can increase safety in the case the takeoff altitude is
very high and the vehicle never reaches it but looses links.
2021-06-25 10:46:43 +02:00
Matthias Grob
11556d4e9a Commander: allow disabling RC loss failsafe for mission, hold, offboard independently 2021-06-25 10:46:43 +02:00
Matthias Grob
933d31b476 commander_params: correct parameter group from Mission to Commander 2021-06-25 10:46:43 +02:00
Matthias Grob
6ee8f7be0f Commander: switch to static_cast<> for set_nav_state parameters 2021-06-25 10:46:43 +02:00
Jukka Laitinen
d83033f449 Take the crypto_backend library into use in bootloader for signature verification
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-06-25 08:35:58 +02:00
Jukka Laitinen
0d4f481035 Add simple SW implementations for crypto_backend and keystore_backend
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-06-25 08:35:58 +02:00
Jukka Laitinen
d068ae48d6 Add header file for arhitecture/implementation specific px4 crypto and
configuration for cmake

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-06-25 08:35:58 +02:00
Jukka Laitinen
b3e9904df0 Add monocypher crypto library in src/lib/crypto/monocypher
This simple crypto library is used as an example default backend for the crypto
interfaces

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-06-25 08:35:58 +02:00
Jukka Laitinen
09e62f96b2 Put all the test key material into same directory
Move Tools/test_key.json and key0.pub into same directory.

key0.pub is just a hex-dump of the public key part from the test_key.json,
for easy inclusion into bootloader monocypher sw crypto

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-06-25 08:35:58 +02:00
Jukka Laitinen
caed8e4b05 Fix cryptotools.py signature alignment
If the signature start address is already aligned, the tool erroneously adds 4 filling bytes

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-06-25 08:35:58 +02:00
Roman Dvořák
ab0e3b6001
icm20948_i2c_passthrough: allow to configure i2c address 2021-06-25 07:50:31 +02:00
Beat Küng
d79229f958 mavlink_shell.py: allow scripted use
E.g. echo free|./Tools/mavlink_shell.py

Or creating a virtual nsh console:
socat pty,rawer,link=/tmp/fmu_nsh_pts exec:"mavlink_shell.py 0.0.0.0\\:14550,pty,rawer"
2021-06-24 15:18:06 +02:00
Sander Swart
aa60d76963
camera trigger: don't keep triggering while enabled but paused 2021-06-24 06:56:58 +02:00
achim
6b356068cb
boards: mro_x21-777 board.h fix SPI 2 SCK pin
- SPI 2 had the wrong SCK PIN -> PB10 instead of PB13 -> accidentally the kill pin
could be probably wrong on other mro boards
2021-06-23 15:00:20 -04:00
Mathieu Bresciani
9cedb169fc
HTE: relax validity condition when already valid (#17783)
The condition to get valid requires a low variance and test ratio. but
to stay valid, only the variance is required.

Co-authored-by: Daniel Agar <daniel@agar.ca>
2021-06-23 07:33:11 +02:00
Hamish Willee
74cc1d901d Thoneflow - fix up links to docs 2021-06-22 13:43:53 -04:00
Paul Riseborough
3beb5bcbe0 EKF: Fix momentum drag density altitude scaling and update comments 2021-06-22 18:50:56 +10:00
Paul Riseborough
97b5ae1e96 EKF: Fix derivation comments for drag fusion 2021-06-22 18:50:56 +10:00
Paul Riseborough
58d376e2be EKF: prevent /0 and use pre-computed inverses 2021-06-22 18:50:56 +10:00
Paul Riseborough
de8625d255 EKF: fix sign error in bluff body drag fusion 2021-06-22 18:50:56 +10:00
Paul Riseborough
73d1e514d0 EKF: Extend drag fusion to include propeller momnetum drag 2021-06-22 18:50:56 +10:00
Matthias Grob
0dee7af81f ekf2_params: enable baro ground effect compensation by default 2021-06-22 10:32:54 +02:00
BazookaJoe1900
91808f7c9e Update EKF/common.h
Set non-zero default value for airspeed threshold to enable it by default

Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
2021-06-22 18:30:47 +10:00
Bazooka Joe
9c0a52d52a delay time: potentially reduce delay time if baro/aux velocity/airspeed is not used 2021-06-22 18:30:47 +10:00
bresch
611ace0ed6 EV_yaw: reset ev_to_ekf to identity when yaw is reset to EV
Otherwise, the old rotation matrix is used and not updated anymore
because the EKF is fusing EV yaw data.
2021-06-22 10:25:55 +02:00
bresch
804c3563fb heading_fusion: fix yaw gyro bias oscillation on ground
When the mag is pulled away before takeoff, the EKF can end up learning
a bad yaw gyro bias. This bad gyro bias makes the estimated heading spin
and even if the bias continues to be learned, it can end up being stuck
in limit cycle due to the innovation changing its sign every time the
heading estimate overshoots the measurement.
To prevent this, the Z gyro bias variance is reset when the mag heading
fusion test ratio fails on ground.
2021-06-22 16:45:26 +10:00
Thomas
a264541861 explicitly set param2 to 0 in existing *DO_VTOL_TRANSITION commands. add a guard against NaNs. 2021-06-21 22:39:54 +02:00
TSC21
0c5f2d3b8c microRTPS: add missing header for PRIu32 and PRIu16 macros
Co-authored-by: squizz617 <seulbae@gatech.edu>
2021-06-21 16:36:44 +02:00
TSC21
9fb53d4276 microRTPS: add option to build the microRTPS agent after its generation 2021-06-21 16:36:44 +02:00
TSC21
084a992572 microRTPS: agent: only allow to whitelist the localhost when using FastDDS as the rmw 2021-06-21 16:36:44 +02:00
TSC21
79f7986715 apply ROS2 default memory management and publish mode QoS policies; make sure that SharedMemory is only used with FastDDS as the rmw 2021-06-21 16:36:44 +02:00
Igor Mišić
39909128ec micrortps_client: increased stack size by 250B
Co-authored-by: Nuno Marques <n.marques21@hotmail.com>
2021-06-21 16:36:44 +02:00
TSC21
d3a23cee40 microRTPS: agent: fix double free memory problem on SIGINT
It fixes also some minor issues when exiting the agent, including the printed stats
2021-06-21 16:36:44 +02:00
TSC21
6d5f12d2a2 microRTPS: client: add TX rate limiter 2021-06-21 16:36:44 +02:00
TSC21
ac2b38603c microRTPS: client: add missing "-p" option for the UART poll timeout and use microsecs for the send/rcv thread sleeps 2021-06-21 16:36:44 +02:00
TSC21
0cc79f3e48 microRTPS: client: show diagnostic of current bandwidth usage on the 'status' option 2021-06-21 16:36:44 +02:00
TSC21
d6ee15596d microRTPS: client: show diagnostic of average bandwidth usage on the 'status' option 2021-06-21 16:36:44 +02:00
TSC21
40462bfc1f microRTPS: client: reduce name set by pthread_setname_np since Linux requires names (with NUL) to fit in 16 chars, otherwise returns ERANGE (34) 2021-06-21 16:36:44 +02:00
TSC21
145e7387fb posix: start the microRTPS client in sim every time the module is available 2021-06-21 16:36:44 +02:00
TSC21
773d81f208 microRTPS: client: fix send per allocated topic 2021-06-21 16:36:44 +02:00
TSC21
f2fad6d966 microRTPS: by default, when FastDDS >= 2.0, enable Shared Memory transport for the agent participants when the localhost network is enabled 2021-06-21 16:36:44 +02:00
TSC21
320b414511 microRTPS: client: match the code style from the PX4 Firmware 2021-06-21 16:36:44 +02:00
TSC21
63571b3e3f microRTPS: agent: match the code style from the PX4 Firmware 2021-06-21 16:36:44 +02:00
TSC21
323ce797f8 microRTPS: allow communications only in the localhost network when ROS_LOCALHOST_ONLY env variable is set 2021-06-21 16:36:44 +02:00
TSC21
578e426e9e microRTPS: set trajectory_waypoint to be sent only, as this is outgoing data with vehicle_trajectory_waypoint_desired 2021-06-21 16:36:44 +02:00
Pieter-Jan Dewitte
155d3c7d36 FW pos control: fix airspeed input constaining 2021-06-21 10:55:21 +02:00
Claudio Micheli
b1829e5766
Predict and use braking distance when Pausing auto modes (for multicopters) (#17269) 2021-06-18 10:45:03 +02:00
Daniel Agar
76a8617529
sensors: fix IMU init race condition
- IMU init requires valid published data (device ids, etc)
 - orb_group_count will include advertised instances before data is published, so this can't be used to throttle IMU init attempts
2021-06-17 10:38:33 -04:00
Peter van der Perk
b2742658b7 UAVCANv1 port unset fixes and deinitialization 2021-06-17 10:02:17 -04:00
Beat Küng
1c3f30be01 protocol_splitter: tcflush() uart before closing it 2021-06-17 09:40:57 -04:00
Beat Küng
14ec7a0d93 mavlink: tcflush() uart before closing it
On NuttX with flow control, if no one was reading from the uart, the
close() call would block indefinitely waiting for data to be sent.
2021-06-17 09:40:57 -04:00
honglang
074ed24d02 nora:fixed syntax error 2021-06-17 09:37:04 -04:00
Daniel Agar
500c45e798 uORB: Subscription check if uORB::Manager instance is valid
- this is necessary if uORB::Subscription is used with static storage
duration
2021-06-17 08:07:24 +02:00
David Sidrane
a728431e43 spracing_h7extreme:Track NuttX assert changes 2021-06-16 17:07:47 +02:00
David Sidrane
b399b8d5ea protocol_splitter:Track NuttX assert changes 2021-06-16 17:07:47 +02:00
David Sidrane
61f80c087a px4io:Fix Type 2021-06-16 17:07:47 +02:00
David Sidrane
18960f0b82 RoboClaw:Fix Types 2021-06-16 17:07:47 +02:00
David Sidrane
9377b02c58 Track NuttX Timer changes 2021-06-16 17:07:47 +02:00
David Sidrane
05bdef867d Track NuttX syslog change 2021-06-16 17:07:47 +02:00
David Sidrane
028ae9561d logger:watchdog Track NuttX file reorg 2021-06-16 17:07:47 +02:00
David Sidrane
eea1477e80 FakeImu:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
37d93320eb uavcan_v1:Uavcan: Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
026d36dee8 microRTPS:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
fd68fd2933 tests:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
f3624c172c kinetis pinirq:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
93c37e4e0c syslink:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
8d078eb02e vtol_att_control:Fix type 2021-06-16 17:07:47 +02:00
David Sidrane
bec5d6de9b vmount:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
350e43f02c dataman:fix types 2021-06-16 17:07:47 +02:00
David Sidrane
77082188d8 temperature_calibration:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
d73f842151 sensors:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
274c55a4ae navigator:mission Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
65d026d45c mavlink:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
5faa116681 logger:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
3b725e5525 gyro_fft:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
07fbf8681d gyro_calibration:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
85f4f13e8a flight_mode_manager:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
9a423e222b ekf2:Use inttypes and fix types 2021-06-16 17:07:47 +02:00
David Sidrane
ed474794cc commander:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
a3593d7d07 analog_battery:Use inttytpes 2021-06-16 17:07:47 +02:00
David Sidrane
9c87766021 sensor_calibration:Use inttytpes 2021-06-16 17:07:47 +02:00
David Sidrane
4bc7f1f3f3 lib/perf:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
f50b238c78 lib/parameters:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
b4ebc68a40 lib/drivers/nuttx/ I2C SPI:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
ff2748ba53 PX4Gyroscope:Fix types 2021-06-16 17:07:47 +02:00
David Sidrane
42e51b0215 PX4Accelerometer:Fix types 2021-06-16 17:07:47 +02:00
David Sidrane
17502da493 lib/battery:Fix types 2021-06-16 17:07:47 +02:00
David Sidrane
42e4ea86b1 uavcannode_gps_demo:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
616401190c UavcanNode:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
71f3a02c65 uavcan:use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
a07390a2d7 iridiumsbd:use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
2af9934f1c pcf8583:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
4ecda97fc1 roboclaw:Fix types 2021-06-16 17:07:47 +02:00
David Sidrane
4aa7bff8c6 rc_input:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
e7406bbd46 px4io:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
3747d0bc80 px4io:Fix types 2021-06-16 17:07:47 +02:00
David Sidrane
9443dd6345 pwm_out:use inttypes, match signature 2021-06-16 17:07:47 +02:00
David Sidrane
bd511e1074 dShot: Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
810e9e174f distance_sensor: Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
c12a3330b8 camera_trigger: Use proper types 2021-06-16 17:07:47 +02:00
David Sidrane
7b2a1d4742 drivers:camera_trigger Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
b6435bb7f2 drivers:camera_capture Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
3a0770499a drivers:batt_smbus Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
05007944f1 drivers:barometer Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
824dbce941 drivers:ADC Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
6e5a86b6fe dshot:Matched signature to drv_pwm_output.h 2021-06-16 17:07:47 +02:00
David Sidrane
dc23c85085 px4/common:mtd Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
1b80018f30 systemcmds:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
62fd132047 boards:Use inttypes
nxp_ucans32k146:Fix constant

spracing_h7extreme:Use inttypes
2021-06-16 17:07:47 +02:00
David Sidrane
84dd8839a2 i2c_spi_buses:Track NuttX change to getopts avoid name collision
NuttX #defined optarg and getopt to move to TLS. This fixes the
  name collision.
2021-06-16 17:07:47 +02:00
David Sidrane
64db89ab20 px_generate_uorb_topic_helper: Use inttypes 2021-06-16 17:07:47 +02:00
bresch
0ef5d7d4c8 test_replay: remove setting read-only parameter 2021-06-16 15:38:17 +02:00
AlexKlimaj
dddd2c3297
drivers/distance_sensor: New Broadcom AFBR-S50LV85D distance sensor driver
* Basic Broadcom AFBR-S50 driver using vendor API and binary blob https://github.com/Broadcom/AFBR-S50-API
* fix ARK Flow paw3902 rotation
2021-06-15 12:12:24 -04:00
Julian Oes
e828ba4288
commander: send parachute command on termination (#17564)
* commander: send parachute command on termination

This sends the DO_PARACHUTE command to parachute component.

* commander: fix lying comments and printf

* commander: use one flag for termination triggered

This merges the duplicate flags _flight_termination_triggered and
_flight_flight_termination_printed.

* commander: correct variable name

* commander: always send tune with parachute

* commander: fix target_component for parachute cmd

The previous changes were wrong in that all commands were now sent to
the parachute component which doesn't make any sense. Of course only the
parachute command should be sent there.
2021-06-15 11:50:30 +02:00
Jukka Laitinen
b550ad22b9 EKF2: Always publish global position
For historical reasons, there is a check in EKF2 to only publish global
position if it has moved for 1mm.

This is no longer necessary, and also this if doesn't save any cpu cycles
in real conditions where GPS errors are always much bigger that this.

When using simulated or fake GPS, based on some other positioning
system, the GPS coordinate input can be very accurate due to quantization
or true accuracy. In this case this check bites and perfectly valid position
doesn't get published.

Just removed this if.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-06-15 10:55:39 +02:00
Julian Oes
8415692f2a commander: enable user override when GPS is lost
When user override using the RC sticks is allowed, I would expect this
feature to also work in the case where GPS is lost and the vehicle goes
into a blind land/descent.

Without this commit, the vehicle would switch to Land mode and a pilot
could not take over control unless they switch to Altitude control in
a ground station.

With this commit, user override works as I would expect it and it will
switch to Altitude control allowing a pilot to recover in this
situation.
2021-06-15 10:36:11 +02:00
TSC21
749f213ca5 make_list: check if file exists before the other operations 2021-06-14 11:54:05 +02:00
TSC21
c4d54d983b mavsdk_tests: bump MAVSDK version to 0.40.0 2021-06-14 09:23:38 +02:00
Daniel Agar
0c303f03f4
Update submodule mavlink v2.0 to latest Mon Jun 14 00:39:13 UTC 2021 2021-06-13 21:30:10 -04:00
Hamish Willee
d6f69ef2a0 aion robotic frame - fix broken link to R1 UGV docs 2021-06-12 11:58:26 -04:00
TSC21
0f47ae8e7b update submodule Tools/sitl_gazebo 2021-06-12 11:57:17 -04:00
David Sidrane
9c8e95db8d NuttX w/NXP contrib for FlexCAN fixes 2021-06-12 06:22:01 -07:00
David Sidrane
5b9201e5b4 cuav:Nora X7 Pro:Camera trigger is on 13/14 2021-06-11 15:13:23 +02:00
David Sidrane
e0fab172a4 camera_trigger:Support more than 8 channles 2021-06-11 15:13:23 +02:00
Beat Küng
615e1f3e29 mavlink: fix module doc for broadcast 2021-06-11 09:01:41 +02:00
Beat Küng
468aea9409 cmake: enable --ethernet to generate common param metadata
This will add the MAV_x_BROADCAST params.
2021-06-11 09:01:41 +02:00
Peter van der Perk
8c4b900f9a
uavcan_v1: Correct transmission deadline check & fix SocketCAN tx deadline 2021-06-10 02:26:28 +00:00
Julian Oes
ca86416ce6 mavlink: don't read garbage target sysid/compid
This fixes a tricky bug that we discovered in MAVSDK:
https://github.com/mavlink/MAVSDK/pull/1464

It turns out the target_system and target_component fields can
potentially be:
1. at the end of a message payload,
2. and zero,

and therefore they get trimmed. When you then try to read it you
potentially read some garbage from the CRC fields.
2021-06-09 15:40:46 -04:00
echoG
6bc09138c1
Adding BatMon smart battery as a module and refactoring SMBUS based SBS 1.1 spec to a library 2021-06-09 12:17:45 -04:00
Julian Oes
8be1034346
workflows: fixes typo on python package name (#17740)
The previous PR was merged optimistically.
2021-06-09 09:11:28 -07:00
bresch
514845592b en-/disable mc position controller using explicit control mode flag 2021-06-09 18:10:22 +02:00
Julian Oes
17ea92bb54
workflows: add missing dependency for mypy (#17736) 2021-06-09 08:52:21 -07:00
Daniel Agar
328c5cb1cf mavlink: properly cleanup instance on exit 2021-06-09 10:58:34 -04:00
Hamish Willee
9f87702074 px4moduledoc/markdownout.py - source links to PX4-Autopilot 2021-06-09 11:11:08 +02:00
Hamish Willee
665d2ea74e markdownout for parameters - makes link internal 2021-06-09 11:09:48 +02:00
Hamish Willee
f9201811b4 airframes markdownout.py - fix link to not open file for editing 2021-06-09 11:08:37 +02:00
JacobCrabill
0931ff10d5 uavcan_v1: Clean up handling of invalid port IDs
Always convert 'invalid' port ID values (e.g., the default PX4 port-ID
parameter value of -1) to CANARD_PORT_ID_UNSET in all comparisons.
2021-06-08 20:13:19 -04:00
JacobCrabill
73ef22ae77 uavcan_v1: Fix heartbeat pub timestamp
The hrt_abstime value used to control the 1s pub rate was the value of
the timestamp_usec of the CanardTransfer, which has a timeout of 100ms
added to it.

Since hrt_abstime is an unsigned datatype, if the hrt_elapsed_time()
check was called <100ms apart, the negative value would result in a
large hrt_elapsed_time, and the bus would be spammed with Heartbeat
messages (or error messages from canardTxPush).
2021-06-08 20:13:19 -04:00
Daniel Agar
251f1a069b ekf2: update message lost error messages to perf counters
- only allocate these perf counters if data source is present
2021-06-08 20:12:17 -04:00
bresch
841914462d MC pos control: use vz<->z_deriv blending in pure vel mode only
This logic was introduced to avoid large altitude drifts in velocity
mode (altitude not controlled) due to potential velocity estimate bias
in case of IMU problems (see PR #8445). After some refactorings,
the logic started to be used in altitude-controlled modes as well, which is not needed.
2021-06-08 14:58:14 +02:00
Daniel Agar
47b9016f5e I2CSPIDriverBase: print rotation and i2c address if set 2021-06-08 09:27:21 +02:00
CUAV_gitfishup
c61c1a15ee
cuav/x7pro: fix syntax error in rc.board_sensors 2021-06-08 09:18:20 +02:00
honglang
8b1d2b8551 change fmu-v5's uavcan timer5 to timer6 2021-06-07 20:07:03 +02:00
achim
00229c4fd2
drv_pwm_output.h: increase highest max pwm limit from 2150 to 2500
- servo linkages in vtol often need further travel of the servos to cover the full tilt travel
2021-06-07 09:13:39 -04:00
Daniel Agar
578c003c13 ekf2: selector handle uninitalized test ratios
- choose the best instance regardless of tilt or yaw alignment
2021-06-07 08:56:37 -04:00
Matthias Grob
ed62ae0e4f mavlink: add actuator_armed header to heartbeat 2021-06-07 08:55:49 -04:00
Julian Oes
446598d003 mc_pos_control: omit initial warning 2021-06-07 08:54:19 -04:00
Daniel Agar
4f850c7cd0 sensors: preserve all valid calibration parameters even if sensor currently missing
- mark calibration slots active for first N sensors found
 - calibration procedure don't bother resetting unused slots
2021-06-07 08:50:32 -04:00
Daniel Agar
2ccd86102b ekf2: add command line option to manually select instance 2021-06-07 08:47:17 -04:00
achim
66dbc1e25f Update rc.board_arch_defaults
logger doesn't start at all up to 4k buffer
2021-06-05 11:46:30 -04:00
achim
fd2161b6bf Update rc.board_arch_defaults
logger doesn't start at all up to 4k buffer
2021-06-05 11:46:10 -04:00
achim
1ab7943940 Update rc.board_arch_defaults
Logger doesn´t start at all with 4k buffer
2021-06-05 11:45:53 -04:00
Daniel Agar
4f8f1a5f7e
mavlink: streams HEARTBEAT fix code style 2021-06-04 20:43:25 -04:00
Daniel Agar
d31a45a62d github actions SITL test run standard_vtol with address sanitizer 2021-06-04 13:27:42 -04:00
Matthias Grob
faabe2d431 mavlink: make sure heartbeat reports flight termination 2021-06-04 12:48:22 -04:00
achim
6fb1ba7583 Update rcS
remove sd index file spoofing
2021-06-04 11:43:17 -04:00
Matthias Grob
70050ae4f5 mc_pos_control_params: correct MPC_POS_MODE docs since 1 is depracated 2021-06-04 09:32:03 -04:00
Peter van der Perk
9756c70491
UAVCANv1 Iteration, dynamic subscribers and decoupling (#17624)
* Update to use libcanard callback
Reworked param system with lambda

* Use callback instead of lambda saves 500 bytes of flash

* [UAVCANv1] Added ServiceRequest class, subscribers decoupled

* PX4 UAVCANv1 portID param default CANARD_PORT_ID_UNSET (65535U)

* [UAVCANv1] uORB sensor_gps modify timestamp for now untill we've got timesync working

* UAVCANv1 update parameter definition to use -1 as unset
2021-06-04 09:30:17 -04:00
Daniel Agar
470c3cfa6e mavlink: streams HEARTBEAT fix vehicle_control_mode copy 2021-06-04 15:19:34 +02:00
CUAVmengxiao
98fb373590 mavlink: 14S battery support 2021-06-04 09:15:40 -04:00
RomanBapst
ad9288536b TECS: enable direct height-rate control
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
RomanBapst
f6de99d42e FixedWingPositionControl: control only height rate when using pitch stick
in manual altitude controlled modes

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
Silvan Fuhrer
3d87bfcc0a rename FW_T_CLIMB_R_SP to FW_T_CLMB_R_SP
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-06-04 14:51:27 +02:00
RomanBapst
19449a4e75 FixedWingPositionControl: use target climb/sink rate parameters as maximum
rates in manual altitude controlled modes

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
RomanBapst
a5cc449e69 tecs: propagate altitude setpoint based on target climb/sink rate
- avoids tecs always climbing and sinking and max rates and allows to fine tune these rates
- avoid numerical calculation of feedforward velocity using derivative, this
 was prone to jitter in dt

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
RomanBapst
4b7416c05b FixedWingPosControlL1: added target climb and sink rate parameters
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
Travis Bottalico
861e15be4c - update CDCAM_PRODUCTID to match bootloader 2021-06-03 21:38:53 -04:00
bresch
8ad0f36f48 pwm: specific fail/disarm parameters should default to global value 2021-06-03 21:26:13 -04:00
Daniel Agar
db1657fa84 sensors/vehicle_magnetometer: apply current compensation regardless of arming state
- simplify update on mag compensation type change
2021-06-03 10:08:19 -04:00
Julian Oes
60235f8474 mavlink: properly initialize vehicle_command queue
This makes sure that the vehicle_command topic is properly
initialized from the beginning.

orb_exists returns -1 or 0 and not a bool as one would expect.
2021-06-03 08:53:39 -04:00
Hamish Willee
00cc1323ea gpio.cpp: Add backticks around gpio command docs 2021-06-03 12:37:48 +02:00
alexklimaj
3e9b295c22 Add watchdog_init to ark boards to ensure watchdog pauses during debugging 2021-06-03 00:54:57 -04:00
Daniel Agar
284375efc3 px4io: only update PWM MAX/MIN/DIS/FAIL/REV once
- Updating PWM params on param change was interfering with VTOL
parameter settings (e.g. PWM_MIN is set by VTOL at init, and
was then overwritten here after an arbitrary param change).
2021-06-03 00:52:05 -04:00
Silvan Fuhrer
697d713faf pwm out: disable PWM parameter update on param change
Only update PWM params on initialisation.
Updating PWM params on param change was interfering with VTOL
parameter settings (e.g. PWM_MIN is set by VTOL at init, and
was then overwritten here after an arbitrary param change).

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-06-03 00:52:05 -04:00
bresch
71fc1b8161 airspeed fusion: use yaw from 312 sequence when pitch is close to 90deg
This caused bad initialization of the wind estimate on tailsitters
2021-05-23 15:58:50 +10:00
Bazooka Joe
e57af44d71 set parameters that doesn't change with const attribute, for clearification 2021-05-20 18:19:33 +10:00
bresch
85f5a935fe [AUTO COMMIT] update change indication 2021-05-12 08:33:07 +10:00
bresch
f7c687e433 GNSS yaw unit test: test fallback to non yaw aiding mode 2021-05-12 08:33:07 +10:00
bresch
a4fe2b1e72 yaw_align: let the mag control logic do the alignement and resets 2021-05-12 08:33:07 +10:00
bresch
2cc023038b mag control: select mag mode before doing the reset 2021-05-12 08:33:07 +10:00
bresch
fe943cf104 mag reset: force align in MC custom mode (aka. indoor mode)
Checking the parameter is enough to decide if we want to force the yaw
alignment or not
2021-05-12 08:33:07 +10:00
bresch
cadcc58415 mag reset: do not stop the fusion from inside the reset function
The start/stop is already handled in the dedicated mag control logic
The early return is not required as this case is handled just below
2021-05-12 08:33:07 +10:00
bresch
6248646bff EV yaw: move EV yaw reset out of resetMagHeading function
Also remove the unnecessary 2nd "manual reset" done in the start function
2021-05-12 08:33:07 +10:00
bresch
48722a2a92 control: inhibit EV yaw from restarting when GPS aid wants to start 2021-05-12 08:33:07 +10:00
bresch
a685987082 GNSS yaw: unset yaw_align if fusion stops before takeoff
We do not want to rely on a potentially badly initialized heading as it
could lead to a flyaway directly after takeoff

Also remove the resetMagHeading() call from the GPS fusion control logic
as this is properly handled in mag_control.
2021-05-12 08:33:07 +10:00
bresch
7ee69706e8 GNSS yaw: add test case when measurement jumps 2021-05-12 08:33:07 +10:00
bresch
7a11871566 GNSS yaw tests: adjust timing
the starting condition needs more than 1 sample to determine if the data
comes regularly

the timeout on "no data" is defined by the fusion reset timeout
parameter (7 seconds)
2021-05-12 08:33:07 +10:00
bresch
51197a5d82 GNSS yaw selection logic refactor 2021-05-12 08:33:07 +10:00
bresch
29243ac5cb yaw_reset: reduce minimum vector length to compute yaw error
A value of 1m/s was too conservative and the EKF takes too much time to
trigger a yaw reset. The value can be safely reduced because the
threshold is computed using the accuracy of the measurement and estimate
before being limited by this value.
2021-05-06 19:13:54 +10:00
Kabir Mohammed
aad48407c2 EKF: increase allowed difference between flow and gyro ODRs
In the normal and lowlight mode for the PAW3902/3 sensor, the ODR is 66Hz, while in super lowlight mode it is 50Hz.

The IMU ODR vs flow ODR mismatch threshold was too conservative for the 66Hz ODR, since https://github.com/PX4/PX4-ECL/pull/928. The EKF would keep waiting for the data to line up and never fuse measurements.
2021-05-03 11:08:16 +02:00
Eike
a7b8afe420
Allow rangefinder fusion in vision height mode (Fix for #994) (#999)
Co-authored-by: Daniel Agar <daniel@agar.ca>
2021-04-30 14:17:39 -04:00
Daniel Agar
4ac57d3bde
EKF: increase fault flags value size to fit current flag bits (> 16) 2021-04-25 17:05:09 -04:00
Eike
5d34d7a24e
Height source vision: Fallback to rangefinder if available (#994) 2021-03-31 14:24:38 +02:00
PX4BuildBot
da06f25216 [AUTO COMMIT] update change indication 2021-03-28 21:22:25 -04:00
PX4 BuildBot
85fcf9393d Update geo_lookup WMM to latest Sun Mar 28 11:48:06 UTC 2021 2021-03-28 21:22:25 -04:00
bresch
6f2dec726a gps sacc: apply same minimum for EKF2 and yaw estimator 2021-03-25 09:54:30 +01:00
Daniel Agar
e3d1ade660 EKF: use flow for vel test ratio if only active source of horizontal aiding 2021-03-23 15:56:22 +01:00
Morten Fyhn Amundsen
bb950a1550 Expose terrain vpos reset counter 2021-03-18 14:25:07 +01:00
Morten Fyhn Amundsen
ab69681744 Add parameter for terrain timeout 2021-03-18 14:25:07 +01:00
Daniel Agar
4df0054873 geo: purge old globallocal_converter 2021-03-15 14:43:53 -04:00
Paul Riseborough
b3c1bd6d40 EKF: Remove un-used code 2021-03-09 21:23:38 +11:00
Paul Riseborough
4bad2a272c EKF: Use debug prints for NuttX builds 2021-03-05 19:06:59 -05:00
Daniel Agar
0f47cae1e1 remove ECL_{INFO,WARN,ERN}_TIMESTAMPED macros
- we already have mechanisms to print these messages timestamped
2021-03-05 19:06:59 -05:00
Paul Riseborough
c1f1415696 EKF: Add usage warning comment 2021-03-05 19:06:59 -05:00
Paul Riseborough
c2b86cdb20 EKF: Provide external reset of event records 2021-03-05 19:06:59 -05:00
Paul Riseborough
9d51ab079a EKF: Remove duplicated event recording 2021-03-05 19:06:59 -05:00
Paul Riseborough
140ca3f48f EKF: Add external monitoring of warning and information events 2021-03-05 19:06:59 -05:00
Paul Riseborough
90a445ddbc EKF: upgrade some events from into to warning status 2021-03-05 19:06:59 -05:00
bresch
cb8367026c [AUTO COMMIT] update change indication 2021-03-04 19:43:01 +11:00
bresch
93dd4e5754 fix unit tests 2021-03-04 19:43:01 +11:00
bresch
5d441d65e1 Accelerate tilt fine alignment by reducing obs noise when at rest
Fine tilt alignment is accomplished by fusing fake position data after
a coarse tilt leveling. The observation noise can be reduced if the
vehicle is at rest to speed up the process.
2021-03-04 19:43:01 +11:00
Daniel Agar
098d5ce5c0
EKF allow range aid without horizontal aiding
- skip range aid velocity check when horizontal aiding isn't active
2021-02-22 11:55:56 -05:00
Nicolas MARTIN
29943a2c09
EKF test ratio status return current height source test ratio 2021-02-22 09:22:45 -05:00
mcsauder
164e53bad3 Add unit tests and update ekf_helper setEkfGlobalOrigin() method to allow for condition when current position is unitialized. 2021-02-19 08:59:47 -05:00
Daniel Agar
63f64b57c1 EKF: set global origin method
EKF: add convergence after global origin reset test
2021-02-19 08:59:47 -05:00
bresch
81937370ac [AUTO COMMIT] update change indication 2021-02-18 10:11:51 +01:00
bresch
04844a04ed ekf control: move time_last_in_air/on_ground out of GPS control logic 2021-02-18 10:11:51 +01:00
bresch
b00d4a9237 mag fusion: improve on ground forced mag fusion logic
While a yaw test ration > 1 rejects the mag data in air, the fusion is
forced with a limited innovation on ground to fix gyro bias and local
magnetic effects problems pre-takeoff. However, the same logic is
applied after landing and immediately after the land detector detects
landing. In some cases, this can disturb the other EKF states which can
lead to a state change of the land detector.
To avoid such a loop, the start of this forced yaw fusion is delayed by
5 seconds after landing.
2021-02-18 10:11:51 +01:00
Daniel Agar
310f415175
EKF add const state reset status access 2021-02-16 10:33:43 -05:00
isidroas
0c5291d194
Heading reset to magnetometer from GPS or EV (#969) 2021-02-16 14:37:34 +01:00
Mathieu Bresciani
d4258cc66d
yaw emergency: check angle between vel observation and estimate (#975)
use thresholds based on state and obs variance

* [AUTO COMMIT] update change indication
2021-02-15 10:31:16 +01:00
Loic Dubois
ffab483504 Waiting for the filter to be initialized to set global origin 2021-02-11 12:55:25 -05:00
Paul Riseborough
602e65146c EKF: Remove unnecessary initialisation 2021-02-09 19:55:32 +11:00
Paul Riseborough
6f664abc4a EKF: Non functional changes arising from review 2021-02-09 19:55:32 +11:00
Paul Riseborough
b87778e61d EKF: Make clip detection logic easier to follow 2021-02-09 19:55:32 +11:00
Paul Riseborough
9aa8d93efc EKF: Use isRecent function 2021-02-09 19:55:32 +11:00
Paul Riseborough
e948b3505f EKF: Don't reject vertical aiding data if inertial solution is bad
Also reduce clipping count threshold
2021-02-09 19:55:32 +11:00
Paul Riseborough
c566318db5 EKF: misc improvements to handling of accel clipping 2021-02-09 19:55:32 +11:00
Paul Riseborough
9c89fa3b29 EKF: Use IMU clipping to adjudicate bad accel data check 2021-02-09 19:55:32 +11:00
bresch
cd38621dd6 flow terrain: use dedicated variable for last fusion time
This avoids confusion with the flow "for velocity" fusion in the main
EKF
2021-02-08 23:26:33 -05:00
PX4BuildBot
9521e81b09 [AUTO COMMIT] update change indication 2021-02-08 09:43:53 -05:00
PX4 BuildBot
ae0c054d75 Update geo_lookup WMM to latest Mon Feb 8 11:48:14 UTC 2021 2021-02-08 09:43:53 -05:00
bresch
5aaa6c6dde lpos accuracy: bump variance if deadreckon time exceeded 2021-02-08 09:01:51 -05:00
Daniel Agar
46251db4a1 geo: explicitly link libm 2021-02-05 19:00:53 -05:00
Paul Riseborough
b919f3ddf4 EKF: Restore protection from extreme innovation values 2021-01-21 20:55:42 +11:00
Paul Riseborough
efb78deef9 EKF: Set position fusion gate option false by default 2021-01-21 20:55:42 +11:00
Paul Riseborough
556a195320 EKF: Improve handling of non position mode large position innovations
These changes fix a bug that allowed IMU gyro errors that cause large tilt errors prior to start of aiding not resulting in large innovation test ratios.
2021-01-21 20:55:42 +11:00
Paul Riseborough
99575d73e1 EKF: Add bad accel bias checking for EV and range finder height use cases 2021-01-09 11:03:31 -05:00
Paul Riseborough
ff3c0a6136 EKF: Fix bug preventing recovery from bad delta velocity bias estimates 2021-01-09 11:03:31 -05:00
priseborough
c25c97f8b5 [AUTO COMMIT] update change indication 2021-01-09 11:03:31 -05:00
Paul Riseborough
96418101e1 test: Allow for larger vel variance growth due to dvel bias variance 2021-01-09 11:03:31 -05:00
Paul Riseborough
1b1c049e81 test: Update unit test to match expected behaviour 2021-01-09 11:03:31 -05:00
Paul Riseborough
dd259a288f EKF: Don't modify accel bias states and variances when inhibited 2021-01-09 11:03:31 -05:00
Paul Riseborough
3e1f2d8674 EKF: Set dvel bias variance to stored value when state is inactive 2021-01-09 11:03:31 -05:00
bresch
c212975abe rng height: reset to baro using common logic
The failsafe from rng height to baro height should occur after a reset
to baro triggered by the controlHeightSensorTimeouts function and not in
the fusion selector.

Until now, the EKF was fusing baro measurements between rng updates if
the range finder ODR was slower than the EKF update rate. This is not
the case anymore as the height reset occurs after 5 seconds.

The unit test has been extended to show this behavior.
2021-01-07 10:07:57 +01:00
Paul Riseborough
03fed323ab EKF: Fix formatting 2021-01-05 21:08:28 +11:00
Paul Riseborough
31fca9c31d EKF: Update GPS loss message 2021-01-05 21:08:28 +11:00
Paul Riseborough
c65cf13bb8 EKF; Treat combined sideslip and airspeed as a horizontal aiding source 2021-01-05 21:08:28 +11:00
bresch
211c84c85b Rng finder unit test: cover "un-stuck" logic 2021-01-05 20:04:17 +11:00
Kamil Ritz
78ce46f007 Removing Matlab derivation 2021-01-02 06:29:11 +11:00
Mathieu Bresciani
18f334f4db
flow: add unit test for yaw motion (#950) 2020-12-25 09:47:14 +01:00
Kamil Ritz
df7f261e03 Add missing const modifier 2020-12-20 14:04:29 +01:00
Daniel Agar
a8e0e82858 EKF: update mag LPF immediately 2020-12-17 10:46:04 +01:00
Daniel Agar
398fe159ce EKF: allow initialising without mag depending on configuration
- reduce initial number of required mag and baro samples before init
2020-12-17 19:55:51 +11:00
Daniel Agar
1237087d70
AlphaFilter add constructor that takes alpha and use in EKF 2020-12-16 13:55:59 -05:00
Daniel Agar
37e84b763a README: fix zenodo badge (rename ecl -> PX4-ECL) 2020-12-16 10:47:21 -05:00
Mathieu Bresciani
5ccb8b457d
fakePosFusion: reset _last_known_posNE to current state when starting (#943)
* [AUTO COMMIT] update change indication
2020-12-15 10:09:01 +01:00
bresch
9d22f140dd gps_alt: constrain var using 1.5 as a typical ratio of vacc/hacc 2020-12-13 14:39:50 +11:00
bresch
b0cf45e2d2 gps_alt: rename getGpsAltVar -> getGpsHeightVariance 2020-12-13 14:39:50 +11:00
bresch
62f2e26c49 gps_alt: reset GPS alt variance usign helper function 2020-12-13 14:39:50 +11:00
bresch
f7bddda3d5 gps_alt: do not scale up reported gps vertical accuracy
The comment said that the horizontal accuracy needs to be scaled up
using the typical epv/eph ratio but the epv (vacc) is already available,
so no scaling is required.
2020-12-13 14:39:50 +11:00
bresch
02369cd415 gps_alt: extract measurement variance computation and saturation 2020-12-13 14:39:50 +11:00
Daniel Agar
1541e4b414
EKF: update control status and fault status getters
- the fault status union exceeded 16 bits, but the getter was get_filter_fault_status(uint16_t *val)
2020-12-10 09:13:12 -05:00
zhaoxiaowei
fbf67bdef9 reset gps height use vacc 2020-12-10 10:07:59 +01:00
Mathieu Bresciani
8f3df7a97b
flow: restructure optical flow control logic (#928)
- extract motion checks performed on ground
- move all non-timing check to controlOpticalFlowFusion. This simplifies and standardirzes the setOpticalFlowData function. Furthermore, in some cases (SITL, PX4Flow), the dt is forced to 0 when the quality is 0 (which is usual on ground) so the ekf needs to ignore those values on ground to initialize properly the flow fusion.
- add filter convergence test
- move check for dt time max in setOpticalFlowData
- in the simulator, do not update dt as this is the sensor integration
period.
2020-12-09 11:33:00 +01:00
kritz
38358002bb
Auto update change indication by github actions
Co-authored-by: kamilritz <kamilritz@users.noreply.github.com>
2020-12-08 18:05:28 -05:00
Daniel Agar
688a054bdb EKF: controlDragFusion() add parenthesis for readability 2020-12-08 18:03:04 -05:00
Paul Riseborough
944b18c63e EKF: Remove non useful status print
Local position is never valid when filter is initialised so there is no use printing the status.
2020-12-08 18:03:04 -05:00
Paul Riseborough
ee94980a8f EKF: Clean up wind state activation logic
Ensure wind states are deactivated in one place and always when in a non-position mode.
Activate wind states separately for each observation method.
2020-12-08 18:03:04 -05:00
Paul Riseborough
44ebfb8c43 EKF: Don't report local position as valid when in a non-position mode 2020-12-08 18:03:04 -05:00
Daniel Agar
da7d41e78a
EKF: add mag bias reset helper and update IMU bias reset to match (#924) 2020-12-08 12:16:59 -05:00
Daniel Agar
03cfcb903e
EKF: RingBuffer minor improvements
- allocate IMU and output buffers on construction according to defaults
 - determine buffer max time delay based on configuration parameters
 - reorder flowSample and extVisionSample to minimize padding
 - adjust parameter defaults to match PX4-Autopilot
2020-12-03 20:48:51 -05:00
PX4 BuildBot
67f13f7ede Update geo_lookup WMM to latest Wed Dec 2 11:48:25 UTC 2020 2020-12-02 19:47:46 -05:00
bresch
da9f314b69 mag: use strength in Gauss 2020-11-10 20:25:09 +11:00
Claudio Micheli
c4d162f9a0
EKF: range_finder parameterize range sensor quality hysteresis time
Signed-off-by: Claudio Micheli <claudio@auterion.com>
Co-authored-by: bresch <brescianimathieu@gmail.com>
2020-11-04 12:35:39 -05:00
Daniel Agar
6158d6d841
EKF: add const reference getters for status flags 2020-11-02 13:05:08 -05:00
Daniel Agar
a21092804a EKF: remove virtual getters from estimator_interface 2020-11-02 09:35:47 -05:00
Daniel Agar
48a8992caf
EKF: move small simple getters to header
- return by const reference where possible
2020-10-30 09:48:45 -04:00
Daniel Agar
defb35d8f5 EKF: pass imuSample by const reference 2020-10-30 09:47:22 -04:00
Daniel Agar
d85e24d3ca EKF: Ekf class is final 2020-10-27 08:53:58 -04:00
Daniel Agar
961b545da0 cmake: respect MAX_CUSTOM_OPT_LEVEL if set
- ignored for Debug and Coverage builds
2020-10-27 08:53:58 -04:00
Daniel Agar
5ea8824439 EKF: inline simple getters 2020-10-27 08:53:58 -04:00
Daniel Agar
6e99ebd928 EKF: add fault status bit for bad vertical accel data 2020-10-26 17:37:15 +01:00
Daniel Agar
d936b85d71 EKF: add fault status bit for clipping 2020-10-26 17:37:15 +01:00
Mathieu Bresciani
dd3ffc4192
Optical flow: compute velociy from corrected flow data for logging (#920)
This is really useful when debugging optical flow data
2020-10-26 13:27:52 +01:00
bresch
9126282c03 CI: update containers, sync with px4/Firmware 2020-10-26 11:07:13 +01:00
bresch
e80a683981 CI: update change indicator of yaw emergency estimator
This was incorrectly uptated in 1a7c68ea72db82de1d8729f900a5543a253a3ac4
2020-10-26 11:07:13 +01:00
Paul Riseborough
f666ebb995 EKF: Code format fix - replace 1E-x with 1e-x 2020-10-06 20:50:52 +11:00
Paul Riseborough
e82d0af6d2 EKF: Improve code clarity - non functional change 2020-10-06 20:50:52 +11:00
Paul Riseborough
1a7c68ea72 EKF: update change indicator 2020-10-06 20:50:52 +11:00
Paul Riseborough
759d217d5a EKF: Improve protection for GSF weight collapse 2020-10-06 20:50:52 +11:00
Paul Riseborough
7c81350c7a EKF: Don't yaw reset if not yaw induced nav failure 2020-10-06 20:50:52 +11:00
Paul Riseborough
bf0d70fc90 EKF: Protect against collapse of GSF weights 2020-10-06 20:50:52 +11:00
Daniel Agar
4c2355a638 EKF: use GPS to lookup declination from WMM before full GPS checks pass 2020-09-28 08:43:32 +02:00
Daniel Agar
6b99ea2a60 ECL standalone build improve ECL_INFO/WARN/DEBUG
- ECL_{INFO,WARN,DEBUG} add newline
 - ECL_{INFO,WARN,DEBUG}_TIMESTAMPED add imu timestamp and newline
2020-09-25 09:33:50 -04:00
bresch
5879eaaf78 ekf: fix variable length array error
Even if the non_zeros() function is static constexpr, gcc (10.2) does not like it.
Using sizeof...(Idxs) fixes the error.
2020-09-25 11:33:29 +02:00
Daniel Agar
99aafbaa18
README: remove obsolete build status 2020-09-14 12:04:42 -04:00
Daniel Agar
fab242a81f python generation add shebang, mark executable, ignore cache
- commit all current generated files
2020-09-07 09:20:41 +02:00
rjgritter
a204c59990
WindEstimator: Fix incorrect _state accessing, clarify enums (#906) 2020-09-05 08:48:51 +02:00
bresch
264c8c4e86 mag_fusion: mag heading and 3d modes are mutually exclusive
There is no need to check if 3d fusion is active when in mag heading
fusion mode since this is impossible
2020-08-27 15:48:40 +10:00
kamilritz
9797e4d28f updateYawInRotMat with hidden rotation sequence handling 2020-08-27 09:51:56 +10:00
kamilritz
419b70e4b5 Add tests for shouldUse321RotationSequence 2020-08-27 09:51:56 +10:00
kamilritz
4fb4e0ca01 Clean euler321 and euler312 code and comment 2020-08-27 09:51:56 +10:00
Kamil Ritz
2be738e806 Add helper function to alter heading in rotation matrices 2020-08-27 09:51:56 +10:00
Kamil Ritz
fdc86c247a add functions to compute yaw (321 and 312 sequence)
from quaternion and rotation matrix
2020-08-27 09:51:56 +10:00
Kamil Ritz
15afa8ae17 shouldUse321RotationSequence(const Dcmf& R) 2020-08-27 09:51:56 +10:00
Kamil Ritz
4872f2a545 Remove not used code 2020-08-24 19:24:27 +10:00
Kamil Ritz
0fafd4d68b precompute cos and sin of yaw once before mutliple use 2020-08-24 19:24:27 +10:00
Kamil Ritz
114516b784 Use new added matrix functions 2020-08-24 19:24:27 +10:00
Kamil Ritz
1f637af7de Add const modifier 2020-08-24 19:24:27 +10:00
kamilritz
aa2c77f92d Small cleanup in velposfusion 2020-08-24 18:04:57 +10:00
kamilritz
644e903552 Apply measurementUpdate function 2020-08-24 18:04:57 +10:00
kamilritz
404edde7f3 Add measurementUpdate function 2020-08-24 18:04:57 +10:00
kamilritz
f6252ff533 small cleanup in limitDeclination 2020-08-24 18:04:57 +10:00
Daniel Agar
f62662ee46 update change_indication for newer WMM tables 2020-08-21 16:54:45 -04:00
PX4 BuildBot
802a6d99a0 Update geo_lookup WMM to latest Fri Aug 21 11:48:14 UTC 2020 2020-08-21 16:54:45 -04:00
kamilritz
bd0c5fbb97 Update change indication for ekf gsf 2020-08-20 22:16:28 +02:00
kamilritz
3ae934544f Add change indication for ekf_gsf_reset 2020-08-18 17:13:46 +10:00
Paul Riseborough
fd849e0578 EKF: Fix specific force observation noise variance
Also add protection for out of range value.
2020-08-18 17:05:59 +10:00
Paul Riseborough
76f393dcb0 EKF: Use const reference instead of local copy 2020-08-18 17:05:59 +10:00
Paul Riseborough
c43307b8cf EKF: convert drag fusion from Matlab to SymPy generated auto-code 2020-08-18 17:05:59 +10:00
Paul Riseborough
1e6c6f2d3c EKF: update all output states when aligning output time horizon filter 2020-08-16 10:00:47 +10:00
kamilritz
3bd9415498 Make delayed output stayed not a member variable 2020-08-16 10:00:47 +10:00
kamilritz
da9bfe4316 Update interface of applyCorrectionsToOuputStates 2020-08-16 10:00:47 +10:00
Paul Riseborough
64ab2b087a EKF: Only record successful sideslip fusion when states updated 2020-08-16 08:45:59 +10:00
Paul Riseborough
0fa7ef3517 EKF: Use ecl::powf for integer exponents 2020-08-16 08:45:59 +10:00
Paul Riseborough
168dbdf630 EKF: Convert sideslip fusion to use SymPy generated auto-code 2020-08-16 08:45:59 +10:00
Paul Riseborough
06aa78a291 EKF: Only record airspeed fusion event when states are updated 2020-08-16 08:45:26 +10:00
Paul Riseborough
486a461a5e EKF: airspeed fusion derivation test comparison cleanup 2020-08-16 08:45:26 +10:00
Paul Riseborough
ede6204f85 EKF: airspeed fusion cleanup 2020-08-16 08:45:26 +10:00
Paul Riseborough
a5a43dbc6c EKF: Convert airspeed fusion to use SymPy generated auto-code 2020-08-16 08:45:26 +10:00
Paul Riseborough
5907e81ef7 EKF: optflow fusion cleanup 2020-08-16 08:44:17 +10:00
Paul Riseborough
7fa9a1963b EKF: optflow fusion cleanup
Co-authored-by: kritz <kritz@ethz.ch>
2020-08-16 08:44:17 +10:00
Paul Riseborough
0e74f3ea9d EKF: optflow fusion cleanup
Co-authored-by: kritz <kritz@ethz.ch>
2020-08-16 08:44:17 +10:00
Paul Riseborough
6e992a18f6 EKF: optflow fusion cleanup
Co-authored-by: kritz <kritz@ethz.ch>
2020-08-16 08:44:17 +10:00
Paul Riseborough
1ad042da23 EKF: Use ecl::powf in comparison test 2020-08-16 08:44:17 +10:00
Paul Riseborough
274523bd98 EKF: Use ecl::powf for integer exponents 2020-08-16 08:44:17 +10:00
Paul Riseborough
f20a5d814d EKF: Remove redundant tilt check
Also fix comment indent
2020-08-16 08:44:17 +10:00
Paul Riseborough
1592db8f34 EKF: Convert optical flow fusion to use SymPy generated equations 2020-08-16 08:44:17 +10:00
Paul Riseborough
1f386c1bb8 EKF: Add yaw estimate SymPy generated code files 2020-08-16 08:43:29 +10:00
Paul Riseborough
510d93858f EKF: move yaw estimator derivation into main filter derivation
Enables use of common components
2020-08-16 08:43:29 +10:00
Paul Riseborough
f89c52e840 EKF: use ecl::powf for integer exponents 2020-08-15 08:40:59 +10:00
Paul Riseborough
0aa2f17562
EKF: Convert GPS yaw observation method to use SymPy generated code (#880)
* EKF: add test comparison program for GPS yaw fusion equations

* EKF: convert GPS yaw fusion method to use SymPy generated equations

* Replace if/else with simple if

* EKF: fix formatting of GPS yaw fusion auto-code comparison test

* EKF: Use  SparseVector type for GPS yaw fusion Jacobians

* EKF: Fix bug in GPS yaw derivation comparison check

* Add gps_yaw auto generated code file

Co-authored-by: kamilritz <kritz@ethz.ch>
2020-08-13 13:23:57 +10:00
Paul Riseborough
21cc46edd7
EKF: Convert magnetic field observation methods to use SymPy generated code (#879)
* EKF: Add comparison test for mag field fusion generated code

* EKF: convert mag field fusion to use SymPy generated code

* EKF: Add test comparison program for yaw fusion equations

* Stop setting 0 to 0

* Reduce if/else statement to only if

* EKF: more accurate implementation for sequential fusion of magnetometer data

* test: update change indicator

* Use matrix::SparseVector<float, 24, ...> for observation jacobian

* Adapt the auto code generation to allow for different bracket styles

* Add auto generated code for mag fusion

* Add generic computation of KHP

* Apply generic computation of KHP to mag fusion

* tests: update change indicator

* tests: update change indicator

Co-authored-by: kamilritz <kritz@ethz.ch>
2020-08-11 18:57:22 +10:00
kamilritz
ec93490890 geo test change to arc length 2020-08-10 22:15:43 +02:00
kamilritz
98dec6afa6 add tests for waypoint_from_line_and_distance() 2020-08-10 22:15:43 +02:00
kamilritz
60388a8b6d Geo: Fix double correcting for negative distance 2020-08-10 22:15:43 +02:00
Paul Riseborough
6feb28c27d
EKF: Convert EKF-GSF yaw estimator from matlab to sympy derived equations (#871)
* EKF: Add sympy derivation of equations for EKF-GSF yaw estimator

* EKF: Convert EKF-GSF yaw estimator to use sympy generated equations

* EKF: Add status prints for GSF-EKF yaw estimator cvode gen

* EKF: Move generated code for GSF-EKF yaw estinmator to generated directory

* Make it run with python3

* Cleanup yaw estimator code generation

* Improve and simplify gsf measurement update code generation

* Use improved auto generated measurement update code

& remove obsolete updateInnovCovMatInv function

* Delete generated ekf_derivation for the moment

Co-authored-by: kamilritz <kritz@ethz.ch>
2020-08-10 09:27:31 +02:00
kamilritz
9d7d502c56 std::sin -> sin 2020-08-09 15:28:35 -04:00
kamilritz
4ab364f0fd Make conversion from float to double explicite 2020-08-09 15:28:35 -04:00
Julian Kent
9ea3468091 Negative distances go in the opposite direction 2020-08-09 11:36:36 -04:00
kamilritz
b7e49f20e4 Update change indication 2020-08-09 11:08:59 -04:00
kamilritz
497008811a Update matrix version 2020-08-09 11:08:59 -04:00
kamilritz
d7568d55b4 extend firmware build checks 2020-08-07 11:42:13 +02:00
kamilritz
310b989c9a refactor start of gps into separate function 2020-08-07 10:02:47 +02:00
kamilritz
7eb2b08eed Yaw measurement jacobian to Vector4f 2020-08-04 09:57:00 +02:00
kamilritz
15d360f446 saved_mag_ef_cov to Squarematrix2f 2020-08-04 09:57:00 +02:00
kamilritz
7609bc69b2 drag innov member variables to Vector2f 2020-08-04 09:57:00 +02:00
kamilritz
960b80ee71 Do not update output filter a second time after reset to flow. 2020-08-03 09:51:59 +02:00
Paul Riseborough
77b11129fa
EKF: replacement of covariance prediction autocode with sympy generated output (#870)
* added python script with ekf derivation (WIP)

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* worked on c code auto-generation

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* save before variable name change

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* changed symbol names

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* added codegeneration class

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* improve 3D mag fusion derivation

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* EKF: Extend ekf sympy derivation to include all observation types

* EKF: Add custom ecl::powf function for integer powers

* EKF: Convert ekf covariance prediction to use sympy output

* EKF: Add test program to compare sympy and matlab covariance prediction

Also tests ecl::powf(x,exp) function

* EKF: simplify ecl::powf function

* Generate code to subfolder generated/

* Add printouts for showing code generation progress

* Move generated covariance code to generated folder

* Upgrade code generation to python3

* main.py: Remove unused create_symbols function

& making code more compact

* main.py: move main part into function

* Code generation: fix passing wrong rotation matrix to yaw_observation ()

* EKF: Amend generated code filename for consistency

* Move ecl::powf function test to unit tests

* EKF: Use updated ecl:powf functionality in test program

* Move ecl::powf to utils.hpp

* Update ecl::powf test

* Update output change indication

* test: update expected output for change indicator

* test: update expected output for change indicator again

Co-authored-by: RomanBapst <bapstroman@gmail.com>
Co-authored-by: kamilritz <kritz@ethz.ch>
2020-07-30 12:44:08 +10:00
Matthias Grob
0bffd951ec AlphaFilter: include float.h for FLT_EPSILON 2020-07-28 15:41:58 -04:00
kritz
88c52aba5e
Refactor ev fusion start into helper functions (#872) 2020-07-27 11:42:52 +02:00
kamilritz
8c65ca29e4 Only run firmware build test on pull_request 2020-07-26 10:11:52 -04:00
kamilritz
049f59d7de Fix firmware-build-test 2020-07-26 10:11:52 -04:00
Daniel Agar
185f22b094
geo_lookup: copyright header consistency and minor update
Minor consistency fixes for the copyright header and update the tables to current. PX4Buildbot will periodically update the tables automatically from this point.
2020-07-20 13:01:56 -04:00
Daniel Agar
9aa7991654
geo_lookup: upgrade table size (2 bytes per element) and add testing
- updated table to 2 bytes (int16) per element and scaled the inclination/declination/strength tables to use most of the range without being too awkward
 - tables have been extended to include the full latitude range
 - expanded the API slightly to offer declination/inclination in both degrees/radians and the magnetic strength in Gauss and Tesla
 - generated some simple testing that verifies interpolation between points
2020-07-19 18:53:47 -04:00
kamilritz
3651ed37fb Do not update time_last_imu outside of setGpsData 2020-07-17 11:06:36 +02:00
kamilritz
89bfcc2167 Introduce checkAndFixCovarianceUpdate(KHP) function 2020-07-16 18:25:06 +02:00
kamilritz
5c4a3d4576 Make observation jacobian a Vector24f when possible 2020-07-16 18:25:06 +02:00
kamilritz
b5e1397c0f Add const modifier
const modifier


Add missing const modifier
2020-07-16 18:25:06 +02:00
kamilritz
e357376797 Bring declaration and initialization together 2020-07-16 18:25:06 +02:00
kamilritz
796afd5f98 Rename yaw_use_inhibit -> is_yaw_fusion_inhibited
Temp
2020-07-16 18:25:06 +02:00
kamilritz
4cb2d1c645 Remove duplicated code snippets
by combining x and y ballistic coeff inverse a vector
2020-07-16 18:25:06 +02:00
kamilritz
b0ad9f0226 Replace componentwise with matrix operation 2020-07-16 18:25:06 +02:00
kamilritz
b5765eb3b4 Move variable declaration to better place &
remove airspeed_innov_var_temp variable. setting to global variable even when fusion is aborted is okay
2020-07-16 18:25:06 +02:00
kamilritz
05855b7fc1 Update time of last fusion event really only if fused
Except for the velpos fusion
2020-07-16 18:25:06 +02:00
kamilritz
efd96db49d Avoid setting 0 to 0 2020-07-16 18:25:06 +02:00
kamilritz
5ef18f8823 Style improvement 2020-07-16 18:25:06 +02:00
kamilritz
01515b9a9c Replace min(max()) with constrain 2020-07-16 18:25:06 +02:00
kamilritz
b0458fbded Refactor output buffer updates into separate functions 2020-07-16 18:25:06 +02:00
kamilritz
3d82d822ae Add const modifier 2020-07-16 18:25:06 +02:00
kamilritz
93011ed52c Use ternary operator 2020-07-16 18:25:06 +02:00
kamilritz
46a5e6e428 Replace divisions with multiplications 2020-07-02 15:55:24 +02:00
kamilritz
3e3a66e9e9 Remove unnecessary operations 2020-07-02 15:55:24 +02:00
kamilritz
079a699556 Random cleanup 2020-07-02 15:55:24 +02:00
kamilritz
d18ddb3e92 Use ternary operator 2020-07-02 15:55:24 +02:00
kamilritz
122f58b94d Bug: stop overwriting fault status of index 0 with index 1 2020-07-02 15:55:24 +02:00
kamilritz
9e211d6ca1 Stop overwriting fault status with false if one component is true 2020-07-02 15:55:24 +02:00
kamilritz
e5ddd912a4 Remove not needed else case 2020-07-02 15:55:24 +02:00
kamilritz
430497e2f7 Shift variable definition inside calculateOutputStates 2020-07-02 15:55:24 +02:00
kamilritz
f59343b343 Remove misplaced comment 2020-07-02 15:55:24 +02:00
kamilritz
673b309c45 Fix bug: pos gain used instead of vel gain 2020-07-02 15:55:24 +02:00
kamilritz
2af2696b63 Revert if-else condition to get rid of unnecessary indentation 2020-07-02 15:55:24 +02:00
kamilritz
fce4958d4f Random cleanup 2020-07-02 15:55:24 +02:00
kritz
9eea44f4ab
Return type of resets (#859)
* Reset position/velocity return type is void

* Delete not needed comments
2020-07-02 14:53:59 +02:00
bresch
97e54df123 Gps control: add missing consts and reduce variable scope 2020-07-02 13:35:13 +02:00
bresch
b0f79caf34 GPS yaw: Extract and refactor GPS yaw control logic
- Rename GPS yaw fusion functions:
resetGpsAntYaw -> resetYawToGps
fuseGpsAntYaw -> fuseGpsYaw

- Move last fusion time in reset function
2020-07-02 13:35:13 +02:00
bresch
7f4fedde6a GPS Yaw: fix heading initialisation and add unit tests
When the antennas are not parallel to the x body axis, the GPS message
contains the angular offset but the data is already corrected in the
driver. EKF2 should then not add this offset during the initialisation.
2020-07-02 13:35:13 +02:00
kamilritz
97225fcb74 Use matrix lib inside getState 2020-07-02 09:02:24 +02:00
kamilritz
16a00eae0b Make Kfusion a Vector24f 2020-07-02 09:02:24 +02:00
kamilritz
356b2f6ffe Stop setting zero to zero 2020-07-02 09:02:24 +02:00
kamilritz
552bf824ea Add typedef for Matrix 24 types 2020-07-02 09:02:24 +02:00
kamilritz
5356077a32 Make flow_innov/-var a matrix Vector2f 2020-06-26 08:26:26 +02:00
kamilritz
c2801eb488 Add const modifier and increase matrix library usage 2020-06-26 08:26:26 +02:00
kamilritz
d9afc2f1e8 Remove repeated division by same value 2020-06-26 08:26:26 +02:00
kamilritz
d16b43a2da Get rid of non functional piece of code 2020-06-26 08:26:26 +02:00
kamilritz
c3653e68ca Add const modifier 2020-06-26 08:26:26 +02:00
kamilritz
48f0eb16da Remove uninformative comments 2020-06-26 08:26:26 +02:00
kamilritz
4a69b41015 Increase matrix library usage even more 2020-06-26 08:26:26 +02:00
kamilritz
630be60930 Increase matrix library usage 2020-06-26 08:26:26 +02:00
kamilritz
22274b1d30 Add const modifier 2020-06-26 08:26:26 +02:00
kamilritz
61c139ea95 Remove unused variable 2020-06-26 08:26:26 +02:00
kamilritz
afd4f3f86b Fix typo 2020-06-26 08:26:26 +02:00
kamilritz
a3706fdcef Make relative wind computation more compact 2020-06-26 08:26:26 +02:00
kamilritz
b8f937666a Make mag_innov/-var a Matrix::Vector3f 2020-06-26 08:26:26 +02:00
Kamil Ritz
0ea7cd8360 Attempt to fix CI firmware build test 2020-06-26 07:38:25 +02:00
Daniel Agar
2927132954 clang-format set BreakBeforeBraces to Linux style
- this keeps things consistent with PX4/Firmware astyle
2020-06-25 13:23:52 -04:00
sevenbill
b96c62ed8b
Optionalized build dependency on git
Signed-off-by: Bill Morris <bill@sevendof.com>
2020-06-25 08:56:26 -04:00
Bill Morris
794e6ec3a5 Enforce tabs via editorcofig 2020-06-25 08:55:21 -04:00
PX4 BuildBot
e4b44f704b Update geo_lookup WMM to latest Tue Jun 23 14:15:04 UTC 2020 2020-06-23 10:41:59 -04:00
bresch
4b746a3fca GPS Yaw: add consts and remove fusion starting message
The fusion status is captured in the status flags; the message is
superfluous, uses flash space and can impact real-time performance
2020-06-23 08:43:48 +02:00
bresch
2bafe9df08 GPS Yaw: wait to fuse at yaw at least once before declaring it faulty
This fixes the cases where the yaw message from the GNSS receiver would
take more time than the vel/pos. The estimator should wait and not
immediately fall back to an other aiding source after 5sec.
If it never comes, it will never fall back, but this is ok since the
user wants to fly with GPS aiding an not with something else.
2020-06-23 08:43:48 +02:00
bresch
51cd63d626 GPS Yaw: fall back to other yaw aiding source in case of bad data
If the user selects GPS yaw fusion but that there is no GPS yaw data in
the GPS message or if the fusion is rejected for some time, the GPS yaw
data is declared faulty and the fusion is stopped to allow an other
source of yaw aiding to start.
2020-06-23 08:43:48 +02:00
bresch
fe2a9d3018 GPS Yaw: move isfinite checks in control.cpp 2020-06-23 08:43:48 +02:00
bresch
3c6790f5d5 GPS Yaw: Always reset Yaw when GPS Yaw fusion is starting
Also avoid fusing fake mag data when an other source of yaw aiding
is active, even if in MAG_TYPE_NONE mode.
2020-06-23 08:43:48 +02:00
kamilritz
ff8b5ec69d Extract general functions into utils 2020-06-23 08:18:34 +02:00
Daniel Agar
fda30d8cec geo_lookup: expand latitude to +-80 degrees 2020-06-22 09:45:22 -04:00
Daniel Agar
109eca5200 geo_lookup: create simple python script to update tables 2020-06-22 09:45:22 -04:00
Daniel Agar
41b9e4f628 geo_lookup: move tables to separate file 2020-06-22 09:45:22 -04:00
Daniel Agar
a8bb8ea99f move TECS, L1, and validation to PX4/Firmware 2020-06-18 18:48:36 -04:00
Matthias Grob
a296fe7d8c Move AlphaFilter out of EKF 2020-06-15 13:07:51 -04:00
Matthias Grob
daec5ae608 AlphaFilter: replace isfinite with positive denominator check 2020-06-15 13:07:51 -04:00
Kamil Ritz
e835bc34c4 remove inline modifier 2020-06-12 15:11:16 +02:00
Kamil Ritz
74780aa512 Refactor gps fusion commencing 2020-06-12 15:11:16 +02:00
Matthias Grob
38cbd1a182 AlphaFilter: prevent setParameters division by zero 2020-06-09 16:32:24 -04:00
RomanBapst
b7d54b5477 gps: fixed filter initialization bug around gps
- do not gps reference altitude to zero in case gps checks pass before the
filter initialized
- reset the filtered gps position and position derivative filters in case
we are in air or there is movement on the ground

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2020-06-08 16:19:38 +02:00
bresch
8f533cb878 terrain_estimator: fix sensor aid selection 2020-06-05 20:44:30 +02:00
bresch
821e1fa8fc terrain_estimator: add unit tests 2020-06-05 20:44:30 +02:00
bresch
aa96fa6d9e Random style fixes in the code 2020-06-05 20:44:30 +02:00
bresch
5d6a72e383 sensor_simulator: add possibility to set GPS position rate
one can set the position rate = velocity to obtain consistent gps data
2020-06-05 20:44:30 +02:00
Roman Bapst
b3dc06d0cb Added height above ground source bitmask indicating which sensor is used 2020-06-04 09:44:19 +02:00
bresch
62e15cbacf sensor_simulator: set IMU rate to 200Hz as this is the new value
used in the Firmware
2020-06-03 17:09:20 +02:00
bresch
6126c190b2 sensor_simulator: update EKF at IMU rate
This is how it is also done in ekf2_main. Otherwise, this leads to
multiple integration of the same IMU data due to asynchronous sensor
updates triggering a prediction step between IMU updates.

Fix unit tests that broke because of this fix
2020-06-03 17:09:20 +02:00
Paul Riseborough
59183f70ba
EKF: Reduce EKF-GSF vulnerability to large yaw gyro bias errors (#831)
* EKF: Reduce EKF-GSF vulnerability to large yaw gyro bias errors

* Update EKF/ekf_helper.cpp

* EKF: Fix comment typo

Co-authored-by: Roman Bapst <bapstroman@gmail.com>

Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
Co-authored-by: Roman Bapst <bapstroman@gmail.com>
2020-06-02 17:42:54 +10:00
Matthias Grob
d0ddda8917 tecs: fix typo init(i)alized 2020-05-29 20:03:22 +03:00
Kamil Ritz
86fc94b75a Remove tilt align from position innovation check 2020-05-25 11:12:24 +02:00
Mathieu Bresciani
b024cdd282
unit test: check that the accel bias is only learned when observable (#827) 2020-05-25 11:10:01 +02:00
Paul Riseborough
c91c78dcf6 EKF: Allow reset of yaw to EKF-GSF later in flight 2020-05-22 13:05:10 +03:00
Daniel Agar
600240d95f EKF: resetGpsAntYaw() fix double promotion 2020-05-20 12:44:18 -04:00
kamilritz
39c09b8092 add basic gps yaw fusion test 2020-05-20 08:52:52 +02:00
Kamil Ritz
21f49c22dc Use resetQuatStateYaw during gps yaw reset 2020-05-20 08:52:52 +02:00
Carl Olsson
7f21364844
EKF: use initial wind uncertainty with no airspeed sensor (#823) 2020-05-20 08:38:58 +02:00
kritz
bf78044bcd
EKF: fix initialization of local position validity 2 (#820)
The `_deadreckon_time_exceeded` flag is used in
`local_position_is_valid()`. This means that
`_params.valid_timeout_max` after startup, in my observed case 5
seconds, the local position switche from valid to invalid and then after
a while back to valid again.

With this fix, the local position is flagged invalid from boot and gets validated after the first aiding event.

Co-authored-by: Julian Oes <julian@oes.ch>
2020-05-20 08:24:23 +02:00
kritz
716caa5168
Refactor position resets (#822) 2020-05-19 21:53:46 +02:00
Mathieu Bresciani
37d9cef262
ekf: disable xy accel bias learning before takeoff (#818)
* ekf: disable xy accel bias learning before takeoff

As those biases are usually poorly observable before takeoff because
they are almost perpendicular to the gravity vector, learning is often
driven by noise and numerical issues. This results in incorrect bias
learning before takeoff when the drone is static on ground for a long
period of time.

* ekf: update unit test and change indicator
2020-05-19 18:02:40 +10:00
Mathieu Bresciani
9788c3bdf2
ekf: split accel bias learning in independant xyz components (#817)
This is a non-functional change required to select accel bias estimation
per axis selection. The intent is then to disable the learning before
takeoff of the components that are poorly observable.
2020-05-15 09:20:27 +02:00
Paul Riseborough
19bbea75c0
Fix GPS altitude not fused if GPS checks fail and GPS is primary height source (#813)
* EKF: Fix failure to select a height sensor

* EKF: Remove unnecessary check and improve documentation
2020-05-14 19:26:16 +10:00
kritz
24f2e60b7e
Reduce stored strings, to save flash space (#815) 2020-05-13 08:09:26 +02:00
kritz
98801ad17b
Support vision velocity expressed in body frame too (#708)
* Support vision velocity expressed in body frame

* Use switch statement for vision velocity frame

* Robustify vision velocity frame test

* Increase lower bound on vision velocity noise to 0.05 m/s
2020-05-12 16:03:35 +02:00
kritz
c3de452e8e
Remove duplicate code during vision yaw reset (#810) 2020-05-12 08:44:39 +02:00
Kamil Ritz
b40adf3dec Refactor velocity resets 2020-05-12 08:05:32 +02:00
kritz
03191847f9
Fix ev_pos_obs_var(1) entry (#809) 2020-05-11 10:44:05 +02:00
Kamil Ritz
440383f039 Increase matrix library usage and remove white line 2020-05-11 09:09:52 +02:00
bresch
97b437233e ekf: remove unused function 2020-05-08 16:55:23 +02:00
bresch
26d4fbc000 EKF: reduce scope of variable and remove redeclaration of member 2020-05-08 16:55:23 +02:00
bresch
edc8a88c24 yaw_fusion: remove useless initialization 2020-05-08 16:55:23 +02:00
bresch
75c49b2082 ekf_helper: fuse double if 2020-05-08 16:55:23 +02:00
bresch
0e3bf2872c EKFGSF_yaw: cleanup initialization of member variables 2020-05-08 16:55:23 +02:00
Daniel Agar
12835b999e
cmake update CXX standard 11 -> 14
- this doesn't really change anything, just staying in sync with PX4/Firmware
2020-05-01 13:33:49 -04:00
Paul Riseborough
cda7486897
EKF: Prevent yaw reset to GPS caused by loss of GPS data (#805) 2020-04-30 17:50:26 +10:00
kamilritz
8b6d665a13 Avoid subtraction of two uint 2020-04-27 10:17:01 +02:00
kamilritz
70d65ea55f Test:Increase GPS jump need for rejection 2020-04-25 10:11:01 +02:00
Kamil Ritz
c19f40e574 Add reset position test for GPS and VISION 2020-04-25 10:11:01 +02:00
Kamil Ritz
78a6b9f7a8 SensorSimulator: Fix GPS horizontal position step 2020-04-25 10:11:01 +02:00
Kamil Ritz
050298f6c1 Improve matrix library usage 2020-04-25 10:11:01 +02:00
Kamil Ritz
5749273d19 refactor resetPosition 2020-04-25 10:11:01 +02:00
Paul Riseborough
8a9d961f0d
EKF: Improve covariance prediction stability (#795)
* EKF: Improve covariance prediction stability

Eliminates collapse of vertical velocity state variance due to rounding errors that can occur under some operating conditions.

* EKF: Fix typo

* test: Fix initialisation test cases

Provide sufficient time for variances to stabilise and fix calculation of reference quaternion for alignment.

* test: Allow for accumulated rounding error in IMU sampling test

* test: Allow sufficient time for quaternion variances to reduce after initial alignment

* test: Increase allowance for tilt alignment delay and inertial nav errors

* test: Increase allowance for tilt alignment delay and inertial nav errors

* adpat reset velocity test

* test: update change indication file

* test: Adjust tests to handle alignment time and prediction errors

* README.md: Add documentation for change indicator test
2020-04-23 14:38:09 +02:00
Matthias Grob
65a4ca9d65 AlphaFilter: merge with PX4 implementation
I made a separate implementation of the same filter for PX4. Now
that I know it's duplicate I merge the two into one and reuse it.
2020-04-20 09:30:07 +02:00
Matthias Grob
1e033c4719 camke ctest: enable gtest colors 2020-04-20 09:30:07 +02:00
Kamil Ritz
adacca099d test recording of velocity reset 2020-04-19 12:43:37 +02:00
bresch
30d69aa45b Ekf: extract baro height offset computation 2020-04-19 12:38:13 +02:00
bresch
6b64cf0770 Ekf: centralize GPS height fusion startup 2020-04-19 12:38:13 +02:00
bresch
61763544b6 Ekf: centralize baro fusion startup 2020-04-19 12:38:13 +02:00
kamilritz
6f383248ca update change indication 2020-04-13 20:34:41 +02:00
Kamil Ritz
e52482501a Expand standalone mathlib double precision functions' usage 2020-04-13 20:34:41 +02:00
Kamil Ritz
1fa6870cd6 Perform geo.cpp's mathlib calls in double point precision 2020-04-13 20:34:41 +02:00
Kamil Ritz
a013bb9314 Add test for gps projection & reprojections 2020-04-13 20:34:41 +02:00
kritz
fa5a00d871
Refactor velocity reset (#788)
* Refactor velocity reset

* Add unit tests for velocity resets

* Expand updates to vertical buffer to velocity resets outside of resetHeight

* Improve matrix library usage

* Improve naming of vertical output samples

* Fix update of output_vert_new during reset

* Improve naming of vertical output samples 2
2020-04-08 16:39:15 +02:00
Daniel Agar
47624a0f02
EKF increase delta velocity process noise per axis if clipping (#663) 2020-04-08 08:51:51 +10:00
Kamil Ritz
d6b6276cdc change naming from tiltOffset to pitchOffset 2020-04-04 12:48:52 +02:00
bresch
572ad2df0a SensorRangeFinder: add distBottom function to get the vertical distance 2020-04-03 11:01:23 +02:00
bresch
a998da1781 terrain_estimator: initialize with valid delayed measurement 2020-04-03 11:01:23 +02:00
Mathieu Bresciani
0623b2b02d
Range check cleanup (#782)
* EKF: centralize range finder tilt check

* Ekf-control: do not double check for terrain estimate validity

isRangeAidSuitable can only return true if the terrain estimate is valid
so there is no need for an additional check

* range_finder_checks: restructure the checks to avoid early returns

There is now only one clear path that can lead to the validity being
true.
Furthermore, if the _rng_hgt_valid is true, we can trust it and we don't
need for additional checks such as tilt.

The case where we need to provide fake measurements because the drone is
on the ground and the range finder data is bad is already handled
in "controlHeightFusion" so there is no need to hack the range finder
checks with that.

* Add Sensor and SensorRangeFinder classes

The purpose is to encapsulate the checks for each sensor in a dedicated
class with the same interface

* SensorRangeFinder: encapsulate in estimator::sensor namespace

* EKF: rename _sensor_rng to _range_sensor

* Range checks: include limits in valid range

* RangeChecks: update comment in the continuity checks

* RangeChecks: move more low-level checks in functions

Also move setTilt out of the terrain estimator, this is anyway protected internally
to not compute cos/sin if the parameter did not change.

* Sensor: remove unused virtual functions

Those are not required yet but can still be added later

* SensorRangeFinder: re-organise member variables

Also rename getRangeToEarth to getCosTilt

* SensorRangeFinder: split setSensorTilt and setCosMaxTilt functions

* SensorRangeFinder: Add a few unit tests

- good data
- tilt exceeded
- max range exceeded

* SensorRangeFinder: set hysteresis in us instead of ms

* SensorRangeFinder: Add more tests

* SensorRangeFinder: update continuity, hysteresis and stuck tests

* SensorRangeFinder: rename variables

* SensorRangeFinder: get rid of "delayed" specification

From the SensorRangeFinder class point of view, it's not relevant to
know if the data is delayed or not

* SensorRangeFinder: move time_last_valid out of stuck check

* SensorRangeFinder: rename file names to sensor_range_finder

* SensorRangeFinder: address Kamil's comments

* SensorRangeFinder: Add more tilt tests

* SensorRangeFinder: store current tilt offset

This is to avoid recomputing cos/sin functions at each loop
2020-04-03 08:28:07 +02:00
Paul Riseborough
544385fd8c
EKF: Simplify centripetal accel correction (#789) 2020-04-01 13:36:56 +11:00
bresch
027db4bdbd Github Actions: update firmware docker repo 2020-03-30 13:25:00 +02:00
kamilritz
2fa43419d2 Interface: output vector quantities by "return-by-value" 2020-03-30 13:07:00 +02:00
kamilritz
72d8f91b4d Innovation getters: Add const modifier 2020-03-30 13:07:00 +02:00
Paul Riseborough
89b5c77d5d
EKF: Enable GPS flight without magnetometer (#770)
* EKF: Enable GPS flight without magnetometer

Enables takeoff in a non-GPS flight mode with mag fusion type set to MAG_FUSE_TYPE_NONE. After sufficient movement the EKF will reset the yaw tot he EKF-GSF estimate. After that GPS fusion will commence.

* EKF: Fix unconstrained yaw and yaw variance growth when on ground

* EKF: Ensure first yaw alignment can't be blocked

* EKF: Increase yaw variance limit allowed for alignment

Flight test data indicates that an uncertainty value of 15 deg still provides a reliable yaw estimate and enables an earlier alignment/reset if required.

* EKF: Remove unexecutable code

* EKF: Restructure heading fusion

* EKF: parameterise quarter variance check and retune default value

* EKF: Pass by reference instead of pointer

* EKF: Clarify reset logic

* EKF: Remove incorrect setting of mag field alignment flag

* EKF: Non-functional tidy up

* EKF: Fix non-use of function argument

The updateQuaternion function was using the _heading_innovation class variable instead of setting it using the innovation argument.

* EKF: Fix undefined variable

* EKF: Use single precision atan2

* EKF: remove unnecessary timer reset and unwanted execution of reset function

* EKF: Don't declare a mag fault when non-use is user selected

Doing so produces unnecessary user alerts.
2020-03-30 20:05:38 +11:00
Mathieu Bresciani
3bd09fdcd3
EKF: fix range height sensor offset (#787)
The offset needs to be updated directly when switching to range height
2020-03-26 20:22:32 +11:00
TSC21
870ec380f1 elk_helper: use ISFINITE macro instead of isfinite() 2020-03-20 22:42:46 +01:00
bresch
20c3db69e4 Terrain Est: Add sensor aiding bitmask
This adds the ability to select range finder and/or optical flow fusion for
terrain estimate.
2020-03-19 17:53:30 +01:00
bresch
f38388cdab YawEst: simplify AHRS accelerometer gain computation
Replace the multiple if-else statements by a generic equation.
- For a multicopter, the attenuation factor is 2 and symmetrical
- For a fixedwing, the attenuation factor is 1 if the acceleration is
positive and that centripetal correction is available and 2 otherwise.

Note that the function "sq" needs to be const in order to be used in a
const function.
2020-03-18 17:45:13 +01:00
CarlOlsson
ee5e3c479b ekfgsf: fix formatting 2020-03-18 08:34:02 +01:00
Mathieu Bresciani
f20fc08b7d
ekf2: centralize mag covariance reset (#693)
* ekf2: centralize mag covariance reset. A complete and clean reset of the
mag states covariances is now performed through the "resetMagCov"
function only. This avoid having slight differences of implementations
across the code.

* Ekf: reset quat cov with initial uncertainty instead of zero
2020-03-17 20:07:20 +11:00
Daniel Agar
f1aa53db8a
delete attitude_fw (merged into PX4/Firmware)
- this was never maintained as a separate standalone project
 - https://github.com/PX4/Firmware/pull/14284
2020-03-15 13:36:27 -04:00
kamilritz
975060d108 Add missing const modifier 2020-03-11 16:46:16 +01:00
kamilritz
7e20d9df14 Small style cleanup 2020-03-11 16:46:16 +01:00
Daniel Agar
580118e366
EKFGSF_yaw::updateEKF() R_prev copy safely (#775)
* EKFGSF_yaw::updateEKF() R_prev copy safely

* only copy required values (first 3)
2020-03-11 15:49:45 +01:00
kritz
9390d2065b
Run github actions also on master branch (#774) 2020-03-10 20:24:29 +01:00
bresch
d09473da89 Ekf control: do not set hgt mode if already set
If we are in a certain height mode and that we do a reset to the
same mode, there is no need to set the mode again.
2020-03-09 20:22:57 +01:00
bresch
13a7d53295 Ekf: correct wrong indentation 2020-03-09 20:22:57 +01:00
bresch
684737eab1 Ekf control: replace individual by global check of baro/GPS health
Use _gps_data_intermittent and _baro_hgt_faulty to know is the sensors
provide fresh data
2020-03-09 20:22:57 +01:00
bresch
320a90d146 EKF control: extract checkVerticalAccelerationHealth logic
This is done to reduce the size of the controlHeightSensorTimeouts
function and to clarify the logic
2020-03-09 20:22:57 +01:00
bresch
975afa6560 EKF: update csv for change indicator 2020-03-09 19:10:07 +01:00
CarlOlsson
93be6ea49a EKF: dont print wrong reset message on baro timeout
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2020-03-09 09:06:49 +01:00
kritz
bcd3869ca2
CleanUp of the EKFGSF (#769)
* Add const modifiers

* Pass imu data as sampe

* Remove emergency reset request counter

* Improve matrix library usage

* Indentation fix

* Do not store innovation matrix for each model

* Make weights a separate vector

* EKF: Add missing alignment transfer to AHRS solutions

* EKF: Replace #define constants with static constexpr

* EKF: Move declaration for weights into GSF section

* EKF: Fix documentation error

Co-authored-by: Paul Riseborough <p_riseborough@live.com.au>
2020-03-06 19:37:35 +11:00
Paul Riseborough
4669aa6312
EKF: Add Emergency yaw recovery using EKF-GSF estimator (#766)
* EKF: Use common rate vector calculation for offset corrections

* EKF: Remove duplicate matrix entry calculations

* EKF: Create a EKF-GSF yaw estimator class

* EKF: add emergency yaw reset functionality

* EKF: remove un-used function

* EKF: Ensure required constants are defined for all builds

* EKF: Fix CI build error

* Revert "EKF: remove un-used function"

This reverts commit 93005309c7f3794414ad99c86218b3062e00bbd3.

* EKF: Replace in-lined Tait-Bryan 312 conversions with function call

Also remove unnecessary operations

* EKF: Remove unnecessary update of external vision rotation matrix

* EKF: Use const

* EKF: use const

* EKF: don't use class variable as a temporary variable

* EKF: update comments

* EKF: Improve efficiency of yaw reset

Use conversion from rotation matrix to Euler angles instead of quaternion to euler angles.

* EKF: use const

* EKF: remove un-used struct element

* EKF: more descriptive function name

* EKF: use existing matrix row operator

* EKF: remove unnecessary rotation matrix update

* EKF: Use square matrix type

* EKF: Improve protection for bad innovation covariance

* EKF: Use matrix library operations

* EKF: Replace memcpy with better alternative

memcpy bypasses compiler sanity checks and is unnecessary in this instance.

* EKF: Split EKF-GSF yaw reset function

Adds a common function to support yaw reset that can be used elsewhere.

* EKF: Use common function for quaternion state and covariance yaw reset

* EKF: Replace inlined matrix operation

* EKF: Use const

* EKF: Change accessor function name

* EKF: Use const

* EKF: Don't create unnecessary duplicate variable locations

* EKF: Remove duplicate covariance innovation inverse

* EKF: Don't create unnecessary duplicate variable locations

* EKF: Rely on geo library to provide gravity

* EKF: Improve protection from bad updates

* EKF: Reduce effect of vibration on yaw estimator AHRS

* EKF: Improve yaw estimator AHRS accuracy during manoeuvre transients
2020-03-05 21:50:52 +11:00
Paul Riseborough
8ce285cdfa
EKF: Don't allow tilt alignment if vehicle is moving excessively (#768)
Also remove unnecessary update of the _accel_lpf after alignment.
2020-03-05 21:42:45 +11:00
Mathieu Bresciani
230c865fa9
EKF: do not fuse multiple times the same height (#767)
* EKF: do not fuse multiple times the same height

The _fuse_height flag was never set to zero, hence the fusion was called
at each iteration, even if no new data is available.
The effects were: high CPU usage and virtually less measurement noise
due to multiple fusion of the same sample

Also remve unused variables
2020-03-04 10:31:22 +01:00
Paul Riseborough
b4ecfb7723
EKF: Fix sign error in earth rotation rate correction (#763)
* EKF: Fix sign error in earth rotation rate correction

Addresses issue https://github.com/PX4/ecl/issues/759

* Update change indication output

Co-authored-by: kritz <kritz@ethz.ch>
2020-03-03 20:16:49 +01:00
Daniel Agar
4fab6057a7 EKF control height fusion add switch statement for all dist sensor types 2020-03-03 11:29:07 +01:00
Kamil Ritz
7c179b39b8 Make test with Clang 2020-03-03 11:23:45 +01:00
Carl Olsson
3fa5f501ae
EKF: dont check gps_check_fail_status in velocity reset (#761)
In a velocity reset we only used the GPS measurement if _gps_check_fail_status.value was equal to zero. The value of this flag is independent of EKF2_GPS_CHECK so checks can fail even if they are not configured to have any effect.
2020-02-27 11:59:38 +01:00
Daniel Agar
71d4d22ae4
EKF: covariances() helper return const reference and fix code style
- PX4 astyle puts the reference with the name.
2020-02-21 11:28:44 -05:00
bresch
8b918563a2 ekf: fix angle wrapping in realignYawGPS
To obtain the correct difference between two angles, we need to wrap
the result between -pi and pi. Otherwise, the difference between two
angles close to 180 degrees but with opposite signs will produce a large
error.
For example if a = -179 and b = 179, b - a = 258 instead of -2 degrees
2020-02-21 13:08:30 +01:00
Daniel Agar
00872fcaa3
EKF: ImuDownSampler pass imuSample as const reference
- inline ImuDownSampler::getDownSampledImuAndTriggerReset()
 - minor formatting and initialization cleanup
2020-02-18 13:20:52 -05:00
bresch
81c6d6655f ekf: clean uncorrelateQuatStates function
As the name can be ambiguous, it gets renamed
"uncorrelateQuatFromOtherStates".
Also replace the loops storing the values and reapplying them by simply
zeroing two slices (this also saves 130B of flash).
2020-02-13 14:33:32 +01:00
Julian Kent
c6d5a74685 Update change indicator 2020-02-12 22:34:44 +01:00
bresch
05d391c785 Update test csv after functional fix 2020-02-12 22:03:22 +01:00
bresch
90ca012705 ekf_helper: restore oridinal quaternion decorrelation
The intent of the function "uncorrelateQuatStates()" is to uncorrelathe quaternions from the other states but not between each other as they are and should remain linked alltogether.
Clearing the quaternions to quaternion covariances introduced unstabilities in other states (especially accel biases).
2020-02-12 22:03:22 +01:00
CarlOlsson
b6420d0b79 ekf: add vehicle at rest to flags 2020-02-12 18:58:24 +01:00
Paul Riseborough
89bcebd631 EKF: Prevent covariance initialisation overwriting yaw variance
Also typo fix
2020-02-05 15:20:34 +01:00
Paul Riseborough
a3347b7e06 EKF: Use more conservative value for delta velocity bias process noise
Smaller values have resulted in bias estimation divergence under some conditions
2020-02-05 15:20:34 +01:00
Paul Riseborough
21054a4236 EKF: Fix bug causing incorrect covariance initialisation
The covariance initialisation should not be performed before the quaternion states are initialised.
2020-02-05 15:20:34 +01:00
Daniel Agar
ed260c4f1d validation: remove unused vibration metric 2020-02-04 23:37:05 -05:00
kritz
e52e2b88ed
Sensor Replay (#717)
* Add primitive logging for Ekf

* Add python script to extract sensor data from ULog

* Add primitive sensor replay

* Add iris_gps data for sensor replay

* Add CI for functional change indication

* Update sensor replay flow data type

* update iris_gps_change indication

* test: Update EKF replay test documentation

Co-authored-by: Paul Riseborough <priseborough@users.noreply.github.com>
2020-02-01 20:41:12 +11:00
kamilritz
da752c9e30 Hot flow fusion fix 2020-01-28 17:19:51 +01:00
kritz
ee859e092a Robustify timestamp checks (#729)
* Robustify timestamp checks

* Remove lowerbound on sensor timestamp

* Add tests for fusion timeouts

* Inline and const time check functions

* Rename dead_reckoning time variable
2020-01-28 20:33:16 +11:00
kamilritz
f20726d47f Expand auto-format coverage and tiny style changes 2020-01-27 16:54:25 +01:00
kritz
fbdd75da2e Update CONTRIBUTING.md
Co-Authored-By: Roman Bapst <bapstroman@gmail.com>
2020-01-27 10:42:17 +03:00
kamilritz
5d38b73072 Update description of Firmware build tests 2020-01-27 10:42:17 +03:00
bresch
e3af91c9ce Ekf: use helper functions to centralize the checks of horizontal aiding (gps, flow, ev_pos, ev_vel) 2020-01-24 17:22:50 +04:00
kamilritz
a3e1eb9d50 Checkout to matching firmware if possible 2020-01-24 16:18:42 +03:00
kamilritz
f3d790a664 Update optical flow interface 2020-01-24 16:18:42 +03:00
RomanBapst
cafb1400fb estimator_interface: bugfix, set range sample correctly
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2020-01-24 13:03:04 +01:00
kamilritz
df37c9bf1d First draft of the contribution guidelines 2020-01-24 09:31:49 +01:00
kamilritz
4b0e7b2cff Remove filtering on external vision alignment 2020-01-24 08:23:12 +01:00
kamilritz
2fe16c4ffe Update build instructions in readme 2020-01-24 09:03:48 +03:00
kamilritz
d63e4edfd8 Fix github actions 2020-01-23 16:31:42 +01:00
kamilritz
de33885658 Update setExtVisionData interface 2020-01-23 14:50:43 +01:00
kritz
ed916c8006 Auto Formatting with clang-format-6.0 (#727)
* Add clang-format

* Auto-format AlphaFilter and RingBuffer

* Update to tab=8spaces

* Allow for 120 width
2020-01-23 20:56:10 +11:00
CarlOlsson
dbf0bd43e8 EKF: update wind covariance initialization
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2020-01-23 10:27:54 +11:00
kamilritz
37201fb071 Remove legacy imu interface 2020-01-23 09:34:07 +11:00
kamilritz
7c3a2f839b Update range finder interface 2020-01-23 09:34:07 +11:00
kamilritz
4fb2d1b02e Update range finder interface 2020-01-23 09:34:07 +11:00
kamilritz
9f0d8ed59e Update mag interface 2020-01-23 09:34:07 +11:00
kamilritz
856961ba85 Update airspeed interface 2020-01-23 09:34:07 +11:00
kamilritz
b8a3ed5f09 Update baro interface 2020-01-23 09:34:07 +11:00
kamilritz
74ec80cdc7 Update gps interface 2020-01-23 09:34:07 +11:00
Paul Riseborough
a19c29e708 EKF: Rework yaw fusion to remove singularity at +-90 deg yaw 2020-01-23 09:23:56 +11:00
kamilritz
fc7e8b848b Run github actions also on PRs from forks 2020-01-22 09:47:19 +01:00
kamilritz
29cf7884c3 Test baro downsampling 2020-01-21 10:09:48 +03:00
kamilritz
b51ea4fe39 Test dynamic pressure compensation
(cherry picked from commit b3d9334b5abe02f1d123519cfc74a875225eb0bd)
2020-01-21 10:09:48 +03:00
kamilritz
83b2abe434 protect against overflow 2020-01-21 10:09:48 +03:00
kamilritz
4be9ae8029 Compute the timestamp of average sample correctly 2020-01-21 10:09:48 +03:00
kamilritz
29c5954690 Move baro downsampling and dynamic pressure comp to ECL 2020-01-21 10:09:48 +03:00
kamilritz
d7d7b56519 Move mag down sampling to ECL lib 2020-01-21 09:36:02 +03:00
Matthias Grob
950e75e484 EKF_ringbuffer: minor missing space for style 2020-01-18 13:00:36 -05:00
kamilritz
26125c245d Switch from jenkins to github actions 2020-01-17 11:02:57 -05:00
Dusan Zivkovic
011b4c2e4e data_validator_group: add a method to get the state of the sensor with the provided index 2020-01-15 12:20:47 -05:00
bresch
0f4439d281 optical flow: inhibit flow fusion only when the terrain estimate gets invalid 2020-01-15 16:07:17 +11:00
bresch
d06dc33ded range_finder_checks: do not override range_hgt_valid flag with rng_stuck flag
Thif fixes the issue where the range finder data is always set to valid
if not stuck.
2020-01-15 16:07:17 +11:00
bresch
d0fe1f032a mag_fusion: re-introduce delay between mag reset and fusion, this was
dropped during the mag fusion refactor PR #662
2020-01-15 14:40:06 +11:00
Daniel Agar
250d5b8acc TECS: remove height rate complementary filter 2020-01-15 14:28:36 +11:00
kamilritz
8f70a10565 Added missing variable initializations 2020-01-14 15:16:25 +03:00
kamilritz
5b02310f43 Test Airspeed fusion 2020-01-14 15:16:25 +03:00
kamilritz
7ed6a437c7 Add airspeed sensor to sensor_simulator 2020-01-14 15:16:25 +03:00
Tom Wang
4044abdd20 fixed output state variable name state_variance to state_variances 2020-01-10 19:57:39 +05:30
kamilritz
cd9e81539c Expand IMU Down Sampling tests 2020-01-09 19:43:29 +11:00
kamilritz
de58ab9167 inline newly added function save 60Bytes 2020-01-09 19:43:29 +11:00
kamilritz
be11516dd6 Refactor IMU downsampling into its own class 2020-01-09 19:43:29 +11:00
kamilritz
c7e074276f Save flash space
This commit saves roughly 400-500 Bytes in flash space
2020-01-09 19:43:29 +11:00
kamilritz
94484f01ce save flash space 2020-01-08 14:36:03 +01:00
kamilritz
1b0e137b8a Test external vision 2020-01-08 14:36:03 +01:00
kamilritz
84dcb32bd8 Extend auxVel interface to support 3d velocity 2020-01-08 14:36:03 +01:00
kamilritz
07e8e88e88 Support full vision variance 2020-01-08 14:36:03 +01:00
kamilritz
4ab3dd50c9 pass Vector by const reference 2020-01-08 09:00:31 +01:00
kamilritz
2657e4fc0c Improve naming and white space 2020-01-08 09:00:31 +01:00
kamilritz
db73a06620 Use robust AxisAngle constructor 2020-01-08 09:00:31 +01:00
kamilritz
1fcfd394dd Various small non-functional improvements 2020-01-08 09:00:31 +01:00
kamilritz
deeac03d6a Clean up height reset logic booleans 2020-01-08 09:00:31 +01:00
kamilritz
cec6d76577 Raise awareness for drag variance(!=stdDev) bug 2020-01-08 09:00:31 +01:00
kamilritz
0b18143745 Improve readibility 2020-01-08 09:00:31 +01:00
kamilritz
3daf25763e Remove unnecessary comments 2020-01-08 09:00:31 +01:00
kamilritz
36da8d82c8 Clean up white space 2020-01-08 09:00:31 +01:00
kamilritz
48787c0160 Improve Matrix library usage 2020-01-08 09:00:31 +01:00
kamilritz
a21a7cd5b9 Remove output argument from calcEarthRateNed 2020-01-08 09:00:31 +01:00
kamilritz
9e6d27fafb Add missing const qualifier 2020-01-08 09:00:31 +01:00
kamilritz
066392ef02 Improve naming 2020-01-07 08:14:59 +11:00
kamilritz
f99dbd8ca3 Improve naming and brackets 2020-01-07 08:14:59 +11:00
kamilritz
1c68709949 Rename mag ambiguous mag abbreviations with magnitude 2020-01-07 08:14:59 +11:00
kamilritz
a24aaad861 CleanUp GPS drift checks 2020-01-07 08:14:59 +11:00
kamilritz
c6e3f389d2 Replace calculation of earth NED rotation vector 2020-01-07 08:14:59 +11:00
kamilritz
9f053cb8c1 Simplify covariance getters 2020-01-02 19:26:57 +11:00
Paul Riseborough
0d0f46ec1c EKF: Don't run unnecessary makeRowColSymmetric operation
This operation is expensive when done to the whole covariance matrix and unnecessary after covariance prediction because we calculate the upper diagonal and copy across so it is already symmetric.
2020-01-02 19:26:57 +11:00
Paul Riseborough
166d260058 EKF: Provide auto-code output that uses (row, col) syntax for covariance matrix 2020-01-02 19:26:57 +11:00
kamilritz
92ba618f57 Improve on flash memory usage 2020-01-02 19:26:57 +11:00
kamilritz
459b76f9fd Make covariance matrices of type matrix::SquareMatrix
and use functions from Matrix to reset covariances.
2020-01-02 19:26:57 +11:00
Lorenz Meier
a4a694dd87 Disable Coverage option until GCC9 is default
This would simplify coverage builds, but is not widely available yet.
2020-01-01 17:03:04 +01:00
Lorenz Meier
3d3267ed1f Fix CMake configuration for coverage tests on Mac OS 2020-01-01 13:50:25 +01:00
Daniel Agar
57144beb98 gitignore update for in tree cmake builds 2019-12-31 11:18:53 -05:00
kamilritz
490c749f80 Revert if statement swap in resetMagHeading 2019-12-18 10:06:31 +01:00
kamilritz
a6bbafc7b0 Remove unnecessary initialiseCovariance
It is already called in reset()
2019-12-18 09:46:32 +01:00
kamilritz
ef9f1053d0 Random improvements 2019-12-18 09:46:32 +01:00
kamilritz
7d3814b1d8 Add orientation initialization tests 2019-12-18 09:46:32 +01:00
kritz
01495ede97 Clean initialiseFilter function (#687)
* Clean initialiseFilter

* Add const qualifiers
2019-12-17 13:36:28 +01:00
kritz
532c9abd4a Expand test framework and test cases (#685)
* Fix comment

* Ekf wrapper for testing

Add utility function for accessing information in the ekf object

* Add step function for Gps sensor

* Add RangeFinder and Flow to simulated sensors

* Add first fusion logic tests

* Add units to function name

* Use EXPECT_TRUE

* Adding missing qualifiers

* Improve EXPECT_ calls

* Improve naming
2019-12-17 11:35:45 +01:00
kritz
6c25ac5731 Tilt Initialisation: Average Filter -> LowPass Filter (#686)
* Tilt Initialisation: Average Filter -> LowPass Filter

* Add _is_first_imu_sample variable

* Remove not needed comments
2019-12-17 11:01:25 +01:00
Daniel Agar
98a1aae494 EKF: use Matrix cross product 2019-12-17 09:35:08 +01:00
kamilritz
0831c158f2 Move time update to sensor base class 2019-12-16 13:40:01 +01:00
kamilritz
1832bedd13 run_seconds 2019-12-16 13:40:01 +01:00
kamilritz
39b369d90b make ekf a shared pointer 2019-12-16 13:40:01 +01:00
kamilritz
f13f2f8452 use shared pointer 2019-12-16 13:40:01 +01:00
kamilritz
00cd720a66 Change folder name 2019-12-16 13:40:01 +01:00
kamilritz
b9dd1e54c5 Change file names 2019-12-16 13:40:01 +01:00
kamilritz
2d2edd90e3 ECL Unit Test Clean Up 2019-12-16 13:40:01 +01:00
kamilritz
6b25dbd6c7 SensorSimulator 2019-12-16 13:40:01 +01:00
kamilritz
85e0e6e89c Remove resetStates(AndCovariances) function 2019-12-13 16:50:56 +01:00
kamilritz
64652f523b Improve quality of comments 2019-12-12 08:48:10 +01:00
kamilritz
1bf09fd370 Remove EKF prefix from logged messages 2019-12-12 08:48:10 +01:00
kamilritz
88c4929c96 Use helper function to switch to gps height 2019-12-11 17:23:45 +02:00
kamilritz
042d9b6615 Remove dangerous _primary_hgt_source variable 2019-12-11 17:23:45 +02:00
kamilritz
66f707ede0 Remove non enterable if statement 2019-12-11 17:23:45 +02:00
kamilritz
cd030e7cd2 Remove switch to ev hgt during filter initialization 2019-12-11 17:23:45 +02:00
kamilritz
4bc6ae69ae Remove if statement that can not be entered 2019-12-11 17:23:45 +02:00
kamilritz
6941777e17 Remove obsolete vision sample counter during initialization 2019-12-11 17:23:45 +02:00
kamilritz
181303488c Log height innovation sensor specific 2019-12-05 20:09:34 +11:00
kamilritz
f32fce28a3 Fix gps vertical observation variance 2019-12-05 20:09:34 +11:00
kamilritz
ecd199d5d0 Fix vel pos test ratio 2019-12-05 20:09:34 +11:00
kamilritz
2df2dede2f Fix variance vs stdDev bug
(cherry picked from commit 0faea89da2a3326d070a6ecca93ec52ec3e29591)
2019-12-05 20:09:34 +11:00
kamilritz
3923c5fecb Add get*innovation* functions as overide 2019-12-05 20:09:34 +11:00
kamilritz
07e804676c Rename IMU biases 2019-12-05 20:09:34 +11:00
kamilritz
dae8c2f8dc Group velocity and position as a 3d vector 2019-12-05 20:09:34 +11:00
kamilritz
beedf1ce4f Add print statement to reset vel or pos function 2019-12-05 20:09:34 +11:00
kamilritz
5c038a3b43 Add stop*Fusion function 2019-12-05 20:09:34 +11:00
kamilritz
d5dc6bb8ea Clean get*innov* interface 2019-12-05 20:09:34 +11:00
kamilritz
86b9079bdc Refactoring velPos fusion 2019-12-05 20:09:34 +11:00
bresch
6b5f011bc2 ekf: use PDOP instead of GDOP as the TDOP (part of GDOP) is usually not available
PDOP is the position dillution of precision and is given by sqrt(VDOP^2+HDOP^2)
2019-11-25 17:18:40 -05:00
Daniel Agar
362a2dfa08
remove unnecessary <cmath> include 2019-11-22 11:16:51 -05:00
RomanBapst
33a2bd0292 added python script for derivation of initial wind covariance matrix
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-11-20 16:28:34 +11:00
bresch
811ec81246 parameters: change check_mag_strength from bool to int32_t to comply with the standard interface 2019-11-11 15:29:52 +01:00
Mathieu Bresciani
c7bdf25663
[ekf] controlMagFusion refactor and mag field strength check (#662)
* ekf_control: Inhibit mag fusion when field magnitude is large
Move mag inhibition check in separate function

* ekf_control: pull out of functionalities out of controlMagFusion
- yaw abd mag bias observability checks
- mag 3D conditions
- load mag covariances
- set and clear mag control modes

* ekf_control: refactor mag heading/3D start/stop.
Move mag declination, mag 3d and mag heading fusion out of the main function

* ekf_control: extract mag yaw reset and mag declination fusion requirements

* ekf_control: use WMM in isStronMagneticField for mag fusion inhibition
- Correct units of WMM strength table

* ekf_control: extract mag_state_only functionality of AUTOFW (VTOL custom)
Also split inAirYawReset from onGroundYawReset

* ekf_control: extract mag automatic selection
- transform if-else into switch-case for parameter fusion type selection

* ekf_control: extract run3DMagAndDeclFusion, reorganize functions, fix
flag naming in Test script

* ekf_control: do not run mag fusion if tilt is not aligned.
Reset some variables on ground even if mag fusion is not running yet. It
could be that it runs later so we need to make sure that those variables
are properly set.

* ekf_control: move controlMagFusion and related functions to mag_control.cpp

* ekf control: check for validity of mag strength from WMM and falls back
to average earth mag field with larger gate if not valid

* ekf control: remove evyaw check for mag inhibition

* ekf control: change nested ternary operator into if-else if

* Ekf: create AlphaFilter template class for simple low-pass filtering
0.1/0.9 type low-pass filters are commonly used to smooth data, this
class is meant to abstract the computation of this filter

* ekf control: reset heading using mag_lpf data to avoid resetting on an outlier
fixes ecl issue #525

* ekf control: replace mag_states_only flag with mag_field_disturbed and
add parameter to enable or disable mag field strength check

* ekf control: remove AUTOFW mag fusion type as not needed This was implemented for VTOL but did not solve the problem and should not be used anymore

* ekf control: use start/stop mag functions everywhere instead of setting the flag

* ekf control: Run mag fusion depending on yaw_align instead of tilt_align
as there is no reason to fuse mag when the ekf isn't aligned

* AlphaFilter: add test for float and Vector3f
2019-11-08 16:02:59 +01:00
bresch
a6840655e8 ekf: Extract resetState from main reset and reinitialize
the covariances in the init function
2019-11-05 09:07:25 +01:00
bresch
bf48004fb9 ekf: move "reset" part of the init function into a separate function
add getter for the vehicle at rest flag
2019-11-05 09:07:25 +01:00
TSC21
7eb9118673 Jenkins: update container tags; use px4-dev-base-bionic 2019-11-03 10:29:15 -05:00
kamilritz
d76b704225 Only inlcude gtest if standalone build 2019-11-02 09:46:18 -04:00
kamilritz
7c1e38d3ad Make it build with Firmware 2019-10-28 11:04:38 +01:00
kamilritz
d79199c863 Remove swig and python test related things 2019-10-28 11:04:38 +01:00
kamilritz
d88e242a60 pytest are replaced in gtests 2019-10-28 11:04:38 +01:00
kamilritz
71be26efc6 Port RingBuffer Test to GTests 2019-10-28 11:04:38 +01:00
kamilritz
cac5f3fd6d GTest and Coverage cleanup and Basic EKF GTest 2019-10-28 11:04:38 +01:00
Martina Rivizzigno
fcea13eef8 add gtest, temp disable swig
(cherry picked from commit 4008d163d77f503e6acbd7ddc1d87ac6d479c897)
2019-10-28 11:04:38 +01:00
RomanBapst
9b4b24ee71 removed unused definition
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
RomanBapst
0e3a0b8659 range_finder_checks: parametrised signal quality hysteresis duration
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
RomanBapst
16d1e15b51 addressed review comments
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
RomanBapst
6bc6f26043 range_finder_checks: set range height to valid if signal quality is non-zero
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
RomanBapst
6299d8199c ekf_helper: use latest validated range sample to reset height
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
RomanBapst
00f49e62c2 cleanup checks of range finder data
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
Paul Riseborough
4d37065f1b EKF: Make use of inverse rotation function consistent with name
The quaternion to inverse rotation matrix function has been updated so that the rotation it produces is the inverse to that produced by the matrix library and the the inverse of the quaternion is uses. This function is now used to directly calculate an inverse rotation matrix rather than calculating the forward rotation and then transposing it.
2019-10-23 14:44:08 +03:00
Paul Riseborough
36de2b3dc1 EKF: Use matrix library for quaternion to rotation matrix conversion 2019-10-23 14:44:08 +03:00
bresch
1a4ab069c9 rate controller: add override specifiers whenever needed 2019-10-22 09:12:19 -04:00
bresch
29f71fff96 ekf: Add override specifier for all functions that override virtual functions of the estimator interface class 2019-10-22 09:12:19 -04:00
bresch
50167bfbcf estimator interface: add deprecated functions for backward compatibility 2019-10-22 20:19:56 +11:00
bresch
b38458c2ab Terrain estimator: formatting and remove redundant comments 2019-10-22 20:19:56 +11:00
bresch
0aef0eda59 terrain_estimator: remove dead code. Since the terrain estimator is
constantly reset on ground, it is not necessary anymore to fuse fake
measurements on ground if the range measurements are bad.
2019-10-22 20:19:56 +11:00
bresch
370e04ee60 terrain_est: Continuously reset terrain height on ground using known
clearance. This is the best estimate as we should not rely on a distance
sensor while on the ground. This also helps when the drone is carried
over as it avoids starting with a crazy downward distance for optical
flow scaling.
2019-10-22 20:19:56 +11:00
bresch
e09e3e17a1 control: rename _range_aid_enabled to _is_range_aid_suitable
rename rangeAidConditionsMet to checkRangeAidSuitability
2019-10-15 11:10:36 +02:00
bresch
fac69d07a3 control: refactor rangeAidConditionsMet function 2019-10-15 11:10:36 +02:00
Paul Riseborough
eae6e8f19c EKF: Fix on ground yaw drift when using EKF2_MAG_TYPE = 4 2019-10-08 20:08:42 +11:00
RomanBapst
4e946d5bcb implemented synthesized magnetometer Z measurement
- calculate a theoretical value based on the knowledge of the direction
and strength of the magnetic field vector and X/Y sensor measurements
- needs knowledge about location on earth to work
2019-10-08 20:02:16 +11:00
kamilritz
f005e0ea8f Remove deprecated ev_innov_gate param 2019-09-27 10:00:45 -04:00
kritz
b78429aa60 Fix print statements cast error on posix firmware builds (#647) 2019-09-25 14:34:43 +02:00
kritz
4a38f5a2f6 Add timestamp to ECL print statements, (#644)
which is helpful for EKF replay debugging.
2019-09-25 11:24:42 +02:00
kritz
bb88d4ce5e Undo wrong comment change 2019-09-24 08:50:29 +10:00
Kamil Ritz
562731936a Update quaternion direction in documentation pdf 2019-09-24 08:50:29 +10:00
kamilritz
8c061fb6a4 Fixing wrong label of quaternion direction 2019-09-24 08:50:29 +10:00
Jannik Beyerstedt
fe3fec413c fix #595 and add new all-in-one conversion script (PX4 only) 2019-09-24 08:20:16 +10:00
kamilritz
83eb326076 Missing posNED 2019-09-24 07:48:46 +10:00
kamilritz
fd6b364c11 posNED to pos and velNED to vel and add ev vel covariances to reset 2019-09-24 07:48:46 +10:00
kamilritz
4f6ca3a74c Replace rest of spaces with tabs 2019-09-24 07:48:46 +10:00
kamilritz
cea053820d Remove spaces with tabs 2019-09-24 07:48:46 +10:00
kamilritz
1e57c4bbec Fix white space 2019-09-24 07:48:46 +10:00
kamilritz
10cbd79db7 Rotate external vision info in reset function if necessary 2019-09-24 07:48:46 +10:00
kamilritz
4511b9ff5e Add missing checks for flags.ev_vel 2019-09-24 07:48:46 +10:00
kamilritz
e7d927c899 Stop using bad GPS when we have vision velocity 2019-09-24 07:48:46 +10:00
kamilritz
bd8f05567a set vel_pos_test_ratio to zero if no fusion happens 2019-09-24 07:48:46 +10:00
kamilritz
4b30de587f Make vel_pos innov gate variable name clearer 2019-09-24 07:48:46 +10:00
kamilritz
4237d7ccd7 Improve external vision position fusion 2019-09-24 07:48:46 +10:00
kamilritz
3e8139ff9f Enable vision velocity fusion 2019-09-24 07:48:46 +10:00
kamilritz
149233a9ab Add velocity observations to external vision interface 2019-09-24 07:48:46 +10:00
Matthias Grob
62a1e07512 ecl_EKF: Do not include SquareMatrix from Matrix library
because the template of upper_right_triangle() contains /2 and
swig fails to create a wrapper for that (suddenly)
2019-09-18 08:42:58 +02:00
Daniel Agar
eddee193d1 update matrix git tag to latest 2019-09-18 08:42:58 +02:00
Julian Kent
4c4c1f2984 Use copyTo for writing to memory blocks 2019-09-18 08:42:58 +02:00
Julian Kent
8cc8db211c Fix copy_quaternion reference in code generation 2019-09-18 08:42:58 +02:00
Julian Kent
8d60f8ba8f Remove direct unsafe access to matrix internal data 2019-09-18 08:42:58 +02:00
Nico van Duijn
c446ee444a EKF: fake rng if faulty on ground 2019-09-18 10:15:37 +10:00
Andreas Antener
4f19d457c4 ekf, control: make sure mag fusion doesn't start anymore when we have GPS heading fusion active 2019-09-18 09:27:24 +10:00
Jan Brehmer
93eb1266f6 EKF: reset position when stopping GPS use and EV is active 2019-09-18 08:33:40 +10:00
Nico van Duijn
267195a11b EKF: remove check for faulty flag in fake rng
This removes the check for _rng_hgt_faulty in the decision of publishing
a fake range measurement. The reason for this is that some distance sensors
don't populate the quality flag, even if they are saturated. Hence, if we
are on the ground and not moving, it is safe to publish a fake measurement
of the distance sensor and overwrite the actual sensor data.
2019-09-12 17:45:37 +10:00
Nico van Duijn
933189eac0 EKF: fix rng_faulty flag when sensor is stuck 2019-09-12 17:45:37 +10:00
Nico van Duijn
640e41cba7 EKF: change rangeSample quality to int8_t 2019-09-12 17:45:37 +10:00
Nico van Duijn
a12186c285 terrain_estimator: introduce quality metric in rng
This commit introduces a quality measure in the range data. It is
used to properly decide whether to initialize the HAGL estimate on
 sensor data or MIN_HGT parameter, as well as in the decision of
whether a 'fake' measurement should be published on the ground to
allow for optical flow take-offs.
2019-09-12 17:45:37 +10:00
Paul Riseborough
3e05fd552e EKF: Compensate for bad range finder data when on ground 2019-09-12 17:45:37 +10:00
bresch
3b32ee4166 Flow aiding - Reset state when flow is enabled only if it is the only
position/velocity aiding sensor.
Until now, it was alway resetting if the vehicle does not have gps or
external vision. This caused a reset/glitch at every stop (when range data gets
valid)
2019-09-03 09:58:33 +02:00
kamilritz
be368f3656 Update comment 2019-08-29 08:34:10 +10:00
kamilritz
c5abfe626f remove canonicalize and adapt comments 2019-08-29 08:34:10 +10:00
kamilritz
67512d88ea Update matrix library for CI 2019-08-29 08:34:10 +10:00
kamilritz
a2ff415fe4 Fix get frame aligning quaternion function 2019-08-29 08:34:10 +10:00
kamilritz
53eac6e94e Canonicalize alignment quaternion 2019-08-29 08:34:10 +10:00
kamilritz
933c32c921 Enable local frame alignment also without using it 2019-08-29 08:34:10 +10:00
kamilritz
ea352a6631 Dont use mag suffix for magnitude 2019-08-29 08:34:10 +10:00
kamilritz
05196db79e Fix alignment of local frame 2019-08-29 08:34:10 +10:00
RomanBapst
62fa464e4d WindEstimator: added support for pre-set airspeed scale factor
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-08-08 09:15:25 +02:00
Silvan Fuhrer
a7d9c73d4d Wind estimator: added wind_estimator_reset state (to indicate if wind estimator was reset in last fusion-cycle)
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2019-08-08 09:15:25 +02:00
Silvan Fuhrer
09f29dbb07 added option to fix airspeed scaling to 1 2019-08-08 09:15:25 +02:00
Jaeyoung-Lim
d38164fc8e Fix flag for initialization 2019-07-22 10:24:51 +02:00
bresch
e1751188fd EKF - Initialize _deadrekon_time_exceeded to true.
If no sample have been received, deadrekoning and local position should be invalid.
2019-06-28 10:52:52 -04:00
Paul Riseborough
a036cf82cc EKF: Remove use of of quaternion self product operator and fix delta rotation sign 2019-06-17 19:24:55 +10:00
Paul Riseborough
0e946f25fd EKF: Remove use of quaternion self product operator and fix delta rotation sign error 2019-06-17 19:24:55 +10:00
CarlOlsson
ad7f7af03b ekf: correct quaternion multiplication order 2019-06-17 19:24:55 +10:00
CarlOlsson
d6351bd7a5 EKF: update comment 2019-06-17 19:24:55 +10:00
Paul Riseborough
7612fa40ed EKF: Don't start using GPS for height until all validity checks have passed
Consolidate intermittent data checks, improve variable and clarify usage.
2019-06-13 19:36:37 +10:00
Roman
cef2ba5ab9 implemented Kahan summation algorithm for adding process noise to delta
angle- and delta velocity bias variance

- the contribution of process noise per iteration for these states can be so
small that it gets lost if using standard floating point summation

Signed-off-by: Roman <bapstroman@gmail.com>
2019-06-11 19:28:06 +10:00
RomanBapst
0f49eb34a0 fixed method which calculates validity of terrain estimate
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-05-28 19:43:13 +10:00
Daniel Agar
cd34ab802d mathlib delete floorf in favor of math.h 2019-05-28 19:42:59 +10:00
Robert de Vries
340d85afc1 EKF: fix variable names in estimator_interface.h
This fixes issue #566
2019-05-27 17:39:42 -04:00
Matthias Grob
90b4c7c065 mathlib: fix floorf indentation 2019-05-24 09:56:12 +02:00
Sebastian Verling
710c52980e fixed calculation of magentic table values by using floor instead of int casting 2019-05-24 09:09:26 +02:00
Beat Küng
54ac147ae8 Ekf: add set_min_required_gps_health_time() to allow configure minimum GPS health time
This does not change the default of 10 seconds.
2019-05-15 09:00:24 +01:00
Roman
770cd3c5cc added python script for terrain flow derivation (optical flow for terrain
height estimation)

Signed-off-by: Roman <bapstroman@gmail.com>
2019-05-15 17:16:36 +10:00
Roman
c085d7295d addressed review comments 2019-05-15 17:16:36 +10:00
Roman
8673ab0346 terrain estimator: constrain terrain state properly
Signed-off-by: Roman <bapstroman@gmail.com>
2019-05-15 17:16:36 +10:00
Roman
fbb51147b7 implemented use of optical flow for terrain estimation
Signed-off-by: Roman <bapstroman@gmail.com>
2019-05-15 17:16:36 +10:00
Hamish Willee
a27a43eafa Fix up link to EKF docs 2019-05-01 00:36:29 -05:00
Mohammed Kabir
3f691891c4 EKF: control: stop vision yaw fusion on timeout 2019-04-22 12:56:24 +10:00
Martina
c4492b17c1 do not reset yaw if vehicle on ground 2019-04-09 20:50:37 +10:00
Julian Oes
14227eaf1d CMakeLists.txt: fix cmake warning
This removes the cmake warning:
  implicitly converting 'string' to 'STRING' type.
2019-04-08 09:54:47 -04:00
Paul Riseborough
f97f0b6ea3 EKF: Remove unnecessary code
_flt_mag_align_start_time is set on initial alignment and will always be >0 before this check can run
2019-04-08 06:57:17 +10:00
Paul Riseborough
43b5e26fe4 EKF: Fix bug causing continual yaw reset when EKF2_MAG_TYPE = 2 2019-04-08 06:57:17 +10:00
Roman
f95cd4b358 ground effect: removed dependency on local position
Signed-off-by: Roman <bapstroman@gmail.com>
2019-03-19 13:14:57 +11:00
CarlOlsson
7845ff4360 EKF: increase wind process noise scaler to 0.5
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-19 13:10:12 +11:00
CarlOlsson
32ca6f7030 ekf: scale wind process noise with low pass filtered height rate 2019-03-19 13:10:12 +11:00
CarlOlsson
938c8ad9ad EKF: use hagl estimate if valid for when to trigger yaw reset on takeoff 2019-03-19 13:04:54 +11:00
Hamish Willee
8b4ae48c69 README: Fix link to EKF/ECL tuning guide 2019-03-18 10:21:10 -04:00
Carl Olsson
f0889c1760 EKF: fixed some comment typos
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-18 10:20:33 -04:00
Todd Stellanova
6e77b197c7 Add DataValidatorGroup tests, add more DataValidator tests (#592) 2019-03-15 00:09:47 -04:00
Daniel Agar
a892ececf8 cmake add ECL_TESTS option only enabled in standalone build 2019-03-12 23:29:30 -04:00
Paul Riseborough
fabd216ca5 EKF: Documentation edits 2019-03-13 08:14:23 +11:00
CarlOlsson
8d6e8ae078 EKF: update get_mag_decl_deg()
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-13 08:14:23 +11:00
CarlOlsson
2b17ced405 EKF: Clean up use of magnetometer declination. Before the innovation was not zero in fuseDeclination()
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-13 08:14:23 +11:00
CarlOlsson
1d91785a8e EKF: correct quaternion order 2019-03-12 19:07:55 +11:00
CarlOlsson
000aa0de5d EKF: do not update the newest attitude estimate in initialiseFilter(). Is is now done in alignOutputFilter() 2019-03-12 19:07:55 +11:00
CarlOlsson
96c5c14041 EKF: Change the EKF initialization to
1) init tilt
2) init yaw
3) init tilt uncertainty
4) init yaw uncertainty

Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
CarlOlsson
ea259d358d EKF: initialize the newest attitude estimate to a valid quaternion
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
CarlOlsson
6cf512f103 EKF: Also update the newest and oldest quaternion estimate in
alignOutputFilter()

Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
CarlOlsson
78122b20a6 EKF: fix the rotation direction of the buffered attitude solutions
in alignOutputFilter()

Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
CarlOlsson
56b6b7a778 EKF: cleanup use of _mag_filt_state
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
CarlOlsson
37339de57c EKF: remove unused variable
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
Todd Stellanova
6c759e0e9f Initial unit tests for DataValidator (#588) 2019-03-09 14:47:13 -05:00
Nuno Marques
4e0e68e905 Ekf: add more useful methods to interface with the covariances (#543) 2019-03-09 11:57:35 -05:00
Daniel Agar
a85d3a43ed attitude_fw remove unused 2019-03-05 17:26:19 -05:00
Daniel Agar
c66f7f4a09 EKF drop unused timestamp from collect_gps() and pass data by const reference 2019-03-05 17:26:19 -05:00
Freek van Tienen
78b899c72d Add Paparazzi compatibility (#580)
This adds support for the paparazzi autopilot to use this library as EKF.
The header order change has to be done in order to have std.h included to get certain defines at the start of the estimator_interface.h.
2019-03-05 12:41:21 -05:00
Daniel Agar
5cd331055f cmake standalone build pin PX4/Matrix to commit
- 6b0777d815
2019-03-05 12:35:37 -05:00
Daniel Agar
1378ec1797 EKF mag_fusion avoid unnecessary double promotion 2019-02-08 08:24:24 -05:00
Carl Olsson
54ab8191e3 EKF: add method to get the terrain variance 2019-02-06 08:49:16 -05:00
Daniel Agar
c5554cae96 EKF tests update SWIG usage and use latest containers 2019-02-03 18:27:00 -05:00
Paul Riseborough
dd58e69549 EKF: Ensure FW yaw alignment method is used on first in-air reset 2019-01-31 09:53:57 -05:00
Paul Riseborough
3accab1ac5 EKF: protect declination fusion from badly conditioned earth field estimates
Fusion with large initial magnetometer biases errors can result in the the NE earth field states reducing in magnitude and effectively flipping sign.

EKF: Move declination state limiting into a separate function

EKF: Limit NE mag states after each 3-axis mag fusion

EKF: Fix bug in mag field strength look-up scale factor
2019-01-31 09:53:57 -05:00
Paul Riseborough
7bddbd1cc5 EKF: Update cleaned up autocode fragment with sign error fix and missing LD 2019-01-31 09:53:57 -05:00
Paul Riseborough
fe378fd761 EKF: Prevent unwanted declination fusion when re-starting 3-axis fusion 2019-01-31 09:53:57 -05:00
Paul Riseborough
bd1647a7fb EKF: Rework use of fuseDeclination()
Simplify calling so that it is only called in two ways:
1) Immediately before 3-axis mag fusion if not called since the last earth field covariance reset so that the earth field declination information can be formed.
2) Immediately after 3-axis mag fusion otherwise.
2019-01-31 09:53:57 -05:00
Paul Riseborough
d52f53635b EKF: Save mag field covariance data before reset 2019-01-31 09:53:57 -05:00
Paul Riseborough
82ce7a83a5 EKF: Save mag field covariance information on startup 2019-01-31 09:53:57 -05:00
Paul Riseborough
708c79eb8f EKF: Ensure mag field state covariance data is always available for re-use
Prevents use of  _saved_mag_ef_covmat and _saved_mag_bf_variance before being initialised or when stale.
2019-01-31 09:53:57 -05:00
Paul Riseborough
8839e4e1f4 EKF: Don't discard declination certainty information when resuming 3-axis fusion.
In the case where the EKF is switching between 3-axis and heading fusion, off-diagonal elements containing the correlation between N,E  components of the earth field were being lost on each switch event. These elements contained information about the declination uncertainty and should be preserved.
2019-01-31 09:53:57 -05:00
Paul Riseborough
25148e1b45 EKF: Prevent rapid changes in declination estimate after a reset
Ensures that each time the earth field covariance and variance data is reset, that the off-diagonal elements containing earth field declination angle certainty is restored.
2019-01-31 09:53:57 -05:00
CarlOlsson
6e7c119b31 EKF: limit yaw variance increase to 0.01 rad^2 to prevent a badly conditioned covariance matrix
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-01-31 09:53:57 -05:00
CarlOlsson
0896f7b9bd EKF: Also fill in lower part of covariance matrix in increaseQuatYawErrVariance()
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-01-31 09:53:57 -05:00
Paul Riseborough
4b3140e5f7 EKF: Fix rebase error 2019-01-31 09:53:57 -05:00
Paul Riseborough
911d4d8f49 EKF: Fix sign error in increaseQuatYawErrVariance function 2019-01-31 09:53:57 -05:00
Paul Riseborough
a0b9cb002e EKF: Use consistent method for recording completion of in-flight yaw alignment 2019-01-31 09:53:57 -05:00
Paul Riseborough
ef5a87c1d4 EKF: Rework quaternion yaw reset.
Use a new method that preserves the roll and pitch information and adds the uncertainty for yaw only.
Ensure that correlation information to non-quaternion states is removed when a reset occurs to prevent fusion of subsequent observations (e.g. GPS) causing incorrect yaw.
2019-01-31 09:53:57 -05:00
Paul Riseborough
fc2a089823 EKF: Add function to un-correlate quaternion states
This is necessary after a quaternion reset to prevent incorrect attitude corrections with subsequent observation fusions.
2019-01-31 09:53:57 -05:00
Paul Riseborough
bce1b96d17 EKF: Add function enabling yaw variance to be increased 2019-01-31 09:53:57 -05:00
Paul Riseborough
bf1f3a224e EKF: Derive equations enabling yaw variance to be increased 2019-01-31 09:53:57 -05:00
Daniel Agar
81eabc1903 Jenkins update all containers to latest tag 2019-01-28 2019-01-31 08:06:00 +11:00
Daniel Agar
a5e6191ba7 EKF add clarity brackets to avoid potential confusion
- fixes https://github.com/PX4/ecl/issues/555
2019-01-30 09:15:53 -05:00
Anna Dai
721f5e61a5 increase optical flow buffer to imu buffer length 2019-01-17 10:23:15 +11:00
Anna Dai
44200e9649 add GPS drop out case to GPS fusion logic
EKF waits 10s after GPS signal is lost before setting GPS control status flag to false. As the position information given by the alternative position sources drifts from the last GPS position, the controller over corrects.
With this update, the time horizon until GPS control flag set to false is reduced and only alternative position source is used for estimation.

tested with optical flow as position souce

log from as is https://review.px4.io/plot_app?log=d624af5e-dde4-40ab-ba5b-a693a49f5a36

log with update https://review.px4.io/plot_app?log=13ed6dc3-22dd-43f8-b898-4add41d60439
2019-01-17 10:23:15 +11:00
CarlOlsson
8a813c57ec EKF: fix comment typo 2019-01-14 09:57:44 +11:00
CarlOlsson
472f2286b7 EKF: initialize covariances before we reset the heading in order to preserve the yaw uncertainty
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-01-14 09:57:44 +11:00
CarlOlsson
490888285d EKF: Remove flag prefix
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-01-13 23:48:46 +01:00
CarlOlsson
d223680197 EKF: add flt_mag_align_complete to control_status flags
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-01-13 23:48:46 +01:00
Daniel Agar
b920910483 replace <cfloat> with <float.h>
- <cfloat> isn't available in the NuttX c++ library
2019-01-06 12:09:05 -05:00
Paul Riseborough
c032126745 EKF: Fix bug causing incorrect yaw variance value to be used
This bug causes the variance of the Z axis rotation vector uncertainty to not be reset to the correct value.
2019-01-04 11:01:06 +01:00
Paul Riseborough
48d83f3bcb EKF: Fix vulnerability to ground level mag anomally when using heading fusion (#544)
Previously, the reset of the yaw when climbing above 1.5m was not performed until 3-axis fusion was enabled. This could result in loss of navigation depending on the value of  EKF2_MAG_TYPE and the flight profile.
2019-01-03 09:41:55 -05:00
Hamish Willee
4822bf8386 Fix links to moved files in readme 2018-12-10 03:34:53 +01:00
CarlOlsson
1a969aed07 EKF: use low pass filtered mag measurements for heading initialization 2018-12-05 10:08:11 +01:00
Roman
27f7846495 optical flow: fixed sign in calculation of optical flow sensor velocity
- the velocity of the optical flow sensor relative to the IMU expressed in
body frame is the cross product of the angular velocity with the vector
from IMU to the sensor. If we use the angular velocity stored in the flow
sample struct we need to use a negative sign as that angular velocity
follows the opposite sign convention.

Signed-off-by: Roman <bapstroman@gmail.com>
2018-12-04 01:26:40 +11:00
Paul Riseborough
c49ab760c7 EKF: Allow EKF to start without using mag data when not using earth frame data 2018-11-15 09:03:03 +11:00
Daniel Agar
572710ed27 EKF add typed Quatf getter 2018-11-14 22:50:39 +01:00
CarlOlsson
8a2e512c2d terrain_estimator: add vehicle_variance_scaler 2018-11-15 08:38:48 +11:00
Paul Riseborough
acde4ebcc3 EKF: fix comment 2018-11-15 07:16:31 +11:00
Paul Riseborough
df571202c5 EKF: Fix bug preventing saved declination being used for first alignment 2018-11-15 07:16:31 +11:00
Paul Riseborough
4657a9cd21 EKF: Ensure yaw gets reset when declination is set 2018-11-15 07:16:31 +11:00
Roman
68a3cbc368 addressed review comment
Signed-off-by: Roman <bapstroman@gmail.com>
2018-11-13 08:42:28 +11:00
Roman
a74b7ef60b 3D only mag fusion: make sure _flt_mag_align_complete is set
- _flt_mag_align_complete was not set when choosing pure 3D mag fusion.
one effect of this was that the declination used in the filter was not
the one calculated from the magnetic field states.

Signed-off-by: Roman <bapstroman@gmail.com>
2018-11-13 08:42:28 +11:00
jie.zhang
10a0fef7b7 EKF/control: remove unnecessary yaw_align update 2018-10-17 15:50:00 -04:00
Daniel Agar
8bbaf898a5
EKF add new simple setIMUData() interface (#512) 2018-10-17 15:30:25 -04:00
Paul Riseborough
e6cd6eff87 EKF: Fix bug preventing use of flow sensors without gyros
The handling of invalid flow data when on ground is performed in controlOpticalFlowFusion() where it is able to handle flow sensors that don't publish gyro data.
2018-10-11 07:12:54 +11:00
Daniel Agar
2c3a064942
README.md update Jenkins build status icon and url 2018-09-18 20:16:29 -04:00
Paul Riseborough
f240eaa5b0 EKF: Fix test script 2018-09-19 06:32:43 +10:00
Paul Riseborough
5cb228e1b3 EKF: Remove duplicate line 2018-09-19 06:32:43 +10:00
Paul Riseborough
0220f469b0 EKF: Use more generic variable name for bad yaw fusion flag
This flag now reports on  fusion of data that is not from a magnetometer.
2018-09-19 06:32:43 +10:00
Paul Riseborough
eb52f7c410 EKF: Remove implicit conversion and use single precision trig operator
Double precision accuracy is not required for this operation.
2018-09-19 06:32:43 +10:00
Paul Riseborough
6847acb72e EKF: Add protection for undefined GPS antenna array heading offset 2018-09-19 06:32:43 +10:00
Paul Riseborough
d1f3f4c916 EKF: Use #define function for isfinite check 2018-09-19 06:32:43 +10:00
Paul Riseborough
91f886cb5e EKF: Add support for use of GPS heading data.
Heading data is assumed to be from a  dual antenna array at a specified yaw angle offset in body frame, but with the heading data already corrected for antenna offset. The offset is required to apply the correct compensation for combined rotations and to determine when the yaw observation has become badly conditioned.
2018-09-19 06:32:43 +10:00
Paul Riseborough
af60e6bbc8 EKF: Add derivation for for dual antenna yaw observations 2018-09-19 06:32:43 +10:00
Paul Riseborough
342c3ab202 EKF: Fix timeout parameter documentation and name
The parameter used to control the maximum dead reckoning time had 'gps' in the parameter name which was confusing because it was used for all measurement types capable of constraining horizontal velocity error growth. The parameter variable has been renamed and the documentation for it improved.
The parameter used to control the maximum time since fusing a measurement before the measurement is considered to be not contributing to aiding had misleading documentation which has been updated.
2018-09-19 06:32:43 +10:00
Dion Gonano
2354c30d81 Add vision height covariance passthrough (#507)
* Add vision height covariance passthrough

* Fix hgtErr layout
2018-09-11 06:36:13 +10:00
Kabir Mohammed
a7245229cb EKF : Fix divergence when optical flow is not fused for a long time (#503)
* terrain_estimator : guard against case where latest range sample is newer than IMU sample

* EKF : control : correct detection of no optical flow fusion over a time period
2018-09-03 14:26:43 +10:00
Paul Riseborough
b861594d0b EKF: enable optical flow use to bootstrap 2018-09-01 14:49:45 +02:00
Daniel Agar
3c74dc2ce1 ECL_Controller base needs virtual destructor 2018-08-30 12:07:25 -04:00
Daniel Agar
0d39072a6d EKF add missing header guards 2018-08-30 12:07:25 -04:00
Kabir Mohammed
a6a1edbe3f EKF : Fix type of flow data navigation variable (#499) 2018-08-30 18:26:17 +10:00
Paul Riseborough
a53ad9c261 EKF: Add missing optical flow ground motion protection
Motion compensated optical flow rates are supposed to be zeroed if reported flow quality is below the minimum threshold value when on ground.
The comments and logic have been amended to be consistent and make the design intent clearer.
2018-08-28 21:31:50 +02:00
dakejahl
56b8bb08a1 added a checking for range_aid to determine if we are relying on the range finder as our primary source of height observation (#491) 2018-08-24 06:42:58 +10:00
Roman
aa134d5a61 l1 position controller: make sure that a NAN roll setpoint
does not keep the roll setpoint state at NAN forever

Signed-off-by: Roman <bapstroman@gmail.com>
2018-08-21 16:16:33 +02:00
Daniel Agar
34cd1366b7 Jenkins update PX4BuildBot credential usage 2018-08-12 13:38:35 -04:00
Paul Riseborough
35f628e68f
EKF: Add interface to enable logging of GPS drift metrics (#490)
* EKF: Add interface to enable logging of GPS drift metrics

* EKF: Fix bug affecting rate of GPS drift publication

Also fix variable name.
2018-08-03 13:24:31 +10:00
Daniel Agar
48a17b5234
cmake ignore doxygen option when not a standalone build (#488) 2018-07-30 12:23:24 -04:00
Roman
4a8a3a4079 l1 controller: simpler way of doing slew rate limiting
Signed-off-by: Roman <bapstroman@gmail.com>
2018-07-26 07:54:38 +02:00
Roman
fe4e6779f3 l1 position control: added roll angle setpoint slew rate limiting
Signed-off-by: Roman <bapstroman@gmail.com>
2018-07-26 07:54:38 +02:00
Paul Riseborough
748446b92f EKF: Use parameter for stuck range test threshold
The default has been reduced to make it suitable for low altitude optical flow navigation.
2018-07-26 07:53:39 +02:00
Paul Riseborough
628079719f EKF: Fix inconsistency in timeout for terrain validity
Terrain validity is determined solely by successful range finder fusion and terrain state initialisation.
A range finder that has been declared faulty requires continuous range finder data fusion requires  data to be continuous before the fault status _rng_hgt_faulty  can be cleared. This will enforce the requirement for continuous data before fusion can commence.
2018-07-26 07:53:39 +02:00
Paul Riseborough
d1d49857f9 EKF: Prevent stuck range checks running without new data 2018-07-26 07:53:39 +02:00
dakejahl
80146273ba removed if statement that would prevent the update of the _rng_hgt_faulty flag (#480) 2018-07-26 07:53:39 +02:00
Paul Riseborough
17d40478bb EKF: Rework range height validity checking
Eliminate race condition caused by checking for data freshness using time stamps from buffer push instead than buffer pop events.
Consistent use of range data ready and range data fault flags. This achieved by ensuring that _rng_hgt_faulty is set to true for all range data faults, not just data freshness.
Include range data validity requirement in rangeAidConditionsMet() check.
2018-07-26 07:53:39 +02:00
Paul Riseborough
e0bcfeb533 EKF: Add validity boolean to mag declination accessor 2018-07-26 07:51:58 +02:00
Paul Riseborough
1e610894b9 EKF: Correct documentation and function name for declination accessor
The function name and documentation are misleading given the function is only a getter.
This change makes the usage clearer.
2018-07-26 07:51:58 +02:00
Paul Riseborough
4d01883f75 EKF: Disable GPS drift checks when the vehicle is moving. 2018-07-24 07:31:45 +02:00
Roman Bapst
ee85a29202 Pr opt flow (#482)
* optical flow: fixed calculation of velocity of the flow sensor relative to
the IMU

- gyroXYZ holds a delta angle and first needs to converted to a gyro rate

Signed-off-by: Roman <bapstroman@gmail.com>

* optical flow: calculate height above the ground with respect to the flow
camera
- the flow camera can be offset from the IMU which needs to be considered

Signed-off-by: Roman <bapstroman@gmail.com>

* estimator interface: fixed comment regarding optical flow sample timestamp

- the timestamp on an optical flow sample corresponds to the trailing
edge of the flow integration period

Signed-off-by: Roman <bapstroman@gmail.com>
2018-07-16 11:41:35 +10:00
Paul Riseborough
4d59c834eb EKF: Consolidate range finder checking
This brings all the range finder data checks (excluding innovation consistency checks) into one place and eliminates the need to perform range checking external to the library.
The hard coded optical flow tilt limit is changed to use the same value as the range finder.
Variable names are changed to make a clear distinction between the max/min values calculated by the stuck range check and the max/min valid values for the sensor.
2018-07-12 18:20:50 +02:00
Kabir Mohammed
e1661a92c3 EKF : allow init without external vision measurements (#464) 2018-07-12 11:36:47 +10:00
Paul Riseborough
a0ed08967e EKF: Add missing range validity check 2018-07-11 14:53:37 +02:00
Daniel Agar
41953ab582 EKF angle constants in degrees for readability (#465)
* EKF angle constants in degrees for readability

* EKF make FILTER_UPDATE_PERIOD_MS static constexpr and add FILTER_UPDATE_PERIOD_S

* EKF controlOpticalFlowFusion() use constants and update comments

* EKF controlMagFusion() use angle in degrees

* EKF move earth spin rate to geo and update usage

* EKF: Fix numerical constant error and clean up comments

Comments do not need to contain numerical values when the code makes these clear.
2018-07-05 08:55:22 +10:00
Daniel Agar
cebdc3d829 ekf run output predictor immediately with new IMU data (#471)
* EKF collect_imu take const imu sample and populate buffer

* EKF calculateOutputStates cleanup

* EKF add calculate_quaternion output predictor method

* EKF: update documentation

* EKF: remove unnecessary getter function

* EKF calculateOutputStates only apply dt correction to bias

* EKF pytest assert attitude validity, not update() return

* EKF: correct documentation

* EKF: Do not make attitude validity dependent on yaw alignment status

Yaw alignment could fail in flight due to temporary loss of data and yet the quaternions would still usable for stabilisation even though the absolute earth yaw angle wrt true north was uncertain.
2018-07-05 07:59:35 +10:00
Daniel Agar
114ae4116a geo get_bearing_to_next_waypoint() small optimization 2018-06-30 21:30:35 +00:00
Daniel Agar
b26c2d62b8 geo get_distance_to_arc remove double promotion 2018-06-30 10:09:10 -04:00
Philipp Oettershagen
b3959fab2f TECS: Do not even calculate integrator state if integrator gain is zero 2018-06-29 15:55:46 +00:00
Philipp Oettershagen
ccfba49971 TECS: Set the integrator output to zero if the gain is zero. Otherwise (e.g. after a climbout) it can happen that the integrator stays at a large constant value and thus distrubs the control loop 2018-06-29 15:55:46 +00:00
Paul Riseborough
1cba257bac
Merge branch 'master' into pr-ekfOptFlowGyro 2018-06-18 09:36:16 +10:00
Paul Riseborough
1a1106878d
EKF: Prevent timestamp jitter failing GPS data arrival check (#462)
This fixes a error condition that occurs if _time_last_gps is greater than _time_last_imu.
By checking time stamps at the fusion time horizon, we guarantee that this cannot happen because all observations must have a time stamp smaller or equal to _imu_sample_delayed.time_us before they are retrieved from the buffers.
2018-06-15 16:03:54 +10:00
Daniel Agar
4ae8242c35 validation DataValidatorGroup::get_best() nullptr check
- fixes Coverity CID 139448
2018-06-14 08:14:53 +02:00
Daniel Agar
c3e071e052 validation initialize all members
- fixes Coverity CID 260331
2018-06-14 08:14:53 +02:00
Roman
c8af315aa7 flow_fusion: corrected sign of gyro data when it is taken from the ekf
gyro data

Signed-off-by: Roman <bapstroman@gmail.com>
2018-06-13 21:52:42 +02:00
Paul Riseborough
c6ed2ccfcd EKF: Fix half frame offset in flow gyro compensation.
The gyro data accumulation needs to be across the same integration period as the flow sensor. The previous code didn't sample the accumulation until the midpoint of the flow data had fallen behind the fusion time horizon.

This PR changes the optical flow time stamp definition so that flow data is retrieved when the leading edge of the flow accumulation period falls behind the fusion time horizon. This enables the accumulated gyro data to be sampled at the correct time. Fusion is then delayed until the mid sample time has fallen behind the fusion time horizon.
2018-06-13 16:51:42 +10:00
Paul Riseborough
48561b0c8a EKF: Update optical flow interface documentation 2018-06-12 16:52:26 +10:00
Paul Riseborough
de7c9d85a4 EKF: Handle flow data without valid gyro data 2018-06-12 16:24:25 +10:00
elia
26dcf05d80 keep ev timeout sign always positive 2018-06-11 00:17:19 +02:00
Daniel Agar
a8b73bd139 replace geo _wrap_pi with matrix::wrap_pi 2018-06-11 00:16:17 +02:00
Daniel Agar
5c64879688
Jenkins codecov.io add flag 2018-06-09 21:12:03 -04:00
Paul Riseborough
d177e96508 EKF: Fix bug causing slow drift when high rate flow data is used
High rate optical flow data could make flow fusion to run every major update cycle, resulting in the calculation of bias errors in the body rates used to compensate flow data failing time validity checks and not running. This resulted in a slow drift of the nav solution if bias errors were present in the in the gyro data used for flow sensor motion compensation.
2018-06-09 22:23:55 +02:00
Paul Riseborough
ee2dc7d790 EKF: Rework optical flow selection logic
Fixes a race condition caused by the _is_dead_reckoning test.
Only checks flow selection when flow is available.
2018-06-09 22:23:55 +02:00
Paul Riseborough
e383b6a272 EKF: rework optical flow selection logic
Make use of range aiding movement check clearer.
Fix logic errors that caused rapid toggling of flow use when on ground.
2018-06-09 22:23:55 +02:00
Paul Riseborough
487e6a0901 EKF: enable user selection of auto mag free operation
Also modify check to not apply if EV yaw is being used.
2018-06-09 22:23:55 +02:00
Paul Riseborough
6bdbe032f9 EKF: Fallback to optical flow for all in-flight loss of navigation scenarios 2018-06-09 22:23:55 +02:00
Mohammed Kabir
b4d2b8c57d EKF : introduce new architechture for navigation limits 2018-06-09 22:23:55 +02:00
Paul Riseborough
8a713398cb EKF: Improve ground effect compensation
Start deadline at zero so that initial rotor wash effect is rejected.
2018-06-09 22:23:55 +02:00
Paul Riseborough
39697f1196 EKF: rework optical flow switching 2018-06-09 22:23:55 +02:00
Paul Riseborough
1cfe845751 EKF: rework GPS quality check 2018-06-09 22:23:55 +02:00
Paul Riseborough
99a80387ed EKF: improve optical flow GPS quality checking 2018-06-09 22:23:55 +02:00
Paul Riseborough
7f36add241 EKF: scale GPS vertical accuracy check when using optical flow 2018-06-09 22:23:55 +02:00
Paul Riseborough
fc9f532c34 EKF: relax range finder data continuity check 2018-06-09 22:23:55 +02:00
Paul Riseborough
93c456f2b8 EKF: Improve protection against badly conditioned dVel bias covariances
Reduces likelihood of Z delta velocity bias learning to wrong value.
2018-06-09 22:23:55 +02:00
Paul Riseborough
225057aaf5 EKF: Fix bug preventing use of terrain estimator 2018-06-09 22:23:55 +02:00
Paul Riseborough
adb4a09beb EKF: Fix bug causing large yaw innovations when GPS is lost 2018-06-09 22:23:55 +02:00
Paul Riseborough
f59cd0f5b0 EKF: Don't make detection of indoor operation dependent on optical flow
This is required because it can take several seconds for an optical flow sensor operation to be confirmed and there are also many use cases for indoor operation where no optical flow is used.
2018-06-09 22:23:55 +02:00
Paul Riseborough
1562a82dc2 EKF: Add parameter to adjust on-ground movement detector sensitivity 2018-06-09 22:23:55 +02:00
Paul Riseborough
ea9e8246ed EKF: Improve detection of indoor flight condition 2018-06-09 22:23:55 +02:00
Paul Riseborough
565f99254c EKF: Reduce effect of yaw gyro bias when using optical flow indoors 2018-06-09 22:23:55 +02:00
Paul Riseborough
e10798bfdf EKF: Add on ground movement detector 2018-06-09 22:23:55 +02:00
Paul Riseborough
2d3b65231b EKF: Reset yaw gyro bias learning when resuming use of magnetometer
The previous lack of yaw drift constraint will also mean that the yaw gyro bias estimate is likely to be incorrect and needs to be re-learned.
2018-06-09 22:23:55 +02:00
Paul Riseborough
8191068959 EKF: Don't start using mag if optical flow use is interrupted
If magnetometer use is being inhibited because an indoor condition has been detected (optical flow and poor or no GPS) and the optical flow fusion checks fail causing the EKF to stop navigating, we do not want the EKF to start using the magnetometer.
2018-06-09 22:23:55 +02:00
Paul Riseborough
4889e8432c EKF: Don't fuse multi rotor drag if yaw angle is bad 2018-06-09 22:23:55 +02:00
Paul Riseborough
092a8d8f21 EKF: Fix GPS validity time check error 2018-06-09 22:23:55 +02:00
Paul Riseborough
0160aaa568 EKF: Don't use magnetometer with optical flow only nav if GPS checks are failing 2018-06-09 22:23:55 +02:00
Paul Riseborough
84516760c0 EKF: Use stricter GPS accuracy test when optical flow is being used
This adds some hysteresis to the automated optical flow selection and also reduces likelihood of bad GPS being used when operating indoors,
2018-06-09 22:23:55 +02:00
Daniel Agar
a80b3ab610 set MODULE define for each library
- this is needed for INFO, WARN, ERR messages when used within PX4
2018-05-27 20:08:47 +02:00
Daniel Agar
50631e5d98 geo remove use of DBL_EPSILON
-this doesn't seem to be (obviously?) available on qurt
2018-05-21 10:59:40 +02:00
Daniel Agar
cb63f16d48
cmake cache ECL source directory path to work with catkin (#447) 2018-05-17 12:01:30 -04:00
Bart Slinger
bae4b8a5e7 remove superfluous elseif (#431)
* remove superfluous elseif

* Set ev_hgt flag false when starting on baro
2018-05-11 08:38:42 +10:00
Paul Riseborough
16976d3911 Merge branch 'pr-ekfOptFlowFixes'
* pr-ekfOptFlowFixes:
  EKF: fix bug causing height offset when GPS use stops
  EKF: Don't reject saturated flow data when it is the only aiding source
  EKF: Prevent flow motion check false positives
  EKF: Don't assume large position uncertainty when starting optical flow nav
  EKF: relax terrain update requirements for continuing optical flow use
  EKF: Relax minimum required range finder measurement rate
  EKF: relax optical flow on ground motion checks
  EKF: range finder aiding logic fixes
  EKF: Decouple range finder use criteria checking and selection
  EKF: Don't auto select range finder for height when on ground.
  EKF: Fix false triggering of optical flow bad motion checks
  EKF: update comments
  EKF: Don't use optical flow if GPS is good and the vehicle is not using range finder for height
  EKF: Stop using EV for yaw when GPS fusion starts
  EKF: Add persistence criteria to  GPS fail check
  EKF: allow GPS fallback if quality bad and alternative aiding available
  EKF: always run GPS checks
2018-05-11 08:22:14 +10:00
Paul Riseborough
75e65901ae EKF: fix bug causing height offset when GPS use stops
This bug causes the last vertical velocity observation to be continuously fused.
2018-05-10 10:55:56 +02:00
Paul Riseborough
e8e9e34a73 EKF: fix bug causing height offset when GPS use stops
This bug causes the last vertical velocity observation to be continuously fused.
2018-05-10 13:45:19 +10:00
Paul Riseborough
6cadc92285 EKF: Don't reject saturated flow data when it is the only aiding source 2018-05-10 07:11:59 +10:00
Paul Riseborough
bf902e5eca EKF: Prevent flow motion check false positives
The previous implementation could false trigger if there was significant vibration below 200Hz during startup.
2018-05-09 07:47:17 +10:00
Paul Riseborough
bdf5b3e003 EKF: Don't assume large position uncertainty when starting optical flow nav 2018-05-08 08:43:56 +10:00
Paul Riseborough
e26711af7d EKF: relax terrain update requirements for continuing optical flow use 2018-05-08 08:43:14 +10:00
Paul Riseborough
868bc01087 EKF: Relax minimum required range finder measurement rate 2018-05-08 08:43:14 +10:00
Paul Riseborough
02963a85c4 EKF: relax optical flow on ground motion checks 2018-05-08 08:43:14 +10:00
Paul Riseborough
24b005ed57 EKF: range finder aiding logic fixes 2018-05-08 08:42:29 +10:00
Paul Riseborough
0c0a6602b0 EKF: Decouple range finder use criteria checking and selection 2018-05-08 08:42:29 +10:00
Paul Riseborough
6708bec1b4 EKF: Don't auto select range finder for height when on ground. 2018-05-08 08:42:03 +10:00
Paul Riseborough
0a63052753 EKF: Fix false triggering of optical flow bad motion checks 2018-05-08 08:42:03 +10:00
Paul Riseborough
f9d4934db6 EKF: update comments 2018-05-08 08:42:03 +10:00
Paul Riseborough
82de3141f0 EKF: Don't use optical flow if GPS is good and the vehicle is not using range finder for height 2018-05-08 08:42:03 +10:00
Paul Riseborough
389786ef1b EKF: Stop using EV for yaw when GPS fusion starts 2018-05-08 08:42:03 +10:00
Paul Riseborough
4ab78230e6 EKF: Add persistence criteria to GPS fail check 2018-05-08 08:41:15 +10:00
Paul Riseborough
67d71ca406 EKF: allow GPS fallback if quality bad and alternative aiding available 2018-05-08 08:41:15 +10:00
Paul Riseborough
bd59e381db EKF: always run GPS checks 2018-05-08 08:40:31 +10:00
Daniel Agar
b227aca4a8 geo_lookup fix table bounds 2018-05-06 03:13:00 +02:00
Daniel Agar
e494a4e634 Jenkins set git username and email with environment variables 2018-05-05 18:11:28 -04:00
Daniel Agar
3639087ac6 cmake and Jenkins add basic address santiizer test buld 2018-05-05 16:11:04 -04:00
Daniel Agar
1fba622a80 travis-ci basic build script 2018-05-05 15:25:54 -04:00
Daniel Agar
cde2ee9b6f cmake ignore missing-field-initializers 2018-05-05 15:25:54 -04:00
Daniel Agar
2100127304 geo: zeroing static unnecessary 2018-05-05 15:25:54 -04:00
Daniel Agar
0f12db5b2c travis-ci enable coverity_scan 2018-05-05 15:25:54 -04:00
Daniel Agar
aceab8c82c Jenkins upload coverage to codecov.io 2018-05-05 15:13:52 -04:00
Daniel Agar
5780cd3c6b
Jenkins create PX4/Firmware test branch and push (#436) 2018-05-05 14:40:15 -04:00
Daniel Agar
cf957b5831
code coverage cmake and Jenkins support 2018-05-04 01:40:23 -04:00
Daniel Agar
4e0cd45676 doxygen cmake and Jenkins support 2018-05-04 01:22:10 -04:00
Daniel Agar
372f9f430b EKF pytest save plots to pdf 2018-05-03 22:25:36 -04:00
Daniel Agar
d6a3110918 visual studio build compatibility 2018-05-03 22:25:36 -04:00
Daniel Agar
3a61035ac2 fix and re-enable EKF pytests 2018-05-03 22:25:36 -04:00
Daniel Agar
4dabf7a1a8 Jenkins add OSX build 2018-05-03 22:25:36 -04:00
Daniel Agar
c5b2f59f57 PX4 style fixes (excluding EKF generated code) 2018-05-03 22:25:36 -04:00
Daniel Agar
e5952fadaf cmake standalone build 2018-05-03 22:25:36 -04:00
Daniel Agar
eec71d1a10 EKF get_ekf_soln_status() fix pred_pos_horiz_abs 2018-05-03 00:12:23 -04:00
Paul Riseborough
1bd1809d6e
EKF: Fix bug causing simultaneous range and baro height fusion (#429) 2018-05-03 13:24:33 +10:00
Daniel Agar
a14434d6dc EKF always fill position and velocity accuracy (#425) 2018-04-23 21:15:29 +10:00
Paul Riseborough
6e3403ce28
EKF: prevent race condition between global position validity and eph reporting 2018-04-21 13:04:04 -04:00
Paul Riseborough
fdabb9277f
EKF: Use consistent validity definition for global position reporting 2018-04-21 13:04:04 -04:00
Paul Riseborough
31142c0322
EKF: tighten wind variance growth check 2018-04-21 13:04:04 -04:00
Paul Riseborough
ae069b12d6
EKF: Fix bug preventing wind relative dead reckoning 2018-04-21 13:04:04 -04:00
Paul Riseborough
9747dc778d
EKF: Rework nav validity reporting
Remove duplicate checking for dead reckoning and consolidate into a single function.
Use separate timers to check for start of dead reckoning and check when dead reckoning has been performed for too long for the nav solution to be valid.
Allow the timeout for validity reporting to be adjusted externally.
Separate external reporting of dead reckoning from internal checks.
2018-04-21 13:04:04 -04:00
Daniel Agar
bd72f3c521 geo std pressure constants and update usage 2018-04-19 08:57:38 +02:00
Daniel Agar
02e319431b cmake remove embedded vim settings 2018-04-11 20:50:30 -04:00
Daniel Agar
91b5bfe2bb attitude_fw remove unused perf include 2018-04-11 20:50:30 -04:00
Paul Riseborough
02055acee2
EKF: Fix non GPS aiding data reset logic (#418)
* EKF: Move optical flow specific state reset to helper functions

* EKF: Ensure loss of optical flow aiding is handled correctly

If data is only source of aiding and has been rejected for too long - reset using flow data as a velocity reference.
If flow data is unavailable for too long - declare optical flow use stopped.
Use consistent time periods for all resets

* EKF: Ensure loss of external vision aiding is handled correctly

If data is only source of aiding and has been rejected for too long - reset using data as a position.
Don't reset velocity if there is another source of aiding constraining it.
If data is unavailable for too long, declare external vision use stopped.
Use consistent time periods for all resets.

* EKF: Update parameter documentation

Make the distinction between the no_gps_timeout_max and no_aid_timeout_max parameters clearer

* EKF: make class variable units consistent with documentation

* EKF: Don't reset states when optical flow use commences if using external vision

* EKF: Stop optical flow fusion when on ground if excessive movement is detected.

* EKF: fix terrain estimator vulnerabilities

Reset estimate to sensor value if rejected for 10 seconds
Protect against user motion when on ground.
Fix unnecessary duplication of terrain validity check and separate validity update and reporting.

* EKF: remove unnecessary Info console prints

Optical flow use information can be obtained from the estimator_status.control_mode_flags message

* EKF: fix inaccurate comment

* EKF: remove duplicate calculation from terrain validity accessor function
2018-04-09 18:35:15 +10:00
Daniel Agar
ba2b9dfdd9 update matrix lib usage 2018-03-28 17:57:51 -04:00
Daniel Agar
39b69af9bf geo_lookup: Update geomagnetism tables.
Update declination table to use latest IGRF data
Add lookups for inclination and field strength
2018-03-26 21:52:11 -04:00
Daniel Agar
cd12f049fe move geo and geo_lookup from PX4 Firmware to ECL 2018-03-26 21:52:11 -04:00
Paul Riseborough
1bb4c17c0e
EKF: Allow use of large GPS position observation noise when using other aiding sources (#403) 2018-03-27 11:31:37 +11:00
Paul Riseborough
8a012436f9
EKF: Fix reversion from GPS to no-aiding mode (#412)
* EKF: Do not delay reversion to no-aiding mode if parameter initiated

* EKF: Move no-aid reversion resets to helper functions

* EKF: Prevent unwanted fusion of velocity data during no aiding mode
2018-03-22 22:39:00 +11:00
Roman Bapst
95c4777b35 added airdata module which contains wind & airspeed scale estimator (#405)
* added airdata module which contains wind & airspeed scale estimator

* airdata: support gate sizes for innovation consistency checks
2018-03-21 13:06:00 -04:00
Carl Olsson
f6d23cc621 added rng_stuck to filter control status flags (#392) 2018-03-21 11:46:27 +11:00
Roman Bapst
7964820412 tecs.cpp: tecs initialisation fixes (#411)
- zero thrust integrator on initialisation, we already have a cruise throttle
variable
- if initialising from in_air condition set last throttle setpoint to
cruise throttle (_in_air ? throttle_cruise : 0.0f);
2018-03-21 11:25:15 +11:00
Daniel Agar
35bc2cfcd9
tecs and l1 switch to matrix math library (#409) 2018-03-18 21:59:41 -04:00
Daniel Agar
1bc7378414
EKF decrease synthetic sideslip interval 1s -> 150ms (#407) 2018-03-15 23:09:42 -04:00
Daniel Agar
341f8962d2
EKF interface add get_wind_status() (#406) 2018-03-14 16:41:09 -04:00
Thomas Stastny
041886a289 attitude_fw: move angular rate limits to body angular rates (#404) 2018-03-08 22:19:19 -05:00
Paul Riseborough
78e983073a
EKF: Fix bug in use of gps velocity noise parameter (#401)
This fixes a bug introduced by an earlier feature request PR. The parameter is supposed to define the lower limit on the observation noise.
2018-02-28 11:48:53 +11:00
ChristophTobler
cdc6efc5d6 EKF: fix rot vec calc from quat by using matrix lib 2018-02-08 10:22:55 +01:00
ChristophTobler
9238e2f1a2 EKF: fix spike handling in ev rotation calculation 2018-02-08 10:20:59 +01:00
Paul Riseborough
db5264e45c EKF: Add missing reset for output observer vertical position derivative
Required to prevent large transients in value returned by get_pos_d_deriv accessor following a vertical state reset event.
2018-01-31 08:43:39 +01:00
Beat Küng
d078d68f64 Reverse the linked list of data_validator_group #2 (#389)
* Reverse the linked list of data_validator_group and maintain a first node
for search from index 0

Fixes issue PX4/Firmware#8644

* fix code style

* validator: fix shadowing of 'sibling' argument
2018-01-30 09:11:01 +11:00
ChristophTobler
337cdcc59a init height using baro when set to ev height (#388)
this also makes sure the _baro_hgt_offset is being initialized correctly
2018-01-30 07:33:28 +11:00
Paul Riseborough
a2d6a4dded
EKF: fix indexing bug (#387)
Should use index 9 for vertical position.
2018-01-29 08:09:55 +11:00
Paul Riseborough
1ddd94f237 tecs: Remove redundant code
The if() statement was there as provision to do something different with the speed demand derivative limits if an abnormal condition was present, however we have no basis for assigning different limits at this point in time.
2018-01-28 22:01:28 +01:00
Paul Riseborough
f016e66ff8
Revert "EKF: Release flow speed limit with altitude gained" (#382)
* Revert "EKF: Release flow speed limit with altitude gained"

This reverts commit e70206f74bc4f77a0e000da3c923f4459006d2b1.

* Revert "fix code style"

This reverts commit 76bf70121c37e2c1ec74982eb8c26e0510b2c84a.

* Revert "Reverse the linked list of data_validator_group and maintain a first node"

This reverts commit 32482e7644d14d7e4d0e25183b0dc9b0f27bf9c1.
2018-01-24 20:46:48 +11:00
jay
76bf70121c fix code style 2018-01-19 11:53:36 +01:00
lijie
32482e7644 Reverse the linked list of data_validator_group and maintain a first node
for search from index 0

Fixes issue PX4/Firmware#8644
2018-01-19 11:53:36 +01:00
ChristophTobler
cdbca91e79 EV height reset (#379)
* fix typo

* EKF: use baro if it was reset to baro from ev

* EKF: set vert_pos_reset if resetting to ev hgt

otherwise the position controller will not reset the setpoint -> leading to unwanted altitude changes
2018-01-15 20:15:56 +11:00
Andreas Antener
9e16e51d3a attitude_fw: constrain integrator properly to prevent building it up over the specified maximum 2018-01-13 16:17:01 +01:00
Daniel Agar
c8ab806120 EKF pytest temporarily disable 2018-01-05 02:39:02 -05:00
Daniel Agar
ae641020dd EKF run pytest quick and plot 2018-01-05 02:39:02 -05:00
Daniel Agar
ec0d907d5a update README build badge (travis-ci -> jenkins) 2018-01-05 02:39:02 -05:00
Daniel Agar
7df4e0f8eb reenable pytest with px4-dev-ecl 2018-01-05 02:39:02 -05:00
Daniel Agar
f407954207 initial jenkins configuration 2018-01-05 02:39:02 -05:00
Lorenz Meier
dd9ea86fd6
Update README.md
Added link to tuning guide.
2018-01-04 08:50:34 +01:00
Paul Riseborough
76763adb5c
Merge pull request #374 from PX4/pr-ekfInitFix
EKF: Prevent possible /0 due to incorrect initial values
2018-01-04 08:15:08 +11:00
Paul Riseborough
0f047504d4 EKF: Prevent possible div 0 due to incorrect initial values
Gate size class variables should not be initialised to zero, because it will cause a /0 error if fuseVelPosHeight() is called before they are set to their respective parameter values.
2018-01-04 07:47:03 +11:00
Daniel Agar
f0862210c7 EKF initialize _hvelInnovGate
- fixes CID 139550
2018-01-03 08:07:28 +01:00
Paul Riseborough
bdbc05cf91
Merge pull request #372 from PX4/pr-tecs_init
TECS initialize throttle integrator at cruise if in air
2017-12-28 09:09:14 +11:00
Paul Riseborough
a39c376c26
Merge pull request #371 from CarlOlsson/pr-push_beta_test_ratio
ekf: return beta test ratio in get_innovation_test_status
2017-12-28 08:29:15 +11:00
Daniel Agar
8320c8ba14
TECS initialize throttle integrator at cruise if in air 2017-12-21 16:29:14 -05:00
CarlOlsson
5c8b22b43f ekf: return beta test ratio in get_innovation_test_status
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2017-12-18 15:48:36 +01:00
Paul Riseborough
e70206f74b EKF: Release flow speed limit with altitude gained
When GPS use is gained whilst flying using optical flow data, the sudden release of the speed limit is unannounced to  the operator and can cause unexpected acceleration.
This patch releases the speed limit as height is gained, but does not reduce it when the vehicle descends, unless GPS use is lost.
2017-12-12 01:26:44 +00:00
CarlOlsson
dea0c8bb6a tecs: fixed some typos 2017-12-08 00:31:12 -05:00
Paul Riseborough
83b765f707 EKF: Don't print navigation lost message on startup 2017-12-03 23:02:02 +00:00
Daniel Agar
e3da71c89d Ekf initialize all fields 2017-11-26 16:50:16 -05:00
Andreas Antener
ee57908911 Provide access to FW integrators 2017-11-26 15:33:34 +01:00
Paul Riseborough
22a6abbca2
Merge pull request #365 from PX4/pr-ekfBugFix
EKF: Fix vel pos innovation handling bug
2017-11-24 14:46:11 +11:00
Paul Riseborough
89be63d6c2 EKF: Fix vel pos innovation logging bug 2017-11-24 14:25:44 +11:00
Paul Riseborough
882f4d44e5
Merge pull request #362 from PX4/pr-ekfAuxVelFuse
EKF: Add additional velocity interface to use landing beacon data
2017-11-21 11:55:43 +11:00
Paul Riseborough
b0ad8269a5 EKF: enable separate monitoring of aux velocity innovations 2017-11-21 11:18:09 +11:00
Paul Riseborough
2a57fd858d EKF: clean up reset of fusion flags 2017-11-21 11:18:09 +11:00
Paul Riseborough
8e30c2666d EKF: Add support auxiliary velocity observation
This enables the EKF to use an additional NE velocity measurement. This can be used to improve position hold stability when landing using a beacon system for positioning by fusing the beacon velocity estimates.
2017-11-21 11:18:09 +11:00
Paul Riseborough
bd8f30752a
Merge pull request #351 from PX4/ekfGndEffectComp-wip
EKF: Protect against ground effect induced static pressure rise
2017-11-20 09:14:26 +11:00
Paul Riseborough
a2b24fa960 EKF: Protect against ground effect induced static pressure rise during landing and takeoff.
Apply a dead-zone to the vertical position innovation if using baro for height and if in the ground effect region during and just after takeoff.
Method needs to be activated externally.
Turns off automatically after 10 seconds or if specified height gained.
2017-11-17 21:41:31 +11:00
Paul Riseborough
c8d459eecd
Merge pull request #360 from dagar/pr-ekfObsBufAlloc
EKF RingBuffer allocation minor improvements + print memory usage
2017-11-17 08:38:57 +11:00
Paul Riseborough
3479542ae5
Merge pull request #359 from PX4/pr-ekfObsBufAlloc
EKF: Reduce memory usage
2017-11-17 08:09:37 +11:00
Daniel Agar
d9c8af54bd
EKF add print_status() with memory usage 2017-11-16 14:11:34 -05:00
Daniel Agar
75d1ed894c
EKF simplify RingBuffer allocation check 2017-11-16 13:09:17 -05:00
Paul Riseborough
af7004ef01 EKF: report observation buffer allocation errors 2017-11-16 20:04:46 +11:00
Paul Riseborough
d785a19c0a EKF: delay final allocation of observation buffers until required 2017-11-16 19:47:04 +11:00
Paul Riseborough
f54f1d467f
Merge pull request #358 from PX4/pr-ringbuffer_copies
EKF RingBuffer avoid unnecessary copying
2017-11-16 13:37:36 +11:00
Paul Riseborough
7c8fcf7628 EKF: Clarify use of *= operator for quaternions 2017-11-16 11:52:19 +11:00
Daniel Agar
ed9a394029
EKF RingBuffer avoid copying 2017-11-15 18:08:51 -05:00
Paul Riseborough
44eaa076db
Merge pull request #356 from PX4/pr-ekfMiscUpdate
EKF: Remove redundant code
2017-11-16 07:05:18 +11:00
Paul Riseborough
2b20c52c4d EKF: Remove redundant code 2017-11-15 22:03:17 +11:00
Paul Riseborough
cfdab732d1 EKF: Update parameter description 2017-11-15 21:28:11 +11:00
Paul Riseborough
16154423c8 matlab: update optical flow derivation
Support use of sensors with arbitrary orientation in body frame
2017-11-15 11:16:19 +11:00
Paul Riseborough
cc651ac472
Merge pull request #354 from PX4/ekfMagYawReset-wip
Prevent loss of navigation accuracy after in-flight mag yaw alignment
2017-11-13 07:32:23 +11:00
Paul Riseborough
72a7ab2c25 EKF: Improve resistance to bad initial mag offset
When magnetic field states have been reset in-flight using a single sample, the magnetic field states are not used to constrain heading drift for a period after the reset. This period has been shortened from 10 to 5 seconds which is enough time to average out the effects of measurement noise (the original concern). The shorter time has enabled the previous practice for RW vehicles of using magnetic heading in that time period to constrain yaw drift to be discontinued. This is necessary becasue while magnetic heading is being used, it fights the yaw corrections obtained from GPs observations and lengthens the time required to recover from a bad mag calibration.
2017-11-13 07:05:56 +11:00
Paul Riseborough
df9f48d2d3 EKF: Fix build error 2017-11-13 07:05:56 +11:00
Paul Riseborough
44c50ab2df EKF: Correct magnetic yaw measurement using learned mag biases
Don't apply bias corrections when biases are being learned to avoid possible circular data dependency.
2017-11-13 07:05:56 +11:00
Paul Riseborough
c70363c501 EKF: Don't fuse heading if FW and waiting for mag states to stabilise
Doing so is a bad idea because bad mag data can drag the yaw angle away from the reset value and lead to rejection of GPS.
2017-11-13 07:05:56 +11:00
Paul Riseborough
279fc836f7 EKF: Always reset covariance matrix terms when doing vel pos state reset
If state errors were large before the reset, then failure to reset the covariance matrix terms can result in incorrect fusion of position and velocity measurements after the reset due to inconsistencies in the covariance matrix.
2017-11-13 07:05:56 +11:00
Paul Riseborough
141264fe63 EKF: Add method to set diagonals in covariance matrix 2017-11-13 07:05:56 +11:00
Paul Riseborough
32de90b9ef EKF: Add method to zero covariance terms 2017-11-13 07:05:56 +11:00
Paul Riseborough
f3e34eddc9 EKF: do not attempt to align FW yaw using GPS method if on ground 2017-11-13 07:05:56 +11:00
Paul Riseborough
8f27d3fc54 EKF: don't reset quaternion states unnecessarily
When performing the initial in-flight mag yaw reset for RW vehicle, do not reset the quaternion states and corresponding variances unless there has been a change in yaw angle large enough to cause problems with navigation.
This is because the state estimates after a reset are more vulnerable to transient sensor errors, so a reset should be avoided if possible.
2017-11-13 07:05:56 +11:00
Paul Riseborough
9e47b6e1b6 EKF: don't reset quaternions unnecessarily
When performing the initial in-flight magnetic field reset for fixed wing vehicles, resetting the quaternion states and their corresponding covariances should be avoided unless yaw errors are large, because state estimates are vulnerable to transient sensor errors immediately following a reset.
2017-11-13 06:55:02 +11:00
Paul Riseborough
29d383edbf EKF: Allow mag field estimates to stabilise before use 2017-11-13 06:55:02 +11:00
Paul Riseborough
363edf5eb9 EKF: Fix yaw reset for fixed wing
Ensures that a complete reset of velocity and position states will always be performed if yaw has had to be reset using GPS velocity.
Ensures that the yaw_align status cannot be set to false once the filter has aligned.
2017-11-13 06:55:02 +11:00
Paul Riseborough
7852c0ed03
Merge pull request #312 from PX4/pr-ekfExtVisQuat
EKF: Enable operation with arbitrary External Vision reference frame
2017-11-12 08:35:39 +11:00
Paul Riseborough
5fd006ca48 EKF: remove redundant code 2017-11-11 07:06:01 +11:00
ChristophTobler
368248fe6d
Merge pull request #353 from PX4/pr-expo_int_cast
EKF: use uint64_t cast for XeY to avoid float casting of variables
2017-11-08 11:54:39 +01:00
ChristophTobler
e388e59f32 EKF: use uint64_t cast for XeY to avoid float casting of variables
The default type for XeY is float
2017-11-08 11:40:26 +01:00
Paul Riseborough
bba3f70a0e EKF: reduce prediction time step from 12 to 8 sec
Reduces susceptibility to incorrect estimation of acceleration bias during sustained yaw rate.
Requires an increase in RAM allocation of 837 Bytes to allow for the longer IMU and output predictor buffers that can be created.
2017-11-02 09:27:33 +01:00
Paul Riseborough
01d68ef67c EKF: Enable use of rotated external nav estimates 2017-11-01 08:33:57 +11:00
Paul Riseborough
f921b2de5c
Merge pull request #348 from PX4/pr-ekfAddImuBiasReset
EKF: Add method to enable the IMU bias states to be reset externally
2017-10-30 15:55:52 +11:00
Paul Riseborough
063533afae EKF: Add method to enable the IMU bias states to be reset externally 2017-10-26 10:41:39 +11:00
Paul Riseborough
cd2ca57ec2 Merge pull request #339 from PX4/ekfPosCtrlLimits-wip
Ekf pos ctrl limits wip
2017-10-23 06:57:23 +11:00
Daniel Agar
22a51c6afd PX4_ISFINITE -> ISFINITE 2017-10-22 20:37:40 +02:00
Daniel Agar
9e13a2cb21 tecs move initialization 2017-10-22 20:37:40 +02:00
Daniel Agar
31a8e047d7 tecs one line setters and group 2017-10-22 20:37:40 +02:00
Daniel Agar
4f2d571c89 tecs fix code style 2017-10-22 20:37:40 +02:00
Paul Riseborough
79995b2c15 Create total energy control system implementation
This is a new, clean and streamlined variant of the mathematical derivation I created a few years ago.
2017-10-22 20:37:40 +02:00
Daniel Agar
9eb860fabd travis-ci fix gcc and clang compilation jobs (#344)
- allow the python testing to fail without failing the entire build
2017-10-22 12:19:11 -04:00
Paul Riseborough
e10ec59058 EKF: Use consistent test for navigation validity reporting
This will enable controller to take advantage of non-inertial dead reckoning.
2017-10-20 14:44:38 +11:00
Paul Riseborough
19074fdd9e EKF: Use consistent time limit for inertial dead reckoning test 2017-10-20 14:44:38 +11:00
Paul Riseborough
55a2dc94df EKF: handle air data fusion covariance reset consistently
Both the sideslip and airspeed fusion should not be resetting covariances for states they do not modify.
2017-10-20 14:44:37 +11:00
Paul Riseborough
0d32128701 EKF: Use dead-reckoning status to determine if air data should modify non-wind states 2017-10-20 14:44:37 +11:00
Paul Riseborough
e4ffe199ed EKF: fix bug in sideslip fusion activation 2017-10-20 14:44:37 +11:00
Paul Riseborough
59f1c3e19e EKF: Update dead-reckoning definition
Use of air data to navigate should be classified as dead-reckoning because neither ground relative velocity or position is observed directly and errors grow faster.
2017-10-20 14:44:37 +11:00
Paul Riseborough
a2dcd5b9b6 EKF: Consolidate no aiding reset logic 2017-10-20 14:44:37 +11:00
Paul Riseborough
929c5c2b37 EKF: enable gps fusion flag to be false while fusing air data 2017-10-20 14:44:37 +11:00
Paul Riseborough
204a218ee6 EKF: Allow dead-reckoning using air data 2017-10-20 14:22:06 +11:00
ChristophTobler
f5fd90533a fix gps and flow flag handling
gps flag was not turning false if there was flow

only reset states if we were relying on that sensor only
2017-10-20 14:22:06 +11:00
Paul Riseborough
9857fb9eb6 EKF: publish control limits for optical flow navigation 2017-10-20 14:22:06 +11:00
Paul Riseborough
afa8844eb7 Merge pull request #341 from CarlOlsson/fix/fw_yaw_align2
EKF: If aligning yaw for fw with low GPS velocity, use mag
2017-10-20 14:05:52 +11:00
CarlOlsson
2e03084d34 EKF: If aligning yaw for fw with low GPS velocity, use mag 2017-10-19 16:49:54 +02:00
Paul Riseborough
61e0c04811 Merge pull request #338 from CarlOlsson/fix/fw_pos_reset
EKF: Fix bug when resetting position and velocities for fw due to som…
2017-10-18 07:02:34 +11:00
CarlOlsson
c81cdfa1ce EKF: Fix bug when resetting position and velocities for fw due to something else than bad yaw estimate
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2017-10-17 15:08:09 +02:00
Paul Riseborough
410697cb0c Merge pull request #337 from CarlOlsson/fix/comment
EKF: fixed comment
2017-10-17 21:15:06 +11:00
CarlOlsson
8c83167857 EKF: fixed comment
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2017-10-17 11:41:55 +02:00
Paul Riseborough
32b795ee10 EKF: Add readme file to EKF documentation directory 2017-10-13 21:46:41 +11:00
Paul Riseborough
8dd4800a2c EKF: Add preliminary documentation for filter mathematics 2017-10-13 21:34:49 +11:00
Paul Riseborough
a34bba87fc Merge pull request #322 from PX4/pr-ekfMagFusionMode
EKF Add mag fusion mode for VTOL
2017-10-13 07:27:54 +11:00
Paul Riseborough
dbff89fbcb EKF: Fix error preventing selection of MAG_FUSE_TYPE_AUTOFW 2017-10-12 19:54:35 +11:00
Paul Riseborough
6f7f05fdc0 EKF: Move MAG_FUSE_TYPE_AUTOFW control to the expected place 2017-10-12 14:50:23 +11:00
Paul Riseborough
e834522f62 EKF: Use fixed wing status flag in MAG_FUSE_TYPE_AUTOFW logic 2017-10-12 14:50:23 +11:00
Paul Riseborough
7b4c957ad4 ekf2: Add new mag fusion mode
Adds a mode where mag fusion is only used update the field estimates
2017-10-12 14:50:23 +11:00
Paul Riseborough
9c65968c3d Merge pull request #334 from PX4/pr-ekf_minor_flow_fix
ekf: fix optical flow bugs
2017-10-12 09:14:29 +11:00
Paul Riseborough
68bad48598 Merge pull request #330 from CarlOlsson/pr-add_get_wind_vel_var
EKF: added get_wind_velocity_var function
2017-10-12 09:12:54 +11:00
Paul Riseborough
4db23b7b2e EKF: Don't report terrain estimate invalid immediately when HAGL observations fail checks 2017-10-12 08:26:04 +11:00
Paul Riseborough
1119a9b0ac EKF: Enable optical flow reversion to work if flow data is lost
Also improve reporting.
2017-10-12 08:02:54 +11:00
ChristophTobler
cdf6e6cd36 EKF: use delta_time to avoid division by zero 2017-10-11 15:15:06 +02:00
Paul Riseborough
d293c4231d EKF: Protect against divide by zero caused by invalid optical flow 2017-10-11 21:54:47 +11:00
Paul Riseborough
ab9b8e1964 EKF: Prevent bad optical flow quality causing loss of aiding when on ground 2017-10-11 21:22:33 +11:00
ChristophTobler
b7e589b98a EKF: only fuse optical flow if terrain is valid 2017-10-10 17:51:56 +02:00
ChristophTobler
81a64c0479 ekf: fix flow direction when on ground 2017-10-10 14:39:44 +02:00
ChristophTobler
6cb99ce8a8 ekf: add function to get in air status 2017-10-03 22:36:33 +02:00
CarlOlsson
8200e4b218 EKF: added get_wind_velocity_var function
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2017-10-02 14:47:56 +02:00
Paul Riseborough
705f93d0bf Merge pull request #327 from CarlOlsson/parameterize_max_rng_tilt
EKF: Parameterize maximum angle for rng fusion
2017-10-02 17:08:34 +11:00
CarlOlsson
0a7c3ecbc6 EKF: Parameterize maximum angle for rng fusion 2017-09-26 20:53:48 +02:00
Paul Riseborough
160e4d69c1 Merge pull request #323 from PX4/pr-ekfQuatMultOrder
EKF: use hamiltonian convention for quaternion multiplication order
2017-09-21 07:49:35 +10:00
Paul Riseborough
4411c7fd1c Merge pull request #325 from PX4/pr-ekfFlowGyroBias
EKF: Fix bug in accumulation of IMU data for flow sensor gyro bias
2017-09-14 18:47:46 +10:00
Paul Riseborough
1d3e8edc46 EKF: Fix bug in accumulation of IMU data for flow sensor gyro bias calculation 2017-09-14 18:34:11 +10:00
Paul Riseborough
3b3326e250 Merge pull request #326 from TSC21/fix_travis
travis: install python3.5 for trusty in order to run pip3
2017-09-14 18:32:31 +10:00
TSC21
571a0f7da7 travis: use pyenv in order to force pip3 version 2017-09-14 09:22:09 +01:00
TSC21
7affb42f22 travis: install python3.5 for trusty in order to run pip3 2017-09-14 09:08:11 +01:00
Paul Riseborough
dd5b8525c3 EKF: Use hamiltonian convention for quaternion product order 2017-08-31 11:14:02 +02:00
Paul Riseborough
b57b5e869d matrix: Use hamiltonian convention for quaternion product 2017-08-31 11:14:01 +02:00
Paul Riseborough
b0300b9723 Revert "attitude_fw delete unused and cleanup"
This reverts commit 25bd3ac5e66d6ac9f525720ab173bb050705c99c.
2017-08-30 16:23:40 +02:00
Paul Riseborough
1531269f92 Merge pull request #319 from PX4/pr-attitude_fw-cleanup
attitude_fw delete unused and cleanup
2017-08-28 09:48:49 +02:00
Daniel Agar
25bd3ac5e6
attitude_fw delete unused and cleanup 2017-08-26 17:44:24 -04:00
Paul Riseborough
fac292fef9 Merge pull request #321 from dagar/pr-ekf_formatting
EKF trivial code style cleanup
2017-08-26 18:17:23 +10:00
Daniel Agar
99ba1c3745
EKF trivial code style cleanup 2017-08-25 10:09:11 -04:00
ChristophTobler
89236ef275 Merge pull request #314 from PX4/pr-check_stuck_rng
Pr check stuck rng
2017-08-21 07:54:06 +02:00
Peter Dürr
305a95aef9 Integrate Python-based tests and benchmark into Travis
* Unfortunately, due to the SWIG dependency, we need sudo to install on
  Travis (conflicts when adding with debian-sid source prevent using addons)
  which means we cannot use the container-based infrastructure anymore.
* Building the Python bindings requires g++5 (at least with -Werr set).
* When building the Python bindings on Travis, the numpy includes are not found
  by cmake, so they have to be added separately by running a Python process with
  `numpy.get_include()`
* The build script now (somewhat clumsily) depends on the RUN_PYTEST environment
  variable. If it is set to anything other than "", it will make the tests and
  run tests and benchmarks
2017-08-14 12:02:03 +02:00
Peter Dürr
15c8c24418 Fix time units on plots
* Time in plots was of by a factor of 1e3 due to wrong conversion from us.
2017-08-14 12:02:03 +02:00
Peter Dürr
b29067a188 Better handle Python dependencies
* Add requirements.txt file with required Python packages
* Read requirements.txt from CMakeLists.txt to check dependencies and alert the
  user if necessary.
2017-08-14 12:02:03 +02:00
Peter Dürr
bb5719a0da Add Python wrapper to ecl and use it to test functionality
* Add SWIG interface definition (and external numpy interface) to ecl classes
* Add section in CMakeLists.txt to build Python bindings and execute
  Python-based tests
* Write (property-based) tests that show the basic functionality of the Python
  bindings and the EKF (using pytest and hypothesis libraries)
* Write minimal benchmark for the EKF update (using benchmark plugin for pytest)
* Add plotting utilities to analyze tests
* Add lint script to keep the Python scripts clean
2017-08-14 12:02:03 +02:00
Peter Dürr
5988900044 Add getters for a few private variables of the EstimatorInterface
* For testing it is useful to have access to more internal states
* For the same reason I also promote the const FILTER_UPDATE_PERIOD_MS to
  public
2017-08-14 12:02:03 +02:00
Peter Dürr
a2ed0a76f9 Make the destructor of EstimatorInterface virtual
* This is a sane choice (and should arguably always be done for classes with
  virtual methods to avoid undefined behavior)
* It is required for wrapping the EstimatorInterface with SWIG (without virtual
  destructor, deriving from the EstimatorInterface leads to
  -Werror=delete-non-virtual-dtor).
2017-08-14 12:02:03 +02:00
Paul Riseborough
9cf0948bcf matlab: add derivation for air data error equations 2017-08-12 20:59:41 +10:00
Paul Riseborough
3983ac23fa Merge pull request #316 from PX4/pr-ekfTrueAirspeed
EKF: Add true airspeed accessor
2017-08-11 08:18:04 +10:00
Paul Riseborough
967720a9d7 Merge pull request #313 from PX4/pr-ekfYawReset
EKF: Improve in-flight mag error detection, recovery and isolation for fixed wing
2017-08-08 20:59:49 +10:00
Paul Riseborough
35ffd55481 EKF: Fix incorrect use of double precision operation 2017-08-07 10:34:19 +10:00
Paul Riseborough
cc5db74d1b EKF: Add true airspeed accessor 2017-08-07 09:19:48 +10:00
ChristophTobler
8ecec58292 Check for stuck range finder measurements in terrain estimator 2017-07-31 17:59:44 +02:00
ChristophTobler
7252284628 Add check for stuck range finder measurements 2017-07-31 17:59:16 +02:00
ChristophTobler
41f4b62cdb fix indentation 2017-07-31 17:58:03 +02:00
Paul Riseborough
596b8220e2 EKF: Output mag sensor isolation warning first time only 2017-07-31 19:39:07 +10:00
Paul Riseborough
ce806768b7 EKF: Improve in-flight mag error detection, recovery and isolation for fixed wing 2017-07-31 19:39:07 +10:00
Paul Riseborough
c230663b68 Merge pull request #309 from PX4/pr-ekfYawFusion
EKF: Improve efficiency of yaw fusion for External Vision
2017-07-31 19:37:15 +10:00
Paul Riseborough
ba5de96fcb Merge pull request #311 from PX4/pr-ekfExtVis
EKF: Add ability to use EV and GPS data together
2017-07-29 16:29:53 +10:00
Paul Riseborough
3ee6898710 EKF: Enable origin to be maintained when starting aiding using EV only
When starting aiding using EV only and commencing GPS aiding later, this change means that the GPS origin is set to the local position 0,0 point rather than the current vehicle position. This avoids large changes in local position when GPs aiding starts.
2017-07-29 15:31:34 +10:00
Paul Riseborough
e08da1c599 EKF: Add ability to use EV and GPS data together
Fuse external vision data using a relative position odometry method when GPS data is also being used and enable both GPOS and EV data to be fused on the same time step.
2017-07-26 18:06:18 +10:00
Paul Riseborough
74d1955dfa Merge pull request #310 from PX4/pr-ekfFixComments
EKF: Correct units in comments
2017-07-26 16:28:44 +10:00
Paul Riseborough
f3909244f0 EKF: Correct units in comments 2017-07-25 09:17:18 +10:00
Paul Riseborough
33e8d5923f matlab: Allow replay to handle late start GPS data in log
Also minor fix to comments.
2017-07-24 16:34:50 +10:00
Paul Riseborough
e18f92d9c2 matlab: Improve conversion of APM log data
Allow file conversion to work with unequal length GPS and GPA data.
Allow file conversion to work if range, flow and odometry data is not present.
2017-07-24 16:33:12 +10:00
Paul Riseborough
20584ee997 EKF: Improve efficiency of heading fusion calculations when using EV heading
Moves calculation only required for mag heading fusion into the if (_control_status.flags.mag_hdg) branch
When using EV yaw, the observed yaw angle is calculated directly from the EV quaternions using derived expressions from references in code comments.
2017-07-21 10:56:14 +10:00
Paul Riseborough
df34b43c00 Merge pull request #308 from PX4/pr-ekfDoxygen
EKF: Update documentation and make compatible with Doxygen
2017-07-21 10:55:18 +10:00
Paul Riseborough
5aeeebf7ac matlab: Fix derivation for 321 Euler rotation sequence 2017-07-21 10:48:54 +10:00
Paul Riseborough
26b5f26891 matlab: Add scripts to calculate rotation conversions for 321 or 312 Euler sequences 2017-07-21 10:22:17 +10:00
Paul Riseborough
aec01ce59c EKF: Update class variable documentation and make compatible with Doxygen 2017-07-20 20:16:42 +10:00
Paul Riseborough
627f8184b3 Merge pull request #307 from PX4/pr-constrain_vpos
constrain _terrain_vpos to be a minimum of _params.rng_gnd_clearance …
2017-07-20 17:35:35 +10:00
ChristophTobler
61a7991693 constrain _terrain_vpos to be a minimum of _params.rng_gnd_clearance larger than _state.pos(2) 2017-07-20 08:29:11 +02:00
Paul Riseborough
9b6e1ab2a7 Merge pull request #306 from PX4/revert-305-revert-303-pr-get_terr_valid
Revert "Revert "Split get_terrain_vert_pos() into valid and get_vpos""
2017-07-19 17:54:18 +10:00
Paul Riseborough
e1fe5b2229 Revert "Revert "Split get_terrain_vert_pos() into valid and get_vpos"" 2017-07-19 17:52:35 +10:00
Paul Riseborough
13f8d949bd Merge pull request #305 from PX4/revert-303-pr-get_terr_valid
Revert "Split get_terrain_vert_pos() into valid and get_vpos"
2017-07-19 17:34:03 +10:00
Paul Riseborough
c887b02f21 Revert "Split get_terrain_vert_pos() into valid and get_vpos" 2017-07-19 17:33:48 +10:00
ChristophTobler
a59cf894d2 Merge pull request #303 from PX4/pr-get_terr_valid
Split get_terrain_vert_pos() into valid and get_vpos
2017-07-17 17:29:20 +02:00
ChristophTobler
e429ecab17 check if terrain valid instead of initialized 2017-07-17 16:43:23 +02:00
ChristophTobler
eae0522dc2 split into get_terrain_valid and get_terrain_vert_pos 2017-07-17 16:42:42 +02:00
ChristophTobler
c42f820072 Merge pull request #295 from PX4/pr-rng_aid_hagl_hyst
rng aid: use hysteresis with lower hagl check
2017-07-17 16:05:45 +02:00
ChristophTobler
517fe8a71f rng aid: use hysteresis with lower hagl check 2017-07-17 13:36:51 +02:00
ChristophTobler
9da9aa632d Merge pull request #298 from PX4/pr-fix_rng_offset
init rng offset with ground clearance param when on ground to avoid n…
2017-07-17 13:33:10 +02:00
Paul Riseborough
18e81eba31 Merge pull request #300 from nicolaerosia/ekf2-dt
sensor_combined stores deltas in usec instead of seconds
2017-07-17 07:25:27 +10:00
Nicolae Rosia
5277141166 sensor_combined stores deltas in usec instead of seconds
Signed-off-by: Nicolae Rosia <nicolae.rosia@gmail.com>
2017-07-16 20:50:16 +03:00
Paul Riseborough
e2a5e57e14 matlab: Update replay scripts
Miscellaneous fixes and tuning changes.
Add plotting of Euler angle uncertainties.
2017-07-16 12:56:02 +10:00
ChristophTobler
8ed61ac052 init rng offset with ground clearance param when on ground to avoid noisy init 2017-07-13 17:43:19 +02:00
ChristophTobler
667517a9b6 Merge pull request #301 from PX4/pr-fix_hagl_valid
return hagl valid false if update was rejected
2017-07-13 17:28:53 +02:00
ChristophTobler
d2945abd85 return hagl valid false if update was rejected 2017-07-13 14:17:48 +02:00
Paul Riseborough
d69cc3d7c8 Merge pull request #293 from PX4/pr-fixExtVisionFallback
EKF: Allow fallback to non-aiding mode if external vision fusion is lost
2017-07-13 20:45:24 +09:00
Paul Riseborough
9ee35e38df EKF: Don't fallback when optical flow is lost if external vision data is being used 2017-07-13 20:21:41 +09:00
Paul Riseborough
1bb576c197 EKF: Allow fallback to non-aiding mode if external vision is lost. 2017-07-13 20:21:41 +09:00
Paul Riseborough
7a17f74910 Merge pull request #297 from ursa-drone/vispos_fix
Fixed vision position fusion bug
2017-07-12 22:15:54 +09:00
Isaac
f96685267e Fixed vision position fusion bug 2017-07-10 13:44:51 +10:00
Paul Riseborough
ec2b54fde7 EKF: Ensure normal yaw alignment using mag is performed if GPS method is not 2017-07-08 11:13:40 +02:00
Paul Riseborough
d446f66105 EKF: Add a fixed wing mode with setter function 2017-07-08 11:13:40 +02:00
Paul Riseborough
f064915889 EKF: Enable planes to recover from bad mag data at start of flight
Adjusts yaw by the amount of the error between GPS and EKF course if innovations are large.
2017-07-08 11:13:40 +02:00
Paul Riseborough
48a42dfb5b Merge pull request #288 from PX4/pr-ekfDelVelBiasFix
EKF: Improve protection against covariance instability in delta velocity bias states
2017-07-04 08:57:32 +10:00
Paul Riseborough
929f205a00 EKF: Changes arising from code review 2017-07-04 08:12:15 +10:00
Paul Riseborough
7b5f55303a EKF: Prevent covariance instability in delta velocity bias state estimation 2017-07-03 21:04:07 +10:00
Paul Riseborough
eb1e73ec81 Merge pull request #283 from PX4/ekf_matrix_cleanup
EKF matrix typedef cleanup
2017-07-03 21:02:24 +10:00
Paul Riseborough
ae118940b1 Merge pull request #292 from PX4/pr-use_baro_align
use baro for the ekf alignment if range finder is primary height source
2017-07-03 20:31:16 +10:00
Paul Riseborough
dfbc9de48e Merge pull request #291 from PX4/pr-ekfWindEstBugFix
EKF: Fix bug affecting wind estimation for planes
2017-07-01 11:06:58 +10:00
ChristophTobler
ed8fa16678 use baro for the ekf alignment if range finder is primary height source 2017-06-30 10:28:57 +02:00
Paul Riseborough
73ef95b37f Merge pull request #289 from PX4/pr-height_fixes
Pr height fixes
2017-06-30 12:31:26 +10:00
Paul Riseborough
59edccca4a EKF: Fix bug in wind estimation for fixed wing 2017-06-30 10:32:54 +10:00
Paul Riseborough
ba4a311771 EKF: Update comments for wind estimation logic 2017-06-30 10:32:23 +10:00
Paul Riseborough
8e0cd1bc39 EKF: Add parameter to set initial and max allowed wind uncertainty
This enables the initial uncertainty to be set based on application and also ensures that the max allowed growth in wind state variance is consistent with the initial uncertainty specified.
2017-06-30 10:31:16 +10:00
ChristophTobler
e1274ad28a move faultiness check above pop_first_older_than() and check independent of range aid to switch back to original sensor if available 2017-06-29 17:07:58 +02:00
ChristophTobler
0d9e535acb Use baro if reset to baro from gps and vice versa 2017-06-29 17:07:42 +02:00
ChristophTobler
4a4b0fa604 remove setting rng faulty in ev mode because not checked 2017-06-29 10:01:16 +02:00
ChristophTobler
066c641d61 range aid: switch to baro/gps even if rng aid conditions met and rng faulty 2017-06-29 09:47:02 +02:00
ChristophTobler
2f382c8e0e if hgt mode is range, switch to baro if range is faulty 2017-06-29 09:47:02 +02:00
ChristophTobler
e4f36215cb if in range aid mode, check faultiness that otherwise would never change back 2017-06-29 09:47:02 +02:00
ChristophTobler
e800de88b6 remove duplicate 2017-06-29 09:47:02 +02:00
Paul Riseborough
42b2469a46 matlab: fix comment error in file conversion utility 2017-06-29 10:41:42 +10:00
Paul Riseborough
70ece4df17 matlab: Add references for coning and skulling correction method 2017-06-28 15:27:59 +10:00
Paul Riseborough
8ccc45b26b matlab: Fix bug in replay plotting 2017-06-27 16:41:26 +10:00
Paul Riseborough
3e99898d47 matlab: Update readme file for the replay and improve optical flow tuning 2017-06-26 15:23:30 +10:00
Paul Riseborough
c1829d8e9a matlab: fix bugs and add replay of PX4 optical flow test data 2017-06-26 14:48:03 +10:00
Paul Riseborough
233c4b49c5 matlab: Add derivation of observation Jacobians used by the terrain estimator 2017-06-20 16:01:30 +10:00
Daniel Agar
c44488fdb8
EKF matrix typedef cleanup 2017-06-19 11:10:01 -04:00
Paul Riseborough
9303db85eb matlab: remove project specific code from mag cal comparison script 2017-06-17 17:35:07 +10:00
Paul Riseborough
edeed770b7 matlab: fix alignment bugs 2017-06-17 11:46:36 +10:00
Paul Riseborough
7f1cca5b28 Merge pull request #244 from PX4/pr-rangeAid
Pr range aid
2017-06-16 17:47:21 +10:00
ChristophTobler
6f5cffafec fix type of range_aid parameter: int -> int32_t 2017-06-15 10:14:59 +02:00
ChristophTobler
1fed209804 fix formatting 2017-06-15 09:10:43 +02:00
Roman
5036967343 barometer does not special height sensor offset because a barometer
offset from the local origin is calculated if the primary source for
height is not baro

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
c5d464b821 make range sensor height offset computation more robust
- when switching to range finder use the current terrain estimate as
height sensor offset, otherwise spikes in the range measurements could lead
to a wrong offset

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
182ea43445 fixed baro offset calculation
- do not subtract the height sensor offset variable when computing the
baro offset from the local origin. The baro height offset is calculated
when baro is not fused and so the height sensor offset used in that case
is associated to another sensor and has nothing to do with the baro.

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
39983a7d55 range aid: added hysteresis for switching in and out of range aid
- prevents rapid switching
- added innovation consistency check for using range aid

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
1b92c9b5b3 ekf_helper: fixed resetting height using range finder
- take range sensor offset wrt to IMU into account
- use projection to earth Z axis

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
3778f0921a ekf: enable range finder to be used for estimating height even if it's not
the primary height source

- moved height control into single function in order to decide which sensor
should be used for estimating height
- under certain conditions allow to use the range finder to estimate height
even if it's not the primary height source
- fixed a bug where the delta time for the baro offset calculation was always
zero
- use methods to set height control flags to reduce code duplication and
to prevent bugs

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
36bffd2571 ekf: calculate the delta time between consecutive baro measurments
(used for calculating filtered baro offset when primary height source
is not baro)

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
a0ab5cf0d7 ekf vel_pos_fusion: added height sensor offset to range innovation calculation
Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
a1e67396f4 ekf: added methods for setting control height flags
Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Paul Riseborough
d6decb3c84 Merge pull request #277 from PX4/pr-ekfBufferParam
EKF: Add a parameter to enable setting of a minimum buffer length
2017-06-15 07:34:21 +10:00
Paul Riseborough
c48b879843 Merge pull request #276 from CarlOlsson/feature/only_update_mag_states
EKF: Add feature to use the mag to only update the mag states
2017-06-14 11:04:14 +10:00
CarlOlsson
b255d4a53a fixed typos 2017-06-12 18:13:22 +02:00
Paul Riseborough
97eb17a62f Merge pull request #265 from PX4/pr-ekfOutputObserver
EKF: add option to output velocity as time derivative of position
2017-06-12 19:01:54 +10:00
Paul Riseborough
fed4a9bc5a EKF: add vertical position derivative output
Add calculation of a vertical position derivative to the output predictor. This will have degraded tracking relative to the EKF states, but the velocity will be closer to the first derivative of the position and reduce the effect inertial prediction errors on control loops that are operating in a pure velocity feedback mode.
Move calculation of IMU offset angular rate correction out of velocity accessor and into output predictor.
Provide separate accessor for vertical position derivative.
2017-06-12 10:45:46 +10:00
Paul Riseborough
16c7041f4a EKF: Add a parameter to enable setting of a minimum buffer length to handle large sensor timing jitter 2017-06-12 09:33:34 +10:00
Paul Riseborough
a17879ab91 matlab: miscellaneous EKF replay script file improvements
Save APM and PX4 data into separate directories and level plots accordingly
2017-06-10 13:29:20 +10:00
Paul Riseborough
3a7a66d360 matlab: improve EKF simulation fusion control
Add ability to start before GPS checks pass.
Add ability to turn GPS fusion off and on during replay.
Add ability to turn Optical Flow fusion off and on during replay.
Add ability to turn Visual Odometry fusion off and on during replay.
Convert miscellaneous constants to parameters
2017-06-10 13:02:42 +10:00
Paul Riseborough
dabf129daf matlab: Update EKF replay script files
Add automatic save of output results
2017-06-05 20:53:16 +10:00
Julien Lecoeur
d0b4f1e225 Use binary operator~ instead of logical operator! 2017-06-05 01:07:52 +08:00
Julien Lecoeur
c323b64742 Fix -Werror=int-in-bool-context on GCC 7 2017-06-05 01:07:52 +08:00
Daniel Agar
3e197fdded EKF tests remove extra semicolon 2017-06-05 01:06:41 +08:00
Daniel Agar
e7ed32fb82 attitude_fw remove extra semicolons 2017-06-05 01:06:41 +08:00
Daniel Agar
6ed8512ff4 EKF parameters use int32_t (#279) 2017-06-03 17:16:29 -04:00
Paul Riseborough
8351e13c70 Matlab: update readme file and provide link to sample data set 2017-06-03 13:22:08 +10:00
Paul Riseborough
9f61622044 Matlab: Improve efficiency of odometry derivation 2017-06-03 12:39:24 +10:00
Paul Riseborough
510b8763ea Matlab: Add basic implementation of EKF to support development testing 2017-06-03 12:39:24 +10:00
CarlOlsson
871ebb251b EKF: Changed get_control_mode to coyp 32 bits 2017-06-01 11:02:56 +02:00
CarlOlsson
a1308482fd EKF: Reset the mag states to the field state variance when switching from the inhibit mag mode to standard mode 2017-05-31 10:18:40 +02:00
CarlOlsson
be16406b35 EKF: Add feature to use the mag to only update the mag states 2017-05-26 11:29:21 +02:00
Paul Riseborough
05c3c46f83 ekf2: changes arising from code review 2017-05-17 08:59:01 +02:00
Paul Riseborough
394dd95cba EKF: Don't do magnetic field estimation without earth frame measurements
Use horizontal acceleration to check if yaw is observable independent of the magnetometer.
Use rotation about the vertical to check if mag raises are observable.
If neither yaw of mag biases are observable, save the magnetic field variances and switch to magnetic yaw fusion.
Use the last learned declination when using magnetic yaw fusion so that the yaw reference remains consistent.
When yaw or biases become observable, reinstate the saved variances and switch back to 3D mag fusion.
2017-05-17 08:59:01 +02:00
Paul Riseborough
20db74eca8 Revert "EKF: Add parameter control of individual IMU axis delta velocity bias estimation"
This reverts commit 9c31632e2bd8c53843dfc9dc419256607578350e.
2017-05-15 16:38:17 +10:00
ChristophTobler
47973a4820 run terrain estimator after control fusion modes. Otherwise _range_data_ready will never be true and fuseHagl() will never run 2017-05-15 07:42:51 +02:00
Paul Riseborough
9c31632e2b EKF: Add parameter control of individual IMU axis delta velocity bias estimation
Add a bitmask parameter to control bias learning for individual axes. This is achieved by setting the disabled states to zero together with their corresponding covariances.
Minor cleanup of the covariance prediction comments.
Removal of unnecessary variable copy operations.
Replace index operations to initialise covariance to zero with the more efficient memset.
2017-05-11 07:51:37 +02:00
Daniel Agar
87fdee440b EKF estimator_interface coverity fix 139419 2017-04-29 11:48:15 +02:00
Daniel Agar
b3f8fd19e0 EKF estimator_interface coverity fix 140490, 140491 2017-04-29 11:48:15 +02:00
Paul Riseborough
5ee0ed5a0d EKF: Increase sensitivity and add tuning of bad accel checks 2017-04-29 11:47:38 +02:00
Paul Riseborough
e35921534d EKF: fix reporting of optical flow fusion errors 2017-04-29 11:46:39 +02:00
Paul Riseborough
5112ffca90 EKF: Adjust default time delay params and clean up formatting 2017-04-27 07:34:42 +02:00
Paul Riseborough
8a2c5c1ad2 Merge pull request #266 from dagar/valgrind
ekf2 initialization fixes
2017-04-25 17:38:17 +10:00
Daniel Agar
3919d60f66
ekf2 initialization fixes 2017-04-24 18:56:50 -04:00
Paul Riseborough
c62bdcbdb2 Merge pull request #264 from PX4/pr-ekfBuildErrorFix
EKF: remove clang build error message
2017-04-18 19:29:16 +10:00
Paul Riseborough
c3f966f53e EKF: remove clang build error message 2017-04-18 19:22:59 +10:00
Paul Riseborough
d47c372872 Merge pull request #263 from PX4/pr-ekfBuildErrorFix
EKF: Fix travis clang build error
2017-04-18 17:12:51 +10:00
Paul Riseborough
1e393530ed EKF: Fix travis clang build error 2017-04-18 17:06:31 +10:00
Paul Riseborough
c607941e2f EKF: Allow external setting of air density for multi-rotor drag fusion 2017-04-16 13:07:12 +02:00
Paul Riseborough
3758c5a09d EKF: down-sample drag specific force data 2017-04-16 13:07:12 +02:00
Paul Riseborough
9f48c0505b EKF: improve covariance stability when estimating wind 2017-04-16 13:07:12 +02:00
Paul Riseborough
5cf31e439d EKF: Add specific drag fusion tuning parameters 2017-04-16 13:07:12 +02:00
Paul Riseborough
465b145929 EKF: Add multi-rotor drag model for wind estimation 2017-04-16 13:07:12 +02:00
Paul Riseborough
b07acd8cf3 Merge pull request #254 from PX4/pr-ekfAccelErrorHandling
EKF: improve recovery from bad IMU accel data
2017-04-12 21:39:14 +10:00
Paul Riseborough
0d7e7e9d81 EKF: Don't use EKF origin in GPS drift check calculation
The GPS drift calculations need to be able to run independently of the EKF origin.
2017-04-12 13:11:34 +02:00
Paul Riseborough
7b996c5972 EKF: Increase measurement error allowance for accelerometer clipping 2017-04-07 16:37:27 +10:00
Paul Riseborough
f0bbbc8dc6 EKF: Add reporting of bad accel status 2017-04-07 08:47:13 +10:00
Paul Riseborough
2f2ac5be43 EKF: Improve protection against severe IMU accel errors
Use vertical velocity and position innovation failure to detect bad accelerometer data caused by clipping or aliasing which can cause large vertical acceleration errors and loss of height estimation. When bad accel data is detected:

1) Inhibit accelerometer bias learning
2) Force fusion of vertical velocity and height data
3) Increase accelerometer process noise
2017-04-07 08:47:13 +10:00
Paul Riseborough
a1a5734443 Merge pull request #259 from PX4/pr-ekfBugFix
EKF: Protect against covariance prediction and update errors
2017-04-06 16:30:07 +10:00
Paul Riseborough
bef7325884 EKF: protect covariance prediction from delta time errors
Allow time step to vary by a factor of 2 to allow for jitter.
2017-04-06 13:34:37 +10:00
Paul Riseborough
fa07536314 EKF: Prevent rounding errors causing bad conditioned covariance matrix
The previous practice of relying on the off-diagonals being zero caused problems with conditioning of the magnetometer fusion on one flight. By storing the variances when the learning inhibit becomes active and ensuring that the rows and columns in the covariance matrix for the inhibited states are always zero, the observed numerical conditioning error has been eliminated for replay of the problem flight log .
2017-04-06 13:34:37 +10:00
Paul Riseborough
8f6c51e10e Merge pull request #257 from PX4/pr-ekfBugFix
EKF: Do not move EKF origin when performing GPS checks
2017-04-01 08:07:49 +10:00
Paul Riseborough
710b2bcb9f EKF: Do not move EKF origin when performing GPS checks
Doing so can casue large jumps in GPS position and innovation check errors after landing and also reduces the effectiveness of pre-flight innovation consistency checks.
2017-03-31 16:19:30 +11:00
Paul Riseborough
6d9b556b04 Merge pull request #255 from PX4/pr-ekfBugFix
EKF: fix bugs preventing preflight checks passing
2017-03-21 07:27:43 +10:00
Paul Riseborough
a1ff219380 EKF: Extend range of conditions over which we run GPS quality checks
Previously GPS quality checks were only run until the EKF origin was set. This meant that they could not be used by other pre-flight checks.
This change ensures that checks will always be run when the vehicle on-ground or not using GPS to enable use by external preflight checks.
2017-03-21 07:57:23 +11:00
Paul Riseborough
ed2938c8a4 EKF: fix bug causing bad accel bias status to latch 2017-03-21 07:57:23 +11:00
Paul Riseborough
2426f1dd3a EKF: remove use of memset to initialise variable
When using a union of flags and integer value it is safer to initialise the value to 0 rather than memset the flags because the flags may not define all bits in the integer.
2017-03-21 07:57:23 +11:00
Paul Riseborough
9ddfd66d01 EKF: Fix bug in accelerometer bias learning inhibit
This bug caused X and Y delta velocity bias state variance to be reset to the same value as the Z axis when learning was inhibited.
Documentation has also been updated.
2017-03-16 09:34:05 +01:00
Paul Riseborough
040639837e EKF: Use common timeout test for reporting deadreckoning
Use a parameter to set the time-out threshold
Use a class variable for the time-out flag
Clean up comments
2017-03-15 07:57:38 +01:00
Paul Riseborough
6ac7e2f807 EKF: report conservative position errors when failing innovation checks 2017-03-15 07:57:38 +01:00
Paul Riseborough
21e7734149 EKF: fix compile error 2017-03-14 13:00:54 +01:00
Paul Riseborough
f7cae7f3ab EKF: improve compatibility with ARM cross compiler
This change removes the following compiler error when building using the ARM cross compiler.

/Users/paul/src/Firmware/src/lib/ecl/EKF/ekf_helper.cpp:45:12: error: 'std::abs' has not been declared
 using std::abs;
2017-03-12 22:55:23 +01:00
Paul Riseborough
9bb54ccc08 EKF: don't accept GPS data without a 3D lock 2017-03-10 10:15:53 +01:00
Paul Riseborough
588b27bde7 EKF: inhibit accelerometer bias learning if manoeuvre levels are excessive
This prevents bad scale factors and other errors associated with rapid manoeuvres corrupting the accelerometer bias estimates.
2017-03-10 10:14:06 +01:00
Paul Riseborough
5fb24c3032 EKF: Reduce EKF prediction delta time jitter
Make the target EKF rate an integer multiple of the IMU rate. This slightly increases the average prediction time step for the EKF from just over 10msec to 12msec, but the variation reduces significantly which makes filter tuning more deterministic.
Improve the algorithm used to adjust the collection time criteria to reduce jitter in the correction.
2017-03-10 10:14:06 +01:00
Paul Riseborough
324fe3b0c7 EKF: Add accel bias estimation fault to reporting 2017-03-10 10:14:06 +01:00
Paul Riseborough
b51abf4aff EKF: Add console notification for accel bias covariance reset 2017-03-10 10:14:06 +01:00
Paul Riseborough
8511754094 EKF - detect and fix badly conditioned accel bias covariance values. 2017-03-10 10:14:06 +01:00
Paul Riseborough
cf31945038 EKF: Fix use of incorrect timestamp
This was incorrectly using the IMU (1/250 sec) timestamp instead of the EKF (1/100 sec) value.
The corresponding accelerometer limit has been made a parameter and adjusted to match previous behaviour.
2017-03-10 10:14:06 +01:00
Paul Riseborough
879ad1fd2c Merge pull request #231 from pickledgator/ev_hgt_counter_fix
height counter update for ev primary height source
2017-03-10 14:18:35 +11:00
Paul Riseborough
092cc52838 EKF: Remove out of date comment 2017-03-10 14:18:13 +11:00
Paul Riseborough
e4a4427991 Revert "EKF: fix compile error"
This reverts commit 6db552717deefff6b4ad7078bcf4c769d94f1957.
2017-03-10 07:38:02 +11:00
Paul Riseborough
6db552717d EKF: fix compile error 2017-03-07 21:13:45 +11:00
Paul Riseborough
a02a046f5e EKF: Clean up auto-code files for body frame velocity measurements 2017-03-06 09:01:46 +11:00
Paul Riseborough
e569578cf9 EKF: add derivation for body frame velocity measurements 2017-03-04 15:32:10 +11:00
Daniel Agar
eb4f5ecbb9 cmake add all EKF sources (#243)
- trivial cmake cleanup
 - travis-ci build with both gcc and clang
 - update matrix to latest (matches PX4)
 - closes #240
2017-02-27 00:46:48 -05:00
Daniel Agar
507f48a147 geo NULL to nullptr (#242) 2017-02-25 15:27:00 -05:00
Paul Riseborough
0d77470efc EKF: Use conservative reporting of velocity errors when aiding is lost 2017-02-25 21:17:01 +01:00
Paul Riseborough
8070691aa4 EKF: Add accessor function for velocity accuracy 2017-02-25 21:17:01 +01:00
Paul Riseborough
d6abf3f2e4 EKF: add accessor function for local position accuracy 2017-02-25 21:17:01 +01:00
Paul Riseborough
b7d0b3c4d0 EKF: Improve naming of WGS-84 accuracy accessor function 2017-02-25 21:17:01 +01:00
Paul Riseborough
d22599b440 EKF: Add reporting of inertial dead-reckoning status 2017-02-25 21:17:01 +01:00
Roman
7e2597ec28 update range sensor angle parameters in case they have changed
Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-22 14:12:05 +01:00
Roman
aa53f45f15 terrain estimator: removed unused hrt dependancy
Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-22 14:12:05 +01:00
Roman
6480fcc3d5 terrain estimator: fixed computation of filtered time since last range update
- do not use hrt to compute delta time
- limit filter state
- do not use static variables

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-22 14:12:05 +01:00
Paul Riseborough
6561edb9a5 EKF: Clean up terrain estimation functionality.
This is a functionally equivalent. It moves all of the code for the terrain estimator into a single function call from the main filter update, making it clear that it is independent of the main filter.
2017-02-22 14:12:05 +01:00
devbharat
8004e9fe7e EKF: Make range finder data continuous check more robust
Use a filtered arrival time delta to determine if range data is continuous
2017-02-22 14:12:05 +01:00
Paul Riseborough
d94068b88a EKF: Simplify calculation of height above terrain observation variance
The tilt compensation being applied previously was based on a flat earth geometric model assuming perfect tilt knowledge which reduces the effect of range errors on height error as the vehicle tilts. however in the real world, variations in terrain gradient and uncertainty in vehicle tilt and sensor alignment tend to increase height error with tilt, so the adjustment of observation variance with tilt has been removed given we do not have a valid mathematical model on which to base it.
2017-02-22 14:12:05 +01:00
Paul Riseborough
3dadc98b43 EKF: enable scaling of range observation variance with height 2017-02-22 14:12:05 +01:00
Paul Riseborough
cf9c8de167 EKF: Add arbitrary pitch offset for range sensor 2017-02-22 14:12:05 +01:00
devbharat
d9688fae7d EKF: Simplify terrain position validity check
Remove the relative accuracy check that was false triggering close to ground
2017-02-22 14:12:05 +01:00
Paul Riseborough
af26ade1ce EKF: Use norm for vector length everywhere 2017-02-22 14:12:05 +01:00
Paul Riseborough
6e5a9aabe1 Merge pull request #234 from PX4/pr-optFlowUpdates
EKF: optical flow improvements
2017-02-22 09:00:48 +11:00
Andreas Antener
66b8f7ec5b Removed obsolete fields from ECL control data 2017-02-12 11:40:14 +01:00
Andreas Antener
5363e8d307 Wheel controller: use library function to wrap pi 2017-02-12 11:40:14 +01:00
Daniel Agar
674ab3f81b attitude_fw fix style 2017-02-12 11:40:14 +01:00
Roman
f22ad30ef3 removed turn compensation flag form control data since it's obsolete
Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Roman
e1f9874c82 wheel controller: fix computation and scaling of integrator
Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Roman
c4cc02b3f2 yaw controller: fix bug where roll for turn coordination was constrained
wrongly

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Roman
391b6dfd00 yaw controller: for now do not do turn compensation when inverted and use
the roll setpoint as limit for turn compensation

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Roman
66b7773059 yaw controller: deactivate lateral acceleration control for now but
put comment of how to do it properly

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Roman
f300877db4 yaw controller: computed desired yaw rate based on coordinated turn constraint
Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Roman
4057defa53 pitch controller: removed turn offset compensation form pitch controller
- turn compensation is included in the desired yawrate

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Roman
55401ec1b0 fw attitude control: compute integrator correctly
- I gain was applied wrongly, such that the integrator value was depending
direcly on the I gain. This made the integrator value jump when the gain
was changed

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Roman
ac7fc30ea7 fw attitude controllers: restructuring in order to allow acro flight mode
- split rate control into body rate control and euler rate control
- this allows standard attitude control but also direct rate control
of all three axes
- allow activation/deactivation of turn compensation

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-12 11:40:14 +01:00
Daniel Agar
2750961be6 c++11 initialization cleanup (#237) 2017-02-05 13:05:10 -05:00
Daniel Agar
7883085e4a clang-tidy readability-simplify-boolean-expr (#235) 2017-02-02 00:17:43 -05:00
Daniel Agar
47b8ef258b clang-tidy performance-type-promotion-in-math-fn (#236) 2017-02-02 00:17:08 -05:00
Paul Riseborough
bcf7cac5d9 EKF: remove hardcoded limit on optical flow time delta
Allow for up to 50% lost data.
2017-01-18 06:06:45 +11:00
Paul Riseborough
3fb7effb0c EKF: Allow optical flow use when on-ground with poor data quality 2017-01-18 06:06:45 +11:00
Paul Riseborough
21270bb06a EKF: Use last known position when resuming OF aiding 2017-01-17 08:58:01 +11:00
Lorenz Meier
453bde73f8 ECL: Simplify / correct estimator interface 2017-01-15 10:17:41 +01:00
Roman
c5a55d97aa initialise data members properly
- dot not use memset for struct with non POD types

Signed-off-by: Roman <bapstroman@gmail.com>
2017-01-15 10:02:31 +01:00
Paul Riseborough
1465adca2f EKF: Improve use of memcpy
Changes made to remove Coverity scan errors
2017-01-15 10:02:31 +01:00
Paul Riseborough
26a06567bb EKF: add missing initialisation for class variables 2017-01-15 10:02:31 +01:00
Paul Riseborough
f999729d70 EKF: fix incorrect use of memcpy 2017-01-15 10:02:31 +01:00
Paul Riseborough
b536382ae1 EKF: remove dead code 2017-01-15 10:02:31 +01:00
Paul Riseborough
6358bbd257 EKF: remove self assignment 2017-01-15 10:02:31 +01:00
Paul Riseborough
3b61528f0f EKF3: initialise default value for EV fusion gate 2017-01-15 10:02:31 +01:00
Paul Riseborough
9ddcba3ed0 EKF: remove un-used variable 2017-01-15 10:02:31 +01:00
Daniel Agar
d668a2d798 clang-tidy performance-unnecessary-value-param 2017-01-14 16:26:25 -08:00
Daniel Agar
a7cdef6c5c clang-tidy modernize-redundant-void-arg 2017-01-14 16:24:45 -08:00
Nic
ec1a14bc6b height counter needs to be updated with ev counter value when our primary height source is set to ev 2017-01-05 21:47:13 -08:00
Paul Riseborough
3c4c09593f EKF: Rationalise console messages
Combine the observation action buffer and alignment messages
Ensure all data timeout messages are warnings.
Use consistent terminology.
2016-12-28 10:39:47 +01:00
Paul Riseborough
934890c2df EKF: Add validity flag to ekf origin reporting
Flag is false until the origin has been initialised
2016-12-28 00:56:09 +01:00
Dennis Mannhart
b154ce9c33 Fixed include for snapdragon 2016-12-23 10:22:25 +01:00
Lorenz Meier
9618adb542 Simplify switch logic for validator 2016-12-21 08:10:08 +01:00
Lorenz Meier
6f78ef4084 Update validator to provide correct response for single sensor usage 2016-12-17 20:44:46 +01:00
Lorenz Meier
aad3a2b751 Validator: Trim down printing and do not reset init state 2016-12-17 17:39:55 +01:00
Lorenz Meier
75520641a5 Make the equal value threshold configurable 2016-12-17 15:25:29 +01:00
Lorenz Meier
00dbffe11d Validator whitespace fixes 2016-12-17 13:45:28 +01:00
Lorenz Meier
bf8a9a3d09 EKF: Whitespace fixes 2016-12-17 13:45:28 +01:00
Lorenz Meier
6282c72d2e Validation: Whitespace fixes 2016-12-17 13:45:28 +01:00
Lorenz Meier
10c6ae77ae Attitude fw yaw: Initialize yaw rate properly 2016-12-17 13:45:28 +01:00
Daniel Agar
983c44088f fw att fix pitch feedforward constrained roll 2016-11-27 12:34:12 +01:00
Paul Riseborough
a776b2c549 EKF: Fix bug preventing reset to GPS position when using optical flow 2016-11-26 10:28:58 +01:00
Paul Riseborough
460c9e5250 EKF: Don't try to fuse air data if not in normal aiding mode
Taking off before passing GPS checks would cause airspeed or sideslip to be fused when the filter was still using a constant position assumption. This would cause large airspeed innovations, invalid wind estimates and degrade filter performance after GPS was gained and position and velocity was reset.
2016-11-26 10:28:58 +01:00
Paul Riseborough
5ad329b641 EKF: Fix variable names to match convention 2016-11-07 22:23:12 +11:00
Paul Riseborough
afd6e54b2a EKF: Allow for worst case timing jitter when setting observation buffer length 2016-11-07 11:50:16 +11:00
Paul Riseborough
403424d55d EKF: fix cross compiler build errors 2016-11-07 09:38:44 +11:00
Paul Riseborough
d5b398ddb1 EKF: Minimise data buffer lengths
Saves RAM and reduces output predictor errors by using the smallest data buffer length that meets time delay and update rate requirements.
2016-11-07 09:06:45 +11:00
Paul Riseborough
750a8874c1 EKF: Improve recovery and reporting for badly conditioned sideslip fusion
Do not reset the entire covariance matrix if we are only using sideslip fusion to update wind states.
Improve reporting.
2016-11-05 12:19:01 +01:00
Paul Riseborough
6c7703d485 EKF: Update tuning for synthetic sideslip fusion
Used value that worked well for replay of flight logs
2016-11-05 12:19:01 +01:00
Paul Riseborough
f76a2a5ff7 EKF: fix bug in sideslip fusion and reduce RAM usage
The bug meant the  Y velocity (state index 5)  covariance was not being updated correctly when sideslip was being used to constrain velocity drift (extended GPS loss).
The rework of the covariance update to reduce RAM follows the same pattern as adopted for other fusion processes
2016-11-05 12:19:01 +01:00
Paul Riseborough
951c8b77af EKF: Improve wind state reset logic
Enables wind estimation without an airspeed sensor and enables synthetic sideslip to be used with an airspeed sensor for improved wind state estimation.
Wind states and covariances are reset differently depending on whether airspeed is available.
2016-11-05 12:19:01 +01:00
Paul Riseborough
2fedbc8a18 EKF: Refresh sideslip fusion auto-code and improve covariance update efficiency 2016-11-05 12:19:01 +01:00
Paul Riseborough
352b4ca177 EKF: Allow sideslip fusion with airspeed fusion 2016-11-05 12:19:01 +01:00
Paul Riseborough
fb6f4be453 EKF: don't allow sideslip fusion to affect non-airspeed states if not deae-reckoning 2016-11-05 12:19:01 +01:00
CarlOlsson
a9182259a5 fixed bug in beta fusion 2016-11-05 12:19:01 +01:00
CarlOlsson
0e3ae4b323 fixed issue with the covariance update in synthetic sideslip fusion 2016-11-05 12:19:01 +01:00
CarlOlsson
e1d9d503e3 updated logic of when to fuse beta. Now synthetic sideslip measurements are fused after 5 seconds of cruise flight with airspeed sensor activated 2016-11-05 12:19:01 +01:00
CarlOlsson
dec686afd7 updated parameters 2016-11-05 12:19:01 +01:00
CarlOlsson
5205a8198b added function to control when to fuse beta 2016-11-05 12:19:01 +01:00
CarlOlsson
f5d0228cd5 include ecl.h 2016-11-05 12:19:01 +01:00
CarlOlsson
beb90f008d adopted code for upstream changes 2016-11-05 12:19:01 +01:00
CarlOlsson
b7a4a1358f added sidelip_fusion.cpp 2016-11-05 12:19:01 +01:00
CarlOlsson
12aeaafbd3 adopted estimator_interface.h 2016-11-05 12:19:01 +01:00
CarlOlsson
c8e3c24150 adopted ekf_helper.cpp 2016-11-05 12:19:01 +01:00
CarlOlsson
8f6c75bb0b adopted ekf.h 2016-11-05 12:19:01 +01:00
CarlOlsson
15768f6f93 adopted ekf.cpp 2016-11-05 12:19:01 +01:00
CarlOlsson
738414d36e adopted common.h 2016-11-05 12:19:01 +01:00
CarlOlsson
6c9cc5691c adopted EKF/CMakeLists 2016-11-05 12:19:01 +01:00
CarlOlsson
daf44dcd67 adopted CMakeLists 2016-11-05 12:19:01 +01:00
Paul Riseborough
283c328c23 Merge pull request #212 from PX4/pr-ekfCriticalBugFix
EKF: Fix bug causing repeated resets if GPS sensor disconnected
2016-11-05 09:43:24 +11:00
Paul Riseborough
8aee45dd96 EKF: Fix bug causing repeated resets if GPS sensor disconnected 2016-11-05 09:36:06 +11:00
Paul Riseborough
2bc50489fd Merge pull request #210 from PX4/remove_KH
EKF: reduce KH to only the elements that are really needed, and merge the loops
2016-11-05 09:24:13 +11:00
Beat Küng
07c6aabd98 EKF: reduce KH to only the elements that are really needed, and merge the loops 2016-11-02 10:26:40 +01:00
Paul Riseborough
1b59a89a18 EKF: save some stack memory 2016-11-02 09:06:06 +01:00
Beat Küng
f472324ae8 DataValidatorGroup: remove the assert
(avoid crashes in flight)
2016-11-01 22:49:20 +01:00
Beat Küng
25cb400da9 EKF: remove Ekf::KHP and move KHP to the methods where it's used
Everywhere where KHP is used, it is first completely reset, thus making
it unnecessary to keep it as a class member.

This saves 2.3KB RAM.

Stack sizes don't need changing, since there is already a function
Ekf::predictCovariance(), which needs around 3KB of stack and is called
close to where the fuse* functions are called.
2016-11-01 22:49:20 +01:00
Beat Küng
227938d263 DataValidatorGroup: add add_new_validator() to dynamically add new validators 2016-11-01 22:49:20 +01:00
Beat Küng
ded3b1a690 DataValidatorGroup: fix memory leak, delete all DataValidator's in destructor 2016-11-01 22:49:20 +01:00
Beat Küng
b870f92e1c DataValidator: use 32bit timeout instead of 64bit, saves memory 2016-11-01 22:49:20 +01:00
Paul Riseborough
d07692e87e Merge pull request #204 from PX4/pr-gpsReset
ekf reset: more granular reset / timeout strategy for gps fusion
2016-10-26 06:52:10 +11:00
Paul Riseborough
79df7e8889 EKF: Reduce effect of bad airspeed when other aiding data available 2016-10-25 08:34:41 +02:00
Paul Riseborough
968cfae632 EKF: Fix bug preventing fallback from GPS mode if GPS is lost 2016-10-25 08:32:01 +11:00
Roman
63cf3d50be ekf gps reset: do not bother checking for need of reset if gps is not
available

Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-24 11:45:36 +02:00
Roman
c5f750dcca ekf reset: more granular reset / timeout strategy for gps fusion
- if both gps position and velocity measurements are rejected for 7 seconds
do a reset
- if only gps position measurements are rejected then wait for 14 seconds
as we still have velocity measurements to constrain the drift in position
- introduced ecl internal parameter for the timeout

Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-24 11:40:12 +02:00
Roman Bapst
65de4962b5 Merge pull request #203 from PX4/pr-ekfVibeReporting
EKF: Add IMU vibration calculation and reporting
2016-10-19 13:32:53 +02:00
Paul Riseborough
b10b0184c5 EKF: Add IMU vibration calculation and reporting
Add calculation and reporting of IMU delta angle and velocity coning and high frequency vibration
2016-10-19 21:46:55 +11:00
Roman
17c195d1cd ekf2 height reset: do not apply height change to height state twice (bug)
Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-18 07:58:19 +02:00
Paul Riseborough
1093e6d789 EKF: fix documentation error 2016-10-13 22:37:14 +02:00
Roman
f80b3481a4 reset the newest output sample for all possible resets
Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-12 08:54:38 +02:00
Roman
238d947239 proper handling of position and velocity reset
- position reset method was returning before the actual delta values
were written and applied to the output buffer
- apply reset delta also to the output sample which was already taken out
from the output buffer, otherwise the complementary filter solution is
offset from the ekf solution

Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-12 08:54:38 +02:00
Paul Riseborough
79b1d3018d EKF: Fix magnetometer innovation test ratio reporting bug 2016-10-12 08:51:45 +02:00
Lorenz Meier
394bfdc935 Update README.md
Fix prerequisites.
2016-10-08 11:00:52 +02:00
Daniel Agar
0d02bb2612 ecl attitude_fw fix excessive body fixed turn offset
-limit body fixed turn offset contrained roll to possible
roll setpoint range
-fixes #181
2016-10-06 09:03:48 +02:00
James Goppert
7dbb43f2cd Update matrix. 2016-10-06 09:03:10 +02:00
Paul Riseborough
352750e5d1 EKF: publish ekf solution status summary data 2016-10-06 09:02:29 +02:00
Paul Riseborough
007e73379f EKF: Improve reporting of position error 2016-10-06 09:02:29 +02:00
Paul Riseborough
744b79c1b2 EKF: Publish innovation test ratios 2016-10-06 09:02:29 +02:00
Paul Riseborough
5ab90048e1 Merge pull request #184 from PX4/pr-rngDelayFix
fixed computation of range measurement timestamp
2016-10-04 09:13:19 +11:00
Paul Riseborough
b29174d86b Merge pull request #193 from PX4/pr-haglInit
Pr hagl init
2016-10-04 08:21:15 +11:00
Paul Riseborough
5702c2d51b Merge pull request #186 from priseborough/pr-ekfOutputPredictor
EKF: Improve Output Predictor Tracking
2016-10-04 07:47:34 +11:00
Paul Riseborough
b5ba4f280f EKF: reduce output predictor velocity time constant 2016-10-03 14:13:07 +11:00
Paul Riseborough
65762e5998 EKF: publish output predictor tracking errors 2016-10-03 14:13:07 +11:00
Paul Riseborough
c81f9f1dba EKF: Reduce output predictor tracking errors
Implements a PI tracking loop
2016-10-03 14:13:07 +11:00
Julian Oes
4fefe5c6c6 cmake: stack size args cleanup 2016-09-28 08:23:18 +02:00
Julian Oes
616aeb9ad7 ekf_helper: fix forgotten return value 2016-09-27 16:36:29 +02:00
Julian Oes
fd403b733d CMakeLists: don't always optimize for size
Going forward the optimization flags should be set for a platform,
rather than for each individual module.
2016-09-27 16:35:35 +02:00
Roman
c6e1d97176 terrain estimator: initialise with projection
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-20 14:09:42 +02:00
Roman
cc05db4985 terrain estimator: pass initialisation return value correctly
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-20 14:07:50 +02:00
Roman
d53f532079 fixed computation of range measurement timestamp
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-17 11:41:12 +02:00
Paul Riseborough
7240fc78fe Merge pull request #183 from CarlOlsson/cont_wind_estimation
Fix wind state  and wind variance initialization
2016-08-23 19:55:22 +10:00
James Goppert
eab57b0187 Merge pull request #189 from PX4/revert-188-matrix_update
Revert "Update matrix."
2016-08-18 12:29:41 -04:00
James Goppert
e5b74f511f Revert "Update matrix." 2016-08-18 12:29:31 -04:00
James Goppert
90f6bd7f3d Merge pull request #188 from PX4/matrix_update
Update matrix.
2016-08-18 12:06:20 -04:00
James Goppert
1daea6c1a3 Update matrix. 2016-08-18 11:58:31 -04:00
CarlOlsson
8d60da1442 removed old wind initialization 2016-08-11 15:26:21 +02:00
CarlOlsson
51c8715638 fixed issue with airspeed never fused 2016-08-11 15:26:21 +02:00
Paul Riseborough
d1d56d9e5e EKF: Add logic to to control wind state estimation 2016-08-11 15:26:21 +02:00
Paul Riseborough
75bec44b94 EKF: add function to initialise wind states 2016-08-11 15:26:21 +02:00
Paul Riseborough
6dff2df28e EKF: Add method to reset wind state covariances
Set variances in polar coordinates and rotate into cartesian frame
2016-08-11 15:26:21 +02:00
Paul Riseborough
eff9af549f scripts: derive conversion from polar to cartesian wind state covariance 2016-08-11 15:26:21 +02:00
Paul Riseborough
a9894d7e8c EKF: improve efficiency of airspeed fusion
Don't compute array entries where the result will be zero
2016-08-11 15:26:21 +02:00
Roman Bapst
df0f8fed45 fixed wrong condition on which gps height would be fused (#180)
- this solves the issue where height innovations would jump
between two regimes

Signed-off-by: Roman <bapstroman@gmail.com>
2016-08-05 14:45:48 +02:00
Youssef Demitri
168d9add76 added getter function for wind states 2016-07-22 12:33:41 +02:00
Beat Küng
73b8ac954d ekf_helper.cpp: remove unused includes
This fixes a compile error with GCC 5.2.0 and cross-compilation:
/usr/arm-none-eabi/include/c++/5.2.0/arm-none-eabi/armv7e-m/fpu/bits/error_constants.h:122:27: error: 'ENOTSUP' was not declared in this scope
       not_supported =     ENOTSUP,

The problem was that the #include <iomanip> was taken from the host system,
which conflicts with includes from NuttX (NuttX has only basic C++ STL
support)
2016-07-15 12:50:11 +02:00
Lucas De Marchi
2240eb6b4f Move __STDC_FORMAT_MACROS to build system (#174)
__STDC_FORMAT_MACROS changes the behavior of inttypes.h to allow
defining format macros for printf-like functions. It needs to be defined
before any include is done, otherwise due to include chains and header
guards it may not take effect.

Instead of defining it everywhere it is used, let the PX4 build system
to deal with it.
2016-07-10 16:29:51 +02:00
georgehines
4f8ffb3420 promote to float (for internal representation) before scaling by format multiplier (#175) 2016-07-10 11:13:18 +02:00
Paul Riseborough
a2d866520a EKF: perform innovation check in all axes before fusing 3D mag data (#171)
Perform the innovation consistency check on all axes first and exit if any axis fails. Reduces the likelihood of bad magnetometer data corrupting the attitude estimates.
2016-07-07 16:46:30 +02:00
Beat Küng
5e0a229ee8 data_validator cleanup: use dimensions variable, use static for some constants (#167) 2016-06-30 13:28:01 +02:00
Paul Riseborough
0cc0008927 Merge pull request #166 from georgehines/matlab-log-import
add double support
2016-06-30 17:21:37 +10:00
Paul Riseborough
eaae95fdc4 Merge pull request #160 from priseborough/pr-ekf2Improvements
EKF: clean up fusion control logic
2016-06-30 17:18:14 +10:00
Paul Riseborough
f5e9ea1626 EKF: Prevent potential divide by zero 2016-06-30 17:06:32 +10:00
Paul Riseborough
eb2afc522d EKF: fix bug preventing use of baro as a backup height source 2016-06-30 17:06:32 +10:00
Paul Riseborough
573f252b73 EKF: fix bug preventing GPS use as a backup height source 2016-06-30 17:06:32 +10:00
Paul Riseborough
5f9752cac8 EKF: Improve function names 2016-06-30 17:06:32 +10:00
Paul Riseborough
7bc9217f00 EKF: Clean up control of observation fusion
All the decision for a sensor are made within a specific function for that sensor and when there is data to process at the fusion time horizon.
Information and warning messages are improved.
2016-06-30 17:06:32 +10:00
Beat Küng
9a95898414 gps_message: remove time_usec_vel from struct (unused) 2016-06-27 10:12:23 +02:00
George Hines
f467e714bd add double support 2016-06-23 09:24:11 -07:00
Roman Bapst
1b394460a3 fix comment about filter bias states
Signed-off-by: Roman Bapst <roman@px4.io>
2016-06-21 14:13:47 +02:00
Roman Bapst
bec1a6831e added method to get gyro bias
Signed-off-by: Roman Bapst <roman@px4.io>
2016-06-21 14:13:47 +02:00
Lorenz Meier
74a77b45b2 Add DOI 2016-06-12 11:51:54 +02:00
Paul Riseborough
16bdbebdc6 Merge pull request #161 from PX4/pr-resetFix
do not return early in velocity reset method
2016-06-08 17:23:09 +10:00
Roman
703fb4e31b do not return early in velocity reset method otherwise
some code will not be executed
2016-06-08 07:51:18 +02:00
Paul Riseborough
928a7dd059 Merge pull request #157 from PX4/pr-ekf2ResetInterface
Change state reset information interface
2016-06-08 14:18:31 +10:00
Paul Riseborough
2024252d65 Merge pull request #158 from CarlOlsson/act_ars_off_by_default
activate tas fusion, off by default
2016-06-08 14:17:31 +10:00
Paul Riseborough
e72788bd0f Merge pull request #159 from priseborough/pr-ekf2MagBugFix
EKF: Fix critical bugs in mag fusion and yaw reset
2016-06-08 14:11:47 +10:00
Paul Riseborough
f26aca55a1 EKF: Fix bug in quaternion covariance initialisation function
The covariances between quaternion and non-quaternion states were not being updated
2016-06-08 13:23:30 +10:00
Paul Riseborough
b3baab64f2 EKF: Updates to 3-axis mag fusion auto-code
The code fragments for the magnetometer fusion have been refreshed from the auto-coder.
Explicit floating point types used for constants.
The 3x24 observation Jacobian has been replaced with a 1x24 that is updated each axis iteration to save memory.
2016-06-08 12:56:59 +10:00
Paul Riseborough
21168f9929 EKF: fix bug in 3-axis mag fusion innovation test
The fault flag was not being set after an innovation test failure resulting in fusion of the failed measurement
2016-06-08 11:58:33 +10:00
Paul Riseborough
99b34f0df4 EKF: Only reset necessary terms when mag fusion covariance reset required
Only the quaternion and mag fusion state covariances are used in the mag fusion calculations.
2016-06-08 11:58:33 +10:00
Paul Riseborough
381d99aed6 EKF: Inform console of serious fusion numerical errors 2016-06-08 11:58:33 +10:00
Paul Riseborough
dbfe8c0242 EKF: remove approximation in mag fusion innovation variance calculation
The covariance was not being updated with the observation from one axis before the innovation variance was calculated for the next axis. This results in greater weighting on measurements for subsequent axes.
2016-06-08 11:58:33 +10:00
Paul Riseborough
79228352e9 EKF: Reset mag and wind state variances to 'reasonable' values
If an in-flight reset is required, we do not want these variances going to zero as that will significantly delay recovery
2016-06-08 11:58:33 +10:00
Paul Riseborough
34ffffa021 EKF: Prevent use of non time-stamped invalid data during initialisation
Fixes bad height initialisation seen intermittently with snapdragon
2016-06-08 11:56:07 +10:00
CarlOlsson
eded0a8f7e activate tas fusion, off by default 2016-06-07 13:49:17 +02:00
Paul Riseborough
3c84d37175 Merge pull request #156 from PX4/fix_printfs
EKF: use ECL printfs everywhere
2016-06-07 09:45:00 +10:00
Paul Riseborough
081e17729c EKF: delay commencement of 3D mag fusion until clear of ground
Wait until enough height has been gained to be clear of ground based magnetic anomalies. Failure to do so can result in incorrect earth field initialisation.
2016-06-06 21:59:46 +10:00
Roman Bapst
670c6ca019 change state reset information interface for more convenient handling
on firmware side
2016-06-06 13:22:20 +02:00
Paul Riseborough
f08aee0a7d EKF: Fix covariance index bug 2016-06-04 00:36:07 +10:00
Julian Oes
ab0ac05b47 ecl.h: guard PX4 defines with ifdef 2016-06-02 16:29:55 +01:00
Julian Oes
b8e2f79005 EKF: correct include paths 2016-06-02 16:29:22 +01:00
Julian Oes
ecfd8c867a EKF: use ECL printfs everywhere
- Changes all printfs to ECL printfs
- Add ECL_ERR.
- Include ecl.h where needed.
- Add forgotten pragma once.
2016-06-02 16:07:26 +01:00
Paul Riseborough
8bfdb0430c Merge pull request #150 from PX4/pr-ekf2StatusReporting
EKF: Publish full reset and innovation consistency check status data
2016-06-02 07:17:49 +10:00
Paul Riseborough
6a55d908c5 EKF: replace reset event times with event counters
Using a 64bit integer was unnecessary given it was only being used to detect a new reset event.
2016-06-01 17:13:00 +10:00
Paul Riseborough
70f76e1a6c EKF: publish innovation consistency check fail status 2016-06-01 17:13:00 +10:00
Paul Riseborough
e371a303a9 EKF: publish the quaternion reset event 2016-06-01 17:13:00 +10:00
Paul Riseborough
81ca167da8 EKF: align output observer to EKF states on startup 2016-06-01 17:13:00 +10:00
Paul Riseborough
3ec9221c18 EKF: update output observer and capture reset event for EV yaw resets 2016-06-01 17:13:00 +10:00
Paul Riseborough
9ec09f5f4e EKF: update output observer and capture reset event for magnetic heading resets 2016-06-01 17:13:00 +10:00
Paul Riseborough
2b0d5c28f0 EKF: capture full quaternion change for reset events 2016-06-01 17:13:00 +10:00
Paul Riseborough
b2e432e211 EKF: publish position and velocity reset data 2016-06-01 17:13:00 +10:00
Paul Riseborough
733862f649 EKF: move the reset status struct to the Ekf class
This protects it from being modified externally
2016-06-01 17:13:00 +10:00
Paul Riseborough
aca0336392 EKF: update vertical position and velocity reset capture
Use reset event struct members instead of separate variables
2016-06-01 17:13:00 +10:00
Paul Riseborough
0605c88ecc EKF: capture horizontal position reset events 2016-06-01 17:13:00 +10:00
Paul Riseborough
e3a1b4a3b3 EKF: capture velocity reset events 2016-06-01 17:13:00 +10:00
Paul Riseborough
4237269fab EKF: add struct to capture state reset events 2016-06-01 17:13:00 +10:00
Paul Riseborough
65da9173b9 EKF: capture innovation checks and reset events in separate variables
rename the innovation check status class variable and remove the reset flags from it.
2016-06-01 17:13:00 +10:00
Paul Riseborough
79705da7e6 EKF: make output predictor states consistent with position reset 2016-06-01 17:13:00 +10:00
Paul Riseborough
54d90261d5 EKF: make output predictor states consistent with velocity reset 2016-06-01 17:13:00 +10:00
Paul Riseborough
52229da089 EKF: capture optical flow innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough
d80e71a499 EKF: capture HAGL innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough
8125717bf5 EKF: remove un-used airspeed health class variable
Airspeed rejection now is captured in _sensor_fault_status
2016-06-01 17:13:00 +10:00
Paul Riseborough
388e500180 EKF: remove un-used magnetometer health class variable
replaced by _sensor_health_status
2016-06-01 17:13:00 +10:00
Paul Riseborough
cf489f4248 EKF: capture airspeed innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough
e7690bd8f8 EKF: capture magnetometer innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough
3fb449295e EKF: capture yaw innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough
52f6eea52b EKF: capture position and velocity innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough
aea827aa8a EKF: ensure filter fault status is initialised 2016-06-01 17:13:00 +10:00
Paul Riseborough
106482b078 EKF: add structure to capture innovation test failures and state resets 2016-06-01 17:13:00 +10:00
Paul Riseborough
654093cae1 Merge pull request #155 from PX4/pr-ekf2AlignmentNoiseFilterInit
EKF: Initialise alignment noise filters using valid data
2016-05-28 09:12:15 +10:00
Paul Riseborough
70c40d695d EKF: Initialise alignment noise filters using valid data
Don't initialise the states for the alignment data noise filters until the buffers have been flushed
2016-05-28 09:04:26 +10:00
Paul Riseborough
35bb6cc6e9 Merge pull request #154 from PX4/pr-ekf2AlignmentBufferFlush
EKF: Ensure bad initial data is flushed from buffers before use
2016-05-28 08:41:24 +10:00
Paul Riseborough
c905684c12 EKF: Ensure bad initial data is flushed from buffers before using data to perform alignment 2016-05-28 08:28:57 +10:00
Paul Riseborough
9557f64248 Merge pull request #153 from PX4/pr-ekf2ExternalVision
EKF: external vision bug fixes
2016-05-27 18:57:41 +10:00
Paul Riseborough
ad02818b3d EKF: Improve height reset for external vision
reset to measurement closest in time to fusion time horizon
2016-05-27 14:00:50 +10:00
Paul Riseborough
98c0b74a71 EKF: Initialise height correctly when using external vision data
If EV height selected ensure switch to correct height mode as soon as EV data is received
The 0 height datum is not at the initialisation position, so the height state needs to be reset to the measurement on startup
2016-05-27 13:59:14 +10:00
Paul Riseborough
9f81b8f09e EKF: provide reset protection for external vision height 2016-05-27 13:15:53 +10:00
Paul Riseborough
1b6c5bbafd EKF: Enable height source to be selected independent of EV aiding 2016-05-27 13:14:52 +10:00
Paul Riseborough
00bada8f25 EKF: Clean up logic for horizontal position fusion
Remove reference to optical flow fusion mode
Simplify logic flow for selection of observation noise
Remove unnecessary conditional statement
2016-05-27 11:29:10 +10:00
Paul Riseborough
6f412a73b4 EKF: Use correct height gate when using external vision 2016-05-27 11:24:53 +10:00
Paul Riseborough
e41524ac9d EKF: remove unused variables 2016-05-27 11:21:04 +10:00
Paul Riseborough
53030b9297 Merge pull request #152 from PX4/pr-ekf2FixObsDataHandling
EKF: Fix vulnerability to loss of observations due to high input data rates
2016-05-26 21:44:10 +10:00
Paul Riseborough
7dd123094f EKF: correct documentation 2016-05-26 21:42:56 +10:00
Paul Riseborough
d5b5cb5899 EKF: improvements to observation collection
Remove unnecessary function calls
Remove un-used functions
Apply a consistent maximum safe data rate check for all observation inputs
2016-05-26 13:27:08 +10:00
Paul Riseborough
e2d9e19a5d Merge pull request #148 from PX4/pr-ekf2OutputPredictor
EKF2 provide alternative output velocity prediction
2016-05-24 08:46:33 +10:00
Paul Riseborough
9f0b9909e7 Merge pull request #149 from PX4/pr-ekf2FixUnwantedGpsUse
EKF: prevent unwanted GPS use
2016-05-24 08:45:18 +10:00
Paul Riseborough
5a40aa2c1a EKF: prevent unwanted GPS use 2016-05-24 07:55:09 +10:00
Paul Riseborough
90d65071c1 EKF: Add output predictor processing option
Setting the velocity tracking tine constant to a negative number causes the output predictor to use a different method of correcting the velocity which provides a velocity output that is kinematically consistent with the position output.

This may improve height controller performance under some circumstances
2016-05-23 07:47:10 +10:00
Paul Riseborough
30917430e2 EKF: inline ring buffer functions used repeatedly
These functions get called 30 times each per output prediction cycle
2016-05-23 07:43:59 +10:00
Paul Riseborough
c8c2d6d963 Merge pull request #145 from CarlOlsson/small_fix
Deleted second update of transformation matrix
2016-05-23 07:40:58 +10:00
Carl Olsson
0fafc49a49 fixed typos (#147) 2016-05-22 17:40:43 +02:00
Carl Olsson
dbe2513d48 updated logic of calculation of body field variance (#146) 2016-05-22 17:39:25 +02:00
CarlOlsson
eb70aca2e8 deleted second update of transformation matrix 2016-05-22 16:03:30 +02:00
Paul Riseborough
4c5252269c Merge pull request #142 from PX4/pr-ekf2ImproveHeadingReset
EKF: Improved heading reset
2016-05-21 22:38:26 +10:00
Paul Riseborough
ae5071f668 EKF: Improve heading reset
Improves reset of quaternion covariance matrix after a heading reset by preserving variance in roll and pitch and resetting yaw variance to the measurement variance.
2016-05-21 19:30:15 +10:00
Paul Riseborough
4b279a8836 Merge pull request #144 from waltjohnson/master
Addressed C99 compiler issues of initializing variables in header and…
2016-05-20 07:37:24 +10:00
waltjohnson
a9ca8c294c Generalized isfinite() in similar form as done in ekf.cpp e3b9800cac/EKF/ekf.cpp (L45-L52) 2016-05-19 10:34:16 -06:00
waltjohnson
6eaa00e3f9 isfinite() is not part of the math class, rather the math.h header file. 2016-05-19 10:07:45 -06:00
waltjohnson
7c158aa59b Addressed C99 compiler issues of initializing variables in header and unused included statements. 2016-05-19 09:58:18 -06:00
Paul Riseborough
f5e2dabc2b Create CONTRIBUTING.md 2016-05-19 18:14:33 +10:00
Paul Riseborough
e3b9800cac Merge pull request #138 from pickledgator/evTesting
EV testing
2016-05-19 12:56:41 +10:00
Paul Riseborough
867bc8c601 Merge pull request #139 from PX4/pr-ekf2Alignment
EKF: Improve angular alignment consistency
2016-05-18 21:23:31 +10:00
Paul Riseborough
c1b02eaa91 EKF: Don't use 3-axis magnetometer fusion until the tilt is aligned 2016-05-18 21:06:45 +10:00
Paul Riseborough
aaac867da8 EKF: Adjust tilt alignment threshold 2016-05-18 20:34:12 +10:00
Paul Riseborough
e272d5f003 EKF: Use consistent position noise values during alignment 2016-05-18 20:11:08 +10:00
Paul Riseborough
b9a3712ccb EKF: record yaw alignment event during initialisation to allow heading fusion to start early
This ensures bad yaw gyro biases are compensated for early, rather than waiting for the tilt alignment to fully converge before fusing heading.
2016-05-18 19:25:19 +10:00
Paul Riseborough
94a63ec9d5 EKF: don't interfere with quaternion covariances during tilt alignment 2016-05-18 19:25:19 +10:00
Paul Riseborough
22fba0fc6e EKF: don't initialise filter without EV data if we are relying on it 2016-05-18 19:25:19 +10:00
Nic
1b16f3575a added ev_pos flag check to valid_lpos, disable fake gps when ev_pos is valid 2016-05-17 21:07:04 -07:00
Paul Riseborough
50ba26a434 Merge pull request #134 from PX4/pr-ekf2Alignment
EKF: Improved tilt alignment control
2016-05-18 12:34:22 +10:00
Paul Riseborough
e4b2e9c93d EKF: Improve yaw alignment
Uses best conditioned of 321 or 312 Euler sequence to calculate initial yaw angle.
Allows alignment of yaw angle using external vision data
2016-05-18 12:16:16 +10:00
Paul Riseborough
57b2a256f7 EKF: Improve initialisation of quaternion covariances
Convert uncertainty in initial rotate vector into quaternion covariances using symbolic toolbox derived expressions.
Enable setting of initial angle uncertainty via a parameter
2016-05-17 12:47:20 +10:00
Paul Riseborough
a4728bc748 EKF: derive auto-code for quaternion state covariance initialisation 2016-05-17 12:28:58 +10:00
Paul Riseborough
88860d0307 EKF: Enable tuning for IMU switch on bias errors 2016-05-17 11:17:24 +10:00
Paul Riseborough
1540e937b1 EKF: Improve tilt alignment monitoring
Convert quaternion covariances into an angular alignment variance vector and discard the z component so that yaw uncertainty does not affect the result.
2016-05-17 11:17:24 +10:00
Paul Riseborough
6ca8a36782 EKF: Add matlab derivation for calculation of rotation vector variance 2016-05-17 10:56:19 +10:00
Paul Riseborough
d5046b078e Merge pull request #106 from PX4/pr-visionSupport
EKF: add support for external vision data
2016-05-16 07:32:46 +10:00
Paul Riseborough
c955bfbf93 EKF: fix previous merge error 2016-05-15 20:36:51 +10:00
Paul Riseborough
920d83d68c EKF: Fix bugs preventing use of external vision yaw data 2016-05-14 21:56:41 +10:00
Paul Riseborough
13c3a95bc1 EKF: Add missing line returns 2016-05-14 21:17:30 +10:00
Paul Riseborough
59eb9eb3db EKF: fix shadow declaration arising from rebase 2016-05-14 21:17:30 +10:00
Paul Riseborough
172f4be594 EKF: Fix bug in calculation of terrain observation variance 2016-05-14 21:17:29 +10:00
Paul Riseborough
b985e58333 EKF: clean up control function
With the addition of new observation types, the control function has become too large and needed be broken up into separate functions
2016-05-14 21:17:29 +10:00
Paul Riseborough
f4a0f69f6e EKF: print to console when starting EV fusion 2016-05-14 21:17:29 +10:00
Paul Riseborough
349c731375 EKF: remove PX4 dependant text output 2016-05-14 21:17:29 +10:00
Paul Riseborough
ac9b7a3df6 EKF: Ensure use of EV aiding inhibits use of other height sources 2016-05-14 21:17:29 +10:00
devbharat
cf1df5861a Undid hack in ecl. Handled yaw missalignment on the vision side. 2016-05-14 21:17:29 +10:00
devbharat
d16f413b55 Hack to fix external vision pos offset compensation 2016-05-14 21:17:29 +10:00
devbharat
d3bad9fdb0 Correct height fusion flag when using sensor other than baro 2016-05-14 21:17:29 +10:00
devbharat
6d20a426e0 Reset time_last_ext_vision 2016-05-14 21:17:29 +10:00
devbharat
b681c9a5d0 Added external vision noise parameters etc and position offset 2016-05-14 21:17:29 +10:00
devbharat
ff8f03b5dd Added compensation for VI sensor offset. Check sign. 2016-05-14 21:17:29 +10:00
Paul Riseborough
e917d6c7f2 EKF: Add fusion of external yaw data 2016-05-14 21:17:29 +10:00
Paul Riseborough
37a09c61bc EKF: Don't use delayed data to start EV aiding 2016-05-14 21:17:29 +10:00
Paul Riseborough
25f1d1d766 EKF: Add fusion of external vision 3D pos data 2016-05-14 21:17:29 +10:00
Paul Riseborough
81469d6621 EKF: Add position, height and velocity reset for EV aiding 2016-05-14 21:17:29 +10:00
Paul Riseborough
3a0fcd03d7 EKF: Add interfaces and variables to use ext vision data 2016-05-14 21:17:29 +10:00
Paul Riseborough
7afd015b49 Merge pull request #129 from PX4/pr-ekf2OutputFilterTracking
EKF:  Improve output observer position and velocity tracking
2016-05-14 15:53:19 +09:30
Paul Riseborough
c7e225124c EKF: Improve output observer position and velocity tracking
Replace the delayed time feedback mechanism used by the translational states with a direct feedback method.
Time constants for velocity and position convergence can be separately adjusted with tunable parameters
The method is more computationally more expensive because it requires modification of the output buffer history but is acceptable because it only requires 6 FLOP per buffer index for a total of 30*6 = 180 FLOP
The method was not applied to the attitude states because the quaternion operations required at each buffer index would have been computationally prohibitive.
2016-05-14 12:45:29 +09:30
Paul Riseborough
627d08ecc9 Revert "EKF: Fix bug in output observer"
This reverts commit 03f3df741589627bf15225327289b01916cc1a90.
2016-05-14 12:26:46 +09:30
Paul Riseborough
03f3df7415 EKF: Fix bug in output observer
Bug was causing output observer state history to be stored at the the EKF, not IMU output rate and resulted in degraded tracking performance
2016-05-14 08:33:05 +09:30
Lorenz Meier
d595596c42 Merge pull request #114 from PX4/fix_linux_build
CMakeLists: use find_package Eigen3
2016-05-12 12:55:40 +02:00
Carl Olsson
5217b73df1 added bad_airspeed reporting (#123) 2016-05-12 10:06:04 +02:00
Carl Olsson
b126921894 changed airspeed innovation gate to 5 (#119) 2016-05-12 10:05:26 +02:00
Julian Oes
b8ccc58887 cmake: ignore more eigen warnings 2016-05-12 08:38:37 +02:00
Julian Oes
b74114a573 cmake: ignore deprecated warnings of Eigen 2016-05-12 08:27:59 +02:00
Julian Oes
07ecffc963 cmake: another try to get the module path right 2016-05-10 17:59:01 +02:00
Julian Oes
001433c660 cmake: debug output for path 2016-05-10 17:59:01 +02:00
Julian Oes
d242bb78b9 cmake: try to provide path to FindEigen3 2016-05-10 17:59:01 +02:00
Julian Oes
dcd191d734 cmake: include FindEIgen3.cmake for older cmake 2016-05-10 17:59:01 +02:00
Julian Oes
798cdfe675 build.sh: if cmake fails, don't continue with make 2016-05-10 17:59:01 +02:00
Julian Oes
37b73c7d85 README: updated build instructions, prerequisites 2016-05-10 17:59:01 +02:00
Julian Oes
fc47684942 build.sh: get path right for travis build 2016-05-10 17:59:01 +02:00
Julian Oes
54e62f1495 travis: just use libeigen3-dev 2016-05-10 17:59:01 +02:00
Julian Oes
3d28f7ecca CMakeLists: use find_package Eigen3
Instead of hardcoding the Eigen3 path which only works on Mac, use
find_package(Eigen3).
2016-05-10 17:59:01 +02:00
Paul Riseborough
e91a934f07 Merge pull request #124 from PX4/pr-removeVehicleArmStatus
Remove reliance on vehicle arm status
2016-05-10 10:54:32 +10:00
Paul Riseborough
1a24ec5f50 EKF: remove unused flag from control status message 2016-05-10 10:45:06 +10:00
Paul Riseborough
481c624975 EKF: Remove use of vehicle arm status
Use single externally set in-air status for all decisions
2016-05-10 10:23:08 +10:00
Paul Riseborough
3cdf56e57c Merge pull request #122 from CarlOlsson/airspeed_fix
fixed_airspeed_healthy_bug
2016-05-09 10:24:22 +10:00
Paul Riseborough
e06c0f41d7 Merge pull request #117 from PX4/ekf2AccuracyImprovement
EKF: Accuracy Improvements
2016-05-09 09:24:44 +10:00
CarlOlsson
ee7d7aeb8a fixed_airspeed_healthy_bug 2016-05-08 18:30:37 +02:00
Paul Riseborough
175723f690 EKF: Allow for larger accel bias offsets on startup 2016-05-08 18:03:58 +10:00
Paul Riseborough
161ac2e051 EKF: ensure position co-variances are reset
When transitioning into optical flow nav  from a non-aiding condition during ground operation, ensure position covariances are reset as they could be invalid.
2016-05-08 18:03:09 +10:00
Paul Riseborough
feb4db6347 EKF: protect against large IMU errors during initial tilt alignment
Turn off innovation consistency checks for height and synthetic position measurements until the tilt as aligned
2016-05-08 17:54:45 +10:00
Paul Riseborough
00973d6215 EKF: fix pos/vel fusion innovation variance bug 2016-05-08 17:51:47 +10:00
Paul Riseborough
2144a40a3c EKF: redefine accelerometer bias state inhibit switch bit location 2016-05-08 16:03:21 +10:00
Paul Riseborough
724280fd1f EKF: move calculation of optical flow observation variance into a function
Allows it to be used when calculating initial state variance
2016-05-08 15:40:06 +10:00
Paul Riseborough
25682dce91 EKF: Prevent badly conditioned covariance calculation when starting or resetting to optical flow 2016-05-08 10:30:40 +10:00
Paul Riseborough
c66ed7b662 EKF: Add interface method for filter fault status 2016-05-07 21:18:00 +10:00
Paul Riseborough
020b87933e EKF: replace fault status struct with a union to facilitate logging 2016-05-07 21:11:16 +10:00
Paul Riseborough
7f5669fb2d EKF: consolidate covariance corrections
Combines the forced symmetry, variance limiting and zeroing of covariances for unwanted states in the one function.
This ensures a consistent correction is applied after every covariance prediction or correction.
2016-05-07 20:29:50 +10:00
Paul Riseborough
0c6a367e1b EKF: fix Travis build error 2016-05-07 17:45:49 +10:00
Paul Riseborough
22f0f52bf1 EKF: fix travis build error 2016-05-07 17:06:45 +10:00
Paul Riseborough
9e53ff2f80 EKF: Improve protection against bad optical flow fusion 2016-05-07 14:23:56 +10:00
Paul Riseborough
1126048a93 EKF: Improve protection against bad airspeed fusion 2016-05-07 14:23:38 +10:00
Paul Riseborough
c8d95586e7 EKF: Improve protection against bad magnetometer fusion 2016-05-07 14:23:20 +10:00
Paul Riseborough
310bd97080 EKF: Improve protection against bad pos vel fusion 2016-05-07 14:22:59 +10:00
Paul Riseborough
da9d894441 EKF: Improvements to covariance reset 2016-05-07 12:57:41 +10:00
Lorenz Meier
199c423f1f Attitude fw: Remove builtin perf counters 2016-05-05 20:06:01 +02:00
Paul Riseborough
d9aeace6ac EKF: tuning update 2016-05-05 21:23:03 +10:00
Paul Riseborough
f1b7e7714e EKF: Make average update rate of EKF closer to target
With the EKF, the average update rate is more important than the instantaneous value as it affects tuning. This patch ensures that the EKF prediction cycle will be performed early if the previous one was late in an attempt to maintain the target update rate.
2016-05-05 21:23:03 +10:00
Paul Riseborough
1daa6c7866 EKF: update tuning defaults 2016-05-05 21:23:03 +10:00
Paul Riseborough
fc6c0c7ebf EKF: Update covariance prediction
Refresh auto generated code
Make 3-axis accel fusion the default and no accel fusion the option
2016-05-05 21:23:03 +10:00
Paul Riseborough
ecaffe63af EKF: update tuning defaults 2016-05-05 21:23:03 +10:00
Paul Riseborough
7a74d58591 EKF: reduce initial accel bias uncertainty 2016-05-05 21:23:03 +10:00
Paul Riseborough
a7d08d08fc EKF: Relax tilt alignment check 2016-05-05 21:23:03 +10:00
Paul Riseborough
5523a4f225 EKF: Fix IMU bias compensation scale error in output filter
Delta angle and velocities are calculated assuming data is at the filter update rate, not the IMU update rate
2016-05-05 21:23:03 +10:00
Paul Riseborough
fd109b00ab EKF: replace in-line code with existing function 2016-05-05 21:23:03 +10:00
Paul Riseborough
727a43764f EKF: update initial angle alignment check 2016-05-05 21:23:03 +10:00
Paul Riseborough
bc34b14779 EKF: Initialise height state variance to a value compatible with the measurement
A large height state variance and small measurement variance can destabilise the filter in the first few seconds after alignment
2016-05-05 21:23:03 +10:00
Paul Riseborough
29a361d3a3 EKF: Use intuitive units for gyro and accel bias process noise
This also makes the tuning less sensitive to changes in the EKF update rate.
2016-05-05 21:23:03 +10:00
Paul Riseborough
799865c934 EKF: update default tuning parameters 2016-05-05 21:23:03 +10:00
Paul Riseborough
f01f4ae4b1 EKF: tidy up mag declination fusion 2016-05-05 21:23:03 +10:00
Paul Riseborough
0d31aad33a EKF: Fix bad limit on magnetometer noise parameter 2016-05-05 21:23:03 +10:00
Paul Riseborough
7069fb7a04 EKF: refresh auto code for mag fusion 2016-05-05 21:23:03 +10:00
Paul Riseborough
ffea65e1a4 EKF: fix bug in state prediction 2016-05-05 21:23:03 +10:00
Paul Riseborough
63f093a10a EKF: Update upper limits for state variances
This limiting is a  last resort measure and the limiting for normal operation should be achieved by modification in the covariance prediction
2016-05-05 21:23:03 +10:00
Paul Riseborough
26a51c667d EKF: Improve robustness to initial gyro bias errors
Allows for ~6 deg/sec of startup bias
2016-05-05 21:23:03 +10:00
Paul Riseborough
7530e30012 EKF: Improve IMU data collection
Use IMU driver published delta angle integration time to determine when enough data has been accumulated.
Perform basic first order sculling corrections on delta velocity data
Comment steps to make make method clearer
2016-05-05 21:23:03 +10:00
Paul Riseborough
f23f0b1035 EKF: fix bugs in stationary process model covariance prediction
Noise variance for stationary states was  being overwritten by the covariance prediction operations for the kinematic states
Unwanted states could end up with non-zero covariance values
The forced symmetry operation was being applied too late to be effective
2016-05-05 21:23:03 +10:00
Paul Riseborough
a373ada858 EKF: explicitly define floating point type in hardcoded constants 2016-05-05 21:23:03 +10:00
Paul Riseborough
a189c60d33 EKF: update code fragment text files 2016-05-05 21:23:03 +10:00
Paul Riseborough
f4e84a2234 EKF: fix axis label error in comments 2016-05-05 21:23:03 +10:00
Paul Riseborough
57d3036ee7 EKF: update derivation files 2016-05-05 21:23:03 +10:00
Paul Riseborough
82da832816 EKF: tidy up Kalman gain calculations
Inhibiting of states is controlled via zeroing rows and columns in the covariance prediction so conditional logic in gain calculations is unnecessary.
2016-05-05 21:23:03 +10:00
Paul Riseborough
311d046a26 EKF: Enable optional activation of XY delta velocity bias estimation 2016-05-05 21:23:03 +10:00
Paul Riseborough
572c2280bd EKF: tidy up covariance prediction 2016-05-05 21:23:03 +10:00
Paul Riseborough
54e713969d EKF: Fix rebase error 2016-05-05 21:23:03 +10:00
Paul Riseborough
67d23948b5 EKF: preliminary re-tune 2016-05-05 21:23:03 +10:00
Paul Riseborough
03c35266ef EKF: remove unused parameter 2016-05-05 21:23:03 +10:00
Paul Riseborough
fe9f88a8b4 EKF: test new derivation
Use direct attitude parameterisation
Discard scale factors
Add accel bias
2016-05-05 21:23:03 +10:00
Daniel Agar
22d18d638c enable Wshadow 2016-05-04 19:45:40 -04:00
Paul Riseborough
c6775b5bf2 Merge pull request #118 from PX4/fix_member_init
ekf: initialize _terrain_var
2016-05-03 10:26:48 +10:00
Beat Küng
f2dda3c183 ekf: initialize _terrain_var, fixes access to uninitialized value
in PX4 Firmware, Ekf::get_terrain_vert_pos depends on it. This is the
valgrind output:
==15439== Thread 14 ekf2:
==15439== Conditional jump or move depends on uninitialised value(s)
==15439==    at 0x5610087: sqrtf (in /usr/lib64/libm-2.22.so)
==15439==    by 0x4D1AF0: Ekf::get_terrain_vert_pos(float*) (terrain_estimator.cpp:135)
==15439==    by 0x46641F: Ekf2::task_main() (ekf2_main.cpp:655)
==15439==    by 0x42BF3D: entry_adapter(void*) (px4_posix_tasks.cpp:103)
==15439==    by 0x4E3C609: start_thread (in /usr/lib64/libpthread-2.22.so)
==15439==    by 0x5BF7A4C: clone (in /usr/lib64/libc-2.22.so)
2016-05-02 17:35:42 +02:00
Paul Riseborough
0a6d95c6c2 Merge pull request #116 from PX4/pr-covReset
after a height reset zero the cross covariances for height and vertical
2016-05-01 21:44:38 +10:00
Roman
0c77ebf6bd EKF: Reduce likelihood of bad covariance values after height resets
The cross terms (covariances) are now reset before the variance variance is set.

The vertical velocity state variance following a reset without GPS has been reduced.
2016-05-01 21:39:56 +10:00
Paul Riseborough
6c57bea1c3 EKF: fix bug in IMU error application timing patch 2016-04-30 15:11:12 +10:00
Paul Riseborough
6ecbefd7e4 EKF: add matlab script to test complementary filter gains 2016-04-30 11:05:03 +10:00
Paul Riseborough
15df20831a EKF: improve output complementary filter tracking
Optimise for height tracking and adjust gains automatically with changes in time delay.
2016-04-30 11:03:45 +10:00
Paul Riseborough
4fa1e9c651 EKF: Fix timing errors in state prediction
IMU corrections were being applied at the wrong time horizon to the EKF states
IMU downsampling rotates the delta velocities into the orientation produced by the last delta angle, but this wasn't consistent with the way the state prediction was using the delta velocity data.
2016-04-30 11:02:19 +10:00
Paul Riseborough
4c9c102597 Merge pull request #115 from PX4/fix_isfinite_again
ekf: another stab at fixing isfinite for all
2016-04-29 09:12:59 +10:00
Julian Oes
f8a48f9cc5 ekf: now it should even compile for NuttX 2016-04-28 16:30:49 +02:00
Julian Oes
12f4d6f703 ekf: another stab at fixing isfinite for all
The previous solution did not work for Snapdragon, so I needed to copy
what is used in px4_defines.h.
2016-04-28 16:09:12 +02:00
Paul Riseborough
22ad87599c Merge pull request #112 from PX4/fix_ubuntu1604_2
ekf: compile fix for Ubuntu 16.04
2016-04-27 21:21:04 +10:00
Julian Oes
46e207106b ekf: use std::isfinite instead of isnan 2016-04-27 12:58:22 +02:00
Lorenz Meier
7b702ee37e Merge pull request #105 from georgehines/matlab-log-import
fix a field name that I missed last time
2016-04-26 10:03:37 +02:00
Lorenz Meier
7c7945961e Merge pull request #107 from dagar/l1_init
L1 initialize everything
2016-04-26 10:01:27 +02:00
Daniel Agar
fe5a337c99 l1 initialize everything 2016-04-25 14:39:11 -04:00
George Hines
9994aa7fdb fix a field name that I missed last time 2016-04-22 17:21:47 -07:00
Paul Riseborough
42635903cd Merge pull request #102 from priseborough/pr-ekf2HeightReset
EKF: Improve height reset behaviour
2016-04-23 10:04:13 +10:00
Paul Riseborough
4fcbfb5d42 EKF: correct error in comment 2016-04-23 07:55:25 +10:00
Paul Riseborough
13814681d7 Merge pull request #104 from georgehines/matlab-log-import
Matlab log import
2016-04-23 07:50:07 +10:00
Paul Riseborough
3e81b86280 EKF: improve height reset logic
Don't use failed sensors unless necessary and handle case where not height sensor is available for reset
2016-04-22 10:50:53 +10:00
Paul Riseborough
874558d194 EKF: improve detection of bad vert accel data
Improve ability to detect if bad vertical accel data has caused loss of height accuracy by using historical data.
2016-04-22 09:24:04 +10:00
Paul Riseborough
469a7d1711 EKF: rework height reset
calculate and save the amount that the vertical states have changed and the time of the change
apply the change delta to the output observer states and buffer
2016-04-22 08:43:56 +10:00
Paul Riseborough
e3365525c2 EKF: rework height reset logic 2016-04-22 08:39:24 +10:00
Paul Riseborough
421703c267 EKF: rework initialisation of height state and offsets 2016-04-22 08:38:41 +10:00
Paul Riseborough
a7417657c3 EKF: ensure fusion timeout counters are reset when required 2016-04-22 08:33:11 +10:00
Paul Riseborough
10bf05e9a6 EKF: publish the vertical position offset 2016-04-22 08:30:46 +10:00
Paul Riseborough
0de15b1b20 EKF: Add variables to monitor vertical position and height offset 2016-04-22 08:28:56 +10:00
Paul Riseborough
62c6d40f1f EKF: Add methods to ring buffer to access specific indices 2016-04-22 08:21:36 +10:00
George Hines
59df1a3552 rename log GUI consistent with its assumptions 2016-04-21 10:58:28 -07:00
George Hines
62bdcf3e9b supports APM dataflash logs 2016-04-21 10:54:37 -07:00
Paul Riseborough
b295f9050c EKF: ensure GPS check status is correctly initialised 2016-04-20 21:53:15 +10:00
Lorenz Meier
9487eac505 Merge pull request #98 from priseborough/pr-ekf2StatusReporting
EKF: improve reporting of filter status
2016-04-20 11:44:02 +02:00
Roman Bapst
6344fa0e8c limit maximum rates of all measurement at which they are stored into the buffers 2016-04-19 12:47:57 +02:00
Roman Bapst
00c8821006 disable airspeed fusion for now. Needs more testing and implementation of side slip fusion 2016-04-19 11:18:45 +02:00
Paul Riseborough
2fa8a11a29 EKF: replace unnecessary memcopy 2016-04-19 19:10:41 +10:00
Roman Bapst
99fc61c27c ekf2 airspeed fusion:
- finished logic for fusion
- fixed bug where previous control status was set in the wrong location
2016-04-19 09:53:31 +02:00
Paul Riseborough
82920da232 EKF: strengthen checking of local position status
provides immediate status reporting when dropping out of optical flow mode
2016-04-19 17:38:22 +10:00
Paul Riseborough
31bf342fc1 EKF: publish GPS check status 2016-04-19 17:38:22 +10:00
Paul Riseborough
6fa13c7806 EKF: publish control mode status 2016-04-19 17:37:27 +10:00
Roman Bapst
60abf07bee added function to return accelerometer bias 2016-04-18 17:52:16 +02:00
Roman Bapst
f32303de69 added function to return accelerometer bias 2016-04-18 17:00:17 +02:00
Lorenz Meier
3455931617 EKF init: Fix initialization statement 2016-04-17 19:29:23 +02:00
Lorenz Meier
e1ce948768 Merge pull request #97 from dagar/cmake_update
cmake STACK -> STACK_MAIN
2016-04-17 15:58:52 +02:00
Daniel Agar
861c13f1fe cmake STACK -> STACK_MAIN 2016-04-16 21:46:50 -04:00
Paul Riseborough
55db3d8725 Merge pull request #94 from priseborough/pr-sensorPosComp
Add compensation for EKF sensor position offsets
2016-04-14 11:45:24 +10:00
Paul Riseborough
ea38aa130f EKF: update default time delay parameter values 2016-04-14 08:53:59 +10:00
Paul Riseborough
8c55e36ca9 EKF: use common value for gravity 2016-04-12 11:14:31 +10:00
Paul Riseborough
163c08a3ac EKF: Improve output observer documentation 2016-04-12 11:14:31 +10:00
Paul Riseborough
2dcc6e2053 EKF: Improve accuracy of state prediction
Use an a common estimator value for gravity
Use average orientation across update interval when rotating delta velocities
2016-04-12 11:14:31 +10:00
Paul Riseborough
5bf02517a7 EKF: Rationalise use of rotation matrices and improve efficiency 2016-04-12 11:14:31 +10:00
Paul Riseborough
e10093854a EKF: correct outputs for IMU offset 2016-04-12 11:14:31 +10:00
Paul Riseborough
b46053415f EKF: Compensate optical flow data for sensor position offset 2016-04-12 11:14:31 +10:00
Paul Riseborough
48b105b748 EKF: correct range finder data for sensor position offset 2016-04-12 11:14:31 +10:00
Paul Riseborough
e89dbb9f63 EKF: correct GPS data for antenna position offset 2016-04-12 11:14:31 +10:00
Paul Riseborough
3580940e10 EKF: Add sensor position offset parameters 2016-04-12 11:14:31 +10:00
Paul Riseborough
64e95910c4 Merge pull request #92 from priseborough/pr-ekf2HgtResetFix
EKF: Fix vulnerability in height reset
2016-04-12 11:09:06 +10:00
Paul Riseborough
006b6b58e4 EKF: fix bug in status print statement 2016-04-12 10:38:50 +10:00
Paul Riseborough
74078cde94 EKF: reset state variance when performing a height reset
Set vertical position and velocity variances using known sensor error characteristics if we have reset the states to the sensor readings.
2016-04-11 19:40:27 +10:00
Paul Riseborough
f4f108d57d EKF: Reset vertical velocity when performing a height reset 2016-04-11 19:25:24 +10:00
Paul Riseborough
61b919754d Merge pull request #90 from georgehines/matlab-log-import
version/toolbox compatibility
2016-04-11 05:23:50 +10:00
George Hines
941d3bca0a changes some graphics arguments for version compatibility, adds a viewer example to the usage samples script 2016-04-07 16:39:32 -07:00
Paul Riseborough
a919088b6a Merge pull request #89 from georgehines/matlab-log-import
Matlab log import
2016-04-07 15:44:04 -07:00
George Hines
684b41494e adds estimator log viewer UI 2016-04-07 15:13:19 -07:00
George Hines
3773d5a00d removes accidentally commited px4log test file 2016-04-07 11:59:54 -07:00
George Hines
eb41d25ff6 reduces update rate of progress display, stores message time (not TIME message) as floating point seconds, automatically extracts TIME message, updates usage samples accordingly 2016-04-07 11:58:51 -07:00
George Hines
2ad21bc8c7 adds function header comments and method attribution 2016-04-07 07:40:40 -07:00
George Hines
f6413a1924 renames test script for clarity 2016-04-07 07:32:53 -07:00
George Hines
93fde19c25 changes some cell notation for speed 2016-04-07 07:22:21 -07:00
George Hines
0e3a6e214c completed low-overhead import script, added usage examples 2016-04-07 07:18:59 -07:00
George Hines
8c8653a1a2 initial commit of matlab px4 log importer 2016-04-06 17:12:40 -07:00
Lorenz Meier
f86ef34782 EKF: Fix error message which lied 2016-04-05 19:06:35 -07:00
Paul Riseborough
a352c2f4e3 EKF: Fix posix build error
Memset cannot be used on a class like this. Setting the time elements to zero achieves the desired result.
2016-04-05 18:57:21 -07:00
Lorenz Meier
6b3ad03419 Merge pull request #86 from CarlOlsson/small_airspeed_fix
Small airspeed fix
2016-04-05 16:38:37 -07:00
Roman Bapst
f35e78643c Merge pull request #79 from dagar/integrator_fix
fw multiply integrator gain in loop
2016-04-05 22:33:29 +02:00
Paul Riseborough
430d4b1cf8 EKF: ensure data in buffers is zero at startup 2016-04-05 22:23:37 +02:00
Paul Riseborough
c6bd93ed40 EKF: Include all output files generated by derivation script 2016-04-05 22:23:37 +02:00
Paul Riseborough
470098e182 EKF: update default tuning parameters
Parameters needed to be changed when covariance prediction error was corrected.
The magnetic earth and body field process noise now use separate parameters to help with tuning
2016-04-05 22:23:37 +02:00
Paul Riseborough
eaf94935f0 EKF: Fix bug in initialisation of height and magnetic field
This prevents zero data being used to form the initial height and magnetic field.
Do not start sampling initial values until non-zero time values are retrieved from the buffer.
2016-04-05 22:23:37 +02:00
Paul Riseborough
03eac2f25e EKF: Apply covariance prediction derivation changes 2016-04-05 22:23:37 +02:00
Paul Riseborough
ac71ec5d37 EKF: Fix scaling error in covariance prediction derivation
The covariance prediction derivation was using the noise 1-std value instead of the noise variance. This resulted in the values of IMU process noise required to tune not matching the observed covariance growth.
2016-04-05 22:23:37 +02:00
CarlOlsson
8678a939e2 removed reinitialization of intermediate variables 2016-04-05 14:18:47 +02:00
Roman Bapst
2632c930f7 Merge pull request #85 from CarlOlsson/add_error_reporting_tas
added fault status reporting
2016-04-04 18:52:06 +02:00
Roman Bapst
96b9674cb6 Merge pull request #84 from CarlOlsson/change_to_true_airspeed
change name to true_airspeed
2016-04-04 18:49:04 +02:00
CarlOlsson
eee6f1048f Changed vtaspred threshold 2016-04-04 16:27:06 +02:00
CarlOlsson
3ad5b52aea removed comment 2016-04-04 16:26:46 +02:00
CarlOlsson
616725410d updated calculation 2016-04-04 16:26:13 +02:00
CarlOlsson
ec9902d802 added fault status reporting 2016-04-04 16:21:12 +02:00
CarlOlsson
1ea26b406a change name to true_airspeed 2016-04-04 16:10:52 +02:00
Roman Bapst
068c29851c Merge pull request #80 from PX4/fuse_tas_rebased
Fuse tas rebased
2016-03-30 17:17:05 +02:00
Roman Bapst
27b894540e put airspeed fusion logic but don't actually call it yet 2016-03-30 17:01:03 +02:00
Roman Bapst
1b7115dec9 increased airspeed fusion rate to 12.5Hz 2016-03-30 17:01:03 +02:00
CarlOlsson
f5a9afd278 moved init 2016-03-30 17:01:03 +02:00
CarlOlsson
f990d99790 fixed bug 2016-03-30 17:01:03 +02:00
CarlOlsson
4301e1105b added commas 2016-03-30 17:01:03 +02:00
CarlOlsson
81fc086b76 adopted ekf_interface.h 2016-03-30 17:01:03 +02:00
CarlOlsson
d440c883b5 adopted ekf_interface.cpp 2016-03-30 17:01:03 +02:00
CarlOlsson
f8878d41dc adopted ekf_helper.cpp 2016-03-30 17:01:03 +02:00
CarlOlsson
6bb2f7638c adopted ekf.h 2016-03-30 17:01:03 +02:00
CarlOlsson
0918fa04c7 adopted ekf.cpp 2016-03-30 17:01:03 +02:00
CarlOlsson
92abf93c8f adopted common.h 2016-03-30 17:01:03 +02:00
CarlOlsson
0fb1e0578b added function for fusing airspeed 2016-03-30 17:01:03 +02:00
Daniel Agar
82cf1827d4 fw multiply integrator gain in loop 2016-03-25 17:28:39 -04:00
Paul Riseborough
0ea55e25f9 Merge pull request #78 from PX4/pr-addGpsHgtOption
EKF: Add option to use GPS for height and improve height fall-back behaviour
2016-03-23 11:19:01 -07:00
Paul Riseborough
400a6e12ba EKF: Ensure all data in buffers is initialised
This is a defensive change to prevent introduction of NaN's into the filter if data is read from the incorrect place in the buffer.
2016-03-20 15:14:16 +11:00
Paul Riseborough
064a0e4dbc EKF: Don't use GPS to set position noise when not using GPS 2016-03-16 20:12:36 +11:00
Paul Riseborough
c23d72ba29 EKF: Ensure filter control modes are correctly initialised 2016-03-16 17:22:27 +11:00
Paul Riseborough
9f3b1351f7 EKF: Don't initialise velocity to GPS on initial alignment
For initial alignment the velocity and position should start at zero
2016-03-16 17:20:57 +11:00
Paul Riseborough
687fcc70be EKF: Explicitly define type conversion for GPS height 2016-03-16 17:18:20 +11:00
Paul Riseborough
e334a5dc57 EKF: Add check for NaN's on attitude states 2016-03-16 13:43:21 +11:00
Paul Riseborough
6b2e2dba90 EKF: Add GPS height option and improve height recovery 2016-03-16 10:40:51 +11:00
Paul Riseborough
63b0cf4360 EKF: Fix baro height offset bug 2016-03-14 15:51:15 +11:00
Paul Riseborough
4bd79c9e5d Merge pull request #76 from PX4/pr-fixRngHgtMode
EKF: Fix bugs preventing use of range finder as primary height source

Flight testing completed and I have checked that the other pending PR #75 rebases cleanly on it.
2016-03-14 09:46:58 +11:00
Paul Riseborough
49023f3d7e EKF: fix travis build error 2016-03-13 21:56:28 +11:00
Paul Riseborough
7677a162aa EKF: Don't start the output observer before the main filter has initialised
This prevents the possibility of output transients if alignment is delayed.
2016-03-13 21:17:51 +11:00
Paul Riseborough
d2407c3463 EKF: code style updates 2016-03-13 21:17:51 +11:00
Paul Riseborough
c58ab3e256 EKF: Enable fallback to baro alt when using range finder for height 2016-03-13 21:17:51 +11:00
Paul Riseborough
370f643f42 EKF: Enable use of range finder for primary height source 2016-03-13 18:44:34 +11:00
Lorenz Meier
699ec17cc3 Removed spurious print in wheel controller 2016-03-12 11:23:08 +01:00
Paul Riseborough
2882c53246 Merge pull request #74 from PX4/pr-optflow-reworked
Add fusion of optical flow LOS rate measurements
2016-03-11 11:13:03 +11:00
Paul Riseborough
109e0e6dfc EKF: When commencing GPS aiding, don't reset local position and velocity if using optical flow 2016-03-11 11:03:43 +11:00
Paul Riseborough
26238bc2f5 EKF: Allow for change in position when defining the WGS-84 origin position
This allows GPS aiding to commence later in flight without step changes in local position output
2016-03-11 11:03:43 +11:00
Paul Riseborough
e0fcce1463 EKF: Make position and velocity reset publish success
Some users of the position and velocity reset functions will need to know if the reset has been successful.
2016-03-11 11:03:43 +11:00
Paul Riseborough
48f980b054 EKF: Fix syntax causing posix build to fail 2016-03-11 11:03:43 +11:00
Paul Riseborough
eab0ef4266 EKF: Update default process noise for terrain estimator 2016-03-11 11:03:43 +11:00
Paul Riseborough
962fd0aaf2 EKF: Adjust terrain process noise for gradient effect 2016-03-11 11:03:43 +11:00
Paul Riseborough
1a2da887ab EKF: Fix bug in calculation of terrain estimator Kalman gain 2016-03-11 11:03:43 +11:00
Paul Riseborough
cc5512905a EKF: prevent optical flow, GPS and baro fusion from blocking each other 2016-03-11 11:03:43 +11:00
Paul Riseborough
e9ccfdd484 EKF: Update derivation scripts and outputs
Work around limitation in Symbolic toolbox environment space by incrementally saving and clearing workspace
Remove vehicle vertical position from optical flow prediction equations (use range measurement instead) and regenerate auto-code
Remove legacy optical flow auto-code conversion method as it is not required now a work around for symbolic toolbox limitations has been developed
Fix out of date syntax
2016-03-11 11:03:43 +11:00
Paul Riseborough
ffebaf384f EKF: Set initial optical flow fusion monitor outputs to zero 2016-03-11 11:03:43 +11:00
Paul Riseborough
5acd1cbac4 EKF: Make definitions of parameters clearer for external use 2016-03-11 11:03:43 +11:00
Paul Riseborough
dd1d58bab5 EKF: Remove unnecessary matrix operations from optical flow fusion
The updated formulation means that H_LOS[][8] is always zero, so these operations are no longer required.
2016-03-11 11:03:43 +11:00
Paul Riseborough
b3b0f1347a EKF: Make normal GPS mode the default 2016-03-11 11:03:43 +11:00
Paul Riseborough
d97d308ca7 EKF: Add control of optical flow and range finder fusion 2016-03-11 11:03:43 +11:00
Paul Riseborough
836fe39070 EKF: Update external interface functions to support optical flow 2016-03-11 11:03:43 +11:00
Paul Riseborough
2ff338048d EKF: Add support for range-finder fusion as primary height reference 2016-03-11 11:03:43 +11:00
Paul Riseborough
2c2850c0ce EKF: Add functions to get position and velocity state variance 2016-03-11 11:03:43 +11:00
Paul Riseborough
32b03819ef EKF: Add function to calculate global position validity 2016-03-11 11:03:43 +11:00
Paul Riseborough
270451e17b EKF: Update height reset to support range finder height use 2016-03-11 11:03:43 +11:00
Paul Riseborough
dca186c6e8 EKF: Add required declarations for optical flow 2016-03-11 11:03:43 +11:00
Paul Riseborough
75b22c95ac EKF: Add new source files to cmake 2016-03-11 11:03:43 +11:00
Paul Riseborough
122dd9c531 EKF: Add source file for optical flow LOS rate fusion 2016-03-11 11:03:43 +11:00
Paul Riseborough
82cbfafb34 EKF: Add source file for terrain vertical position estimator
Implements a single state Kalman filter to estimate terrain vertical position relative to the NED origin.
2016-03-11 11:03:43 +11:00
Paul Riseborough
829e0f1e65 Merge pull request #73 from mcsauder/master
Conversion error correction and additional function overloads to allow standalone compilation.
2016-03-11 11:02:32 +11:00
mcsauder
6a61f9ba77 Remove a define that might not be required for compilations in other scnearios outside of C99 restrictions to minimize Pull Request modifications. 2016-03-05 02:17:55 -07:00
mcsauder
115c87a0ea Remove an include that was unnecessary. 2016-03-05 02:15:04 -07:00
mcsauder
1aee1b895a Uncomment commented lines that removed Eigen namespaces and dependencies. 2016-03-05 02:12:26 -07:00
mcsauder
f9be23933b Correct deg to rad conversion inversion. Add additional functionality to mathlib to allow standalone compile without Limits.cpp and Limits.hpp files from PX4. 2016-03-05 01:58:58 -07:00
Paul Riseborough
b163efeae2 Merge pull request #72 from PX4/pr-MagFusionBug
Fix bug in declination fusion and standardise covariance update
2016-03-05 11:34:19 +11:00
Paul Riseborough
5242af84af EKF: Standardise covariance update and use static arrays for large matrices 2016-03-05 08:58:19 +11:00
Paul Riseborough
1414d591ce EKF: Fix bug in declination fusion indexing 2016-03-05 08:43:33 +11:00
Daniel Agar
2108466a00 initialize ECL_L1 variables 2016-03-03 11:22:07 +01:00
Roman Bapst
b2744f965d use in_air flag from land detector to determine if we are on the ground 2016-03-03 10:53:39 +01:00
Paul Riseborough
569886a4fc EKF: Fix bug in velocity and position innovation consistency checks 2016-03-03 17:15:22 +11:00
mcsauder
f9e3db0504 Move variable initializations from header file to constructor to allow C99 compliance. 2016-03-02 08:42:38 +01:00
Paul Riseborough
d8627c6aaf EKF: Reset the vertical position states if height fusion times out 2016-03-02 08:39:07 +01:00
Paul Riseborough
f7a53d69f2 EKF: Improve height reset function
Add a method to reset the vertical velocity to enable in-flight resets
Reset to GPS height if baro height is not available.
2016-03-02 08:39:07 +01:00
Paul Riseborough
a6da73fa83 EKF: Add missing div0 protection 2016-03-01 18:03:35 +11:00
Paul Riseborough
d5e47d21db EKF: miscellaneous comment and format changes 2016-03-01 15:35:45 +11:00
Paul Riseborough
7c83ac4b6d EKF: Use heading fusion as default for startup and ground operation 2016-03-01 15:35:17 +11:00
Paul Riseborough
57d4064d7b EKF: Increase default heading observation noise
Improves robustness when operating in a bad magnetic field environment
2016-03-01 15:28:53 +11:00
Paul Riseborough
97df006a6a EKF: Update direct heading fusion
Adds a 312 Euler rotation sequence option for magnetic heading fusion.
Switches between it and the normal 321 sequence option depending on orientation.
2016-03-01 15:25:22 +11:00
Paul Riseborough
ea29e39e5b EKF: Updated derivation of Jacobians for direct heading measurement
Adds an alternative using a 312 Euler sequence.
2016-03-01 15:21:36 +11:00
Paul Riseborough
2c9a814de1 Merge pull request #64 from mcsauder/master
Additional filter variable initializations required to fully reset the filter variables
2016-02-26 23:06:56 +11:00
Paul Riseborough
78d6f6941c Merge pull request #61 from PX4/pr-ImprovedAccuracyReporting
EKF: Improve Position Accuracy Reporting
2016-02-26 22:48:44 +11:00
Paul Riseborough
f058fc817f Merge pull request #63 from PX4/att_reset
Attitude reset after heading reset
2016-02-26 22:35:14 +11:00
mcsauder
5fb48a2e7b Merge remote-tracking branch 'upstream/master' 2016-02-25 22:51:58 -07:00
mcsauder
5fec0df70d Additional initializations required to reset complimentary filter values if the state estimate ever diverges and requires re-initiailization. 2016-02-25 22:51:14 -07:00
Roman Bapst
9192ced7bb do not reset output attitude state after heading reset to avoid jumps in attitude 2016-02-25 18:20:29 +01:00
Lorenz Meier
cd5857e900 Add vibration magnitude estimation 2016-02-25 16:54:24 +01:00
Paul Riseborough
cd0cac066a EKF: Calculate and publish horizontal and vertical position accuracy
This calculation takes into account the uncertainty of the origin.
Dead reckoning status is also published
2016-02-25 10:38:07 +11:00
Paul Riseborough
a30830a7a9 EKF: Scale position observation noise with GPS quality
This allows the filter to adapt to variations in GPs quality.
The range of adjustment in observation noise is limited to the range between a lower limit set by the GPS observation noise parameter and an upper limit set by the no-aiding observation noise.
2016-02-25 10:16:32 +11:00
Paul Riseborough
5483e7a477 Merge pull request #60 from PX4/pr-ReduceMagModeSwitchKick
EKF: Fix Bug Causing Roll/pitch Disturbances On Mag Fusion Mode Switch
2016-02-25 09:42:18 +11:00
Paul Riseborough
f55a0bff53 EKF: Fix code style 2016-02-25 08:17:50 +11:00
Paul Riseborough
5b5bddebea EKF: Always reset yaw and mag field states on entry into 3-axis mag fusion mode 2016-02-25 08:16:42 +11:00
Paul Riseborough
2d09a5f3ac EKF: Don't reset yaw and mag field states when not necessary 2016-02-25 08:16:42 +11:00
Paul Riseborough
380db7ebef EKF: Reset angle error covariance after yaw and mag field reset
The yaw angle could have changed by a significant amount making the correlations invalid.
Setting angle variances to zero prevents the initial kick in angles due to 3D fusion starting
2016-02-25 08:16:42 +11:00
Paul Riseborough
e938475acc Merge pull request #59 from PX4/pr-ImprovedStartup
Improvements to EKF startup - partially replaces PR#57
2016-02-24 18:27:12 +11:00
Paul Riseborough
0ad5329caf EKF: Update comments in heading fusion to clarify calculation of magnetic heading 2016-02-24 12:06:11 +11:00
Paul Riseborough
36affe3cd8 EKF: Fix bug causing incorrect initial roll when inverted 2016-02-24 11:56:12 +11:00
Paul Riseborough
016695fc3e EKF: Reduce startup transients
Update initial state variance values
2016-02-24 11:48:42 +11:00
Siddharth Bharat Purohit
9c7a3f366c Merge pull request #54 from mcsauder/master
Address C99 compatibility issues by relocating variable initialization. - Replaces PR#50
2016-02-23 15:53:04 -08:00
mcsauder
6613335937 Added constexpr back from const var type. 2016-02-23 16:15:52 -07:00
mcsauder
342010c113 Update c style array initialization to attempt to pass Travic CI build tests. 2016-02-23 15:52:02 -07:00
mcsauder
48e80e9e3e Correct C style array initialization. 2016-02-23 15:16:40 -07:00
mcsauder
f9f00fa52b Remove unnecessary include. 2016-02-23 14:00:39 -07:00
mcsauder
ccb5736353 Spaces to tab. 2016-02-23 19:58:30 -07:00
mcsauder
a4cecb1704 Match variable initialization order difference with upstream. 2016-02-23 19:57:27 -07:00
mcsauder
79d07c831f Convert spaces to tabs to match upstream. 2016-02-23 19:53:55 -07:00
mcsauder
6c96f45f08 Remove whitespace differences with upstream for pull request. 2016-02-23 19:49:27 -07:00
mcsauder
fad1c87631 Merge upstream and resolve merge conflicts. 2016-02-23 19:29:30 -07:00
Siddharth Bharat Purohit
237ecfef1a Add travis build check badge 2016-02-22 23:49:58 -08:00
Roman Bapst
8eb63a150d Merge pull request #53 from bugobliterator/pr-sharedlib
Shared Library build
2016-02-23 08:30:46 +01:00
Paul Riseborough
35865048a2 Merge pull request #55 from PX4/pr-FixYawFusionBug
Fix bug in heading fusion and add new method for ground/indoor use
2016-02-21 09:41:18 +11:00
Paul Riseborough
70a3b91217 EKF: Update magnetometer fusion derivations 2016-02-20 20:09:15 +11:00
Paul Riseborough
a711632017 EKF: Add method to fuse horizontal magnetometer data
This method is more suitable than a raw heading measurement because it works across a full range of pitch angles.
It has been made the default for ground operation.
2016-02-20 19:45:32 +11:00
mcsauder
4ce4724105 Added variable initializations back into EstimatorInterface() constructor to resolve a runtime error that occurs with uninitialized variables. 2016-02-19 23:57:06 -07:00
Paul Riseborough
6df6ac0023 EKF: Fix sign error in heading innovation calculation and clean up 2016-02-20 11:54:53 +11:00
Paul Riseborough
90e1bd3e36 EKF: wrap compass yaw estimate 2016-02-19 16:53:55 +11:00
Paul Riseborough
7d6226eb45 EKF: Improve efficiency of yaw angle fusion
Use direct calculation of Kaman gains with optimised algebra
2016-02-19 16:25:01 +11:00
Paul Riseborough
7f121e81e4 EKF: Update yaw innovation calculation to match revised derivation
The new derivation does not use magnetic field measurements in the observation model and instead fuses in a heading measurement directly.
2016-02-19 16:18:07 +11:00
mcsauder
72243c4a84 Resolve tab/space differences with upstream master. 2016-02-18 03:28:40 -07:00
mcsauder
437f6ca5fb Moved initialization to object constructors to allow C99 compiler compatibility. 2016-02-18 03:21:04 -07:00
Lorenz Meier
2b2c490382 Validator: Add function for 1D use of the 3D validator 2016-02-18 09:31:36 +01:00
bugobliterator
ba7f0fc9ff EKF: add licensing information for mathlib header and src 2016-02-17 20:02:08 -08:00
bugobliterator
80632cc12c EKF: add comments and licensing information to builder files 2016-02-17 19:55:47 -08:00
bugobliterator
e65c348905 EKF: add travis build 2016-02-17 18:51:40 -08:00
bugobliterator
a40eb7cf37 EKF: add check for existence of matrix submodule 2016-02-17 17:51:09 -08:00
Siddharth Bharat Purohit
64a7b14171 update readme to include steps to build EKF shared object 2016-02-17 17:46:48 -08:00
bugobliterator
cba5271785 add matrix submodule 2016-02-17 17:38:21 -08:00
bugobliterator
2f05f778de ignore build directory 2016-02-17 17:34:28 -08:00
bugobliterator
263c48d089 EKF: remove dependecies and allow ekf to be built as standalone shared lib 2016-02-17 17:33:18 -08:00
Paul Riseborough
96c0e18acb Merge pull request #49 from PX4/pr-fixMagCovariance
EKF: Fix magnetometer fusion and covariance handling
2016-02-18 10:22:36 +11:00
Roman Bapst
678d6f45cc Merge pull request #52 from bugobliterator/pr-airspeed-sample-fix
EKF: fix time of sample receive setting
2016-02-17 22:34:30 +01:00
bugobliterator
2096e24c06 EKF: fix time of sample receive setting 2016-02-17 13:29:12 -08:00
Paul Riseborough
a679cdf1fb EKF: Change parameter default to not fuse declination when aiding
Ground and flight testing has shown declination drift to not be a problem with current tuning and realistic vehicle motion.
2016-02-17 17:22:02 +11:00
Paul Riseborough
abf9476853 EKF: miscellaneous formatting and typo updates 2016-02-16 11:08:30 +11:00
Paul Riseborough
ffe1d30864 EKF: Set covariances to zero for un-used states 2016-02-16 11:08:30 +11:00
Paul Riseborough
294aca8609 EKF: Improve variance limiting for stationary states
Turn off the process noise if they grow too large and use the hard variance limit as a backup. This is numerically more stable than relying on a hard variance limit which does not deal with the covariances.
2016-02-16 11:08:30 +11:00
Paul Riseborough
1d40507af8 EKF: Set Kaman gains to zero for un-used states
This is a defensive programming technique. In theory this should not be necessary if the corresponding covariance entries are zero.
2016-02-16 11:08:30 +11:00
Paul Riseborough
69b8982043 EKF: Initialise variances to zero for un-used states
Setting these variances to zero makes it less likely that these states will be modified by fusion processing.
2016-02-16 11:08:30 +11:00
Paul Riseborough
d9bf4e9870 EKF: Enable control mode transitions to be detected
Save the previous value of the filter control modes
2016-02-16 11:08:30 +11:00
Paul Riseborough
402206a305 EKF: Fix critical bug in fusion of yaw and declination observations
This bug was in the derivation and resulted from use of a tan instead of an atan operator. The derivations have been reworked and the updated auto-code has been imported as part of this patch.
2016-02-16 11:08:30 +11:00
Paul Riseborough
d8afca5e7a EKF derivations: Correct error in direct yaw and declination angle fusion
The atan function is now being used correctly instead of the tan function. This fixes problems with large heading errors or declination values.
The simple heading fusion has been decoupled from the magnetic field measurements. This enables external yaw measurements to be used in the future.
2016-02-16 11:08:30 +11:00
Paul Riseborough
7da40a45a4 EKF: Add control mode for wind state estimation 2016-02-16 11:08:30 +11:00
Paul Riseborough
de02aebafd EKF: Reset covariance matrix when doing a yaw and magnetic field reset
The correlation terms in the covariance matrix will be incorrect after a reset, so should be zeroed
2016-02-14 22:01:53 +01:00
Paul Riseborough
dba58aa4c6 EKF: Add control logic for fusion modes 2016-02-14 22:01:53 +01:00
Paul Riseborough
22c177c951 EKF: Re-align yaw and magnetic field states when changing into GPS aiding mode 2016-02-14 22:01:53 +01:00
Paul Riseborough
c089079321 EKF: Split tilt and yaw align 2016-02-14 22:01:53 +01:00
Paul Riseborough
020cc5978e EKF: Move calculation of declination into a separate function 2016-02-14 22:01:53 +01:00
Paul Riseborough
aa58b3e98c EKF: Split angular alignment into tilt and yaw and use yaw and magnetic field alignment function 2016-02-14 22:01:53 +01:00
Paul Riseborough
2bbe7f9a1c EKF: Update magnetometer fusion to use declination from the specified source 2016-02-14 22:01:53 +01:00
Paul Riseborough
83945581ed EKF: Add function to calculate the magnetic declination to use 2016-02-14 22:01:53 +01:00
Paul Riseborough
9017e077f8 EKF: Publish the magnetic declination we wish to save for next startup 2016-02-14 22:01:53 +01:00
Paul Riseborough
0308f2f796 EKF: Add parameters to control declination source and fusion type 2016-02-14 22:01:53 +01:00
Paul Riseborough
6140d4b21f EKF: Add function to reset yaw and magnetic field states 2016-02-14 22:01:53 +01:00
Roman
ad978c642f estimator interface:
added flag for in_air status of vehicle
2016-02-14 20:43:22 +01:00
Roman
ce0ddc0207 -added comments
-removed unused print functions
-removed false _imu_time_last variable (correct is _time_last_imu)
2016-02-14 09:49:26 +01:00
Paul Riseborough
9d7340e187 EKF: Fix bugs in position and velocity resets
The position reset was not being compensated for velocity and measurement delay
The height was being reset with the position. It has been moved into a separate reset function
The maximum accepted GPS delay of 100msec was inadequate
The states  was being incorrectly reset to the GPS position and Baro height on initial alignment.
2016-02-14 09:49:26 +01:00
Paul Riseborough
da1de2cc4d EKF: Correct for sensor noise and baro offset during alignment 2016-02-14 09:49:26 +01:00
Roman Bapst
d21ce70eeb Merge pull request #45 from CarlOlsson/move_fuse_function_to_helper
moved fuse function to ekf_helper.cpp
2016-02-13 08:21:28 +01:00
CarlOlsson
1e766c7510 moved fuse function to ekf_helper.cpp 2016-02-12 15:54:32 +01:00
Lorenz Meier
0a9f7e58db Merge pull request #43 from PX4/pr-baroHeightOffset
Correct for sensor noise and baro offset during alignment
2016-02-10 08:02:48 +01:00
Paul Riseborough
fff2bd50f6 EKF: Fix bugs in position and velocity resets
The position reset was not being compensated for velocity and measurement delay
The height was being reset with the position. It has been moved into a separate reset function
The maximum accepted GPS delay of 100msec was inadequate
The states  was being incorrectly reset to the GPS position and Baro height on initial alignment.
2016-02-10 15:16:05 +11:00
Paul Riseborough
40e174b81c EKF: Correct for sensor noise and baro offset during alignment 2016-02-10 10:25:27 +11:00
Paul Riseborough
a6515543da Merge pull request #41 from PX4/pr-magFusionUpdates
EKF2: Prevent declination/heading drift during non-GPS operation
2016-02-09 07:57:34 +11:00
Paul Riseborough
5ea0ef39cd EKF: Update declination fusion logic
We do not need to run declination fusion if 3-axis mag fusion is not being used.
2016-02-09 07:54:24 +11:00
Paul Riseborough
47ab5ebcdd EKF: Make PR comply with project convention for indenting 2016-02-08 15:12:38 +11:00
Paul Riseborough
cdc42c1de0 EKF: Add simple control logic for magnetic declination constraint 2016-02-08 14:18:43 +11:00
Paul Riseborough
dbb8e12948 EKF: Add fusion method to constrain declination when unobservable
When fusing 3-axis magnetometer data without absolute external aiding leg GPS), the declination is ultimately unobservable and the declination of the  field states and the vehicle heading will slowly drift over time. To prevent this we need to fuse in a declination to constraint the NE earth field estimates.
2016-02-08 14:18:43 +11:00
Paul Riseborough
9347afe250 EKF: Use unique variable name for mag heading fusion observation Jacobian 2016-02-08 14:18:43 +11:00
Paul Riseborough
6aeccf01ff EKF: Add missing fusion health status messages 2016-02-08 14:18:43 +11:00
Paul Riseborough
a22886544d EKF: Add missing Kalman gain to Declination fusion autocode 2016-02-08 14:02:08 +11:00
Paul Riseborough
2c8c6efb45 EKF: Eliminate use of power function to square numbers
Use of the power function to square a number can be very inefficient depending on processor and compiler. Replace with an inlined function  that multiplies the number by itself. This has not been put into the maths library because the use of the sq() function is peculiar to the autocode generated for the EKF and an inlined function was desired.
2016-02-08 11:11:59 +11:00
Paul Riseborough
42a943b37e EKF: Fix text errors introduced when editing optical flow fusion autocode fragment 2016-02-07 21:49:50 +11:00
Paul Riseborough
f99256286b Merge pull request #40 from PX4/pr-updateOpticalFlowAutoCode
Update EKF Optical Flow Fusion Autocode Fragments
2016-02-07 19:35:38 +11:00
Paul Riseborough
384ce06110 EKF: Add alternative code fragments for optical flow fusion
These fragments were generated using the inbuilt matlab symbolic toolbox autocoder and may be more efficient than the other method
2016-02-07 19:31:13 +11:00
Paul Riseborough
dba462b9f3 EKF: Improve efficiency of optical flow fusion auto generated code fragments 2016-02-07 19:29:49 +11:00
Paul Riseborough
3f81eb7d1b EKF: fix formatting 2016-02-04 17:15:03 +11:00
Paul Riseborough
9bfc11b660 EKF: Use specific position observation noise when flying without GPS
A larger position uncertainty is required when flying without GPS to reduce tilt attitude estimation errors caused by vehicle manoeuvring. This needs to be tuneable to allow optimisation for different use cases (e.g. outdoor vs indoor).
2016-02-03 18:40:32 +11:00
Paul Riseborough
7de1d39ce4 EKF: Improve use of position and velocity observation noise parameters
Fix bug where noise parameters were not being squared when calculating the observation variance.
Use GPS reported speed accuracy to set velocity observation noise and use the parameter to set the minimum.
2016-02-03 18:15:38 +11:00
Paul Riseborough
2b1e8fe910 EKF: Update tuning parameters
Set conservative defaults as a baseline for tuning
Add a missing parameter for magnetometer observation noise.
Correct error in definition of magnetic heading observations noise (previous parameter defined the variance directly, not the noise).
Scale vertical GPS noise to allow for average EPV to EPH ratio.
Update documentation and display names for consistency.
2016-02-03 17:05:45 +11:00
Lorenz Meier
b21a49b3f9 EKF: Use standard C++ initializers 2016-01-31 23:24:36 +01:00
Roman
b749a7557b fixed typos 2016-01-31 21:36:58 +01:00
bugobliterator
d79e12dfa1 EKF: fix code style 2016-01-31 00:12:16 -08:00
bugobliterator
8200ef4d17 EKF: allocate and unallocate buffer more robustly 2016-01-31 00:12:16 -08:00
bugobliterator
c6249a2825 EKF: change estimator base class name to estimation interface 2016-01-31 00:12:07 -08:00
bugobliterator
3cafedd4c1 EKF: start storing samples only when ekf is initialised 2016-01-30 12:46:01 -08:00
bugobliterator
b062bd2e38 EKF: move estimator specific variables to estimator core 2016-01-30 12:45:23 -08:00
bugobliterator
287f5eb0c2 EKF: move all estimator specific types to common header 2016-01-30 12:44:19 -08:00
bugobliterator
b05e2d825c EKF: move estimator specific initialisations to estimator core 2016-01-30 12:42:24 -08:00
Paul Riseborough
f1b82057c0 EKF: Combine GPS velocity innovation gate parameters
Separate vertical and horizontal parameters for GPS velocity innovation gates are not required
2016-01-30 12:21:50 -08:00
Paul Riseborough
466a104534 EKF: additional GPS check logic
Improve naming of NED origin initialisation status
Add check for GPS solution type
Use GPS checks when regaining GPs in-flight
2016-01-30 12:21:39 -08:00
bugobliterator
a779d45cd0 ekf2: fix bug causing faulty imu data storage 2016-01-29 23:56:24 -08:00
bugobliterator
92dc41e885 EKF: fix typo in function declaration 2016-01-29 20:05:07 -08:00
bugobliterator
3eea6cdcc5 EKF: use namespace for structure definitions
will be moved to a separate file in the future
2016-01-29 20:04:21 -08:00
bugobliterator
001d621eb1 EKF: move imu data processing code to estimator core 2016-01-29 20:03:25 -08:00
bugobliterator
251996d387 ekf: move gps checks to Ekf library from estimator_base 2016-01-29 17:15:18 -08:00
Paul Riseborough
46b0e9654c Add filter control logic 2016-01-30 09:01:48 +11:00
Paul Riseborough
9236f11c80 EKF: Add position and velocity innovation consistency checks 2016-01-28 16:33:54 +11:00
Paul Riseborough
7713cc8c20 Merge pull request #17 from priseborough/pr-addMagErrHandling
EKF: Add magnetometer fusion error handling
2016-01-28 13:43:57 +11:00
Lorenz Meier
f4b2c0eecf Merge pull request #11 from mcharleb/PRIu64-fix
Fixed printf of uint64_t
2016-01-28 01:01:10 +01:00
Paul Riseborough
802129f384 EKF: Add magnetometer fusion error handling 2016-01-28 09:53:55 +11:00
Paul Riseborough
39eef3a2d7 EKF: Remove use of camel case variable names
Also fixes bug in GPS speed accuracy check that was using horizontal position accuracy variable by mistake.
2016-01-28 08:37:45 +11:00
Paul Riseborough
cc50d26601 EKF: Update comments 2016-01-28 08:13:38 +11:00
Paul Riseborough
4526cb9c4f EKF: remove redundant variable 2016-01-28 07:50:45 +11:00
Paul Riseborough
6326433c47 EKF: Eliminate call to hrt_absolute_time()
This will make the library more portable
2016-01-27 19:04:31 +11:00
Paul Riseborough
94a6644684 Add comprehensive user selectable GPS checks 2016-01-25 13:07:57 +11:00
Roman
8d0022ab1e enable estimator state and innovations data logging 2016-01-22 11:31:14 +01:00
Roman
86df68e404 added interface for parameters 2016-01-22 10:45:03 +01:00
Roman Bapst
9b7afa2600 Merge pull request #12 from nickolasrossi/master
fix buffer overflow in constrain of wind velocity
2016-01-20 07:27:00 +01:00
nickolasrossi
dfbbd36ff7 fix buffer overflow in constrain of wind velocity 2016-01-19 18:25:22 -08:00
Mark Charlebois
79bf35c4b3 Fixed printf of uint64_t
Must use PRIu64 to prevent compiler errors.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-01-18 22:19:10 -08:00
Roman Bapst
2c80614e20 Merge pull request #10 from PX4/delta_ang_bias_fix
fix delta angle bias usage:
2016-01-14 17:10:47 +01:00
Roman
0b5c90574c fix delta angle bias usage:
the delta angle bias was applied to imu data which was not coming in the same
time intervall as the filter was operating. Therefore, the delta angle bias
applied to new imu data had to be scaled correctly in order to match
the imu time interval.
2016-01-14 17:06:02 +01:00
Roman Bapst
749156d4aa Merge pull request #7 from PX4/ekf2_fixes
Ekf2 fixes
2016-01-08 07:09:01 +01:00
Roman
2af5856361 initialise output height with baro 2016-01-08 06:59:10 +01:00
Roman
a41f75ffb1 use full mag fusion 2016-01-08 06:59:10 +01:00
Roman
f8354bb5e9 - do not fake vertical gps measurement as we have baro
- formatting

Conflicts:
	EKF/ekf.cpp
2016-01-08 06:59:10 +01:00
Roman
2a88fc6cfd initialise vertical position correctly 2016-01-08 06:42:22 +01:00
Roman
5aa5f7f8c3 use correct timestamp for measurements 2016-01-08 06:42:03 +01:00
Lorenz Meier
b542e2b49b Merge pull request #6 from mcharleb/hexagon_support
Added hexagon support
2016-01-08 00:37:32 +01:00
Mark Charlebois
b8837b4dc6 Added hexagon support
std::to_string is not supported in the Hexagon complier

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-01-07 14:54:55 -08:00
Lorenz Meier
b457709bd9 Merge pull request #4 from PX4/paul-wip
EKF: Fix 'Dizzy on Startup' behaviour
2016-01-03 02:00:23 +01:00
Paul Riseborough
edfb7aefcc EKF: Fix initial alignment errors
Use the gravity vector to estimate the initial roll and pitch angle
Use the projection of the magnetic field measurement onto the earth axis horizontal plane to calculate the initial heading
2016-01-03 00:03:03 +11:00
Lorenz Meier
52cb9d02c7 EKF: Initialize all local structs and variables 2016-01-01 12:31:36 +01:00
Lorenz Meier
7537c966f9 Merge pull request #3 from PX4/paul-wip
Enable use of POSCTL mode with EKF2
2016-01-01 11:41:14 +01:00
Paul Riseborough
0cb210d045 EKF: Changes required to enter POSCTL mode 2016-01-01 11:56:38 +11:00
Lorenz Meier
eda69e727f Do not print states by default 2015-12-24 13:48:22 +01:00
Lorenz Meier
ec0189bb3c Update README 2015-12-24 13:47:02 +01:00
Lorenz Meier
101bcdc4e1 Ignore system and temp files 2015-12-24 13:46:52 +01:00
Lorenz Meier
e2e93ca100 Update README 2015-12-24 10:25:31 +01:00
Roman
457a57c6ff use simple heading fusion 2015-12-22 18:00:59 +01:00
Lorenz Meier
6b49e2495c Fix field initializers 2015-12-22 17:25:08 +01:00
Lorenz Meier
8894786752 Estimator base: Fix printf formatting 2015-12-22 17:24:58 +01:00
Lorenz Meier
faf48242ed EKF: Fix ringbuffer warnings 2015-12-22 17:24:43 +01:00
Roman
5e5d6f432a added static gps mode and init mag state correctly 2015-12-22 11:22:17 +01:00
Lorenz Meier
21fa17c948 Fix field initializers 2015-12-21 18:56:15 +01:00
Lorenz Meier
e8273208d7 EKF: Remove excessive verbosity 2015-12-21 11:52:05 +01:00
Lorenz Meier
0da1aa54af Ignore system and temp files 2015-12-21 11:29:57 +01:00
Lorenz Meier
155ba9f796 Estimator base: Fix printf formatting 2015-12-21 11:27:11 +01:00
Lorenz Meier
2a6e48332d EKF: Fix ringbuffer warnings 2015-12-21 11:26:50 +01:00
Roman
f153a7cb44 added ifdef guard 2015-12-19 09:40:32 +01:00
Roman
772c1bf981 compile fw wheel controller code 2015-12-19 09:38:10 +01:00
Roman
3c7705b3f9 checked out attitude fw folder from master 2015-12-19 09:37:40 +01:00
Roman
d009118437 set stack size for ecl 2015-12-19 09:16:17 +01:00
Roman
dd171670ca checked out validation code from master 2015-12-19 08:53:08 +01:00
Roman Bapst
c58d1df7bc fixed cmake file 2015-12-10 16:49:42 +01:00
Roman Bapst
d233ca3990 added complementary filter for real time state estimation 2015-12-10 16:36:10 +01:00
Roman Bapst
67646a15b0 added full mag fusion 2015-12-10 09:07:00 +01:00
Roman
8de8b0eb76 prediction and vel pos heading fusion working 2015-12-09 17:47:52 +01:00
Roman
921df43d32 added tests for EKF ringbuffer 2015-12-07 22:41:11 +01:00
Roman
d90c8fd7c2 fixed bug in covariance prediction 2015-12-07 22:41:11 +01:00
Roman
cfc39bc2f9 implemented prediction of states and covariance matrix 2015-12-07 22:41:11 +01:00
Roman
16eb3b0e96 cmake: added new files for compilation 2015-12-07 22:41:11 +01:00
Roman
b52e38eb9d fix 2015-12-07 22:41:11 +01:00
Roman
cd5db8f494 enhance ringbuffer 2015-12-06 17:07:44 +01:00
Roman
b3491bcfc3 added file with ekf helper functions 2015-12-06 13:19:25 +01:00
Roman
859502753d added file with covariance calculations 2015-12-06 13:10:49 +01:00
Roman Bapst
144aa9c461 added base class for data storage 2015-12-05 11:08:06 +01:00
Paul Riseborough
83079e0e11 Inertial Nav EKF: add notes on use of generated code 2015-11-04 17:05:23 +11:00
Paul Riseborough
b92c99073e Update read 2015-11-03 12:29:55 +11:00
Paul Riseborough
06e9d73268 Add derivation script files for inertial nav EKF 2015-11-03 12:24:43 +11:00
Paul Riseborough
b3bd09d5b9 Rename directory 2015-11-03 12:24:25 +11:00
Paul Riseborough
af6a196187 Add generated code for 24 state Nav Filter 2015-11-03 12:17:02 +11:00
Lorenz Meier
363b7d8c36 Adding blank folders and instructions 2015-10-27 11:12:05 +01:00
Lorenz Meier
e5743d503c Initial import 2015-10-26 16:06:30 +01:00
Lorenz Meier
86fb72d3a3 Initial commit 2015-10-26 15:41:25 +01:00
1078 changed files with 100890 additions and 7069 deletions

View File

@ -9,10 +9,10 @@ pipeline {
script {
def build_nodes = [:]
def docker_images = [
armhf: "px4io/px4-dev-armhf:2021-04-29",
arm64: "px4io/px4-dev-aarch64:2021-04-29",
base: "px4io/px4-dev-base-bionic:2021-04-29",
nuttx: "px4io/px4-dev-nuttx-focal:2021-04-29",
armhf: "px4io/px4-dev-armhf:2021-05-04",
arm64: "px4io/px4-dev-aarch64:2021-05-04",
base: "px4io/px4-dev-base-bionic:2021-05-04",
nuttx: "px4io/px4-dev-nuttx-focal:2021-05-04",
snapdragon: "lorenzmeier/px4-dev-snapdragon:2020-04-01"
]
@ -133,7 +133,7 @@ pipeline {
// TODO: actually upload artifacts to S3
// stage('S3 Upload') {
// agent {
// docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
// docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
// }
// options {
// skipDefaultCheckout()

View File

@ -12,7 +12,7 @@ pipeline {
stage("build cubepilot_cubeorange_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -86,7 +86,7 @@ pipeline {
stage("build cuav_x7pro_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -159,7 +159,7 @@ pipeline {
stage("build px4_fmu-v3_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -232,7 +232,7 @@ pipeline {
stage("build px4_fmu-v4_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -305,7 +305,7 @@ pipeline {
stage("build px4_fmu-v4pro_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -378,7 +378,7 @@ pipeline {
stage("build px4_fmu-v5_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -451,7 +451,7 @@ pipeline {
stage("build px4_fmu-v5_debug") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -528,7 +528,7 @@ pipeline {
stage("build px4_fmu-v5_optimized") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -601,7 +601,7 @@ pipeline {
stage("build px4_fmu-v5_stackcheck") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -678,7 +678,7 @@ pipeline {
stage("build modalai_fc-v1_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -746,86 +746,12 @@ pipeline {
}
}
stage("holybro_durandal-v1_test") {
stages {
stage("build holybro_durandal-v1_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
steps {
checkout scm
sh 'export'
sh 'make distclean'
sh 'ccache -s'
sh 'git fetch --tags'
sh 'make holybro_durandal-v1_test'
sh 'make sizes'
sh 'ccache -s'
stash includes: 'build/*/*.elf, platforms/nuttx/Debug/upload_jlink_gdb.sh, Tools/HIL/*.py', name: 'holybro_durandal-v1_test'
}
post {
always {
sh 'make distclean'
}
}
} // stage build
stage("test") {
agent {
label 'holybro_durandal-v1'
}
stages {
stage("flash") {
steps {
sh 'export'
sh 'find /dev/serial'
unstash 'holybro_durandal-v1_test'
// flash board and watch bootup
sh './platforms/nuttx/Debug/upload_jlink_gdb.sh build/holybro_durandal-v1_test/holybro_durandal-v1_test.elf && ./Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-*` --baudrate 57600'
}
}
stage("configure") {
steps {
// configure
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 4001"' // generic quadcopter
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show"'
}
}
stage("status") {
steps {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "dshot status"'
statusFTDI()
}
}
stage("tests") {
steps {
// run tests
sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-*`'
}
}
stage("reset") {
steps {
cleanupFTDI()
}
}
}
} // stage test
}
}
stage("nxp_fmuk66-v3_test") {
stages {
stage("build nxp_fmuk66-v3_test") {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}

View File

@ -2,7 +2,7 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/cpp
{
"name": "px4-dev-nuttx",
"image": "px4io/px4-dev-nuttx-focal:2021-04-29",
"image": "px4io/px4-dev-nuttx-focal:2021-05-04",
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

View File

@ -23,12 +23,13 @@ jobs:
"shellcheck_all",
"NO_NINJA_BUILD=1 px4_fmu-v5_default",
"NO_NINJA_BUILD=1 px4_sitl_default",
"BUILD_MICRORTPS_AGENT=1 px4_sitl_rtps",
"airframe_metadata",
"module_documentation",
"parameters_metadata",
]
container:
image: px4io/px4-dev-nuttx-focal:2021-04-29
image: px4io/px4-dev-nuttx-focal:2021-05-04
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v1

View File

@ -11,7 +11,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: px4io/px4-dev-clang:2021-04-29
container: px4io/px4-dev-clang:2021-05-04
steps:
- uses: actions/checkout@v1
with:

View File

@ -11,7 +11,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: px4io/px4-dev-armhf:2021-04-29
container: px4io/px4-dev-armhf:2021-05-04
strategy:
matrix:
config: [

View File

@ -11,7 +11,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: px4io/px4-dev-aarch64:2021-04-29
container: px4io/px4-dev-aarch64:2021-05-04
strategy:
matrix:
config: [

View File

@ -11,7 +11,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: px4io/px4-dev-nuttx-focal:2021-04-29
container: px4io/px4-dev-nuttx-focal:2021-05-04
strategy:
matrix:
config: [

View File

@ -11,7 +11,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: px4io/px4-dev-nuttx-focal:2021-04-29
container: px4io/px4-dev-nuttx-focal:2021-05-04
strategy:
matrix:
config: [

View File

@ -23,7 +23,7 @@ jobs:
needs: enumerate_targets
strategy:
matrix: ${{fromJson(needs.enumerate_targets.outputs.matrix)}}
container: px4io/px4-dev-${{ matrix.container }}:2021-04-29
container: px4io/px4-dev-${{ matrix.container }}:2021-05-04
steps:
- uses: actions/checkout@v1
with:
@ -56,13 +56,13 @@ jobs:
- name: ccache post-run
run: ccache -s
- name: parameter metadata
- name: parameter & events metadata
run: |
make ${{matrix.target}} ver_gen
make ${{matrix.target}} ver_gen events_json
./src/lib/version/get_git_tag_or_branch_version.sh build/${{ matrix.target }} >> $GITHUB_ENV
cd build/${{ matrix.target }}
mkdir _metadata || true
cp parameters.* _metadata
cp parameters.* events/*.xz _metadata
- uses: jakejarvis/s3-sync-action@master
with:

View File

@ -0,0 +1,20 @@
name: EKF Change Indicator
on: pull_request
jobs:
unit_tests:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v2.3.1
- name: checkout newest version of branch
run: |
git fetch origin pull/${{github.event.pull_request.number}}/head:${{github.head_ref}}
git checkout ${GITHUB_HEAD_REF}
- name: main test
run: cd ${GITHUB_WORKSPACE}/src/lib/ecl; make test
working-directory: src/lib/ecl
- name: Check if there is a functional change
run: git diff --exit-code
working-directory: src/lib/ecl/test/change_indication

View File

@ -0,0 +1,56 @@
name: EKF Build Tests
on:
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
Linux-GCC:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v1
- name: main build
run: make
working-directory: src/lib/ecl
- name: clean build
run: make clean
working-directory: src/lib/ecl
- name: main test
run: make test
working-directory: src/lib/ecl
Linux-Clang:
runs-on: ubuntu-latest
container: px4io/px4-dev-clang:2021-05-04
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v1
- name: main build
run: make
working-directory: src/lib/ecl
- name: clean build
run: make clean
working-directory: src/lib/ecl
- name: main test
run: make test
working-directory: src/lib/ecl
Mac-OS:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: main build
run: make
working-directory: src/lib/ecl
- name: clean build
run: make clean
working-directory: src/lib/ecl
- name: main test
run: make test
working-directory: src/lib/ecl

View File

@ -0,0 +1,27 @@
name: EKF Update Change Indicator
on: push
jobs:
unit_tests:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-05-04
env:
GIT_COMMITTER_EMAIL: bot@px4.io
GIT_COMMITTER_NAME: PX4BuildBot
steps:
- uses: actions/checkout@v2.3.1
- name: main test updates change indication files
run: cd ${GITHUB_WORKSPACE}/src/lib/ecl; make test
- name: Check if there exists diff and save result in variable
run: echo "CHANGE_INDICATED=$(git diff --exit-code --output=/dev/null || echo $?)" >> $GITHUB_ENV
working-directory: src/lib/ecl/test/change_indication
- name: auto-commit any changes to change indication
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[AUTO COMMIT] update change indication'
commit_user_name: ${GIT_COMMITTER_NAME}
commit_user_email: ${GIT_COMMITTER_EMAIL}
- if: ${{env.CHANGE_INDICATED}}
name: if there is a functional change, fail check
run: exit 1

View File

@ -25,7 +25,7 @@ jobs:
#- {vehicle: "tiltrotor", mission: "VTOL_mission_1", build_type: "RelWithDebInfo"}
container:
image: px4io/px4-dev-ros-melodic:2021-04-29
image: px4io/px4-dev-ros-melodic:2021-05-04
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v1

View File

@ -20,7 +20,7 @@ jobs:
#- {test_file: "mavros_posix_tests_offboard_rpyrt_ctl.test", vehicle: "iris", build_type: "RelWithDebInfo"}
container:
image: px4io/px4-dev-ros-melodic:2021-04-29
image: px4io/px4-dev-ros-melodic:2021-05-04
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v1

View File

@ -11,7 +11,7 @@ jobs:
airframe:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-04-29
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v1
with:
@ -20,13 +20,24 @@ jobs:
- name: airframe metadata
run: |
make airframe_metadata
./src/lib/version/get_git_tag_or_branch_version.sh build/px4_sitl_default >> $GITHUB_ENV
cd build/px4_sitl_default/docs
ls -ls *
# TODO: deploy to userguide gitbook and s3
# TODO: deploy to userguide gitbook
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: 'px4-travis'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-1'
SOURCE_DIR: 'build/px4_sitl_default/docs/'
DEST_DIR: 'Firmware/${{ env.version }}/_general/'
module:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-04-29
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v1
with:
@ -41,7 +52,7 @@ jobs:
parameter:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-04-29
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v1
with:
@ -63,9 +74,36 @@ jobs:
SOURCE_DIR: 'build/px4_sitl_default/docs/'
DEST_DIR: 'Firmware/${{ env.version }}/_general/'
events:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v1
with:
token: ${{ secrets.ACCESS_TOKEN }}
- name: events metadata
run: |
make extract_events
./src/lib/version/get_git_tag_or_branch_version.sh build/px4_sitl_default >> $GITHUB_ENV
cd build/px4_sitl_default
mkdir _events_full || true
cp events/all_events_full.json.xz _events_full/all_events.json.xz
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: 'px4-travis'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-1'
SOURCE_DIR: 'build/px4_sitl_default/_events_full/'
DEST_DIR: 'Firmware/${{ env.version }}/_general/'
uorb_graph:
runs-on: ubuntu-latest
container: px4io/px4-dev-nuttx-focal:2021-04-29
container: px4io/px4-dev-nuttx-focal:2021-05-04
steps:
- uses: actions/checkout@v1
with:
@ -80,7 +118,7 @@ jobs:
micrortps_agent:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-04-29
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v1
with:
@ -94,7 +132,7 @@ jobs:
ROS_msgs:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-04-29
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v1
with:
@ -107,7 +145,7 @@ jobs:
ROS2_bridge:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-04-29
container: px4io/px4-dev-base-focal:2021-05-04
steps:
- uses: actions/checkout@v1
with:

View File

@ -18,7 +18,7 @@ jobs:
- name: Install Python3
run: sudo apt-get install python3 python3-setuptools python3-pip -y
- name: Install tools
run: pip3 install --user mypy flake8
run: pip3 install --user mypy types-requests flake8
- name: Check MAVSDK test scripts with mypy
run: $HOME/.local/bin/mypy --strict test/mavsdk_tests/*.py
- name: Check MAVSDK test scripts with flake8

View File

@ -15,12 +15,13 @@ jobs:
fail-fast: false
matrix:
config:
- {latitude: "59.617693", longitude: "-151.145316", altitude: "48", build_type: "RelWithDebInfo", model: "iris" } # Alaska
- {latitude: "-38.071235", longitude: "145.281220", altitude: "31", build_type: "RelWithDebInfo", model: "standard_vtol" } # Australia
- {latitude: "29.660316", longitude: "-82.316658", altitude: "30", build_type: "RelWithDebInfo", model: "tailsitter" } # Florida
- {latitude: "47.397742", longitude: "8.545594", altitude: "488", build_type: "Coverage", model: "standard_vtol" } # Zurich
- {latitude: "59.617693", longitude: "-151.145316", altitude: "48", build_type: "RelWithDebInfo", model: "iris" } # Alaska
- {latitude: "-38.071235", longitude: "145.281220", altitude: "31", build_type: "AddressSanitizer", model: "standard_vtol" } # Australia
- {latitude: "29.660316", longitude: "-82.316658", altitude: "30", build_type: "RelWithDebInfo", model: "tailsitter" } # Florida
- {latitude: "47.397742", longitude: "8.545594", altitude: "488", build_type: "Coverage", model: "standard_vtol" } # Zurich
container:
image: px4io/px4-dev-simulation-focal:2021-04-29
image: px4io/px4-dev-simulation-focal:2021-05-04
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v1

2
.gitignore vendored
View File

@ -108,3 +108,5 @@ src/systemcmds/topic_listener/listener_generated.cpp
# SITL
dataman
eeprom/
!src/drivers/distance_sensor/broadcom/afbrs50/Lib/*

11
.gitmodules vendored
View File

@ -18,10 +18,6 @@
path = src/lib/matrix
url = https://github.com/PX4/PX4-Matrix.git
branch = master
[submodule "src/lib/ecl"]
path = src/lib/ecl
url = https://github.com/PX4/PX4-ECL.git
branch = master
[submodule "boards/atlflight/cmake_hexagon"]
path = boards/atlflight/cmake_hexagon
url = https://github.com/PX4/cmake_hexagon.git
@ -67,3 +63,10 @@
path = src/drivers/uavcan_v1/legacy_data_types
url = https://github.com/PX4/public_regulated_data_types.git
branch = legacy
[submodule "src/lib/crypto/monocypher"]
path = src/lib/crypto/monocypher
url = https://github.com/PX4/Monocypher.git
branch = px4
[submodule "src/lib/events/libevents"]
path = src/lib/events/libevents
url = https://github.com/mavlink/libevents.git

View File

@ -6,6 +6,16 @@ CONFIG:
buildType: RelWithDebInfo
settings:
CONFIG: px4_sitl_default
px4_sitl_asan:
short: px4_sitl (AddressSanitizer)
buildType: AddressSanitizer
settings:
CONFIG: px4_sitl_default
px4_sitl_ubsan:
short: px4_sitl (UndefinedBehaviorSanitizer)
buildType: UndefinedBehaviorSanitizer
settings:
CONFIG: px4_sitl_default
px4_sitl_replay:
short: px4_sitl_replay
buildType: RelWithDebInfo
@ -51,6 +61,16 @@ CONFIG:
buildType: MinSizeRel
settings:
CONFIG: px4_fmu-v5x_default
px4_fmu-v6x_default:
short: px4_fmu-v6x
buildType: MinSizeRel
settings:
CONFIG: px4_fmu-v6x_default
px4_fmu-v6x_bootloader:
short: px4_fmu-v6x_bootloader
buildType: MinSizeRel
settings:
CONFIG: px4_fmu-v6x_bootloader
airmind_mindpx-v2_default:
short: airmind_mindpx-v2
buildType: MinSizeRel

View File

@ -129,6 +129,10 @@ define_property(GLOBAL PROPERTY PX4_MODULE_PATHS
BRIEF_DOCS "PX4 module paths"
FULL_DOCS "List of paths to all PX4 modules"
)
define_property(GLOBAL PROPERTY PX4_SRC_FILES
BRIEF_DOCS "src files from all PX4 modules & libs"
FULL_DOCS "SRC files from px4_add_{module,library}"
)
#=============================================================================
# configuration
@ -417,6 +421,9 @@ foreach(module ${config_module_list})
add_subdirectory(src/${module})
endforeach()
# add events lib after modules and libs as it needs to know all source files (PX4_SRC_FILES)
add_subdirectory(src/lib/events EXCLUDE_FROM_ALL)
# must be the last module before firmware
add_subdirectory(src/lib/parameters EXCLUDE_FROM_ALL)
target_link_libraries(parameters_interface INTERFACE parameters)

24
Jenkinsfile vendored
View File

@ -15,7 +15,7 @@ pipeline {
// stage('Catkin build on ROS workspace') {
// agent {
// docker {
// image 'px4io/px4-dev-ros-melodic:2021-04-29'
// image 'px4io/px4-dev-ros-melodic:2021-05-04'
// args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE'
// }
// }
@ -56,7 +56,7 @@ pipeline {
stage('Colcon build on ROS2 workspace') {
agent {
docker {
image 'px4io/px4-dev-ros2-foxy:2021-04-29'
image 'px4io/px4-dev-ros2-foxy:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE'
}
}
@ -85,7 +85,7 @@ pipeline {
stage('Airframe') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh 'make distclean'
@ -105,7 +105,7 @@ pipeline {
stage('Parameter') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh 'make distclean'
@ -125,7 +125,7 @@ pipeline {
stage('Module') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh 'make distclean'
@ -146,7 +146,7 @@ pipeline {
stage('uORB graphs') {
agent {
docker {
image 'px4io/px4-dev-nuttx-focal:2021-04-29'
image 'px4io/px4-dev-nuttx-focal:2021-05-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
@ -176,7 +176,7 @@ pipeline {
stage('Userguide') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh('export')
@ -206,7 +206,7 @@ pipeline {
stage('QGroundControl') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh('export')
@ -234,7 +234,7 @@ pipeline {
stage('microRTPS agent') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh('export')
@ -264,7 +264,7 @@ pipeline {
stage('PX4 ROS msgs') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh('export')
@ -293,7 +293,7 @@ pipeline {
stage('PX4 ROS2 bridge') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh('export')
@ -336,7 +336,7 @@ pipeline {
stage('S3') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-04-29' }
docker { image 'px4io/px4-dev-base-focal:2021-05-04' }
}
steps {
sh('export')

View File

@ -63,7 +63,7 @@ all: px4_sitl_default
space := $(subst ,, )
define make_list
$(shell cat .github/workflows/compile_${1}.yml | sed -E 's|[[:space:]]+(.*),|check_\1|g' | grep check_${2})
$(shell [ -f .github/workflows/compile_${1}.yml ] && cat .github/workflows/compile_${1}.yml | sed -E 's|[[:space:]]+(.*),|check_\1|g' | grep check_${2})
endef
# Parsing
@ -165,6 +165,11 @@ ifdef PYTHON_EXECUTABLE
CMAKE_ARGS += -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
endif
# Check if the microRTPS agent is to be built
ifdef BUILD_MICRORTPS_AGENT
CMAKE_ARGS += -DBUILD_MICRORTPS_AGENT=ON
endif
# Functions
# --------------------------------------------------------------------
# describe how to build a cmake config
@ -274,7 +279,6 @@ misc_qgc_extra_firmware: \
check_bitcraze_crazyflie_default \
check_bitcraze_crazyflie21_default \
check_airmind_mindpx-v2_default \
check_px4_fmu-v2_lpe \
sizes
# builds with RTPS
@ -315,18 +319,21 @@ coverity_scan: px4_sitl_default
# Documentation
# --------------------------------------------------------------------
.PHONY: parameters_metadata airframe_metadata module_documentation px4_metadata doxygen
.PHONY: parameters_metadata airframe_metadata module_documentation extract_events px4_metadata doxygen
parameters_metadata:
@$(MAKE) --no-print-directory px4_sitl_default metadata_parameters ver_gen
airframe_metadata:
@$(MAKE) --no-print-directory px4_sitl_default metadata_airframes
@$(MAKE) --no-print-directory px4_sitl_default metadata_airframes ver_gen
module_documentation:
@$(MAKE) --no-print-directory px4_sitl_default metadata_module_documentation
px4_metadata: parameters_metadata airframe_metadata module_documentation
extract_events:
@$(MAKE) --no-print-directory px4_sitl_default metadata_extract_events ver_gen
px4_metadata: parameters_metadata airframe_metadata module_documentation extract_events
doxygen:
@mkdir -p "$(SRC_DIR)"/build/doxygen

View File

@ -110,7 +110,7 @@ This repository contains code supporting Pixhawk standard boards (best supported
* [Hex Cube Yellow](https://docs.px4.io/master/en/flight_controller/cubepilot_cube_yellow.html)
* [Airmind MindPX V2.8](http://www.mindpx.net/assets/accessories/UserGuide_MindPX.pdf)
* [Airmind MindRacer V1.2](http://mindpx.net/assets/accessories/mindracer_user_guide_v1.2.pdf)
* [Bitcraze Crazyflie 2.0](https://docs.px4.io/master/en/flight_controller/crazyflie2.html)
* [Bitcraze Crazyflie 2.0](https://docs.px4.io/master/en/complete_vehicles/crazyflie2.html)
* [Omnibus F4 SD](https://docs.px4.io/master/en/flight_controller/omnibus_f4_sd.html)
* [Holybro Kakute F7](https://docs.px4.io/master/en/flight_controller/kakutef7.html)
* [Raspberry PI with Navio 2](https://docs.px4.io/master/en/flight_controller/raspberry_pi_navio2.html)

View File

@ -1,8 +0,0 @@
#!/bin/sh
#
# @name 3DR Iris Quadrotor SITL (RTPS)
#
# @type Quadrotor Wide
#
. ${R}etc/init.d-posix/airframes/10016_iris

View File

@ -1,4 +0,0 @@
#!/bin/sh
# shellcheck disable=SC2154
micrortps_client start -t UDP -r $((2019+2*px4_instance)) -s $((2020+2*px4_instance))

View File

@ -0,0 +1,54 @@
#!/bin/sh
#
# @name Plane SITL
#
. ${R}etc/init.d/rc.fw_defaults
param set-default EKF2_ARSP_THR 8
param set-default EKF2_FUSE_BETA 1
param set-default EKF2_MAG_ACCLIM 0
param set-default EKF2_MAG_YAWLIM 0
param set-default FW_LND_AIRSPD_SC 1
param set-default FW_LND_ANG 8
param set-default FW_THR_LND_MAX 0
param set-default FW_L1_PERIOD 12
param set-default FW_MAN_P_MAX 30
param set-default FW_PR_I 0.4
param set-default FW_PR_P 0.9
param set-default FW_PR_FF 0.2
param set-default FW_PSP_OFF 2
param set-default FW_P_LIM_MAX 32
param set-default FW_P_LIM_MIN -15
param set-default FW_RR_FF 0.1
param set-default FW_RR_P 0.3
param set-default FW_THR_MAX 0.6
param set-default FW_THR_MIN 0.05
param set-default FW_THR_CRUISE 0.25
param set-default FW_T_ALT_TC 2
param set-default FW_T_CLMB_MAX 8
param set-default FW_T_HRATE_FF 0.5
param set-default FW_T_SINK_MAX 2.7
param set-default FW_T_SINK_MIN 2.2
param set-default FW_T_TAS_TC 2
param set-default FW_W_EN 1
param set-default MIS_LTRMIN_ALT 30
param set-default MIS_TAKEOFF_ALT 30
param set-default NAV_ACC_RAD 15
param set-default NAV_DLL_ACT 2
param set-default NAV_LOITER_RAD 50
param set-default RWTO_TKOFF 1
set MIXER_FILE etc/mixers-sitl/plane_sitl.main.mix
set MIXER custom

View File

@ -46,8 +46,6 @@ px4_add_romfs_files(
1014_solo
1015_iris_obs_avoid
1015_iris_obs_avoid.post
1016_iris_rtps
1016_iris_rtps.post
1017_iris_opt_flow_mockup
1018_iris_vision_velocity
1019_iris_dual_gps
@ -62,6 +60,7 @@ px4_add_romfs_files(
1034_rascal-electric
1035_techpod
1036_malolo
1037_believer
1040_standard_vtol
1041_tailsitter
1042_tiltrotor

View File

@ -48,10 +48,10 @@ else
# shellcheck disable=SC2012
REQUESTED_AUTOSTART=$(ls "${R}etc/init.d-posix/airframes" | sed -n 's/^\([0-9][0-9]*\)_'${PX4_SIM_MODEL}'$/\1/p')
if [ -z "$REQUESTED_AUTOSTART" ]; then
echo "Error: Unknown model $PX4_SIM_MODEL (not found by name on ${R}etc/init.d-posix/airframes)"
echo "ERROR [init] Unknown model $PX4_SIM_MODEL (not found by name on ${R}etc/init.d-posix/airframes)"
exit 1
else
echo "Info: found model autostart file as SYS_AUTOSTART=$REQUESTED_AUTOSTART"
echo "INFO [init] found model autostart file as SYS_AUTOSTART=$REQUESTED_AUTOSTART"
fi
fi
@ -126,7 +126,7 @@ then
param set SYS_RESTART_TYPE 2
fi
param set-default BAT_N_CELLS 4
param set-default BAT1_N_CELLS 4
param set-default CBRK_AIRSPD_CHK 0
param set-default CBRK_SUPPLY_CHK 894281
@ -225,6 +225,12 @@ sensors start
commander start
navigator start
# Try to start the micrortps_client with UDP transport if module exists
if px4-micrortps_client status > /dev/null 2>&1
then
# shellcheck disable=SC2154
micrortps_client start -t UDP -r $((2019+2*px4_instance)) -s $((2020+2*px4_instance))
fi
if param greater -s MNT_MODE_IN -1
then

View File

@ -13,12 +13,13 @@
# @output MAIN6 gear
#
# @maintainer Lorenz Meier <lorenz@px4.io>
# @board px4_fmu-v2 exclude
#
. ${R}etc/init.d/rc.fw_defaults
param set-default BAT_N_CELLS 3
param set-default BAT1_N_CELLS 3
param set-default FW_AIRSPD_MAX 20
param set-default FW_AIRSPD_MIN 12

View File

@ -38,8 +38,9 @@ param set-default MC_YAWRATE_P 0.25
param set-default MC_YAWRATE_I 0.25
param set-default MC_YAWRATE_D 0
param set-default BAT_V_DIV 12.27559
param set-default BAT_A_PER_V 15.39103
param set-default BAT1_V_DIV 12.27559
param set-default BAT1_A_PER_V 15.39103
set MIXER quad_w
set PWM_OUT 1234

View File

@ -26,7 +26,7 @@
. ${R}etc/init.d/rc.mc_defaults
param set-default BAT_N_CELLS 4
param set-default BAT1_N_CELLS 4
param set-default MC_ROLL_P 7
param set-default MC_ROLLRATE_P 0.13

View File

@ -26,8 +26,8 @@
. ${R}etc/init.d/rc.mc_defaults
param set-default BAT_N_CELLS 6
param set-default BAT_V_EMPTY 3.5
param set-default BAT1_N_CELLS 6
param set-default BAT1_V_EMPTY 3.5
param set-default MC_ROLL_P 7
param set-default MC_ROLLRATE_P 0.08
@ -45,6 +45,7 @@ param set-default MC_YAWRATE_D 0
param set-default MPC_XY_VEL_MAX 2
param set-default PWM_MAIN_MIN 1080
set MIXER quad_w
set PWM_OUT 1234

View File

@ -6,6 +6,7 @@
# @class Copter
#
# @maintainer Lorenz Meier <lorenz@px4.io>
# @board px4_fmu-v2 exclude
#
. ${R}etc/init.d/rc.mc_defaults

View File

@ -14,7 +14,7 @@
. ${R}etc/init.d/rc.vtol_defaults
param set-default BAT_N_CELLS 3
param set-default BAT1_N_CELLS 3
param set-default COM_RC_IN_MODE 1

View File

@ -44,7 +44,8 @@ param set-default MPC_HOLD_MAX_XY 0.25
param set-default MPC_THR_MIN 0.15
param set-default MPC_Z_VEL_MAX_DN 2
param set-default BAT_N_CELLS 4
param set-default BAT1_N_CELLS 4
set MIXER octo_cox_w
set PWM_OUT 12345678

View File

@ -23,9 +23,9 @@
. ${R}etc/init.d/rc.vtol_defaults
param set-default BAT_CAPACITY 23000
param set-default BAT_N_CELLS 4
param set-default BAT_R_INTERNAL 0.0025
param set-default BAT1_CAPACITY 23000
param set-default BAT1_N_CELLS 4
param set-default BAT1_R_INTERNAL 0.0025
param set-default CBRK_AIRSPD_CHK 162128
param set-default CBRK_IO_SAFETY 22027

View File

@ -23,8 +23,7 @@
. ${R}etc/init.d/rc.vtol_defaults
param set-default BAT_N_CELLS 6
param set-default BAT1_N_CELLS 6
param set-default FW_AIRSPD_MAX 30
param set-default FW_AIRSPD_MIN 19
@ -71,7 +70,6 @@ param set-default MPC_JERK_AUTO 4
param set-default MPC_LAND_SPEED 1
param set-default MPC_MAN_TILT_MAX 25
param set-default MPC_MAN_Y_MAX 40
param set-default MPC_POS_MODE 3
param set-default MPC_SPOOLUP_TIME 1.5
param set-default MPC_THR_HOVER 0.45
param set-default MPC_TILTMAX_AIR 25

View File

@ -13,6 +13,7 @@
# @maintainer Trent Lukaczyk <aerialhedgehog@gmail.com>
#
# @board bitcraze_crazyflie exclude
# @board px4_fmu-v2 exclude
#
. ${R}etc/init.d/rc.mc_defaults

View File

@ -13,6 +13,7 @@
# @maintainer Trent Lukaczyk <aerialhedgehog@gmail.com>
#
# @board bitcraze_crazyflie exclude
# @board px4_fmu-v2 exclude
#
. ${R}etc/init.d/rc.mc_defaults

View File

@ -26,8 +26,8 @@
. ${R}etc/init.d/rc.fw_defaults
param set-default BAT_CAPACITY 2500
param set-default BAT_N_CELLS 3
param set-default BAT1_CAPACITY 2500
param set-default BAT1_N_CELLS 3
param set-default PWM_AUX_RATE 50
param set-default PWM_MAIN_RATE 50
@ -46,5 +46,6 @@ param set-default FW_R_LIM 40
param set-default FW_P_LIM_MAX 25
param set-default FW_P_LIM_MIN -5
param set-default FW_P_RMAX_NEG 20
set MIXER TF-AutoG2
set MIXER_AUX pass

View File

@ -48,8 +48,7 @@ param set-default PWM_MAIN_DISARM 1000
# the payload bay is pitched up about 7 degrees
param set-default SENS_BOARD_Y_OFF 7
set MIXER phantom
set MIXER fw_generic_wing
# Provide ESC a constant 1000 us pulse
set PWM_OUT 4

View File

@ -23,7 +23,7 @@
. ${R}etc/init.d/rc.fw_defaults
param set-default BAT_N_CELLS 2
param set-default BAT1_N_CELLS 2
param set-default FW_AIRSPD_MAX 15
param set-default FW_AIRSPD_MIN 10
param set-default FW_AIRSPD_TRIM 13
@ -48,7 +48,7 @@ param set-default PWM_MAIN_DISARM 1000
set MAV_TYPE 1
# Set mixer.
set MIXER wingwing
set MIXER fw_generic_wing
# Provide ESC a constant 1000 us pulse.
set PWM_OUT 4

View File

@ -27,5 +27,4 @@ param set-default FW_AIRSPD_TRIM 15
param set-default NAV_LOITER_RAD 150
set MIXER FX79
set MIXER fw_generic_wing

View File

@ -49,8 +49,7 @@ param set-default PWM_MAIN_DISARM 1000
# the payload bay is pitched up about 7 degrees
param set-default SENS_BOARD_Y_OFF 11.9
set MIXER phantom
set MIXER fw_generic_wing
# Provide ESC a constant 1000 us pulse
set PWM_OUT 4

View File

@ -63,6 +63,6 @@ param set-default PWM_MAIN_REV2 1
param set-default PWM_MAIN_MIN 900
param set-default PWM_MAIN_MAX 2100
set MIXER fw_generic_wing
set MIXER caipi
set PWM_OUT 1234

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# @name Lumenier QAV-R (raceblade) 5" arms
# @name Lumenier QAV-R (raceblade) 5inch arms
#
# @type Quadrotor x
# @class Copter

View File

@ -127,9 +127,9 @@ param set-default IMU_GYRO_CUTOFF 100
param set-default SENS_EN_PMW3901 1
# Power Parameters
param set-default BAT_N_CELLS 4
param set-default BAT_A_PER_V 36.364
param set-default BAT_V_DIV 18.182
param set-default BAT1_N_CELLS 4
param set-default BAT1_A_PER_V 36.364
param set-default BAT1_V_DIV 18.182
# Circuit breakers
param set-default CBRK_IO_SAFETY 22027

View File

@ -1,38 +0,0 @@
#!/bin/sh
#
# @name Hobbyking Micro PCB
#
# @type Quadrotor x
# @class Copter
#
# @maintainer Thomas Gubler <thomas@px4.io>
#
# @board px4_fmu-v2 exclude
# @board px4_fmu-v3 exclude
# @board px4_fmu-v4 exclude
# @board px4_fmu-v4pro exclude
# @board px4_fmu-v5 exclude
# @board px4_fmu-v5x exclude
# @board bitcraze_crazyflie exclude
#
. ${R}etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
param set-default MC_ROLL_P 7
param set-default MC_ROLLRATE_P 0.1
param set-default MC_ROLLRATE_I 0.05
param set-default MC_ROLLRATE_D 0.003
param set-default MC_PITCH_P 7
param set-default MC_PITCHRATE_P 0.1
param set-default MC_PITCHRATE_I 0.05
param set-default MC_PITCHRATE_D 0.003
param set-default MC_YAW_P 2.8
param set-default MC_YAWRATE_P 0.2
param set-default MC_YAWRATE_I 0.1
param set-default MC_YAWRATE_D 0
param set-default PWM_MAIN_MIN 1200

View File

@ -54,7 +54,7 @@ param set-default DSHOT_CONFIG 600
param set-default SYS_HAS_BARO 0
param set-default SYS_HAS_MAG 0
param set-default BAT_N_CELLS 2
param set-default BAT1_N_CELLS 2
# The Whoop uses reversed props
set MIXER quad_h
set PWM_OUT 1234

View File

@ -20,7 +20,7 @@ set PWM_OUT 1234
# The set does not include a battery, but most people will probably use 4S
param set-default BAT_N_CELLS 4
param set-default BAT1_N_CELLS 4
param set-default IMU_GYRO_CUTOFF 120
param set-default IMU_DGYRO_CUTOFF 45

View File

@ -17,7 +17,7 @@ set MIXER quad_x
set PWM_OUT 1234
param set-default BAT_N_CELLS 4
param set-default BAT1_N_CELLS 4
param set-default GPS_1_CONFIG 0
param set-default RC_PORT_CONFIG 201

View File

@ -17,7 +17,7 @@ set MIXER quad_x
set PWM_OUT 1234
param set-default BAT_N_CELLS 6
param set-default BAT1_N_CELLS 6
param set-default MC_ROLL_P 6.5
param set-default MC_ROLLRATE_P 0.05

View File

@ -92,10 +92,10 @@ param set-default MPC_TKO_RAMP_T 1
param set-default MPC_TKO_SPEED 1.1
param set-default MPC_VEL_MANUAL 3
param set-default BAT_SOURCE 0
param set-default BAT_N_CELLS 4
param set-default BAT_V_DIV 10.14
param set-default BAT_A_PER_V 18.18
param set-default BAT1_SOURCE 0
param set-default BAT1_N_CELLS 4
param set-default BAT1_V_DIV 10.14
param set-default BAT1_A_PER_V 18.18
#param set CBRK_IO_SAFETY 22027
param set-default COM_DISARM_LAND 2

View File

@ -73,7 +73,7 @@ param set-default PWM_MAIN_RATE 0
param set-default SENS_BOARD_ROT 2
param set-default BAT_SOURCE 0
param set-default BAT1_SOURCE 0
param set-default CBRK_IO_SAFETY 22027
#param set COM_DISARM_LAND 3

View File

@ -102,10 +102,10 @@ param set-default MPC_TKO_RAMP_T 1
param set-default MPC_TKO_SPEED 1.1
param set-default MPC_VEL_MANUAL 3
param set-default BAT_SOURCE 0
param set-default BAT_N_CELLS 4
param set-default BAT_V_DIV 10.14
param set-default BAT_A_PER_V 18.18
param set-default BAT1_SOURCE 0
param set-default BAT1_N_CELLS 4
param set-default BAT1_V_DIV 10.14
param set-default BAT1_A_PER_V 18.18
#param set CBRK_IO_SAFETY 22027
param set-default COM_DISARM_LAND 2

View File

@ -21,7 +21,7 @@ set MIXER quad_x
set PWM_OUT 1234
param set-default BAT_N_CELLS 1
param set-default BAT1_N_CELLS 1
param set-default MC_ROLL_P 8
param set-default MC_ROLLRATE_P 0.19

View File

@ -32,17 +32,18 @@ set PWM_OUT 1234
param reset_all SYS_AUTOSTART SYS_AUTOCONFIG RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* CAL_MAG* SENS_BOARD* EKF2_MAGBIAS*
# battery
param set-default BAT_CAPACITY 2750
param set-default BAT_CRIT_THR 0.15
param set-default BAT_EMERGEN_THR 0.075
param set-default BAT_LOW_THR 0.20
param set-default BAT_N_CELLS 4
param set-default BAT_R_INTERNAL 0.06
param set-default BAT_SOURCE 1
param set-default BAT_V_CHARGED 4.15
param set-default BAT_V_DIV 11.1625
param set-default BAT_V_EMPTY 3.65
param set-default BAT_V_OFFS_CURR -0.0045
param set-default BAT1_CAPACITY 2750
param set-default BAT1_N_CELLS 4
param set-default BAT1_R_INTERNAL 0.06
param set-default BAT1_SOURCE 1
param set-default BAT1_V_CHARGED 4.15
param set-default BAT1_V_DIV 11.1625
param set-default BAT1_V_EMPTY 3.65
param set-default BAT1_V_OFFS_CURR -0.0045
# sensor calibration
param set-default CAL_MAG_SIDES 63

View File

@ -19,9 +19,9 @@
set MIXER quad_x_cw
set PWM_OUT 1234
param set-default BAT_N_CELLS 1
param set-default BAT_CAPACITY 240
param set-default BAT_SOURCE 1
param set-default BAT1_N_CELLS 1
param set-default BAT1_CAPACITY 240
param set-default BAT1_SOURCE 1
param set-default CBRK_SUPPLY_CHK 894281
param set-default CBRK_USB_CHK 197848

View File

@ -16,7 +16,7 @@
. ${R}etc/init.d/rc.rover_defaults
param set-default BAT_N_CELLS 2
param set-default BAT1_N_CELLS 2
param set-default EKF2_ANGERR_INIT 0.01
param set-default EKF2_GBIAS_INIT 0.01

View File

@ -2,7 +2,7 @@
#
# @name Aion Robotics R1 UGV
#
# @url http://docs.aionrobotics.com/en/latest/r1-ugv.html
# @url https://www.aionrobotics.com/r1
#
# @type Rover
# @class Rover
@ -19,7 +19,7 @@
. ${R}etc/init.d/rc.rover_defaults
param set-default BAT_N_CELLS 4
param set-default BAT1_N_CELLS 4
param set-default EKF2_GBIAS_INIT 0.01
param set-default EKF2_ANGERR_INIT 0.01

View File

@ -21,7 +21,7 @@
. ${R}etc/init.d/rc.rover_defaults
param set-default BAT_N_CELLS 2
param set-default BAT1_N_CELLS 2
param set-default EKF2_GBIAS_INIT 0.01
param set-default EKF2_ANGERR_INIT 0.01

View File

@ -116,9 +116,9 @@ param set-default COM_DISARM_LAND 3
param set-default PWM_MAIN_RATE 0
# Battery
param set-default BAT_SOURCE 0
param set-default BAT_N_CELLS 4
param set-default BAT_V_DIV 10.133
param set-default BAT1_SOURCE 0
param set-default BAT1_N_CELLS 4
param set-default BAT1_V_DIV 10.133
# TELEM1 ttyS1
param set-default MAV_0_CONFIG 101

View File

@ -71,7 +71,6 @@ px4_add_romfs_files(
4016_holybro_px4vision
4017_nxp_hovergames
4018_s500_ctrlalloc
4020_hk_micro_pcb
4030_3dr_solo
4031_3dr_quad
4040_reaper

View File

@ -226,6 +226,8 @@ then
fi
fi
param set PWM_AUX_OUT ${PWM_AUX_OUT}
if [ $MIXER_AUX != none -a $AUX_MODE = none -a -e $OUTPUT_AUX_DEV ]
then
#
@ -268,6 +270,8 @@ then
fi
fi
param set PWM_MAIN_OUT ${PWM_OUT}
if [ $EXTRA_MIXER_MODE != none ]
then

View File

@ -26,6 +26,12 @@ then
batt_smbus start -X
fi
# Start batmon driver if enabled using BATMON_DRIVER_EN
if param compare -s BATMON_DRIVER_EN 1
then
batmon start -X #start on external bus
fi
# Sensors on the PWM interface bank
if param compare -s SENS_EN_LL40LS 1
then
@ -111,7 +117,14 @@ fi
# ADIS16448 spi external IMU
if param compare -s SENS_EN_ADIS164X 1
then
adis16448 -S start
if param compare -s SENS_OR_ADIS164X 0
then
adis16448 -S start
fi
if param compare -s SENS_OR_ADIS164X 4
then
adis16448 -S start -R 4
fi
fi
# probe for optional external I2C devices

View File

@ -81,33 +81,6 @@ then
hardfault_log reset
fi
fi
# Prevent MacOS and Ubuntu from creating unnecessary temporary files on the microSD card
# block MacOS Spotlight indexing (.Spotlight-V100 folder)
if [ ! -f "/fs/microsd/.metadata_never_index" ]; then
cat > /fs/microsd/.metadata_never_index
fi
# block MacOS trashes
if [ ! -f "/fs/microsd/.Trashes" ]; then
cat > /fs/microsd/.Trashes
fi
# block MacOS logging of filesystem events
if [ ! -d "/fs/microsd/.fseventsd" ]; then
mkdir /fs/microsd/.fseventsd
fi
if [ ! -f "/fs/microsd/.fseventsd/no_log" ]; then
cat > /fs/microsd/.fseventsd/no_log
fi
# block Ubuntu trash
if [ ! -f "/fs/microsd/.Trash-1000" ]; then
cat > /fs/microsd/.Trash-1000
fi
else
# tune SD_INIT
set STARTUP_TUNE 14 # tune 14 = SD_INIT
@ -404,21 +377,30 @@ else
if param greater -s TRIG_MODE 0
then
# We ONLY support trigger on pins 5+6 or 7+8 when simultanously using AUX for actuator output.
if param compare TRIG_PINS 56
if param compare TRIG_PINS_EX 0
then
# clear pins 5 and 6
set FMU_MODE pwm4
set AUX_MODE pwm4
else
if param compare TRIG_PINS 78
# We ONLY support trigger on pins 5+6 or 7+8 when simultanously using AUX for actuator output.
if param compare TRIG_PINS 56
then
# clear pins 7 and 8
set FMU_MODE pwm6
set AUX_MODE pwm6
# clear pins 5 and 6
set FMU_MODE pwm4
set AUX_MODE pwm4
else
set FMU_MODE none
set AUX_MODE none
if param compare TRIG_PINS 78
then
# clear pins 7 and 8
set FMU_MODE pwm6
set AUX_MODE pwm6
else
set FMU_MODE none
set AUX_MODE none
fi
fi
else
if param compare TRIG_PINS_EX 12288
then
set FMU_MODE pwm12
set AUX_MODE pwm12
fi
fi

View File

@ -39,7 +39,6 @@ px4_add_romfs_files(
AETRFG.main.mix
babyshark.main.mix
blade130.main.mix
caipi.main.mix
CCPM.main.mix
claire.aux.mix
claire.main.mix
@ -53,7 +52,6 @@ px4_add_romfs_files(
firefly6.aux.mix
firefly6.main.mix
fw_generic_wing.main.mix
FX79.main.mix
generic_diff_rover.main.mix
hexa_cox.main.mix
hexa_+.main.mix
@ -66,7 +64,6 @@ px4_add_romfs_files(
octo_+.main.mix
octo_x.main.mix
pass.aux.mix
phantom.main.mix
quad_dc.main.mix
quad_h.main.mix
quad_+.main.mix
@ -94,5 +91,4 @@ px4_add_romfs_files(
vtol_convergence.main.mix
vtol_delta.aux.mix
vtol_tailsitter_duo.main.mix
wingwing.main.mix
)

View File

@ -1,50 +0,0 @@
FX-79 Delta-wing mixer for PX4FMU
=================================
Designed for FX-79.
TODO (sjwilks): Add mixers for flaps.
This file defines mixers suitable for controlling a delta wing aircraft using
PX4FMU. The configuration assumes the elevon servos are connected to PX4FMU
servo outputs 0 and 1 and the motor speed control to output 3. Output 2 is
assumed to be unused.
Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0
(roll), 1 (pitch) and 3 (thrust).
See the README for more information on the scaler format.
Elevon mixers
-------------
Three scalers total (output, roll, pitch).
On the assumption that the two elevon servos are physically reversed, the pitch
input is inverted between the two servos.
The scaling factor for roll inputs is adjusted to implement differential travel
for the elevons.
M: 2
S: 0 0 8500 8500 0 -10000 10000
S: 0 1 9500 9500 0 -10000 10000
M: 2
S: 0 0 8500 8500 0 -10000 10000
S: 0 1 -9500 -9500 0 -10000 10000
Output 2
--------
This mixer is empty.
Z:
Motor speed mixer
-----------------
Two scalers total (output, thrust).
This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1)
range. Inputs below zero are treated as zero.
M: 1
S: 0 3 0 20000 -10000 -10000 10000

View File

@ -2,6 +2,7 @@
# 1-4 (main): Ailerons (Y-cable), A-tail left, Pusher, A-tail right
# 5-8 (main): quad motors
#=============================
# @board px4_fmu-v2 exclude
Aileron mixer (roll)

View File

@ -1,48 +0,0 @@
Delta-wing mixer
===========================
Designed for TBS Caipirinha
This file defines mixers suitable for controlling a delta wing aircraft using
PX4FMU. The configuration assumes the elevon servos are connected to PX4FMU
servo outputs 0 and 1 and the motor speed control to output 3. Output 2 is
assumed to be unused.
Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0
(roll), 1 (pitch) and 3 (thrust).
See the README for more information on the scaler format.
Elevon mixers
-------------
Three scalers total (output, roll, pitch).
On the assumption that the two elevon servos are physically reversed, the pitch
input is inverted between the two servos.
The scaling factor for roll inputs is adjusted to implement differential travel
for the elevons.
M: 2
S: 0 0 8000 8000 0 -10000 10000
S: 0 1 9000 9000 0 -10000 10000
M: 2
S: 0 0 8000 8000 0 -10000 10000
S: 0 1 -9000 -9000 0 -10000 10000
Output 2
--------
This mixer is empty.
Z:
Motor speed mixer
-----------------
Two scalers total (output, thrust).
This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1)
range. Inputs below zero are treated as zero.
M: 1
S: 0 3 0 20000 -10000 -10000 10000

View File

@ -1,6 +1,8 @@
Thrust tilt/ Starboard Thrust / Port Thrust / Tail Thrust mixer for PX4FMU
=======================================================
# @board px4_fmu-v2 exclude
This file defines mixers suitable for controlling an airship with
a thrust tilt, starboard and port thruster and a tail thruster using PX4FMU.
The configuration assumes the starboard thruster is connected to PX4FMU

View File

@ -1,5 +1,6 @@
# DeltaQuad mixer for PX4FMU
#=============================
# @board px4_fmu-v2 exclude
Quad motors 1 - 4
-------------

View File

@ -1,3 +1,4 @@
# Dodeca Cox
# @board px4_fmu-v2 exclude
R: 6a

View File

@ -1,3 +1,4 @@
# Dodeca Cox
# @board px4_fmu-v2 exclude
R: 6m

View File

@ -1,6 +1,8 @@
# mixer for the FireFly6 tilt mechansim servo, elevons and landing gear
=======================================================================
# @board px4_fmu-v2 exclude
Tilt mechanism servo mixer
---------------------------
M: 1

View File

@ -1,4 +1,6 @@
# FireFly6 mixer for PX4FMU
#
#===========================
# @board px4_fmu-v2 exclude
R: 6c

View File

@ -1,3 +1,4 @@
# @board px4_fmu-v2 exclude
# Roll channel for mount
M: 1

View File

@ -1,45 +0,0 @@
Phantom FX-61 mixer
===================
This file defines mixers suitable for controlling a delta wing aircraft using
PX4/Pixhawk. The configuration assumes the elevon servos are connected to
servo outputs 0 and 1 and the motor speed control to output 3. Output 2 is
assumed to be unused.
Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0
(roll), 1 (pitch) and 3 (thrust).
See the README for more information on the scaler format.
Elevon mixers
-------------
Three scalers total (output, roll, pitch).
On the assumption that the two elevon servos are physically reversed, the pitch
input is inverted between the two servos.
The scaling factor are set so that pitch will have more travel than roll.
M: 2
S: 0 0 -6000 -6000 0 -10000 10000
S: 0 1 6500 6500 0 -10000 10000
M: 2
S: 0 0 -6000 -6000 0 -10000 10000
S: 0 1 -6500 -6500 0 -10000 10000
Output 2
--------
This mixer is empty.
Z:
Motor speed mixer
-----------------
Two scalers total (output, thrust).
This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1)
range. Inputs below zero are treated as zero.
M: 1
S: 0 3 0 20000 -10000 -10000 10000

View File

@ -1,6 +1,8 @@
Tilt-Quadrotor mixer for PX4FMU (2/2) V2
===========================
# @board px4_fmu-v2 exclude
This file defines the aux outputs mixer for a Tilt-quadrotor in the + configuration.
# @output AUX1 Outer servo motor for rotor 2 arm

View File

@ -1,6 +1,8 @@
Tilt-Quadrotor mixer for PX4FMU (1/2) V2
===========================
# @board px4_fmu-v2 exclude
This file defines the main outputs mixer for a Tilt-quadrotor in the + configuration.
# @output MAIN1 motor 1

View File

@ -1,3 +1,5 @@
# @board px4_fmu-v2 exclude
# Motor 1
M: 3
S: 0 2 -4000 -4000 0 -4000 +4000

View File

@ -1,6 +1,8 @@
Mixer for an AAERT VTOL
=======================
# @board px4_fmu-v2 exclude
Aileron 1 mixer
---------------
M: 1

View File

@ -1,6 +1,8 @@
Aileron/v-tail/throttle VTOL mixer for PX4FMU
=======================================================
# @board px4_fmu-v2 exclude
This file defines mixers suitable for controlling a fixed wing aircraft with
aileron, v-tail (rudder, elevator) and throttle using PX4FMU.
The configuration assumes the aileron servos are connected to PX4FMU

View File

@ -1,5 +1,7 @@
# Generic quadplane tiltrotor servo mixer
# @board px4_fmu-v2 exclude
# Tilt mechanism servo mixer
---------------------------
# front left up:2000 down:1000

View File

@ -1,4 +1,5 @@
# E-flite Convergence Tricopter Y-Configuration Mixer
# @board px4_fmu-v2 exclude
# Motors
R: 3y

View File

@ -1,48 +0,0 @@
Delta-wing mixer for PX4FMU
===========================
Designed for Wing Wing Z-84
This file defines mixers suitable for controlling a delta wing aircraft using
PX4FMU. The configuration assumes the elevon servos are connected to PX4FMU
servo outputs 0 and 1 and the motor speed control to output 3. Output 2 is
assumed to be unused.
Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0
(roll), 1 (pitch) and 3 (thrust).
See the README for more information on the scaler format.
Elevon mixers
-------------
Three scalers total (output, roll, pitch).
On the assumption that the two elevon servos are physically reversed, the pitch
input is inverted between the two servos.
The scaling factor for roll inputs is adjusted to implement differential travel
for the elevons.
M: 2
S: 0 0 -6000 -6000 0 -10000 10000
S: 0 1 6500 6500 0 -10000 10000
M: 2
S: 0 0 -6000 -6000 0 -10000 10000
S: 0 1 -6500 -6500 0 -10000 10000
Output 2
--------
This mixer is empty.
Z:
Motor speed mixer
-----------------
Two scalers total (output, thrust).
This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1)
range. Inputs below zero are treated as zero.
M: 1
S: 0 3 0 20000 -10000 -10000 10000

View File

@ -16,10 +16,12 @@ exec find boards msg src platforms test \
-path src/drivers/uavcannode_gps_demo/libcanard -prune -o \
-path src/drivers/uavcan/uavcan_drivers/kinetis/driver/include/uavcan_kinetis -prune -o \
-path src/lib/ecl -prune -o \
-path src/lib/events/libevents -prune -o \
-path src/lib/matrix -prune -o \
-path src/lib/parameters/uthash -prune -o \
-path src/modules/gyro_fft/CMSIS_5 -prune -o \
-path src/modules/micrortps_bridge/micro-CDR -prune -o \
-path src/modules/micrortps_bridge/microRTPS_client -prune -o \
-path test/mavsdk_tests/catch2 -prune -o \
-path src/lib/crypto/monocypher -prune -o \
-type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) | grep $PATTERN

15
Tools/build_micrortps_agent.sh Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
SCRIPT_DIR=$0
if [[ ${SCRIPT_DIR:0:1} != '/' ]]; then
SCRIPT_DIR=$(dirname $(realpath -s "$PWD/$0"))
fi
PX4_DIR=$(cd "$(dirname $(dirname $SCRIPT_DIR))" && pwd)
if [ -d $PX4_DIR/build/*_rtps ]; then
cd $PX4_DIR/build/*_rtps/src/modules/micrortps_bridge/micrortps_agent/
cmake -Bbuild
cmake --build build -j$(nproc --all)
fi

20
Tools/compress.py Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env python
import argparse
import lzma
parser = argparse.ArgumentParser(description="""Compress a file with xz""")
parser.add_argument('filename', metavar='file', help='Input file (output: file.xz)')
args = parser.parse_args()
filename = args.filename
def save_compressed(filename):
#create xz compressed version
xz_filename=filename+'.xz'
with lzma.open(xz_filename, 'wt', preset=9) as f:
with open(filename, 'r') as content_file:
f.write(content_file.read())
save_compressed(filename)

View File

@ -81,7 +81,8 @@ def sign(bin_file_path, key_file_path=None, generated_key_file=None):
# Align to 4 bytes. Signature always starts at
# 4 byte aligned address, but the signee size
# might not be aligned
signee_bin += bytearray(b'\xff')*(4-len(signee_bin)%4)
if len(signee_bin)%4 != 0:
signee_bin += bytearray(b'\xff')*(4-len(signee_bin)%4)
try:
with open(key_file_path,mode='r') as f:
@ -133,7 +134,7 @@ if(__name__ == "__main__"):
parser.add_argument("signee", help=".bin file to add signature", nargs='?', default=None)
parser.add_argument("signed", help="signed output .bin", nargs='?', default=None)
parser.add_argument("--key", help="key.json file", default="Tools/test_keys.json")
parser.add_argument("--key", help="key.json file", default="Tools/test_keys/test_keys.json")
parser.add_argument("--rdct", help="binary R&D certificate file", default=None)
parser.add_argument("--genkey", help="new generated key", default=None)
args = parser.parse_args()
@ -152,7 +153,7 @@ if(__name__ == "__main__"):
sys.exit(1)
# Issue a warning when signing with testing key
if args.key=='Tools/test_keys.json':
if args.key=='Tools/test_keys/test_keys.json':
print("WARNING: Signing with PX4 test key")
# Sign the binary

View File

@ -4,7 +4,7 @@ if [ -z ${PX4_DOCKER_REPO+x} ]; then
echo "guessing PX4_DOCKER_REPO based on input";
if [[ $@ =~ .*px4_fmu.* ]]; then
# nuttx-px4fmu-v{1,2,3,4,5}
PX4_DOCKER_REPO="px4io/px4-dev-nuttx-focal:2021-04-29"
PX4_DOCKER_REPO="px4io/px4-dev-nuttx-focal:2021-05-04"
elif [[ $@ =~ .*navio2.* ]] || [[ $@ =~ .*raspberry.* ]] || [[ $@ =~ .*beaglebone.* ]] || [[ $@ =~ .*pilotpi.default ]]; then
# beaglebone_blue_default, emlid_navio2_default, px4_raspberrypi_default, scumaker_pilotpi_default
PX4_DOCKER_REPO="px4io/px4-dev-armhf:2021-02-04"
@ -30,7 +30,7 @@ fi
# otherwise default to nuttx
if [ -z ${PX4_DOCKER_REPO+x} ]; then
PX4_DOCKER_REPO="px4io/px4-dev-nuttx-focal:2021-04-29"
PX4_DOCKER_REPO="px4io/px4-dev-nuttx-focal:2021-05-04"
fi
# docker hygiene

View File

@ -20,7 +20,7 @@ function spawn_model() {
X=${X:=0.0}
Y=${Y:=$((3*${N}))}
SUPPORTED_MODELS=("iris" "iris_rtps" "plane" "standard_vtol" "rover" "r1_rover" "typhoon_h480")
SUPPORTED_MODELS=("iris" "plane" "standard_vtol" "rover" "r1_rover" "typhoon_h480")
if [[ " ${SUPPORTED_MODELS[*]} " != *"$MODEL"* ]];
then
echo "ERROR: Currently only vehicle model $MODEL is not supported!"

View File

@ -12,6 +12,7 @@ import sys, select
import termios
from timeit import default_timer as timer
from argparse import ArgumentParser
import os
try:
from pymavlink import mavutil
@ -135,15 +136,20 @@ def main():
mav_serialport.write('\n') # make sure the shell is started
# setup the console, so we can read one char at a time
# disable echo & avoid buffering on stdin
fd_in = sys.stdin.fileno()
old_attr = termios.tcgetattr(fd_in)
new_attr = termios.tcgetattr(fd_in)
new_attr[3] = new_attr[3] & ~termios.ECHO # lflags
new_attr[3] = new_attr[3] & ~termios.ICANON
try:
old_attr = termios.tcgetattr(fd_in)
new_attr = termios.tcgetattr(fd_in)
new_attr[3] = new_attr[3] & ~termios.ECHO # lflags
new_attr[3] = new_attr[3] & ~termios.ICANON
termios.tcsetattr(fd_in, termios.TCSANOW, new_attr)
except termios.error:
# tcgetattr can fail if stdin is not a tty
old_attr = None
ubuf_stdin = os.fdopen(fd_in, 'rb', buffering=0)
try:
termios.tcsetattr(fd_in, termios.TCSANOW, new_attr)
cur_line = ''
command_history = []
cur_history_index = 0
@ -156,11 +162,19 @@ def main():
next_heartbeat_time = timer()
while True:
quit_time = None
while quit_time is None or quit_time > timer():
while True:
i, o, e = select.select([sys.stdin], [], [], 0)
i, o, e = select.select([ubuf_stdin], [], [], 0)
if not i: break
ch = sys.stdin.read(1)
ch = ubuf_stdin.read(1).decode('utf8')
if len(ch) == 0: # EOF
if quit_time is None:
# run a bit longer to read the response (we could also
# read until we get a prompt)
quit_time = timer() + 1
break
# provide a simple shell with command history
if ch == '\n':
@ -182,8 +196,8 @@ def main():
cur_line = cur_line[:-1]
sys.stdout.write(ch)
elif ord(ch) == 27:
ch = sys.stdin.read(1) # skip one
ch = sys.stdin.read(1)
ch = ubuf_stdin.read(1).decode('utf8') # skip one
ch = ubuf_stdin.read(1).decode('utf8')
if ch == 'A': # arrow up
if cur_history_index > 0:
cur_history_index -= 1
@ -223,7 +237,8 @@ def main():
mav_serialport.close()
finally:
termios.tcsetattr(fd_in, termios.TCSADRAIN, old_attr)
if old_attr:
termios.tcsetattr(fd_in, termios.TCSADRAIN, old_attr)
if __name__ == '__main__':

View File

@ -6,7 +6,7 @@ import html
class MarkdownTablesOutput():
def __init__(self, groups, board, image_path):
result = ("# Airframes Reference\n"
"> **Note** **This list is [auto-generated](https://github.com/PX4/Firmware/edit/master/Tools/px4airframes/markdownout.py) from the source code**.\n"
"> **Note** **This list is [auto-generated](https://github.com/PX4/PX4-Autopilot/blob/master/Tools/px4airframes/markdownout.py) from the source code**.\n"
"> \n"
"> **AUX** channels may not be present on some flight controllers.\n"
"> If present, PWM AUX channels are commonly labelled **AUX OUT**.\n"

View File

@ -0,0 +1,58 @@
import codecs
import json
import sys
import os
class JsonOutput():
def __init__(self, groups):
all_json = {}
all_json['version'] = 1
component = {}
all_json['components'] = {1: component} #1: autopilot component
all_events = {}
component['namespace'] = "px4"
component['event_groups'] = all_events
for group in groups:
current_group = {}
current_events = {}
current_group['events'] = current_events
all_events[group] = current_group
for e in groups[group]:
event_obj = {}
event_obj['name'] = e.name
event_obj['message'] = e.message
if e.description is not None:
event_obj['description'] = e.description
args = []
for i in range(len(e.arguments)):
arg = {}
arg['type'] = e.arguments[i][0]
arg['name'] = e.arguments[i][1]
args.append(arg)
if len(args) > 0:
event_obj['arguments'] = args
sub_id = e.sub_id
assert sub_id not in current_events, \
"Duplicate event ID for {0} (message: '{1}'), other event message: '{2}'".format(
e.name, e.message, current_events[sub_id]['message'])
current_events[sub_id] = event_obj
self.json = all_json
def save(self, filename):
need_to_write = True
# only write if current file is not the same, to avoid updating the file
# timestamp
if os.path.isfile(filename):
with open(filename, 'rb') as json_file:
existing_data = json.load(json_file)
if existing_data == self.json:
need_to_write = False
if need_to_write:
with codecs.open(filename, 'w', 'utf-8') as f:
f.write(json.dumps(self.json,indent=2))

View File

@ -0,0 +1,308 @@
import sys
import re
import math
def hash_32_fnv1a(data: str):
hash_val = 0x811c9dc5
prime = 0x1000193
for i in range(len(data)):
value = ord(data[i])
hash_val = hash_val ^ value
hash_val *= prime
hash_val &= 0xffffffff
return hash_val
class Event(object):
"""
Single event definition
"""
def __init__(self):
self.name = None
self.message = None
self.description = None
self.group = "default"
self._arguments = []
@staticmethod
def _get_id(name):
return 0xffffff & hash_32_fnv1a(name)
@property
def arguments(self):
""" list of (type: str, name: str) tuples """
return self._arguments
def set_default_arguments(self, num_args):
""" set argument names to default (if not specified) """
for i in range(num_args):
self.add_argument(None, "arg"+str(i))
def _shift_printed_arguments(self, msg, offset):
""" shift all {<idx> arguments by an offset """
i = 0
while i < len(msg):
if msg[i] == '\\': # escaped character
i += 2
continue
if msg[i] == '{':
m = re.match(r"^(\d+)", msg[i+1:])
if m:
arg_idx = int(m.group(1)) + offset
msg = msg[:i+1] + str(arg_idx) + msg[i+1+len(m.group(1)):]
i += 1
return msg
def prepend_arguments(self, arguments):
""" prepend additional arguments, and shift all '{<index>}' in the
description and message
:param arguments: list of (type: str, name: str) tuples
"""
self._arguments = arguments + self._arguments
num_added = len(arguments)
if self.message is not None:
self.message = self._shift_printed_arguments(self.message, num_added)
if self.description is not None:
self.description = self._shift_printed_arguments(self.description, num_added)
def add_argument(self, arg_type, name):
self._arguments.append((arg_type, name))
@property
def sub_id(self):
return self._get_id(self.name)
def validate(self):
if self.name is None: raise Exception("missing event name")
if self.message is None: raise Exception("missing event message for {}".format(self.name))
# just to ensure a common convention
assert self.message[-1] != '.', "Avoid event message ending in '.' ({:})".format(self.message)
# description is optional
class SourceParser(object):
"""
Parses provided data and stores all found events internally.
"""
re_split_lines = re.compile(r'[\r\n]+')
re_comment_start = re.compile(r'^\/\*\s*EVENT$')
re_events_send = re.compile(r'^events::send[<\(]')
re_comment_content = re.compile(r'^\*\s*(.*)')
re_comment_tag = re.compile(r'^@([a-zA-Z][a-zA-Z0-9_]*):?\s*(.*)')
re_comment_end = re.compile(r'(.*?)\s*\*\/$')
re_code_end = re.compile(r'(.*?)\s*;$')
re_template_args = re.compile(r'([a-zA-Z0-9_:\.]+)\s*<([a-zA-Z0-9_,\s:]+)\s*>\s*\((.*)\);$')
re_no_template_args = re.compile(r'([a-zA-Z0-9_:\.]+)\s*\((.*)\);$')
re_event_id = re.compile(r'(events::)?ID\("([a-zA-Z0-9_]+)\"')
def __init__(self):
self._events = {}
@property
def events(self):
""" dict of 'group': [Event] list """
return self._events
def Parse(self, contents):
"""
Incrementally parse program contents and append all found events
to the list.
"""
# This code is essentially a comment-parsing grammar. "state"
# represents parser state. It contains human-readable state
# names.
state = None
def finalize_current_tag(event, tag, value):
if tag is None: return
if tag == "description":
descr = value.strip()
# merge continued lines (but not e.g. enumerations)
for i in range(1, len(descr)-1):
if descr[i-1] != '\n' and descr[i] == '\n' and descr[i+1].isalpha():
descr = descr[:i] + ' ' + descr[i+1:]
event.description = descr
elif tag == "group":
known_groups = ["calibration", "health", "arming_check", "normal"]
event.group = value.strip()
if not event.group in known_groups:
raise Exception("Unknown event group: '{}'\nKnown groups: {}\n" \
"If this is not a typo, add the new group to the script".format(event.group, known_groups))
elif tag.startswith("arg"):
arg_index = int(tag[3:])-1
arg_name = value.strip()
assert len(event.arguments) == arg_index, "Invalid argument ordering/duplicate ({}, {})".format(tag, value)
event.add_argument(None, arg_name)
else:
raise Exception("Invalid tag: {}\nvalue: {}".format(tag, value))
for line in self.re_split_lines.split(contents):
line = line.strip()
# Ignore empty lines
if line == "":
continue
assert not line.startswith("using namespace events;"), "Avoid 'using namespace events;', as it prevents proper events extraction"
# Check for '/* EVENT'
if self.re_comment_start.match(line):
state = "parse-comments"
event = Event()
current_tag = None
current_value = None
current_code = ""
continue
# Check for events::send (allow '/* EVENT' to be optional)
if state is None and self.re_events_send.match(line):
state = "parse-command"
event = Event()
current_tag = None
current_value = None
current_code = ""
if state is None:
assert 'events::ID(' not in line or line.startswith('//'), \
"unmatched 'events::ID(' found in line '{:}'".format(line)
continue
if state == "parse-command":
current_code += line
m = self.re_code_end.search(line)
if m:
# extract template arguments
m = self.re_template_args.search(current_code)
if m:
call, template_args, args = m.group(1, 2, 3)
template_args = template_args.split(',')
else:
m = self.re_no_template_args.search(current_code)
if m:
template_args = []
call, args = m.group(1, 2)
else:
raise Exception("Failed to parse code line {:}".format(current_code))
# if event arguments are not specified, use default naming
if len(event.arguments) == 0:
event.set_default_arguments(len(template_args))
# get argument types from template arguments
assert len(template_args) == len(event.arguments), \
"Number of arguments mismatch (args: {:})".format(template_args)
num_args = len(template_args)
for i in range(num_args):
arg_name = event.arguments[i][1]
arg_type = template_args[i].strip()
if arg_type.startswith('events::'):
arg_type = arg_type[8:]
arg_type = arg_type.replace('enums::', '')
event.arguments[i] = (arg_type, arg_name)
#print("method: {}, args: {}, template args: {}".format(call, args, event.arguments))
ignore_event = False
# extract function arguments
args_split = self._parse_arguments(args)
if call == "events::send" or call == "send":
if len(args_split) == 1:
# This is a send call for a generated event
ignore_event = True
else:
assert len(args_split) == num_args + 3, \
"Unexpected Number of arguments for: {:}, " \
"num template args: {:} (missing template args?)" \
.format(args_split, num_args)
m = self.re_event_id.search(args_split[0])
if m:
_, event_name = m.group(1, 2)
else:
raise Exception("Could not extract event ID from {:}".format(args_split[0]))
event.name = event_name
event.message = args_split[2][1:-1]
elif call in ['reporter.healthFailure', 'reporter.armingCheckFailure']:
assert len(args_split) == num_args + 5, \
"Unexpected Number of arguments for: {:}, {:}".format(args_split, num_args)
m = self.re_event_id.search(args_split[2])
if m:
_, event_name = m.group(1, 2)
else:
raise Exception("Could not extract event ID from {:}".format(args_split[2]))
event.name = event_name
event.message = args_split[4][1:-1]
if 'health' in call:
event.group = "health"
else:
event.group = "arming_check"
event.prepend_arguments([('common::navigation_mode_category_t', 'modes'),
('uint8_t', 'health_component_index')])
else:
raise Exception("unknown event method call: {}, args: {}".format(call, args))
if not ignore_event:
event.validate()
# insert
if not event.group in self._events:
self._events[event.group] = []
self._events[event.group].append(event)
state = None
else: # parse-comments
m = self.re_comment_end.search(line)
if m:
line = m.group(1)
last_comment_line = True
else:
last_comment_line = False
m = self.re_comment_content.match(line)
if m:
comment_content = m.group(1)
m = self.re_comment_tag.match(comment_content)
if m:
finalize_current_tag(event, current_tag, current_value)
current_tag, current_value = m.group(1, 2)
elif current_tag is not None:
current_value += "\n"+comment_content
# else: empty line before any tag
elif not last_comment_line:
# Invalid comment line (inside comment, but not starting with
# "*" or "*/".
raise Exception("Excpected a comment, got '{}'".format(line))
if last_comment_line:
finalize_current_tag(event, current_tag, current_value)
state = "parse-command"
return True
def _parse_arguments(self, args):
"""
given a string of arguments, returns a list of strings split into the
arguments, with respecting brackets.
args is expected to be a single line.
Note: comments are not handled, also template arguments.
e.g. "32, test(4,4), \"e(c\", ab" -> ["32", "test(4,4)", "\"e(c\"", "ab"]
"""
args_split = []
start = 0
bracket = 0
in_string = False
for i in range(len(args)):
if in_string and args[i] == "\"" and args[i-1] != "\\":
in_string = False
elif not in_string and args[i] == "\"":
in_string = True
if in_string:
continue
if args[i] in "{([":
bracket += 1
if args[i] in "})]":
bracket -= 1
if bracket == 0 and args[i] == ',':
args_split.append(args[start:i].strip())
start = i + 1
args_split.append(args[start:].strip())
return args_split

View File

@ -0,0 +1,52 @@
import os
import re
import codecs
import sys
class SourceScanner(object):
"""
Traverses directory tree, reads all source files, and passes their contents
to the Parser.
"""
def ScanDir(self, srcdirs, parser):
"""
Scans provided path and passes all found contents to the parser using
parser.Parse method.
"""
extensions = tuple([".cpp"])
for srcdir in srcdirs:
if os.path.isfile(srcdir):
if not self.ScanFile(srcdir, parser):
return False
else:
for dirname, dirnames, filenames in os.walk(srcdir):
for filename in filenames:
if filename.endswith(extensions):
path = os.path.join(dirname, filename)
try:
if not self.ScanFile(path, parser):
return False
except:
print(("Exception in file %s" % path))
raise
return True
def ScanFile(self, path, parser):
"""
Scans provided file and passes its contents to the parser using
parser.Parse method.
"""
with codecs.open(path, 'r', 'utf-8') as f:
try:
contents = f.read()
except:
contents = ''
print('Failed reading file: %s, skipping content.' % path)
pass
try:
return parser.Parse(contents)
except Exception as e:
print("Exception while parsing file {}".format(path))
raise

View File

@ -28,7 +28,7 @@ available commands, and in most cases `command help` will print the usage.
Since this is generated from source, errors must be reported/fixed
in the [PX4-Autopilot](https://github.com/PX4/PX4-Autopilot) repository.
The documentation pages can be generated by running the following command from
the root of the Firmware directory:
the root of the PX4-Autopilot directory:
```
make module_documentation
```
@ -66,7 +66,7 @@ The generated files will be written to the `modules` directory.
result = ''
for module in module_list:
result += "## %s\n" % module.name()
result += "Source: [%s](https://github.com/PX4/Firmware/tree/master/src/%s)\n\n" % (module.scope(), module.scope())
result += "Source: [%s](https://github.com/PX4/PX4-Autopilot/tree/master/src/%s)\n\n" % (module.scope(), module.scope())
doc = module.documentation()
if len(doc) > 0:
result += "%s\n" % doc

Some files were not shown because too many files have changed in this diff Show More