Commit Graph

959 Commits

Author SHA1 Message Date
Peter Barker f40250c073 AP_AHRS: compile EKF2 out by default on all boards 2023-11-27 09:05:08 +11:00
muramura 87f4509472 AP_AHRS: Change to Boolean value 2023-11-11 09:06:42 +09:00
Iampete1 19b263a220 AP_AHRS: check the health of the airspeed sensor that is being used 2023-10-31 10:39:21 +11:00
Mykhailo Kuznietsov 28e4f78ebb AP_AHRS: Fix some typos
Fixed some typos found in the code.
2023-10-12 18:30:42 +11:00
Tim Tuxworth 12f9fe9456 AP_AHRS: Correct/clarify AHRS_WIND_MAX description 2023-10-11 19:09:00 +11:00
Henry Wurzburg 5a64cc9e8e AP_AHRS: add airspeed estimate status logging 2023-10-10 08:11:10 +09:00
Peter Barker fa4c7d8eb0 AP_AHRS: allow compilation when GPS not available 2023-10-04 18:10:58 +11:00
Peter Barker 486ed2965e AP_AHRS: add AP_AHRS_DCM_ENABLED
preliminary commit to add the bulk of the changes which are not problematic
2023-09-27 08:00:54 +10:00
Peter Barker 8e57d66a0d AP_AHRS: move AP_AHRS_DCM::groundspeed_vector into correct file 2023-09-20 19:06:10 +10:00
Peter Barker 53d12ab46d AP_AHRS: rename EKFType::NONE to EKFType::DCM 2023-09-20 17:15:10 +10:00
Peter Barker 12a06ee0ae AP_AHRS: make a pair of methods static on AP_AHRS_Backend
these don't use any information from the specific backend, but they are called within the backends so making them static on that class is handy
2023-09-19 13:20:15 +10:00
Peter Barker a5bfd58524 AP_AHRS: remove un-needed AP_AHRS_Backend::getCorrectedDeltaVelocityNED
over-kill, and can be derived from backend biases if required
2023-09-19 12:51:31 +10:00
Peter Barker 9bcd9df7dd AP_AHRS: move load_watchdog_home into correct cpp file
NFC, just moving the code out of the DCM backend file
2023-09-19 11:35:45 +10:00
Peter Barker 622b83da9e AP_AHRS: move set_home method into correct .cpp file
NFC, just moving the code in prepration for allowing DCM to be compiled out
2023-09-19 11:35:45 +10:00
Peter Barker f8a4dd02d9 AP_AHRS: simplify specification of primary IMU indices
given that DCM doesn't specify to use the primary accel or gyro when fetching the data from the Ins library, it shouldn't be special-cased here when asked what the primary IMU and accel are.  Note that this was asking for the *configured* backend type, rather than the active EKF type, making these clauses even stranger.

This also changes the definition of the "primary IMU index" to be whichever gyro is active rather than the accel.  Since we don't currently split primary gyro/primary accel, this is a reasonable change.
2023-09-19 11:34:37 +10:00
Peter Barker e83b6bcfcb AP_AHRS: remove get_primary_IMU_index from public interface 2023-09-19 11:34:37 +10:00
Peter Barker 0b4007d22c AP_AHRS: make comment match code behaviour in airspeed DCM-fallback
the comment here was incorrect; we do not need EKF3 to have a good wind estimate to fall back to DCM here.

