Commit Graph

9433 Commits

Author SHA1 Message Date
Caio Marcelo de Oliveira Filho e36728d1db RC_Channel: make example compile again
By adding a missing library dependency. Also remove unnecessary
includes, in particular including each board HAL file is not needed
anymore.
2015-10-21 09:16:09 +11:00
Caio Marcelo de Oliveira Filho 5020db4481 AP_Math: remove unnecessary includes
Remove unnecessary includes, in particular the includes for specific
boards. The list of libraries for 'polygon' example was updated so that
the example compiles again.
2015-10-21 09:16:09 +11:00
Caio Marcelo de Oliveira Filho b29d6eff5d AP_HAL: add an AP_HAL_MAIN_CALLBACKS() macro
This is going to be used by vehicles that already have an object with
setup/loop functions. The vehicle object will just implement the
HAL::Callbacks interface.
2015-10-21 09:16:09 +11:00
Caio Marcelo de Oliveira Filho 19b4ca60c4 AP_HAL: provide AP_HAL_MAIN()
Move the macros to a single place and reduce the variations not based on
board, but based on

- The name of the entry-point function, specified by AP_MAIN;
- Whether it contains argc/argv arguments or not.

The goal here is that programs (vehicles and examples) don't need to
include all possible boards to define a main function. Further patches
will change the programs.
2015-10-21 09:16:09 +11:00
Caio Marcelo de Oliveira Filho e30457a84d AP_HAL_VRBRAIN: merge init() and run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho cb61bdd8d1 AP_HAL_PX4: merge init() and run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho e18884a328 AP_HAL_AVR: merge init() and run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho 1649104382 AP_HAL_FLYMAPLE: merge init() and run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho 3c22564307 AP_HAL_Linux: merge init() and run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho e4ef0e43c0 AP_HAL_SITL: merge init() and run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho 0c837326b5 AP_HAL_Empty: merge init() and run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho 6fc60e2d5e AP_HAL: remove unused init() from the interface
And make run() pure virtual to ensure future implementations provide it.
2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho fe1dd1be25 AP_HAL_VRBRAIN: implement HAL::run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho 0dab23c4df AP_HAL_PX4: implement HAL::run() 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho 3fe1d86c80 AP_HAL_AVR: implement HAL::run() for APM1 and APM2 2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho 51bc25a2ab AP_HAL_FLYMAPLE: implement HAL::run() 2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 32dc822470 AP_HAL_Linux: implement HAL::run()
Added a note about the different ordering between setup callback and
scheduler initialized call.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho c6292ff097 AP_HAL_SITL: implement HAL::run() 2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 346ab77c27 AP_HAL_Empty: implement HAL::run() 2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 72cd5ef185 AP_HAL: add run() method
Add run method, that encapsulate any mainloop logic on behalf of the
client code. The setup/loop functions are passed via a HAL::Callbacks
interface. The AP_HAL_MAIN() macro should be kept as trivial as
possible.

