Commit Graph

673 Commits

Author SHA1 Message Date
Peter Barker 24647fb2b0 AP_AHRS: make get_relative_position_D_home pure virtual
Having a void function with a return parameter that isn't
filled in by the base class function seems like a bad idea
2017-02-24 21:13:08 +11:00
Jacob Walser 8c87868b5c AP_AHRS: Add submarine vehicle class 2017-02-21 11:26:14 +11:00
Peter Barker 1217256898 AP_AHRS: correct infinite recursion in AP_AHRS_View 2017-02-21 09:03:03 +11:00
Andrew Tridgell 7845181f4b AP_AHRS: fixes for changes in AP_AHRS API from Michael 2017-02-18 17:26:43 +11:00
Andrew Tridgell c62c64d27b AP_AHRS: added support for AP_AHRS_View 2017-02-18 17:26:43 +11:00
Andrew Tridgell 1345bf8737 AC_AttitudeControl: added support for AP_AHRS_View
this allows for tailsitters with a different attitude view
2017-02-18 17:26:43 +11:00
Michael du Breuil 3274f1dbb1 AP_AHRS: Split all NED methods into a collection of NED relative to home vs origin 2017-02-13 09:23:14 +11:00
priseborough 93aa40a9e0 AP_AHRS: Fix EKF3 gyro bias reporting and improve code clarity 2017-02-08 19:11:08 +00:00
priseborough e2757c17c8 AP_AHRS_NavEKF: fix ekf variable naming and initialisation 2017-01-27 16:57:42 +09:00
Andrew Tridgell 33a84624c6 AP_AHRS: use const reference
save a bit of stack and CPU
2017-01-23 21:36:34 +11:00
Julien Beraud d2afa1cac8 AP_AHRS_NavEKF: Push gyro bias for optical flow
Push gyro bias for optical flow usage only if there is an optical
flow declared in the HAL
2017-01-23 21:23:16 +11:00
Andrew Tridgell 09c969477f AP_AHRS: fixed fallback to DCM for get_position
this fixes dead-reckoning on fixed wing on GPS loss, and fallback to
DCM on loss of EKF position in fixed wing

This was broken by the EKF3 merge
2017-01-22 13:40:46 +11:00
mirkix d2431dafd0 AP_AHRS: fix description 2017-01-17 18:55:46 +00:00
Dr.-Ing. Amilcar Do Carmo Lucas 8419045aea Spell in comments 2017-01-06 10:57:39 -08:00
Andrew Tridgell 7a5ee29b6e AP_AHRS: fixed a build warning 2016-12-31 08:53:16 +11:00
Andrew Tridgell ad518f0cc7 AP_AHRS: fixed EKF type 10 EKF nav scaler return 2016-12-29 18:43:32 +11:00
murata 4c320373eb AP_AHRS: Change indentation.
AP_AHRS: Delete inserted message "no break"
2016-12-24 11:30:37 +09:00
Andrew Tridgell 22fd2025de AP_AHRS: fixed EKF type 10 2016-12-21 10:52:12 +11:00
Peter Barker 802206baed AP_AHRS: remove use of uninitialised value 2016-12-19 19:51:16 -08:00
Andrew Tridgell 0870e02584 AP_AHRS: fixed example build 2016-12-19 08:07:13 +11:00
priseborough 33a7c682a3 AP_AHRS: Add EKF3 and remove EKF1 2016-12-19 08:07:10 +11:00
Andrew Tridgell ab05472e0e AP_AHRS: added EKF3 for EKF experimentation
Conflicts:
	libraries/AP_AHRS/AP_AHRS_NavEKF.cpp
2016-12-18 10:28:04 +11:00
jinchengde@gmail.com efd0f0b832 modify NavEKF2 for AHRS Test 2016-12-05 17:10:23 -08:00
priseborough b4961971e0 AP_AHRS: add beacon object to ahrs 2016-11-30 17:56:42 +09:00
Randy Mackay c615bac1cd AP_AHRS: add getLastPosDownReset accessor 2016-11-24 19:57:53 +09:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Peter Barker 9a8d3d6e7c AP_AHRS: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Andrew Tridgell 772209b3f3 AP_AHRS: make posOffset a const reference 2016-10-27 15:45:24 +11:00
priseborough 6069c37b19 AP_AHRS: add position offset to optical flow interface 2016-10-27 14:54:42 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Jonathan Challinger 25a14fe0dc AP_AHRS: add interface to retrieve corrected delta velocities in NED frame 2016-10-14 10:45:58 +09:00
Jonathan Challinger e20687fbce AP_AHRS: cache trim rotation 2016-10-13 10:02:14 +11:00
Jonathan Challinger 5ff78b8e47 AP_AHRS: fix rotation of acceleration into earth frame 2016-10-13 10:02:13 +11:00
Jonathan Challinger a03fa2d3cf AP_AHRS: use exact matrix for trim rotations 2016-10-13 10:02:13 +11:00
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Andy Little 0d113b265c Examples: fix examples for px4
The change to use AP_BoardConfig messed up the examples. Here are some
updated but there are plenty more to do.
2016-10-04 12:50:47 -03:00
floaledm 27e977289a AP_AHRS: add the get_variances method found in AP_AHRS_NavEKF to AP_AHRS 2016-09-27 09:20:32 -07:00
Andrew Tridgell 334db0a1a5 AP_AHRS: added get_primary_accel_index() and get_primary_gyro_index() 2016-09-05 12:56:36 +10:00
Andrew Tridgell c62fc336cb AP_AHRS: use current EKF2 IMU core in gyro estimate
The EKF2 implementation uses one IMU per EKF2 core. When reporting the
gyro estimate, accel_ef estimate and gyro bias estimate we need to use
the values associated with the current IMU index being used by the
current EKF2 core. Otherwise we will have an inconsistency between the
gyro estimate and attitude estimate