Also restructure the code to make it more obvious that this is what's going on.
2023-09-19 11:30:45 +10:00
Peter Barker c30bceb2a0 AP_AHRS: return location inside backend_results structure
with the change to cache results inside AP::ahrs().state we no longer need to worry about the backend's attempts to project the last-known-location forwards according to amount of time elapsed since that last-known-location was calculated.
2023-09-19 11:25:49 +10:00
Andy Piper 2f807230d0 AP_AHRS: rename get_angle_P_scale_logging() 2023-09-13 18:02:44 +10:00
Peter Barker 6e1e1f6596 AP_AHRS: add methods for returning location for origin offsets 2023-09-12 09:29:26 +10:00
Peter Barker 73a09f3dc5 AP_AHRS: allow more libraries to compile with no HAL_GCS_ENABLED 2023-09-05 22:23:51 +10:00
Andrew Tridgell d8c5ce4347 AP_AHRS: fixes for macos CAN SITL build 2023-08-29 15:09:48 +10:00
Andrew Tridgell 725a2227ca AP_AHRS: return estimates from state structure
this lowers CPU usage and fixes race conditions
2023-08-26 17:13:10 +10:00
Andrew Tridgell 5d4bf9fc14 AP_AHRS: fixed build for SITL periph 2023-08-24 13:06:40 +10:00
Andrew Tridgell ce33149c9d AP_AHRS: fixed relative home functions to calculate without origin
this allows for FENCE_AUTOENABLE on planes with no compass
2023-08-03 13:08:21 +10:00
Andrew Tridgell b38fde2cf6 AP_AHRS: fixed comments on position functions 2023-08-03 13:08:21 +10:00
Henry Wurzburg 0aef2cc133 AP_AHRS:improve filter inconsistent messages
Co-authored-by: Peter Barker <pbarker@barker.dropbear.id.au>
2023-08-01 09:09:01 +09:00
Randy Mackay 4b96c2f568 AP_AHRS: comment to clarify get-velocity-NED units 2023-07-18 21:02:02 +09:00
Peter Barker be392b1c5b AP_AHRS: add and use AP_AHRS_ENABLED 2023-06-21 22:28:48 +10:00
Peter Barker 904707de15 AP_AHRS: clarify get_vert_pos_rate AHRS method name to include 'D' 2023-06-06 20:09:28 +10:00
Paul Riseborough 34a5657e3e AP_AHRS: Add handlers for external lat lng position set 2023-06-06 15:19:12 +10:00
Peter Barker f192d2644c AP_AHRS: make ExternalAHRS an AP_AHRS_Backend 2023-06-01 12:45:56 +10:00
Andrew Tridgell 3e601df229 AP_AHRS: don't reject airspeed using EKF if dead-reckoning
when dead-reckoning the EKF wind estimate can diverge from reality,
leading to us rejecting a valid airspeed sensor. We are best off
trusting airspeed if we are dead-reckoning
2023-05-30 17:06:13 +10:00
Henry Wurzburg 3a49804703 AP_AHRS: fix compile for 1MB bds using SITL on hdwr 2023-05-16 21:11:36 +10:00
Peter Barker f67f025c92 AP_AHRS: pre-declare Location object
we don't need to know the storage, and if you cut enough stuff out then we don't end up transitively including the required header for this.
2023-05-15 16:34:23 +10:00
Andrew Tridgell f7be18755e AP_AHRS: fixed earth frame accel for EKF3 with significant trim 2023-02-28 17:16:39 +11:00
Tom Pittenger 9ac0514e8e AP_AHRS: move AP_NMEA_OUTPUT to a first class library 2023-02-07 21:12:07 +11:00
Peter Barker 7fa0b75d48 AP_AHRS: avoid using struct Location
clang reports this could be a problem when compiling under some EABIs.  Remove it from most places as it is just noise, replace with class where we want to avoid including Location.h
2023-02-04 22:51:54 +11:00
Peter Barker 6ce2e17232 AP_AHRS: use FieldBitmaskEnum and FieldValueEnum 2023-01-25 19:50:34 +11:00
Peter Barker c440d98897 AP_AHRS: tidy available-AHRS-types enumeration 2023-01-23 10:05:17 +11:00
Peter Barker aa7ab28969 AP_AHRS: add a bool wind_estimate(...)
NavEKF3 can fail to return a wind estimate, and we lose that value
2023-01-18 11:20:32 +11:00
Peter Barker d78ea08d24 AP_AHRS: move AP_AHRS_SIM::get_results into backend file 2023-01-17 10:49:56 +11:00
Peter Barker c42754b691 AP_AHRS: create an AP_AHRS_SIM backend 2023-01-12 13:11:40 +11:00
Andy Piper 80fb33fb8b AP_AHRS: add throttle slew to RATE
log PD scaling values
2023-01-11 18:59:52 +11:00
Peter Barker 551dae8759 AP_AHRS: break out an AP_AHRS_config.h 2023-01-10 10:27:39 +11:00
Peter Barker 3854e4a99d AP_AHRS: get_relative_position_D_home: don't use home until set 2023-01-04 18:11:01 +11:00
Iampete1 f933f148ed AP_AHRS: always run external AHRS arming check if enabled 2023-01-03 10:32:20 +11:00
Andrew Tridgell 87b4b031bf AP_AHRS: if DCM has no yaw source then don't fallback when hovering
this copes with quadplanes with no compass. With a compass we are
better off using EKF when not in fly-forward as it will give better
height control.