This interface should be implemented by the existing vehicle objects. To
make easy for the examples (that don't have the equivalent of vehicle
objects), a FunCallbacks was added to bridge to the functions directly.
2015-10-21 09:16:07 +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
Jonathan Challinger 78af6d61de AP_Compass: only play compass cal cancel tone if a cal was running 2015-10-21 08:24:49 +11:00
Jonathan Challinger 3b480bd6ec AP_InertialSensor: fix order of accelerometer corrections 2015-10-21 08:22:36 +11:00
Jonathan Challinger 562db11159 AP_Compass: fix potential AP_Notify concurrency problem 2015-10-20 20:54:02 +09:00
Paul Riseborough cd8b9c7d26 AP_NavEKF: prevent high rate mag data locking out other data fusion 2015-10-20 20:16:04 +11:00
Paul Riseborough ab8c28a7cc AP_NavEKF: Fix bug allowing takeoff in GPS modes without aiding
The legacy EKF switches GPs aiding on on arming, whereas the new EKF switches it on based on GPS data quality.
This means the decision to arm and therefore the predicted solution flags must now reflect the actual status of the navigation solution as it will no longer change when motor arming occurs.
2015-10-20 20:16:00 +11:00
Paul Riseborough e076ed7f66 AP_NavEKF2: Remove compiler warning message 2015-10-20 18:16:16 +11:00
Andrew Tridgell b0aa7cb990 DataFlash: use new perf API 2015-10-20 18:16:16 +11:00
Andrew Tridgell cb0f7cb370 NavEKF2: use new perf counter API 2015-10-20 18:16:15 +11:00
Andrew Tridgell f66966ccae NavEKF: use new perf counter API 2015-10-20 18:16:15 +11:00
Andrew Tridgell 8dbb51c64e HAL_PX4: implement AP_HAL::Util perf calls for PX4 2015-10-20 18:09:57 +11:00
Andrew Tridgell 28fa05c965 AP_HAL: added generic perf counter
simple wrapper around PX4 API, but ready for use by other HALs
2015-10-20 18:09:57 +11:00
Paul Riseborough 60c2e81d19 AP_NavEKF2: Apply optimisations to declination fusion covariance update
These are the same type of optimisations that were successful with the magnetometer fusion
2015-10-20 15:21:41 +11:00
Paul Riseborough 0054291cf4 AP_NavEKF2: Apply optimisations to side-slip fusion covariance update
These are the same optimisations that were successful with the magnetometer fusion
2015-10-20 15:21:40 +11:00
Paul Riseborough 5e4bc4e954 AP_NavEKF2: Apply optimisations to airspeed fusion covariance update
These are the same optimisations that were successful with the magnetometer fusion
2015-10-20 15:21:40 +11:00
Paul Riseborough a29147d6d2 AP_NavEKF2: Apply optimisations to optical flow covariance update
These are the same optimisations that were successful with the magnetometer fusion
2015-10-20 15:21:40 +11:00
Paul Riseborough b5e43288d4 AP_NavEKF2: Down to 12 from 14 usec for perf test[8] 2015-10-20 15:21:40 +11:00
Paul Riseborough 0f530bb5a0 AP_NavEKF2: Correct comments 2015-10-20 15:21:40 +11:00
Andrew Tridgell d1dfd5fd01 AP_NavEKF2: use common header for optimisation level and irq disable 2015-10-20 15:21:40 +11:00
Andrew Tridgell a017ae7e00 AP_NavEKF2: down to 218us for test[9] 2015-10-20 15:21:40 +11:00
Andrew Tridgell fc23be8025 AP_NavEKF2: enable fine grained perf tuning for mag fusion 2015-10-20 15:21:40 +11:00
Andrew Tridgell b6c1352e4c AP_NavEKF2: added 10 test perf counters
used for fine grained performance tuning
2015-10-20 15:21:40 +11:00
Paul Riseborough 824436dfb6 AP_NavEKF2: Explicitly define constants as floats 2015-10-20 15:21:40 +11:00
Paul Riseborough 2fbd050418 AP_NavEKF2: Use blended accelerometer data
If high vibration levels cause offsets between the two, it switches to the accelerometer with lower vibration levels. The default behaviour is to use the average of both accelerometers.
2015-10-20 15:21:40 +11:00
Paul Riseborough 240ea92947 AP_NavEKF: Re-center gyro bias limits on arming
Allows the gyro bias to vary by up to +-10 deg/second before and after arming.
2015-10-20 15:21:39 +11:00
Paul Riseborough 8515dda727 AP_NavEKF: Fix bug in vertical position derivative calculation 2015-10-20 15:21:39 +11:00
Paul Riseborough 2b13020c19 AP_NavEKF2: Fix bug in vertical position derivative calculation 2015-10-20 15:21:39 +11:00
Paul Riseborough f6ad79688e AP_NavEKF2: Update start sequence console messages 2015-10-20 15:21:39 +11:00
Paul Riseborough 6b3e114cd6 AP_NavEKF: Enable EKF1 to be disabled to reduce frame over-runs 2015-10-20 15:21:39 +11:00
Paul Riseborough 1a1236f764 AP_NavEKF2: Update magnetometer fusion documentation 2015-10-20 15:21:39 +11:00
Paul Riseborough 8526a8ba7e AP_NavEKF2: Level processor loading between frames
Don't fuse other measurements on the same frame that magnetometer measurements arrive if running at a high frame rate as there will be insufficient time to complete other operations.
2015-10-20 15:21:39 +11:00
Paul Riseborough 225b81baf4 AP_NavEKF2: Prevent users breaking filter by setting excessive time delays
If time deelays greater than the IMU buffer length are used, then it is possible for measurements to be dropped.
2015-10-20 15:21:39 +11:00
Paul Riseborough a1d6c7ae1e AP_NavEKF2: Improve timing accuracy
This parameter is a compromise between numerical accuracy of the covariance prediction and sensor timing jitter
Further testing has shown that doing covariance prediction and sensor fusion every 10msec has no observable effect on fusion health and reduces timing hitter noise on magnetometer observations during high rate maneovures
2015-10-20 15:21:39 +11:00
Paul Riseborough e0ed2dab63 AP_NavEKF2: Adjust IMU FIFO buffer for different IMU data rates
The values chosen ensure that up to consistent 250 msec of sensor delay compensation is available for different platform types
The revised values also ensure that fusion occurs at different time to when the 10Hz magnetometer measurements are read
2015-10-20 15:21:39 +11:00
Paul Riseborough baa8692960 AP_NavEKF2: Allow use of magnetometer learning during optical flow nav
Adds fusion of the declination when there are no earth relative measurements so that the declination angle and therefore the copters yaw angle have an absolute reference.
This enables the length (but not the declination) of the earth field North/East states to change along with the magnetometer offsets.
2015-10-20 15:21:38 +11:00
Paul Riseborough 1b8a93ef0c AP_NavEKF2: Update function header comments 2015-10-20 15:21:38 +11:00
Paul Riseborough 6899767d28 AP_NavEKF2: Disable magnetic field learning if we have no absolute position reference 2015-10-20 15:21:38 +11:00
Paul Riseborough 0722ebe8a0 AP_AHRS: Add EKF variance checks 2015-10-20 15:21:38 +11:00
Paul Riseborough 242b9641c8 AP_NavEKF2: Fix in-air logic bug 2015-10-20 15:21:38 +11:00
Paul Riseborough e7de2d3ea3 AP_NavEKF: Update magnetic field learning options
Provide an option to always do learning
Make field learning decision logic clearer
Change defaults so that plane learns when airborne
Change defaults so that Rover does not learn (large external magnetic interference)
2015-10-20 15:21:38 +11:00
Paul Riseborough 495809f211 AP_NavEKF2: Allow magnetic field learning to be faster 2015-10-20 15:21:38 +11:00
Paul Riseborough 84a02efd52 AP_NavEKF2: Improve efficiency of Z magnetometer fusion 2015-10-20 15:21:37 +11:00
Paul Riseborough 35b08849f7 AP_NavEKF2: Reduce effect of rounding errors on covariance prediction 2015-10-20 15:21:37 +11:00
Paul Riseborough 4e928bf294 AP_NavEKF2: Fix bug preventing pre-takeoff reference measurements 2015-10-20 15:21:37 +11:00
Paul Riseborough 71c399674a AP_NavEKF2: Delay use of magnetic field states until off-ground
Magnetic interference whilst on the ground can adversely affect filter states. This patch ensures that the simpler and more robust magnetic heading observation method is used until the vehicle has cleared the ground.
2015-10-20 15:21:37 +11:00
Paul Riseborough 99c2dc41e0 AP_NavEKF2: Miscellaneous tuning changes 2015-10-20 15:21:37 +11:00
Paul Riseborough 2d44441d6b DataFlash: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review.
2015-10-20 15:21:37 +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 840f307d58 AP_NavEKF: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review.
2015-10-20 15:21:37 +11:00
Paul Riseborough 1323db10e8 DataFlash: 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 47ae0f35f6 AP_NavEKF2: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review.
2015-10-20 15:21:37 +11:00
Paul Riseborough f63c32531c AP_InertialNav: Address peer review comments
The decision to set the origin to zero has been moved out of the AHRS library and into the inertial nav library as this is consumer specific.
2015-10-20 15:21:36 +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 27393855f1 AP_NavEKF2: Change assumed gyro calibration accuracy
If an external gyro calibration has been performed, we should assume that it has been done under static conditions
Otherwise it is pointless and we should allow the EKF to find its own gyro bias offsets.
2015-10-20 15:21:36 +11:00
Paul Riseborough 67a669fcdc AP_NavEKF2: Correct comments for height measurement 2015-10-20 15:21:36 +11:00
Paul Riseborough 0dc570b5a5 AP_NavEKF2: Improve optical flow takeoff detection logic
Ensure takeoff detect status goes to false when on ground
2015-10-20 15:21:36 +11:00
Paul Riseborough d3a6690e4f AP_NavEKF2: Fix bugs preventing use of optical flow navigation 2015-10-20 15:21:36 +11:00
Paul Riseborough 24c0309e85 AP_InertialNav: Enable flight using EKF2
All EKF functions are accessed via the AHRS library enabling AHRS_EKF_TYPE to determine which EKF is being used by the control loops
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
Paul Riseborough f062ed4180 AP_InertialNav: Add output method for rate of change of vertical position 2015-10-20 15:21:36 +11:00
Paul Riseborough dab658f6ed AP_NavEKF: Add methods to output and calculate vertical position derivative 2015-10-20 15:21:36 +11:00
Paul Riseborough 9e3d9d15fc DataFlash: Log vertical position derivative output 2015-10-20 15:21:35 +11:00
Paul Riseborough 52fd369b2f AP_NavEKF2: Add methods to output and calculate vertical position derivative
This patch calculates a derivative of the vertical position (positive down).
The derivative is exposed via a public function.
2015-10-20 15:21:35 +11:00
Andrew Tridgell f5b5a3b0f8 AP_NavEKF: added EKF_DISABLE_INTERRUPTS
this helps with performance tuning
2015-10-20 14:37:41 +11:00
Andrew Tridgell 10fddf4c7e AP_NavEKF: enable optimisation level 3 for the EKF 2015-10-20 14:36:56 +11:00
Andrew Tridgell c9ec8b3f67 AP_Math: added O3 optimisation to core math libraries
this costs some flash space but speeds things up considerably
2015-10-20 14:36:53 +11:00
Andrew Tridgell 2ae0811458 AP_NavEK2: fixed perf counter names for EKF2 2015-10-20 14:36:49 +11:00
Randy Mackay 756d564b7c Mission: sanity check command altitudes 2015-10-19 16:15:08 +09:00
Randy Mackay acd8252e4b Common: add location alt max definition 2015-10-19 16:15:05 +09:00
Randy Mackay b751d2bb18 InertialSensor: remove gyro cal on first arming 2015-10-19 12:00:38 +09:00
Randy Mackay 09aef3a3b8 AP_Arming: remove ahrs check from ins 2015-10-16 13:50:58 +09:00
Randy Mackay 53b39b201b AP_Arming: make ins check virtual 2015-10-16 13:50:57 +09:00
Randy Mackay 304a23923a AP_Arming: add Bitmask parameter description
Also moved ARMING_CHECK to standard category
2015-10-16 13:50:56 +09:00
Randy Mackay 0cc4b6977e AP_Arming: add compass consistency check
Also moved the offsets and mag field limits into definitions at top of
.cpp file
2015-10-16 13:50:55 +09:00
Randy Mackay 342651cc9b AP_Arming: add board voltage checks 2015-10-16 13:50:54 +09:00
Randy Mackay f5f31e4b31 AP_Arming: move ahrs health check after Accel/Gyro checks
If the AHRS is unhealthy because of accel or gyro problems we want those underlying problem reported first
2015-10-16 13:50:53 +09:00
Randy Mackay 0a21fe65e9 AP_Arming: do not report prearm_failure_reason when ahrs unhealthy
The EKF's prearm failiure message is more related to the position estimate rather than the ahrs's health
2015-10-16 13:50:52 +09:00
Randy Mackay 78c6287f95 AP_Arming: check health of all barometers 2015-10-16 13:50:50 +09:00
Randy Mackay c716bfce88 AP_Arming: remove most exclamation marks 2015-10-16 13:50:49 +09:00
Randy Mackay 6b91beb3ff AP_Arming: formatting changes 2015-10-16 13:50:48 +09:00
Andrew Tridgell 6f36267a66 AP_NavEKF: fixed EKF error message during 10 second warmup 2015-10-16 14:58:46 +11:00
José Roberto de Souza 9889f826b3 AP_HAL_Linux: RCInput_UDP: Fix compiling warning
This warning happens because of the difference of datatypes between
32 and 64 bits processors.

