104 Commits

Author SHA1 Message Date
Thomas Debrunner
8db7a6225b geo: Moved the map_projection_* functions and state into a self-contained C++ class 2021-12-06 14:30:14 +01:00
Thomas Stastny
8defbc8829 update correct airsp scale param string in ekf2 2021-11-25 11:01:04 -05:00
Jukka Laitinen
5dbbddb13f EKF2: Use _distance_sensor_subs vector directly
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-24 09:11:45 +01:00
Jukka Laitinen
d9498ade32 EKF2: Allocate distance sensor subscriptions as member variables
Just create the subscriptions and keep them, instead of
re-creating them continuously

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-24 09:11:45 +01:00
bresch
f751dd2242 FlightTask: set yaw_setpoint to NAN when yaw should not be controlled 2021-11-16 18:09:37 -05:00
Daniel Agar
4e8c234a55 ekf2: only save mag declination if changed 2021-11-16 12:33:48 -05:00
Beat Küng
4ba84d56c9 logger: introduce optional topics
The current practice of adding topics to the default set isn't scalable,
as it affects all setups.
By making sure topics are advertised on init, logger can just discard
topics that don't exist. This does not work for all topics, so topics are
specifically marked as optional. It can be extended to more topics later
on though.

This reduces the list of topics by ~35 on a pixracer configured as quad,
and reduces RAM usage by ~1KB.
2021-11-15 09:02:03 -05:00
Daniel Agar
68026eadeb
save significant IMU bias changes learned by the EKF
* ekf2: make publishing of learned accel biases more robust
* ekf2: reset accel bias if calibration updated
* msg: add separate accel and gyro calibration counters
* ekf2: use separate accel and gyro calibration counters
* ekf2: rework logic to reset biases when calibration counters increment
* sensors: add saving of learned accel biases
* ekf2: generalized saving accel/gyro/mag in flight sensor calibration
* boards: holybro kakutef7 disable systemcmds/perf and systemcmds/top to save flash

Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
2021-11-07 15:34:27 -05:00
bresch
6e8f0e92ff ekf2: refactor airspeed fusion control logic 2021-10-26 10:18:56 +02:00
Shubham Shah
c92cd65831 Update EKF2.cpp 2021-10-09 19:39:43 -04:00
Daniel Agar
06c2d14903 ekf2: multi-mode allow first instance to save EKF2_MAG_DECL 2021-08-19 10:14:35 +02:00
David Sidrane
e8c418caaf EKF:Use inttypes 2021-08-13 14:22:00 -04:00
Daniel Agar
fb4ac0f08c ekf2: remove redundant IMU vibration metrics
- consume IMU vibration metrics from vehicle_imu_status
2021-08-08 06:26:03 -07:00
bresch
01d0b8800e commander: report GNSS yaw fault to user 2021-08-05 11:10:02 +02:00
Daniel Agar
93aa6e3f78 ekf2: baro bias publish minor cleanup
- naming consistency (estimator prefix as "namespace")
 - only publish if baro is available and bias is changing as a small logging optimization
 - avoid unnecessary copying (get const reference to status directly)
 - trivial code style fixes
2021-08-02 13:59:38 -04:00
bresch
54c7e74de3 EKF: add baro bias estimator using GNSS altitude 2021-07-19 16:53:45 -04:00
Daniel Agar
10f4fc7783 ekf2: don't print distance_sensor selection unless there are multiple options 2021-07-19 12:17:12 -04:00
Daniel Agar
0101934f47 ekf2: multi-EKF instance message INFO -> DEBUG 2021-07-18 18:02:33 -04:00
Daniel Agar
eeb73fdbe6 ekf2: resetting IMU bias message INFO -> DEBUG 2021-07-17 10:57:09 -04:00
Paul Riseborough
2d6363e0ef ekf2: Add parameter for propeller momentum drag 2021-07-08 22:19:52 -04:00
David Sidrane
9a423e222b ekf2:Use inttypes and fix types 2021-06-16 17:07:47 +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
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
Daniel Agar
2ccd86102b ekf2: add command line option to manually select instance 2021-06-07 08:47:17 -04:00
Daniel Agar
22838f491a
ekf2: replace mag missed error message with perf count
- this error is primarily useful when significant gaps in magnetometer are present, otherwise the occasional gaps at startup, etc are distracting in regular usage
2021-05-24 20:52:07 -04:00
Julian Oes
29730e30fa ekf2: don't timeout in HITL mode
Otherwise ekf2 might not start if HITL isn't started within 30 seconds.
2021-05-07 22:38:03 -04:00
Beat Küng
38c1ec6a9c ekf2: check if ChangeInstance succeeded 2021-04-27 10:29:09 -04:00
Daniel Agar
2d15c96b9b
ekf2: Multi-EKF let new instance schedule itself immediately on successful init
- this is to minimize missed sensor data (and unnecessary error output) between EKF2 construction and once it actually starts running
2021-04-13 14:24:46 -04:00
Daniel Agar
846695f986 ekf2: replace vehicle_imu lost error message with perf count 2021-03-31 22:07:32 -04:00
Paul Riseborough
4465c4fbf6
ekf2: Publish and log EKF warning and information events (NEW msg estimator_event_flags)
* msg: Add estinator information and warning events message (estimator_event_flags)
 * ekf2: publish information and warning events
 * logger: log estimator_event_flags
 * update ecl submodule to latest