This affects all multi-IMU systems using EKF2
2016-09-05 12:54:53 +10:00
Andrew Tridgell bf1e0e1536 AP_AHRS: fixed EKF GPS arming check for fixed wing
when in a quadplane mode we set fly_forward to zero. We need to ensure
the GPS checks for EKF health are applied when doing arming checks, so
we use the checks always when disarmed
2016-09-02 11:12:19 +10:00
LukeMike d8cc2668cb VRBRAIN / AP_AHRS_NavEKF: set AP_AHRS_WITH_EKF1 to 1 only for VR Brain 5.4 2016-08-07 20:31:51 +10:00
Peter Barker 78fa23440c AP_AHRS: remove use of uninitialised variable
clang told us:

../../libraries/AP_AHRS/AP_AHRS_NavEKF.cpp:695:35: fatal error: variable 'posD' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
2016-07-20 00:06:49 -03:00
priseborough 01ce3e7f1e AP_AHRS: fix documentation errors 2016-07-19 12:16:49 +10:00
priseborough 5454f76702 AP_AHRS: Add separate interfaces for local horizontal and vertical position 2016-07-19 12:16:49 +10:00
Andrew Tridgell e82468a529 AP_AHRS: avoid ifdef for AP_MODULE_SUPPORTED 2016-07-14 13:39:47 +10:00
Andrew Tridgell 36181b78de AP_AHRS: fixed build for px4 2016-07-14 13:39:46 +10:00
Andrew Tridgell 15a01eefb1 AP_AHRS: added AHRS_update hook 2016-07-14 13:39:46 +10:00
Andrew Tridgell 2db2486b3a AP_AHRS: send zero EKF_STATUS_REPORT with EKF type 10 2016-06-19 22:02:25 +10:00
masierra 8fc494cfcd AP_AHRS_DCM: changed estimate to use prev values for dir & vel 2016-06-06 15:26:51 -07:00
Andrew Tridgell a6cbc5d4a5 AP_AHRS: use EKF for groundspeed estimate if available 2016-05-31 15:56:25 +10:00
Andrew Tridgell d17e3b17bf AP_AHRS: special handling for flying fixed wing with no compass
we need to accept EKF having no absolute position and velocity before
takeoff with no compass
2016-05-27 10:18:53 +10:00
Andrew Tridgell 8486d4ab5e AP_AHRS: disable EKF1 on all PX4v1 and PX4v2 boards
we're out of space in copter now too
2016-05-21 15:25:18 +10:00
Paul Riseborough 597ec61673 AP_AHRS: extend ekf fault status reporting coverage 2016-05-21 15:13:50 +10:00
Ricardo de Almeida Gonzaga 2bf9aa94ad AP_AHRS: Fix typos 2016-05-13 19:20:06 -03:00
dgrat 6d3b491c02 AP_Math: Replace is_equal with a type safe template function
It makes sense to consider also other floating point types.
2016-05-10 11:41:26 -03:00
dgrat 41661f815f AP_Math: Replace the pythagorous* functions with a variadic template
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
Andrew Tridgell 73d3797a7e AP_AHRS: finish implementing have_ekf_logging() 2016-05-07 18:27:20 +10:00
Andrew Tridgell 795080742e AP_AHRS: added have_ekf_logging() API 2016-05-07 18:27:19 +10:00
Andrew Tridgell 07060051cf AP_AHRS: added API for forcing EKF to start
used by Replay to sync start times
2016-05-07 18:27:18 +10:00
Andrew Tridgell 664ce5c16e AP_AHRS: don't use disabled gyro in rate controllers
obey INS_USE* parameters in gyro estimate
2016-05-01 22:16:06 +10:00
Randy Mackay 4419b3c617 AHRS_NavEKF: fix get_position by using ekf origin
The EKF's getPosNED returns a vertical position relative to the EKF origin but previously this function was using it as if it was relative to ahrs's home
2016-04-21 11:23:07 +10:00
Jonathan Challinger 6a5f1c0bec AP_AHRS_NavEKF: reflect changes to getMagOffsets 2016-04-21 09:53:03 +10:00
Jonathan Challinger 18240107f0 AP_AHRS_NavEKF: add getGpsGlitchStatus 2016-04-14 12:24:04 +09:00
Andrew Tridgell 9db618c73c AP_AHRS: disable EKF1 for plane
we are running too close to the 1MByte limit for pixhawk. This
recovers nearly 100kbyte of flash
2016-04-04 11:08:03 +10:00
Lucas De Marchi e0153faa85 AP_AHRS: replace header guard with pragma once 2016-03-16 18:40:40 +11:00
Andrew Tridgell d0b67ce007 AP_AHRS: allow for EKF without GPS on plane in VTOL modes
this allows for testing quadplanes indoors
2016-03-05 08:58:08 +11:00
Lucas De Marchi 0ccd2de12b AP_AHRS: fix use of undefined macro
../../libraries/AP_AHRS/examples/AHRS_Test/AHRS_Test.cpp:63:5: warning: "WITH_GPS" is not defined [-Wundef]
 #if WITH_GPS
     ^