This makes QHOVER for takeoff in quadplanes with no compass a lot more
flyable
2022-12-20 10:34:22 +11:00
Andrew Tridgell 56c8cffc07 AP_AHRS: auto-enable EKF3 for misconfiguration
this fixes a "climb away" in quadplanes when AHRS_EKF_TYPE=2 and
EK2_ENABLE=0. The user has ARMING_CHECK=5390 to disable key arming
checks, and the plane flew on DCM as the configured EKF wasn't
enabled.

This resulted in AHRS::get_origin() returning false as it couldn't ask
EKF2 for the origin (as EKF2 was not enabled or instantiated)

The result was an incorrect calculation for target height during the
descent stage of QRTL, resulting in a climb away until the user took
over
2022-12-20 10:34:22 +11:00
Andrew Tridgell 81b519056b AP_AHRS: implement timing jitter in SITL
make the AHRS update take a random amount of extra CPU time
2022-12-06 11:03:50 +11:00
Stephen Dade 5d3e636d71 AP_AHRS: Add support for fixed height optical flow 2022-12-01 08:03:47 +09:00
Peter Barker 141074d07a AP_AHRS: use Vector3f.xy() to avoid creating a fresh Vector2f 2022-11-16 17:59:29 +11:00
Peter Barker 5ed0451f8b AP_AHRS: include required AP_Vehicle_Type header 2022-11-02 18:35:48 +11:00
Randy Mackay f2ed41f5cf AP_AHRS: pre-arm msg loses extra AHRS prefix 2022-10-21 08:07:39 +11:00
Andrew Tridgell d398e567a3 AP_AHRS: added ATSC logging
log scale factors for angle P scaling when not == 1.0
2022-10-18 07:38:39 +11:00
jackhong12 4a4f361a17 all: use CLASS_NO_COPY() macro 2022-10-04 11:23:04 +11:00
Paul Riseborough 6a328c5d3b AP_AHRS: Add accessor function for airspeed health monitoring 2022-09-26 14:17:53 +10:00
Andrew Tridgell f80ba734c8 AP_AHRS: removed use of "blended" accel values
calculate a single EF accel based on primary IMU
2022-08-21 18:51:59 +10:00
Andrew Tridgell 924759510d AP_AHRS: fixed use of filtered gyro with DCM active
we need to overwrite _omega with the filtered gyro value, so we get
both the low pass filter and the notch filters. Otherwise we will fly
with very high noise gyro data

this also fixes the accel_ef_blended to use the filtered accel. It is
not blended, and removing "_blended" from the API will be worthwhile
as a followup
2022-08-21 18:51:59 +10:00
nrt c3d8f0fa45 AP_AHRS: added a getter function to get active source set once the ekf3 filter is started 2022-08-18 02:05:27 -04:00
Peter Barker 4139b7a548 AP_AHRS: rename OpticalFlow class to AP_OpticalFlow
Brings us in-line with other classes in ArduPilot.