Co-authored-by: Daniel Agar <daniel@agar.ca>
2021-03-07 16:16:48 -05:00
Daniel Agar
263b00b65f
ekf2 support SET_GPS_GLOBAL_ORIGIN and remove globallocalconverter usage
- vehicle_command cmd extended from uint16 to support PX4 internal commands that don't map to mavlink
2021-03-05 18:25:14 -05:00
Daniel Agar
b66a9629e0 ekf2: update to latest ecl with new global origin helpers 2021-02-25 10:43:07 -05:00
Silvan Fuhrer
0ea8104344
select single system-wide wind estimate message (current best)
- publish wind estimate only from EKF, and wind speeds from airspeed selector to new separate topic (airspeed_wind)
 - rename message wind_estimate to wind
 - publish wind from currently used ekf instance (ekf2selector)

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-02-20 13:15:01 -05:00
Daniel Agar
5e188b3cd7 ekf2: populate local_position dist_bottom_sensor_bitfield 2021-02-18 10:37:02 -05:00
Daniel Agar
cff7a01d5e
ekf2: estimator_status log reset counts 2021-02-17 21:16:34 -05:00
Daniel Agar
c3172a91d9 ekf2: try reselecting distance_sensor on timeout 2021-02-12 08:25:27 -05:00
bresch
a399bb9894 ekf2: fix mismatch between ecl and firmware flag definition 2021-02-05 14:30:09 +01:00
Daniel Agar
e7f2195a9b ekf2: error if unable to copy every sensor publication 2021-01-29 22:12:29 -05:00
bresch
eaa2ae9dc9 ekf2: add param to enable synthetic mag Z fusion mode 2021-01-17 12:06:59 +01:00
bresch
983234e29d ekf2: add param to set rng check hysteresis 2021-01-17 12:06:59 +01:00
Daniel Agar
48f125f150 estimated IMU bias preflight checks
- commander preflightcheck use estimator_sensor_bias message instead of EKF state index magic number
 - ekf2 publish estimated bias limits in estimator_sensor_bias
 - preflightcheck only error if bias estimate exceeds half of configured limit (delete COM_ARM_EKF_AB and COM_ARM_EKF_GB parameters)
2021-01-12 09:09:42 +01:00
Daniel Agar
abec2bd8df
msg: estimator_status_flags shorten fields
- previously this message exceeded the logger total field length (1500 bytes)
2021-01-11 11:49:51 -05:00
Daniel Agar
662f177830 ekf2: multi instance numbering consistent with uORB publication instances 2021-01-09 13:20:26 -05:00
Daniel Agar
88f8da27ef
save learned mag bias per sensor (Multi-EKF support)
- handle saving the mag bias per sensor (across all estimator instances using that mag) in sensors/vehicle_magnetometer
 - this is now saving back to the actual mag calibration CAL_MAGn_OFF{X,Y,Z}
 - ekf2 reset mag mag bias on any magnetometer or calibration change
 - use Kalman filter scheme to update stored mag bias parameters using all available bias estimates for that sensor

Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
2021-01-07 09:54:13 -05:00
Paul Riseborough
64ed96bd95
ekf2: Correct airspeed used by EKF for calibration errors 2021-01-05 19:22:53 -05:00
Daniel Agar
98cff94702 px4_work_queue: directly support SITL lockstep
- the purpose is to ensure that every WorkItem (and WorkItems scheduled
by WorkItems) is allowed to run to completion every step
 - per workqueue register a lockstep component whenever a work item is
added (if not already registered)
 - once the work queue is empty unregister component
2021-01-04 09:38:05 +01:00
Daniel Agar
4f62355dec
msg: new estimator_status_flags message for more accessible ekf2 status logging
- log all estimator (ekf2) flags as separate booleans in a new dedicated low rate message (only publishes at 1 Hz or immediately on any change)
 - this is a bit verbose, but it avoids the duplicate bit definitions we currently have across PX4 msgs, ecl analysis script, flight review, and many other custom tools and it's much easier for casual log review in FlightPlot, PlotJuggler, csv, etc
 - for compatibility I've left estimator_status filter_fault_flags, innovation_check_flags, and solution_status_flags in place, but they can gradually be removed as tooling is updated

Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
2020-12-29 11:27:21 -05:00
bresch
b23d8244f0 ekf2: fix dist bottom constraint 2020-12-16 09:33:38 -05:00
Daniel Agar
d44e537084
ekf2: update to new ecl to fix fault status getter
- estimator_status filter_fault_flags was broken because the union within ecl/EKF has exceeded 16 bits
2020-12-10 12:45:41 -05:00
Daniel Agar
82746af07a
ekf2: use new IMU and mag bias and variance getters in ecl/EKF
- reset IMU bias on calibration change (only works with multi-ekf)
 - standardize PX4_INFO/PX4_WARN/PX4_ERR output for multi-ekf with instance number
 - https://github.com/PX4/PX4-ECL/pull/924
2020-12-08 16:06:18 -05:00