g_gps was not even declared so remove it.
2016-02-19 12:35:20 -02:00
Jonathan Challinger cbf2309023 AP_AHRS: add get_mag_field_NED and get_mag_field_correction 2016-01-23 10:35:36 +09:00
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 3d22490397 waf: examples: use methods from bld instead of ardupilotwaf 2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa d281067bcc waf: make example binaries be placed in 'examples' dir
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
Randy Mackay f6b909d0a5 AHRS_NavEKF: resolve compiler warning re signed vs unsigned comparison 2016-01-07 12:31:47 +09:00
Andrew Tridgell f8b52c6a67 AP_AHRS: try to start EKF2 slightly before EKF2
this gives priority to EKF2 on memory
2016-01-07 08:34:32 +11:00
Andrew Tridgell ea823a818c AP_AHRS: enable EKF2 by default in AHRS 2016-01-05 16:42:01 +11:00
Jonathan Challinger 5cb7331095 AP_AHRS: fix example build 2015-12-29 10:46:35 -08:00
Jonathan Challinger a2999ece54 AP_AHRS_NavEKF: add setTakeoffExpected, setTouchdownExpected 2015-12-28 13:51:24 +09:00
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Andrew Tridgell 6a5c5969fa AP_AHRS: fixed example build 2015-12-27 14:57:32 +09:00
Jonathan Challinger 6682b27456 AP_AHRS: rename get_dcm_matrix to get_rotation_body_to_ned 2015-12-18 18:08:37 +11:00
Julien BERAUD 924a94633d AP_AHRS: Fix build
Due to interdependancy between optical flow and AHRS, it is not possible
to include full class definition which rely on each other
2015-12-18 17:56:06 +11:00
Lucas De Marchi 2b26a2eebe AP_AHRS: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:42 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Andrew Tridgell 1e8c391024 AP_AHRS: fixed float exception on start in SITL
zero DCM matrix
2015-12-01 15:19:45 +11:00
Andrew Tridgell b3e6129fd4 AP_AHRS: added EKF type 10 for SITL
this bypasses all attitude and position estimators and uses the SITL
state directly. It can be used for when the SITL backend cannot
provide perfect sensor data
2015-11-22 17:30:28 +11:00
Andrew Tridgell 7b38f2185f AP_AHRS: use the right DCM matrix for right EKF
this fixes a bug where the EKF2 DCM matrix would be used for
get_dcm_matrix() when EKF1 was active
2015-11-20 18:34:08 +11:00
Caio Marcelo de Oliveira Filho 3a17c858e3 AP_AHRS: use millis/micros/panic functions 2015-11-20 12:29:00 +09:00
Caio Marcelo de Oliveira Filho 4ea45b8df1 AP_AHRS_NavEKF: use millis/micros/panic functions 2015-11-20 12:28:53 +09:00
Caio Marcelo de Oliveira Filho 55e61538b3 AP_AHRS_DCM: use millis/micros/panic functions 2015-11-20 12:28:45 +09:00
Andrew Tridgell 8f4ce7f20b build: removed all nocore.inoflag files
these were APM2 specific
2015-11-16 08:05:17 +11:00
Paul Riseborough 803817821d AP_AHRS: Support changes to EKF2 interfaces that specify the instance
An instance of -1 is specified which causes data for the primary instance to be returned.
2015-11-08 15:37:28 +11:00
Lucas De Marchi dd784189a1 AP_AHRS: remove comment about avr-libc 2015-11-04 12:14:16 +11:00
Lucas De Marchi da86e29c27 AP_AHRS: remove check for AVR CPUs
Remove the checks for HAL_CPU_CLASS > HAL_CPU_CLASS_16 and
HAL_CPU_CLASS >= HAL_CPU_CLASS_75. Corresponding dead code will be
removed on separate commits.
2015-11-04 12:14:14 +11:00
Lucas De Marchi 124937ab61 AP_AHRS: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:11 +11:00
Paul Riseborough 7ed36d8e65 AP_AHRS: Enable pre-flight GPS check status reporting for EKF2 2015-11-02 14:12:17 +11:00
Lucas De Marchi 20c6ffc5e3 Replace use of UARTDriver::printf_P() with UARTDriver::printf()
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Randy Mackay 4e959ef6f9 AP_AHRS: constify getLastPosNorthEastReset
Also constify getLastVelNortEastReset
2015-10-30 12:24:13 +09:00
Randy Mackay 7c20577ee0 AP_AHRS: constify getLastYawResetAngle 2015-10-30 12:24:10 +09:00
Paul Riseborough f67f6b01f4 AP_AHRS: Publish the EKF position and velocity reset deltas 2015-10-30 12:24:05 +09:00
Caio Marcelo de Oliveira Filho f7c73fbb13 AP_AHRS: remove AHRS_EKF_USE_ALWAYS define
This option now is passed when instantiating the code in ArduCopter, so
selecting the default value at compile time is not necessary anymore.

