Commit Graph

369 Commits

Author SHA1 Message Date
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