Removes ambiguity with AP_HAL::OpticalFlow which can cause compilation errors as we start to make code more portable across targets
2022-08-18 14:24:01 +10:00
Peter Barker cfb391dc2c AP_AHRS: stop using GCS_MAVLINK.h in header files
... by passing through a reference to a link object instead
2022-08-16 09:45:51 +10:00
Henry Wurzburg a5b373e912 AP_AHRS: modify AHRS type check for compass-less setups 2022-08-09 11:02:24 +10:00
Iampete1 d423f483a6 AP_AHRS: params always use set method 2022-08-03 13:43:48 +01:00
Andrew Tridgell 0ededd7c62 AP_AHRS: use wind from simulation if available with EKF type 10 2022-08-02 07:49:34 +10:00
Peter Barker aeb24d4978 AP_AHRS: remove method casting active EKF type for logging
logging is now done internally
2022-07-29 11:05:19 +10:00
Peter Barker 4909866dd9 AP_AHRS: add prearm check that we are using configured AHRS type 2022-07-28 15:53:13 +10:00
Bailey K. Srimoungchanh b6a089f90e AP_AHRS: Fixed body_to_earth
body_to_earth was not implemented consistently with earth_to_body.
Changed the order of operation to be consistent and rotate reference
frame correctly.
2022-07-22 09:11:17 +10:00
Henry Wurzburg 51a21679be AP_AHRS: expand description of custom orientation parameters 2022-07-21 15:45:28 +01:00
Iampete1 dc0491a8ff AP_AHRS_view: add rotate method to move from AHRS to AHRS view referance frames 2022-06-21 10:01:30 +10:00
Peter Barker 5a1d4f3bf5 AP_AHRS: update rotation based on board_orient parameter 2022-06-12 17:32:11 +10:00
Andrew Tridgell 5a1a87cc60 AP_AHRS: fixed bug in blended EKF bias
The bug fix in #20431 was incomplete, and ended up with the wrong
blended accel bias. This fixes it
2022-05-04 06:49:34 +10:00
Peter Barker 34a7503c1e AP_AHRS: tidy includes 2022-05-03 09:14:58 +10:00
Iampete1 d621910a59 AP_AHRS: remove unneeded get_position wrapper 2022-04-26 10:28:28 +10:00
Iampete1 6c24a5ff37 AP_AHRS: add method to get view 2022-04-26 10:03:30 +10:00
Iampete1 04fdfea74a AP_AHRS_View: add method to get pitch trim and note on rotation 2022-04-26 10:03:30 +10:00
Joshua Henderson 7cc2382a78 AP_AHRS_DCM: NFC comment on check_matrix() normalization reset 2022-04-19 09:27:00 +10:00
Peter Barker c1c18331f9 AP_AHRS: remove instance id from EK2 external interface
Removes passing of instance id in interfaces where -1 was the only value
ever passed in
2022-04-12 10:25:29 +10:00
Peter Barker b762aac6ce AP_AHRS: remove instance id from EK3 external interface
Removes passing of instance id in interfaces where -1 was the only value
ever passed in
2022-04-06 17:36:05 +10:00
Peter Barker fd666dc4f1 AP_AHRS: subtract accel bias from correct ins accel instance
In the case that you have INS_USE indicating IMUs should be used, but
EK3_IMU_MASK leaving some IMUs unused, we subtract the bias from the
wrong INS data
2022-04-03 11:41:09 +10:00
Peter Barker 7ad9609fb7 AP_AHRS: split AP_HAL_SITL and HAL_SIM_ENABLED 2022-03-17 14:39:55 +11:00
Peter Barker 4896f8a6d7 AP_AHRS: rename SITL backend to SIM 2022-03-17 14:39:55 +11:00
Iampete1 480cc3fa46 AP_AHRS: convert param to new custom rotation 2022-03-02 18:16:42 +11:00
Iampete1 1cc2e082e0 AP_AHRS: remove custom rotations 2022-03-02 18:16:42 +11:00
Peter Barker 24099f9a2d AP_AHRS: include cleanups 2022-03-01 11:21:33 +11:00
Peter Barker 9229fb6f9d AP_AHRS: add alias get_position to get_location 2022-02-18 21:23:06 +11:00
Iampete1 e56b6d2765 AP_AHRS: View: get_gyro_latest should include pitch trim. 2022-02-15 11:08:05 +11:00
Peter Barker f72024fc63 AP_AHRS: move logging of LogEvent::SET_HOME up 2022-02-08 11:04:26 +11:00
Andrew Tridgell 01ac314837 AP_AHRS: use EKF rejecting_airspeed flag
stop using airspeed sensor when EKF is rejecting the sensor
2022-02-07 14:13:49 +11:00
murata 819b25d918 AP_AHRS: remove duplicated words from comments 2022-02-07 08:24:14 +09:00
RuffaloVM bb1bd69172 AP_AHRS : remove duplicated words from comments 2022-02-04 08:36:35 +00:00
Peter Barker 5528159f31 AP_AHRS: add WARN_IF_UNUSED to several methods 2022-02-02 19:32:47 +11:00
Randy Mackay 9126e14c9c AP_AHRS: getOptFlowSample returns latest correct flow data for use in calibration 2022-01-29 08:26:12 +09:00
Peter Barker bd069cc5e9 AP_AHRS: move logging of SIMSTATE, AHRS2 and POS into AP_AHRS library 2022-01-25 10:59:17 +11:00
Peter Barker ff63b62b0c AP_AHRS: rename AP_AHRS::get_position to get_location 2022-01-25 10:47:22 +11:00
Peter Barker a6099acd5c AP_AHRS: return failure in pre_arm_check if unhealthy 2022-01-19 18:33:07 +11:00
Joshua Henderson 8a6942a9df AP_AHRS: add define AP_AIRSPEED_ENABLED 2022-01-19 18:21:32 +11:00
Peter Barker a31ff08f23 AP_AHRS: create and use AP_AHRS_SIM_ENABLED 2022-01-17 19:12:56 +11:00
Iampete1 efb04e7f30 AP_AHRS: add video stab log message 2022-01-05 19:56:03 +11:00
Iampete1 cee0503812 AP_Logger: add video stab log structure 2022-01-05 19:56:03 +11:00