%% libraries/AP_HAL_Linux/RCInput_UDP.o
/home/zehortigoza/dev/ardupilot/libraries/AP_HAL_Linux/RCInput_UDP.cpp: In member function 'virtual void Linux::LinuxRCInput_UDP::_timer_tick()':
/home/zehortigoza/dev/ardupilot/libraries/AP_HAL_Linux/RCInput_UDP.cpp:42:72: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t {aka long unsigned int}' [-Wformat=]
             hal.console->printf("no rc cmds received for %llu\n", delay);
2015-10-16 10:28:07 +11:00
José Roberto de Souza e6f0ba6c8b AP_HAL_Linux: Compile RCInput_UDP in all Linux boards
This RCInput is generic enough to be used on every Linux board.
2015-10-16 10:28:06 +11:00
teddytrowbridge a4690a7b0a SITL_State: fixed _set_param_default
Fixed _set_param_default() so that it finds the parameter using it's
NAME rather than the entire NAME=VALUE string
2015-10-16 10:20:31 +11:00
José Roberto de Souza 30610fb17d AP_InertialSensor: Remove misspelled and unused method 2015-10-16 10:16:24 +11:00
José Roberto de Souza 3888579c07 AP_Compass: HMC5843: Use the correctly spelled method 2015-10-16 10:16:24 +11:00
José Roberto de Souza daa32725ac AP_InertialSensor: Fix typo: auxiliar to auxiliary 2015-10-16 10:16:24 +11:00
José Roberto de Souza c53e9d1ff0 AP_Baro: Fix typo 2015-10-16 10:05:03 +11:00
José Roberto de Souza 9a98eb35fc AP_Baro: Add MS5637 over I2C to init() 2015-10-16 10:05:03 +11:00
José Roberto de Souza 6215a3d224 AP_HAL: Add MS5637 over I2C to the supported barometers list 2015-10-16 10:05:03 +11:00
José Roberto de Souza c373ce34d1 AP_Baro: MS56XX: Some minor fixes 2015-10-16 10:05:03 +11:00
José Roberto de Souza d9931b5f34 AP_Baro: Add support to MS5637
As AVR2560 is not supported anymore and do integer operations is
usually faster than float-point the _calculate() implementation was
done using only integer operations and as more close to what
datasheet says.
2015-10-16 10:05:03 +11:00
Randy Mackay 6bdeae97b6 Compass: update param descriptions
offset parameter units are milligauss
User settable parameters should have a User category defined.  Those that should never be set by a user should not have this.
2015-10-15 20:52:38 +09:00
Randy Mackay 131536a3a7 Compass: resolve compiler warning 2015-10-15 20:33:25 +09:00
Randy Mackay 35769035d4 AP_NavEKF2: resolve compiler warning related to init order 2015-10-15 20:03:05 +09:00
Gustavo Jose de Sousa 0caaef7394 AP_Compass: mention mag field unit in existing documentation
We are now always using milligauss for mag field unit, so let's update
documentation accordingly.
2015-10-15 19:56:15 +09:00
Gustavo Jose de Sousa 9927cf066f AP_Compass: remove use of milligauss_ratio
Now, we have all current compasses publishing their values already in
milligauss, so there's no need for that variable anymore.
2015-10-15 19:56:14 +09:00
Gustavo Jose de Sousa b603641d7c AP_Compass: AK8963: fix where to apply sensitivity adjustments
The function rotate_field() can change the values axes and the function
correct_field() applies offsets (which are already in milligauss). Thus any
sensitivity adjustment must be done for two reasons:

    (1) The offsets must be applied to the values already in milligauss;
    (2) The factory sensitivity adjustment values are per axis, if any rotation
        that switches axes is applied, that'll mess with the adjustment.