The motivation is to move vehicle specifc code out of the general
libraries. This patch shouldn't change behavior.
2015-10-21 11:01:11 +11:00
Caio Marcelo de Oliveira Filho 9d2e3157fe AP_AHRS: add a runtime flag for always using EKF
The AHRS_EKF_USE_ALWAYS define is used to force EKF to be always
used. It is defined only for building ArduCopter. Change it to be a
runtime flag. Keep its default value still based on the original define,
once the Copter uses it the define will be removed.

The motivation is to move vehicle specifc code out of the general
libraries. This patch shouldn't change behavior.
2015-10-21 11:01:10 +11:00
Caio Marcelo de Oliveira Filho e87db31149 AP_AHRS: remove unused define
AHRS_EKF_USE_DEFAULT is not used since commit
7ba45444a2 "AP_AHRS: added selection of
EKF type using AHRS_EKF_TYPE".
2015-10-21 11:01:10 +11:00
Caio Marcelo de Oliveira Filho 9b73fcb6f8 AP_AHRS: remove unnecessary includes in the example 2015-10-21 09:16:11 +11:00
Caio Marcelo de Oliveira Filho ec52df991c build: compile only the HAL files needed by the board
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 2e464a53c2 AP_HAL: make code not depend on concrete HAL implementations
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.

A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.

The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.

Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.

The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11:00
Andrew Tridgell 79d85f7e10 AP_AHRS: wait for up to 10 samples to get a valid accel vector
the initial accel vectors can be invalid
2015-10-21 09:09:11 +11:00
Andrew Tridgell eac91430a2 AP_AHRS: update _dcm_attitude() on reset()
this prevents the roll/pitch being overwritten by the AHRS_NavEKF
update code on next update
2015-10-21 08:58:30 +11:00
Jonathan Challinger c35605fa04 AP_AHRS_DCM: align tilt during initialization 2015-10-21 08:34:02 +11:00
Paul Riseborough 0722ebe8a0 AP_AHRS: Add EKF variance checks 2015-10-20 15:21:38 +11:00
Paul Riseborough ae830b44c4 AP_AHRS: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review.
2015-10-20 15:21:37 +11:00
Paul Riseborough e8037f94ad AP_AHRS: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review
2015-10-20 15:21:37 +11:00
Paul Riseborough 58d57994f4 AP_AHRS: Rectify coding errors found during peer review
Fixes code that didn't take into account fall-through behaviour of C++ switch statements
Makes get_rigin furnction more generic allowing the consumer to decide what to do with an invalid origin
2015-10-20 15:21:36 +11:00
Paul Riseborough e65ae51564 AP_AHRS: Enable AP_InertialNav to access all EKF functions via AP_AHRS
This patch adds additional methods to the the AHRS library so that the AP_InertialNav library dow nto have to access the EKF directly. This enables Copter to fly using the EKF nominated by AHRS_EKF_TYPE.
It will also pave the way to elimination of the AP_InertialNav library.
2015-10-20 15:21:36 +11:00
Gustavo Jose de Sousa 84f811fe76 AP_AHRS: use compass get_{field,offsets}() functions
Both functions are equivalent, so we're going to simply use
get_{field,offsets}() instead of get_{field,offsets}_milligauss().
2015-10-15 19:56:00 +09:00
Andrew Tridgell 232fc8a64d AP_AHRS: added send_ekf_status_report() 2015-09-29 10:58:54 +10:00
Randy Mackay 9f59b6f7b5 AP_AHRS: getLastYawResetAngle returns reset time 2015-09-24 16:57:41 +09:00
Andrew Tridgell 06c0ad987e AP_AHRS: fixed divide by zero in SITL
fixes issue#2875
2015-09-24 16:49:22 +10:00
Paul Riseborough f77bdd90fc AP_AHRS: Update EKF2 data logging 2015-09-24 12:58:44 +10:00
Andrew Tridgell dde8330077 AP_AHRS: rename using_EKF to active_EKF_type()
thanks to Randy for the suggestion
2015-09-23 17:53:44 +10:00
Andrew Tridgell f9348887c5 AP_AHRS: added getLastYawResetAngle() and resetHeightDatum() 2015-09-23 17:46:51 +10:00
Andrew Tridgell 0677c2c80c AP_AHRS: run astyle for formatting 2015-09-23 17:31:00 +10:00
Andrew Tridgell 13f72e5ba9 AP_AHRS: expose EKF2 for logging 2015-09-23 12:09:36 +10:00
Andrew Tridgell 7ba45444a2 AP_AHRS: added selection of EKF type using AHRS_EKF_TYPE 2015-09-23 11:57:18 +10:00
Andrew Tridgell ed25c85d21 AP_AHRS: added NavEKF2 to constructor 2015-09-23 11:56:42 +10:00
Randy Mackay b5e1ad89b3 AHRS: remove INS start style from example sketch 2015-09-21 17:06:23 +09:00
Grant Morphett b2751d876c AP_AHRS: Fixed spelling error in parameter desc. 2015-09-16 09:33:30 +09:00
Staroselskii Georgii 4b948f5bb1 AP_AHRS: make DCM use milligauss 2015-09-09 10:38:16 +10:00
Andrew Tridgell c18c6d894e AP_AHRS: added prearm_failure_reason() 2015-09-08 15:50:22 +10:00
Randy Mackay a7569e3a61 AHRS_NavEKF: integrate INS use_accel 2015-08-19 16:44:22 +09:00
Randy Mackay 7f46cc9059 AHRS_DCM: integrate INS use_accel 2015-08-19 16:44:19 +09:00
Lucas De Marchi b43bddc0af AP_AHRS: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-18 17:12:51 +10:00
Gustavo Jose de Sousa 54d5277842 AP_AHRS: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:42 +10:00
Andrew Tridgell 7e2e78c1af AP_AHRS: protect against zero deltat in DCM
fixes issue #2657
2015-08-05 15:21:00 +10:00
Randy Mackay 9067abc037 AHRS_NavEKF: fix blended accel to use primary accel 2015-08-01 17:19:45 +09:00
Andrew Tridgell 9c776736c1 AP_AHRS: use delta_velocity and delta_angle in DCM
this prevents an aliasing effect by using the correct delta velocity
time value for each accelerometer sample used
2015-07-30 11:04:31 +10:00
mirkix d169fea9ec AP_AHRS: Add Linux support for example 2015-06-18 08:59:16 +10:00
Andrew Tridgell edab50ab5a AP_AHRS: convert example from .pde to .cpp 2015-06-01 16:58:10 +10:00
Andrew Tridgell 04ba5fa0bd AP_AHRS: pass EKF into constructor
this makes it possible for var_info in vehicle code to be in text
segment
2015-06-01 16:16:24 +10:00
Andrew Tridgell 00ca493860 AP_AHRS: prevent a floating exception in update_trig 2015-05-27 22:10:39 +10:00
Andrew Tridgell b61f7fa2f6 AP_AHRS: enable EKF by default on plane
now we have arming checks enabled by default I think this is the best
choice
2015-05-23 17:17:44 +10:00
Andrew Tridgell 7a76f72bf5 AP_AHRS: added uptime_ms() interface 2015-05-20 15:22:14 +10:00
Andrew Tridgell 5514a9f690 AP_NavEKF: base EKF decisions on vehicle class
using the vehicle class rather than the build macros allows this to
work correctly in replay
2015-05-19 15:21:22 +10:00
Andrew Tridgell 92daa15ccc AP_AHRS: on plane and rover make AHRS unhealthy when EKF not initialised
planes and rovers need full absolute position from the EKF if the EKF
is going to be used. We don't want users to arm without full
capabilities
2015-05-19 15:21:21 +10:00
Andrew Tridgell 29f0561ce4 AP_AHRS: reject EKF for plane when we have GPS and aren't fusing
plane users would prefer to use GPS in this case
2015-05-17 21:24:57 +10:00
Paul Riseborough c2ac80cc63 AP_AHRS: Prevent copter from switching to DCM unless EKF has severe errors 2015-05-13 16:11:13 +09:00
Andrew Tridgell 3529e02675 AP_AHRS: if we have 3 gyros then only use first two
the 3rd gyro on a PH2 has a lot more noise as it is not vibration
isolated
2015-05-09 21:00:49 +10:00
Randy Mackay 3390d9932e AP_AHRS: fix example sketch 2015-05-09 12:23:05 +09:00
Peter Barker 463270e0ee AP_AHRS: avoid FPE when we don't have a compass reading 2015-05-05 15:02:35 +10:00
Andrew Tridgell 4d4a607b80 AP_AHRS: revert AP_Math class change 2015-05-05 13:27:05 +10:00
Tom Pittenger 20f47417d5 AP_AHRS: compiler warnings: apply is_zero(float) or is_equal(float) and float to doubles 2015-05-05 13:26:55 +10:00
Andrew Tridgell e597575747 AP_AHRS: fix for HAL_SITL rename 2015-05-05 09:45:54 +10:00
Andrew Tridgell 6bfca648b9 AP_AHRS: raise DCM P gains when disarmed for first 20 seconds 2015-04-28 14:07:39 +10:00
Tom Pittenger e28c555889 AHRS_DCM: fix compile warnings re float constants
Also fix example sketch
2015-04-24 12:26:08 +09:00
Paul Riseborough 7f1749dc1c AP_AHRS: Allow EKF to pull data from range finder object 2015-04-24 10:56:58 +09:00
Paul Riseborough 405862bd8f AP_AHRS: Reduce time delay for EKF initialisation 2015-04-23 20:35:52 +09:00
Paul Riseborough 5184bca87f AP_AHRS: Prevent DCM reporting good tilt error when inverted 2015-04-23 20:35:39 +09:00
Paul Riseborough ea8217bd3a AP_AHRS: Reduce time constant on filtering of DCM error reporting
Reduces time constant from 2 to 1 second to make data more useful for pre-flight alignment checks by the EKF
2015-04-23 20:35:35 +09:00
Randy Mackay 6e30093924 AP_AHRS: correct sanity checks on update_trig 2015-04-23 09:45:43 +09:00
Jonathan Challinger 6a6ccb4f32 AP_AHRS: add sanity checks 2015-04-22 21:50:51 +09:00
Randy Mackay c6f71ea2e0 AHRS: make get_error_rp and get_error_yaw const 2015-04-21 22:42:17 +09:00
Andrew Tridgell a0969905ce AP_AHRS: make get_error_rp() and get_error_yaw() const
this makes them usable by multiple consumers, and allows use by EKF
2015-04-21 21:42:17 +10:00
Andrew Tridgell d7249cc1e6 AP_AHRS: only use EKF for plane and rover if all data available
we need position and velocity to be working for plane and rover
2015-04-14 09:57:45 +10:00
Paul Riseborough ff9917d338 AP_AHRS: Fix bug preventing EKF from initialising 2015-04-10 11:07:42 +09:00
Jonathan Challinger dc5bdd5ad8 AP_AHRS: use filtered INS output to compute _accel_ef_blended 2015-04-09 20:19:56 +09:00
Paul Riseborough d44cf14178 AP_AHRS : Publish EKF learned compass offsets 2015-04-03 15:24:47 -07:00
Andrew Tridgell 8ba043e593 AP_AHRS: fixed EKF startup bug
This fixes the EKF for when GPS lock takes more than 10 seconds