Experiments showed that before this patch the length of the mag field reported
quite different from the expected. After this patch, the same experiments
showed reasonable values.
2015-10-15 19:56:13 +09:00
Gustavo Jose de Sousa 6198e81bb3 AP_Compass: AK8963: scale mag field internally
This is part of the transition to make all mag field values be used in
milligauss.
2015-10-15 19:56:12 +09:00
Gustavo Jose de Sousa 256c9c06c9 AP_Compass: HMC5843: scale mag field internally
This is part of the transition to make all mag field values be used in
milligauss. Additionally the value of _gain_multiple is adapted to the new way
we're using it and corrected accordingly to the datasheets.
2015-10-15 19:56:11 +09:00
Gustavo Jose de Sousa 814442563e AP_Compass: HMC5843: fix _calibrate()
The use of _gain_multiple is not necessary because the values of
expected_{x,yz} and _mag_{x,y,z} are both in sensor raw unit (i.e., lsbs).

That wasn't fixed before in order not to make APM users to recalibrate their
compasses.
2015-10-15 19:56:10 +09:00
Gustavo Jose de Sousa 88a1a928e9 AP_Compass: remove get_{field,offsets}_milligauss() functions
Those functions are not being used anymore.
2015-10-15 19:56:09 +09:00
Gustavo Jose de Sousa f0dee75ab3 GCS_MAVLink: 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:08 +09:00
Gustavo Jose de Sousa 363f9cf82a DataFlash: 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:07 +09:00
Gustavo Jose de Sousa afccf615d5 AP_NavEKF: 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:03 +09:00
Gustavo Jose de Sousa 99a55f9379 AP_Compass: 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:02 +09:00
Gustavo Jose de Sousa 9a2808a593 AP_Arming: 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:01 +09: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
Gustavo Jose de Sousa 4375606eeb AP_Compass: make get_field() and get_offsets() return milligauss
This is part of a transition to make AP_Compass always use a single unit for
magnetic field values, namely milligauss.
2015-10-15 19:55:59 +09:00
Paul Riseborough 0c61e09b70 AP_NavEKF2: Critical big fix - states not initialised
The failure to initialise the magnetometer bias states to zero can result in a large jump in yaw gyro bias and heading when a heading reset is performed.
2015-10-15 09:52:55 +11:00
Paul Riseborough e3013b493b AP_NavEKF2: Critical bug fix - perf counter not initialised 2015-10-15 09:48:13 +11:00
Grant Morphett 4f01aaf5e3 AP_Arming: fixing up some ARMING_CHECK param doco 2015-10-13 19:53:55 +09:00
Paul Riseborough 3479a0e209 AP_NavEKF: Prevent blocking of synthetic position fusion
Fixes a potential error where changes to timing and arrival rate of magnetometer and baro data could block the fusion of synthetic position and velocity measurements, allowing unrestrained tilt errors during operation without GPS or optical flow.
Fusion of synthetic position or velocity measurements is now timed to coincide with fusion of barometer observations.
If a new barometer observation has not arrived after 200 msec then the synthetic position or velocity is fused anyway so that fusion of synthetic position or velocity observations cannot occur any slower than 5 Hz
2015-10-13 14:05:36 +09:00
Paul Riseborough a895b16fa6 AP_NavEKF: Prevent GPS glitch activating EKF failsafe 2015-10-12 16:29:21 +09:00
Paul Riseborough a82c8b241f DataFlash: Update NKF4 data logging
Add roll/pitch error metric
Reduce normalised magnetometer vector with a vector length
2015-10-10 21:22:57 +09:00
Paul Riseborough 20a3f9782e AP_NavEKF2: Add full set of selectable pre-flight GPS checks 2015-10-10 21:22:53 +09:00
Paul Riseborough f451a81ef9 AP_NavEKF: Add missing GPs check report 2015-10-10 21:22:49 +09:00
Paul Riseborough a3a1dabb94 AP_NavEKF: Update GPS check description and default setting
Previous check default only checked the number of satellites and horizontal position accuracy.
Updated default value also checks HDoP and speed accuracy.
2015-10-10 21:21:25 +09:00
Paul Riseborough db4dfce7b1 AP_NavEKF2: Add fix status to GPS check report message 2015-10-10 14:49:07 +09:00
Paul Riseborough ef5049862a AP_NavEKF: Add fix status to GPS check report message 2015-10-10 14:49:05 +09:00
Paul Riseborough ba6387f206 DataFlash: Add logging of EKF GPS check status 2015-10-10 14:49:03 +09:00
Paul Riseborough 5177746c00 AP_NavEKF: Add reporting of GPS check status 2015-10-10 14:49:01 +09:00
Paul Riseborough 22920aafad AP_NavEKF2: Improve GPS status reporting 2015-10-10 14:48:59 +09:00
Paul Riseborough d0080b66cd AP_NavEKF: Define a structure for reporting of GPS checks 2015-10-10 14:48:56 +09:00
Paul Riseborough 1cb2220107 AP_NavEKF2: Critical Bugfix 2015-10-10 14:48:54 +09:00
Paul Riseborough f467a89fa3 AP_NavEKF2: Update comments for filter status output function 2015-10-10 14:48:52 +09:00
Paul Riseborough b142cc7fd2 AP_NavEKF2: Rename files and re-distribute content 2015-10-10 14:48:50 +09:00
Siddharth Bharat Purohit 1ce3276d74 AP_NavEKF2: split EKF control and output get functions from state specific libs 2015-10-10 14:48:48 +09:00
Siddharth Bharat Purohit 2e388fb2f9 AP_NavEKF2: split otp flow from PosVelNED 2015-10-10 14:48:46 +09:00
Siddharth Bharat Purohit 290ea0e1e8 AP_NavEKF2: split up EKF_core into different files 2015-10-10 14:48:44 +09:00
Caio Marcelo de Oliveira Filho b5abab9d37 AP_GPS_GSOF: minor tweak to avoid warning
Fixes the issue of three unused variables, two of which were used in a
commented Debug() call.