fixes issue #2010
2015-03-28 10:52:22 -07:00
Randy Mackay 98efcd5f03 AHRS: always use EKF for copter 2015-03-19 15:15:51 +09:00
Randy Mackay 7f25938834 AHRS: fix example sketch 2015-03-16 20:29:19 +09:00
Jonathan Challinger f92c711d14 AP_AHRS: define AP_AHRS_TYPE to be the type of AHRS in use 2015-03-16 09:14:03 +11:00
Andrew Tridgell 585a105128 AP_AHRS: use compass->last_update_usec() 2015-03-14 12:31:50 +11:00
Andrew Tridgell b488d6de00 AP_AHRS: fix for new compass API 2015-03-13 18:46:17 +11:00
Andrew Tridgell 031c81beee AP_AHRS: removed call to 1D accel cal 2015-03-12 12:50:29 +11:00
Andrew Tridgell 6781a8d329 AP_AHRS: fixed get_position for EKF to use correct relative altitude
we need to use the EKF relative height plus the current AHRS home
2015-02-21 10:12:53 +11:00
Jonathan Challinger 180c85817d AP_AHRS: remove armed state, use hal.util soft_armed state 2015-02-11 20:25:11 +11:00
mirkix 49d81a9c99 AP_AHRS: fix apm1 oilpan support 2015-02-11 18:22:39 +11:00
Randy Mackay b66a1135d9 AHRS: fix example sketch compile error 2015-02-03 15:57:11 +09:00
Andrew Tridgell ee9c778834 AP_AHRS: added a get_NavEKF_const() function
needed for AP_Mount_MAVLink

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2015-02-03 09:49:16 +11:00
Andrew Tridgell 68f64fa11c AP_AHRS: make the healthy() method const 2015-02-01 14:13:52 +11:00
Randy Mackay d8664d15d6 AHRS: fix example sketch 2015-01-28 17:15:35 +09:00
Andrew Tridgell ed0a56cc3c AP_AHRS: cope with the changed semantics of airspeed.use() 2015-01-20 11:27:58 +11:00
Andrew Tridgell d2c827aa4b AP_AHRS: updates for new AP_Baro API 2015-01-09 11:50:56 +11:00
Andrew Tridgell b499cd1b59 AP_AHRS: fixed examples build
using a relative include works as the object is just passed through,
not used, in this header
2015-01-05 07:04:27 +11:00
Andrew Tridgell 70c2aeca42 AP_AHRS: make optflow available via AHRS
same pattern as compass and airspeed sensor
2015-01-03 14:16:34 +11:00
priseborough 5b8265ad6f AP_AHRS: Expand EKF speed limit public method to handle control limits 2014-12-06 18:16:50 +11:00
priseborough 83775554ea AP_AHRS: Publish EKF ground speed limit 2014-12-06 18:16:50 +11:00
priseborough 5532750a99 AP_AHRS: Add public method to inhibit GPS useage when using EKF
This provides the calling vehicle software the abiity to request the EKF to not use GPS.
An integer is returned that indicates the type of operation available:
0 = request rejected (request will only be accepted if the EKF is in static mode, eg pre-armed)
1 = request accepted, attitude, vertical velocity and position estimates available
2 = request accepted, attitude, height rate, height, horizontal velocity and relative position estimates available
2014-12-06 18:16:49 +11:00
priseborough 44e1695d5a AP_AHRS : Enable EKF start without GPS 2014-12-06 18:16:46 +11:00
priseborough a4984a1e76 AP_AHRS : Add range finder health status to EKF optical flow data 2014-12-06 18:16:44 +11:00
priseborough 12b012a00e AP_AHRS : temporary mods to test use of flow sensor internal gyro data 2014-12-06 18:16:44 +11:00
priseborough 7b76fc29fb AP_AHRS : EKF optical flow fusion support preliminary changes 2014-12-06 18:16:44 +11:00
Randy Mackay 4452aa8448 AP_AHRS_DCM: compile error fix for low speed CPUs
Also correct initialisatoin order to remove compiler warning
2014-12-05 19:43:05 +09:00
Jonathan Challinger 9261dfdefb AP_AHRS_NavEKF: overload get_accel_ef and get_accel_ef_blended functions 2014-12-05 19:40:08 +09:00
Jonathan Challinger 4975cefd84 AP_AHRS_DCM: update _accel_ef_blended 2014-12-05 19:40:06 +09:00
Jonathan Challinger 033ee3c900 AP_AHRS: Add get_accel_ef_blended function 2014-12-05 19:40:04 +09:00
Randy Mackay 9e731550fd AHRS: default EKF on for copter 2014-12-01 17:29:39 +09:00
Andrew Tridgell 38c1b622f3 AP_AHRS: fixed example build on APM2 2014-11-28 17:59:18 +11:00
Andrew Tridgell 89cdae62b4 AP_AHRS: fixed example build 2014-11-28 10:40:52 +11:00
priseborough 2c07299c04 AP_AHRS : Add reset of EKF gyro bias states 2014-10-29 15:32:18 +09:00
Randy Mackay dffcfb42bc AHRS: add reset_gyro_drift method 2014-10-28 20:25:33 +09:00
Andrew Tridgell 26de54c29a AP_AHRS: cope with 90 degree pitch in update_trig()
this prevents a numerical error in Replay
2014-10-25 11:21:04 +11:00
Andrew Tridgell f79ce92673 AP_AHRS: fixed example build 2014-10-24 12:10:40 +11:00
Randy Mackay 39c8535223 AHRS_DCM: sanity check AHRS_RP_P and AHRS_YAW_P 2014-10-21 21:41:41 +09:00
Andrew Tridgell 270bac4472 AP_AHRS: make get_position() const
This allows use from within AP_Mission
2014-10-20 08:36:20 +11:00
Andrew Tridgell 4ad643b233 AP_AHRS: use a common function for updating the CD values
this ensures the wrapping of yaw is consistent between the 3 use cases
2014-10-15 13:18:08 +11:00
Andrew Tridgell eec5cd5add AP_AHRS: restore DCM attitude before update()
The DCM drift correction code uses the current attitude to calculate
error values to update its gyro drift correction. If we were using EKF
then without this patch the DCM code running as an alternative AHRS
source would be using the EKF attitude for calculating the error
value, leading to very bad gyro drift estimation
2014-10-15 11:15:33 +11:00
Andrew Tridgell 63c06ea2af AP_AHRS: fixed calls to DCM in parent class
use_compass() and reset() are common to AP_AHRS_DCM and
AP_AHRS_NavEKF. As AP_AHRS_NavEKF is a child of AP_AHRS_DCM, when we
call use_compass() from within AP_AHRS_DCM we actually end up calling
AP_AHRS_NavEKF::use_compass().