To keep the convenient debug message (and the variable names for the
data bytes), this patch uncomment the debug call but wrap the variables
and the debug call around an ifdef for the local symbol
gsof_DEBUGGING. So by turning it on, the debug will already be in place.

The Debug() call was modified to actually compile and include the third
variable in the output.
2015-10-10 14:34:54 +09:00
Paul Riseborough 2b0434f089 AP_NavEKF: Improved detection of GPS glitch behaviour 2015-10-08 15:09:45 +09:00
Paul Riseborough d48d4ac950 AP_NavEKF: Add GPS glitching monitor to EKF status report 2015-10-08 15:09:43 +09:00
Paul Riseborough 8a9d9c04c5 AP_NavEKF: Add public function to declare GPS glitch 2015-10-08 15:09:40 +09:00
Paul Riseborough 21e4910149 AP_NavEKF: Allow user to select preflight GPS checks 2015-10-08 15:09:37 +09:00
Paul Riseborough cdae84aec1 AP_NavEKF: Additional pre-arm GPS quality checks 2015-10-08 15:09:34 +09:00
Paul Riseborough 8a66c9c2ed AP_NavEKF: Critical Bugfix 2015-10-08 10:54:34 +09:00
Randy Mackay 825abdbedc Compass: example sketch displays in milligauss 2015-10-07 21:35:24 +09:00
Randy Mackay d3066fcdad GCS_MAVLink: send compass vector to GCS in milligauss 2015-10-07 21:35:21 +09:00
Randy Mackay e9254ca1a9 DataFlash: log compass as milligauss 2015-10-07 21:35:19 +09:00
Randy Mackay 2deaf5280e RangeFinder: add User to param descriptions
First sensor appears in standard list, second in advanced
2015-10-07 14:10:24 +09:00
Julien BERAUD b37c52f7a3 AP_InertialSensor_MPU6000: Add heat support
Send current tempertaure to the Heater so the control loop sets the correct
temperature to the imu
2015-10-06 15:21:39 +11:00
Julien BERAUD f231182cd9 AP_HAL: Add support for a Heater
Add heater class and non-pure virtual method to Util class in order to do
nothing in case the function is not implemented
2015-10-06 15:21:39 +11:00
Julien BERAUD ffbb892a01 AP_HAL_Linux: add support for a pwm heater
It uses a heating resistor controlled by a pwm.
By changing the duty cycle of the pwm, we can control the temperature.
A simple PI algorithm is used in order to get to the correct temperature
fast enough and without too much overshoot
It is implemented as a member of the Util class in order not to make to much
modification to the current codebase
2015-10-06 15:21:39 +11:00
Julien BERAUD 1aadcdf538 AP_InertialSensor_MPU6000: read temperature
Read temperature as part of the normal burst. This is not very costly since it
is part of the burst read in i2c and already read in spi.
It is meant to be used for imu heating.
The filter is set to 1Hz on temperature because of the inherent inertia of
heating systems.
2015-10-06 15:21:39 +11:00
Peter Barker af4ad01f23 DataFlash: make CAM a critical message 2015-10-06 15:20:08 +11:00
Michael Oborne 8ec9ab6ad3 AP_GPS: add SBF and GSOF to gps documentation 2015-10-06 15:00:46 +11:00
Michael Oborne 0fceb76493 AP_GPS_GSOF: add trimble gsof driver 2015-10-06 15:00:46 +11:00
Lucas De Marchi 0dad58ae8b AP_HAL_Linux: RCOutput_Bebop: group writes
This allows to remove the hard limit of 4 motors in Bebop, allowing to
execute the motor test.
2015-10-06 11:03:30 +11:00
Lucas De Marchi 24f41538cb AP_HAL_Linux: RCOutput_PCA9685: group writes 2015-10-06 11:03:30 +11:00
Lucas De Marchi f43f6c53f7 AP_Motors: Group writes to motors
Surround calls to rcout->write() with rcout->cork() and rcout->push().
If the RCOutput implementation allows the writes are grouped and only
sent together to the underlying hardware.
2015-10-06 10:42:18 +11:00
Lucas De Marchi fb643fbb53 AP_HAL: RCOutput: add methods to allow grouping writes 2015-10-06 10:42:18 +11:00
mirkix ddb8e67954 AP_Compass: Add support for more then one AK8963 2015-10-06 10:38:21 +11:00
Julien BERAUD 22af74bfe6 AP_Menu: Fix warning
Declare member in an appropriate type so there is no warning
2015-10-06 10:36:22 +11:00
Julien BERAUD 1c46205c2b AP_HAL_Linux: fix warning
Fix warning and use htole16 instead of trying to implement it.
The current code does nothing on little endian platforms.
Moreover, the status variable was unused.
2015-10-06 10:34:59 +11:00
Randy Mackay 6145794da2 AP_Math: remove duplicate RADIUS_OF_EARTH definition 2015-10-05 21:00:14 +09:00
Paul Riseborough cde140354a AP_NavEKF2: Clean up control logic 2015-10-05 13:35:32 +09:00
Paul Riseborough f4db78fc11 AP_NavEKF2: Allow for larger gyro bias errors
MPU6000 data sheet indicates that variation on gyro ZRO across temperature range from -40 to +85 is +-20 deg/sec.
The limits on the gyro bias states have been increased to allow for this.
To enable the EKF to accommodate such large gyro bias values in yaw without the yaw error wrapping, leading to continual heading drift, an unwrap function has been applied to the compass heading error.
2015-10-05 13:35:29 +09:00
Paul Riseborough 325f4139fe AP_NavEKF2: Clean up mode change logic 2015-10-05 13:35:26 +09:00
Paul Riseborough ef624199f9 AP_NavEKF2: Enable GPS velocity fusion to be inhibited 2015-10-05 13:35:23 +09:00
Randy Mackay 9b96a2c385 GCS_MAVLink: send_home and send_home_all methods 2015-10-03 12:50:42 +09:00
Randy Mackay 88f32bc86f GCS_MAVLink: version update after generate 2015-10-03 12:50:39 +09:00
Randy Mackay 544220b599 GCS_MAVLink: generate after importing home-position messages 2015-10-03 12:50:36 +09:00
Randy Mackay b84b069080 GCS_MAVLink: home-position message defs from upstream 2015-10-03 12:50:33 +09:00
Lucas De Marchi d3e8e8fd43 AP_InertialSensor: disable backend's copy constructor
We never want to copy a backend. This protects us of accidentally using
a copy instead of a reference for all subclasses.
2015-10-01 20:57:22 -03:00
Lucas De Marchi a58bb0fc32 AP_InertialSensor: MPU6000: Fix using copy instead of reference
In 294298e ("AP_InertialSensor: use method for downcast") I was too eager
to use "auto" and ended up using the implicit copy constructor instead
of actually getting a reference to the object.
2015-10-01 20:57:22 -03:00
raspilot aa4d16622e HAL_Linux_Class: Init spi before rcin & rcout, because raspilot rcin & rcout use spi. 2015-10-02 09:54:55 +10:00
raspilot 831bb554e7 AP_Baro_MS5611: suspend timer when init to prevent other SPI drivers grabbing the bus. 2015-10-02 09:54:55 +10:00
mirkix ba4db34c83 AP_Baro: Prevent busy waiting 2015-10-02 09:49:12 +10:00
raspilot 5dc18b9a54 HAL_Linux_Class: Fix the broken declare of "LinuxUtilRPI utilInstance" at building raspilot. 2015-10-02 09:47:18 +10:00
José Roberto de Souza 1a2b5ff677 AP_Compass: AK8963: Remove unused AP_HAL::Semaphore attributes 2015-10-01 10:42:51 -03:00
José Roberto de Souza a9d34ac3bd AP_Compass: AK8963: Rename some SPI/I2C method parameters
On read/write operations the argument is the register that will be read or
write not the address, SPI don't even have the concept of device address.
2015-10-01 10:42:40 -03:00
Randy Mackay 3d7ec3704d Mount: add param descriptions to allow RC9 ~ RC12 inputs to be used to control gimbal 2015-09-29 16:41:51 +09:00
Lucas De Marchi e938075581 AP_MotorsCoax: get rid of _motor_to_channel_map 2015-09-29 12:01:41 +09:00
Lucas De Marchi ec4ebfde83 AP_MotorsSingle: get rid of _motor_to_channel_map 2015-09-29 12:01:28 +09:00
Lucas De Marchi 537599c01b AP_MotorsTri: get rid of _motor_to_channel_map 2015-09-29 12:01:14 +09:00
Lucas De Marchi 1572c9d4f4 AP_MotorsMatrix: get rid of _motor_to_channel_map 2015-09-29 12:00:56 +09:00
Lucas De Marchi 43268b9822 AP_MotorsHeli: get rid of _motor_to_channel_map 2015-09-29 12:00:18 +09:00
Lucas De Marchi 7ea141b774 AP_Motors_Multi: get rid of _motor_to_channel_map 2015-09-29 11:59:48 +09:00
Lucas De Marchi d97d97dc54 AP_Motors: get rid of _motor_to_channel_map
This was only used for supporting APM1. The removal was mostly automatic
with:

    sed -i 's/pgm_read_byte(&_motor_to_channel_map\[\([^]]*\)\])/\1/g' libraries/AP_Motors/*.cpp
    sed -i 's/_motor_to_channel_map\[\([^]]*\)\]/\1/g' libraries/AP_Motors/*.cpp

And then remove references to MOTOR_TO_CHANNEL_MAP and
_motor_to_channel_map and make sure the variable used in shifts is
unsigned
2015-09-29 11:59:25 +09:00
Lucas De Marchi 139b88f544 AP_HAL_VRBRAIN: remove unused write method 2015-09-29 11:53:53 +09:00
Lucas De Marchi 7d9c75478f AP_HAL_SITL: remove unused write method 2015-09-29 11:53:51 +09:00
Lucas De Marchi ce674f6926 AP_HAL_PX4: remove unused write method 2015-09-29 11:53:49 +09:00
Lucas De Marchi 191ec10554 AP_HAL_Linux: remove unused write method 2015-09-29 11:53:46 +09:00
Lucas De Marchi 9b4be3bf74 AP_HAL_FLYMAPLE: remove unused write method 2015-09-29 11:53:44 +09:00
Lucas De Marchi 302252d096 AP_HAL_Empty: remove unused write method 2015-09-29 11:53:42 +09:00
Lucas De Marchi f1e53a9bdd AP_HAL_AVR: remove unused write method 2015-09-29 11:53:40 +09:00
Lucas De Marchi 666dc3e440 AP_HAL: RCOutput: remove unused write method
This method is not used anymore since the introduction of channel map and
allowing motors to be enabled/disabled in AP_Motors.

Later we may introduce a method to write multiple values with a default
implementation that supports the channel and enable maps rather than
requiring all subclasses to implement this method.
2015-09-29 11:53:38 +09:00
Lucas De Marchi a5cc0be531 AP_HAL_FLYMAPLE: remove the only user of multiwrite
This is the only place where this variant of RCOutput::write() is
called. Remove it so to use the common interface. It can be added back
later when there's support for asynchronous write.
2015-09-29 11:53:36 +09:00
Andrew Tridgell b9aad88d17 SITL: moved ignition to channel 6 2015-09-29 10:59:41 +10:00
Andrew Tridgell 232fc8a64d AP_AHRS: added send_ekf_status_report() 2015-09-29 10:58:54 +10:00
Lucas De Marchi 7ba6f92eb5 AP_Common: give some type safety to ARRAY_SIZE macro
Now that most places in the code use the ARRAY_SIZE macro instead of
coding it by hand, let's use some type safety in its definition. This is
a C++ version of similar macros used in kmod, Linux kernel and the
source of them, ccan.

A C++ version like this is used in V8 (the JS engine) and other open
source projects.

The main benefit of this version is that you get a compile error if you
pass in a variable that's not an array. For example,

     Bla y[10];
     Bla *y_ptr = y;

     void foo(Bla x[])
     {
         // build error since x[] decay to a pointer in function
         // parameter
         for (int i = 0; i < ARRAY_SIZE(x); i++) {
             ...
         }

         // build error since y_ptr is not an array
	 for (int i = 0; i < ARRAY_SIZE(y_ptr); i++) {
             ...
	 }
     }

I added the additional specialization to allow arrays of size 0.
2015-09-28 18:20:14 +10:00
stew@lovinggibbard.com 9ed6e6afa4 Copy paste errors and naming issues in documentation help. 2015-09-28 18:17:07 +10:00
Andrew Tridgell e0810c2e54 AP_RSSI: fixed doc prefixes for RSSI variables 2015-09-25 22:00:22 +10:00
Paul Riseborough 53e58f1075 AP_NavEKF2: Update default parameters
Updates from preliminary tuning in Replay
2015-09-25 19:22:56 +10:00
Paul Riseborough 73686dfa89 DataFlash: fix error in NKF descriptor 2015-09-25 19:20:52 +10:00
Paul Riseborough 2fb72b6e6a AP_NavEKF2: Clean up loss of GPS logic 2015-09-25 19:20:52 +10:00
Paul Riseborough df0eb9d9d7 AP_NavEKF2: Don't run GPS checks when not required 2015-09-25 19:20:52 +10:00
Paul Riseborough 1986af021f AP_NavEKF2: Remove un-used flight mode and duplicate variable 2015-09-25 19:20:52 +10:00
Paul Riseborough 7230472516 AP_NavEKF2: Adjust parameter defaults 2015-09-25 19:20:52 +10:00
Paul Riseborough 8bcedb228b AP_NavEKF2: Bring pre-flight GPS checks up to date with EKF1 2015-09-25 19:20:52 +10:00
Andrew Tridgell f22a1d3e6d AP_Motors: display message in heli parameter_check() 2015-09-25 12:30:34 +10:00
Andrew Tridgell 9da2b2b430 AP_Motors: added H_GYR_GAIN_ACRO 2015-09-25 12:30:33 +10:00
Andrew Tridgell ac363c5447 AP_RPM: added RPM_MAX parameter
attempt to avoid noise in the pulses
2015-09-25 12:05:43 +10:00
Andrew Tridgell e3f7b002c2 AC_AttitudeControl: use non-flybar leaky I handling
The standard leaky-I handling works fine on a flybar, so better not to
have a special case that isn't needed
2015-09-25 12:05:43 +10:00
Randy Mackay 9f59b6f7b5 AP_AHRS: getLastYawResetAngle returns reset time 2015-09-24 16:57:41 +09:00
Randy Mackay 015f700bc0 AP_NavEKF2: getLastYawResetAngle returns last reset time 2015-09-24 16:57:38 +09:00
Randy Mackay b5c49e0792 AP_NavEKF: minor comment fix
No functional change
2015-09-24 16:57:36 +09:00
Jonathan Challinger 51fb13a329 AP_NavEKF: fix getLastYawResetAngle to return yaw reset system time 2015-09-24 16:57:33 +09:00
Andrew Tridgell 06c0ad987e AP_AHRS: fixed divide by zero in SITL
fixes issue#2875
2015-09-24 16:49:22 +10:00
Lucas De Marchi fc2a1d27b4 AP_HAL_Linux: fix build for raspilot after Util change
Make sure raspilot also builds after making the Util class common for
RPI-based boards.
2015-09-24 15:31:32 +10:00
Lucas De Marchi 55e1d60b54 AP_HAL_Linux: Use from() method for downcast in Util class 2015-09-24 15:31:32 +10:00
Michael du Breuil cf6e6b7e82 DataFlash: Remove stale UBX3 message 2015-09-23 20:42:42 -07:00
Michael du Breuil 75c0644b9a AP_GPS: Use state.instance instead of trying to track instance numbers inside of the ublox driver 2015-09-23 20:42:42 -07:00
Andy Piper 5adb6d2b89 AP_GPS: Support UBX messages for dual UBLOX GPS setups.
Add extra DOP information to UBX precision messages.
2015-09-23 20:41:50 -07:00
mirkix eee9522ca5 AP_Compass: Add MPU9250 multiple instance support 2015-09-24 13:11:38 +10:00
mirkix 840f583d23 AP_InertialSensor: Add MPU9250 multiple instance support 2015-09-24 13:11:38 +10:00
dgrat 15b3717d89 AP_HAL_Linux: Move RPi version check to util class
- Moved the version check functions to util.
 - Removed a redundant version check.
 - Removed redundant version check functions from RCInput.
2015-09-24 13:04:18 +10:00
dgrat 2590db378a AP_HAL_Linux: remove extra spaces in RCInput_Navio 2015-09-24 13:04:18 +10:00
dgrat e96a1bae8a AP_HAL_Linux: cleanup pointer casts in RCInput_Navio
Although RPi is 32 bits, use uintptr_t and friends for casts.
2015-09-24 13:04:18 +10:00
Paul Riseborough 80e182f827 AP_NavEKF2: Update EKF2 data logging 2015-09-24 12:58:44 +10:00
Paul Riseborough 86ad1e6e66 DataFlash: Update EKF2 data logging 2015-09-24 12:58:44 +10:00
Paul Riseborough f77bdd90fc AP_AHRS: Update EKF2 data logging 2015-09-24 12:58:44 +10:00
Paul Riseborough 4acd6c129a AP_NavEKF2: Update parameters 2015-09-24 12:58:43 +10:00
Paul Riseborough 9c5e48e7e9 AP_NavEKF2: Remove unused variables and improve variable names 2015-09-24 12:58:43 +10:00