This has the effect of disabling the compass in DCM when EKF is active
and EKF has decided not to use the compass. That means that the DCM
yaw (and in fact the whole attitude) can get badly off while EKF is
enabled, making DCM an ineffective fallback if EKF fails.

The fix is to call the specific class versions of use_compass() and
reset()
2014-10-15 10:12:50 +11:00
Andrew Tridgell 809b6cc855 AP_AHRS: added get_yaw_rate_earth()
used to estimate course correction on takeoff
2014-10-07 07:17:46 +11:00
Randy Mackay 85eee31510 AHRS: rename ekfNotStarted method to initialised
Also created default implementation in AP_AHRS class so AP_AHRS_DCM does
not need to implement it.
2014-10-02 14:40:54 +09:00
priseborough 7cea7c6a18 AP_AHRS : add method to report if EKF is waiting to start 2014-10-02 14:38:29 +09:00
priseborough 7370e07c8d AP_AHRS : Prevent EKF starting if GPS sats less than AHRS_GPS_MINSATS 2014-10-01 12:55:29 +10:00
Andrew Tridgell e9a9e33280 AP_AHRS: use EKF use_compass() if EKF enabled
this allows magfailed status to show on console via SYS_STATUS health
bits
2014-08-24 21:00:56 +10:00
Randy Mackay a6de3283b6 AHRS_DCM: init members to resolve compiler warnings 2014-08-14 11:27:31 +09:00
Andrew Tridgell 0f5b65e40e AP_AHRS: fixed example build 2014-08-13 21:46:04 +10:00
Przemek Lekston ae4814a773 AP_AHRS_DCM.cpp: changed the direction of position projection to ensure correct behavious in crosswind 2014-08-07 12:34:30 +10:00
Andrew Tridgell 82d0666501 AP_AHRS: fixed example build 2014-07-25 17:54:04 +10:00
Andrew Tridgell 6a275372dd AP_AHRS: ensure get_position() fills in flags 2014-07-25 11:40:16 +10:00
Randy Mackay d23b685023 AP_AHRS: add empty virtual destructor 2014-07-16 14:56:54 +09:00
Randy Mackay 1f2e38ed28 AHRS: initalise members to reduce compiler warnings 2014-07-16 14:38:26 +09:00
Andrew Tridgell 28fedba4d8 AP_AHRS: fixed gyro_bias sign, and pre-calculate gyro_estimate for EKF
this allows us to return a constant vector for the corrected gyro
estimate. Based on discussions with Jon Challinger
2014-07-13 21:56:39 +10:00
Jonathan Challinger 966d66ef40 AP_AHRS_NavEKF: use gyro drift states from EKF in get_gyro 2014-07-13 21:34:44 +10:00
Jonathan Challinger 61987f6655 AP_AHRS: Fixed DCM get_gyro function
Previously incorporated the attitude correction terms into the return. Now only returns the drift-corrected gyro.
2014-07-13 21:19:29 +10:00
Andrew Tridgell d70bee9249 AP_AHRS: fix for HAL_GPIO_* 2014-06-02 10:42:36 +10:00
Andrew Tridgell b3c1e515dc AP_AHRS: when no accel info available in buffer use current value
this prevents an initialisation error, and is reasonable in flight too

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2014-05-15 22:19:54 +10:00
Andrew Tridgell 315290029a AP_AHRS: fixed check of accel sensor health
we need to check health of each accelerometer separately
2014-05-15 22:18:56 +10:00
Andrew Tridgell 1a05c27bbb AP_AHRS: added healthy() function
this will be used to report when the AHRS subsystem becomes unhealthy
2014-05-15 21:14:21 +10:00
Andrew Tridgell c8c6e05a4a AP_AHRS: added vehicle class to AHRS
used by EKF to control use of get_fly_forward()
2014-04-21 18:13:12 +10:00
Andrew Tridgell 4d24a86088 AP_AHRS: prevent a infinity value 2014-04-21 15:37:07 +10:00
Andrew Tridgell b7350118a6 AP_AHRS: enable EKF wind estimate with no airspeed sensor
EKF can now estimate with IMU and GPS only

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2014-04-13 19:42:49 +10:00
Andrew Tridgell 27a3b5fb36 AP_AHRS: fixed wind reporting with EKF and no airspeed sensor
the EKF does not estimate wind without an airspeed sensor
2014-04-10 06:49:23 +10:00
Andrew Tridgell 35c111a63a AP_AHRS: fixed example build 2014-04-01 06:38:25 +11:00
Andrew Tridgell f07e4dee52 AP_AHRS: convert to new GPS API 2014-04-01 06:38:24 +11:00
Andrew Tridgell afab8a9c5b AP_AHRS: fixed example build 2014-03-19 12:14:02 +09:00
Randy Mackay efd4058e8b AHRS: interate move of p1 from Location to mission cmd 2014-03-19 12:10:51 +09:00
Paul Riseborough 15a44571c2 AP_NavEKF : enable operation without a compass for planes 2014-03-09 20:01:45 +11:00
Andrew Tridgell aaaae9a222 AP_AHRS: added get_fly_forward() method
will be used to detect a copter
2014-02-27 17:39:49 +11:00
Andrew Tridgell 9a5ecc9541 AP_AHRS: use primary accel for accel_ef
Logs from Randy show that the copter INav code can't handle the
accelerometer sensor changing.
2014-02-27 16:28:37 +11:00
Andrew Tridgell b53496d470 AP_AHRS: choose the best accelerometer at each drift correction step
this greatly reduces the impact of aliasing on accelerometers by
choosing the accelerometer that produces the smallest error term in
DCM. The difference can be quite dramatic on the Pixhawk.
2014-02-27 09:41:28 +11:00
Andrew Tridgell 0b45d2bc06 AP_AHRS: removed the AHRS_GPS_DELAY parameter
the best value has turned out to be 1, and tweaking it has not turned
out to be useful, so this simplifies the code in preparation for
adding the anti-aliasing handling with multiple accelerometers
2014-02-27 08:57:44 +11:00
Andrew Tridgell 6fc5c12f1d AP_AHRS: remove unused variable 2014-02-26 10:28:12 +11:00
Jonathan Challinger f321a5f241 AP_AHRS: Change airspeed_estimate to const in children of AP_AHRS
Allows roll/pitch controllers to use DCM's airspeed estimate. Thanks to Kevin Hester for assistance in finding this.
2014-02-25 18:49:16 +11:00
Paul Riseborough 9f3c19c03a AP_AHRS : change initialisation requirements for EKF and use dynamic method 2014-02-23 19:50:34 +11:00
Andrew Tridgell b434c11215 AP_AHRS: removed empty file 2014-02-19 22:00:25 +11:00
Andrew Tridgell 3b1f9a4bbf AP_AHRS: added get_armed() and set_armed() calls
will be used by NavEKF to determine static mode
2014-02-19 10:52:24 +11:00
Andrew Tridgell fad0b2b233 AP_AHRS: added get_correct_centrifugal()
used by NavEKF to force static mode
2014-02-19 10:28:14 +11:00
Andrew Tridgell ee37bc3d27 AP_AHRS: ensure we have HAL_CPU_CLASS available 2014-02-16 17:57:09 +11:00
Randy Mackay a021d0ca31 AHRS: fix compiler warning 2014-02-16 13:35:37 +11:00
Andrew Tridgell be33a9634e AP_AHRS: move using_EKF to .cpp to make it easier in gdb 2014-02-15 09:25:40 +11:00
Andrew Tridgell eedd88c2ec AP_AHRS: give zero lat/lng and baro alt if no position yet in DCM 2014-02-15 09:25:40 +11:00
Randy Mackay 5bdc564191 AP_AHRS: fix example sketch 2014-02-15 06:09:08 +11:00