Commit Graph

123 Commits

Author SHA1 Message Date
Caio Marcelo de Oliveira Filho 0d3fbbdd37 AP_Compass: use millis/micros/panic functions 2015-11-20 12:30:05 +09:00
José Roberto de Souza 17e105640e AP_InertialSensor: Add HAL_COMPASS_AK8963_MPU9250_I2C to _detect_backends() 2015-11-11 14:29:07 +11:00
José Roberto de Souza 1fc29a2654 AP_Compass: AK8963: Use MPU9250 auxiliary bus 2015-11-11 14:29:06 +11:00
Lucas De Marchi 5244559010 Minimize AP_Progmem.h includes
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.

In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
2015-10-30 14:35:32 +09:00
Lucas De Marchi 6f4904189b Replace use of println_P() with println() 2015-10-30 14:35:22 +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
Lucas De Marchi e6b942ffb0 AP_Compass: use HMC5843 behind MPU6000 for minlure 2015-10-22 12:04:52 +11:00
Lucas De Marchi 1a4a26de2b AP_Compass: remove check for max compass instances
For all supported boards the maximum number of instances is 3. The
number of HIL_COMPASSES was already defined as 2 instead of 3, so this
is left as before.
2015-10-21 10:05:18 +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
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 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
mirkix ddb8e67954 AP_Compass: Add support for more then one AK8963 2015-10-06 10:38:21 +11:00
Randy Mackay fff5ec09eb AP_Compass: fix consistent check for less than three compasses
Also use vector functions where available
Use get_field_milligause instead of just get_field
2015-09-16 15:11:01 +09:00
Jonathan Challinger 87bbf1a487 AP_Compass: add consistent() function 2015-09-16 15:10:27 +09:00
Andrew Tridgell fa9ff5b604 AP_Compass: added parameter for compass calibration fitness threshold 2015-09-14 17:01:14 +10:00
raspilot 19b4f5559a AP_Compass: added LSM303D driver 2015-09-14 14:22:15 +10:00
Andrew Tridgell c59bdc12df AP_Compass: fix the milligauss handling
the previous approach assumed a 1:1 mapping between compass backends
and compass instances, which isn't true on PX4.

It also only setup milligauss offsets on a set_and_save call, which is
not the only way offsets change

this adds a milligauss_ratio per instance, which is considerably
simpler
2015-09-09 14:53:11 +10:00
Staroselskii Georgii e93ff44a97 AP_Compass: make a transition to milligauss in Compass library 2015-09-09 10:38:16 +10:00
Siddharth Bharat Purohit 6a603eb594 Compass_cal: implement the concept of auto and mandatory user reboot after cal 2015-09-03 16:59:13 +10:00
Jonathan Challinger de600ca3da AP_Compass: configured() only checks compasses with _USE set 2015-09-03 16:59:12 +10:00
Jonathan Challinger cc36401b7c AP_Compass: add calibration interface 2015-09-03 16:59:11 +10:00
Jonathan Challinger f20ef69777 Compass: add soft-iron corrections 2015-09-03 16:59:09 +10:00
Lucas De Marchi a66a201bf5 AP_Compass: HMC5843: Add support for MPU6000 auxiliary bus
Allow HMC5843 to be on MPU6000's auxiliary bus.
2015-08-28 12:39:09 +10:00
Lucas De Marchi c66c9c41f2 AP_Compass: HMC5843: be agnostic to I2C bus
Like was done to inertial AK8963 and inertial sensor move the decision
regarding the I2C bus to the caller. We don't allow changing the address
because apparently HMC5843 doesn't support different addresses.

Changing only the bus could be more easily done but this prepares the
ground for using HMC5843 on an AuxiliarBus.

The need for a more generic abstraction is evidenced by this commit: a
"SerialBus" in AP_HAL would be a nice addition rather than letting each
driver to provide its own. However the methods are a little bit
different from what we have in AK8963. It's safer to do the simple
conversion now and later on to add the abstraction changing everybody to
use it.
2015-08-28 12:39:09 +10:00
Lucas De Marchi a5df93bf10 AP_Compass: AK8963: be agnostic to I2C bus/address
This decision is better made by the caller rather than polluting the
driver with board-specific details.
2015-08-28 12:39:08 +10:00
Lucas De Marchi d92c2ac9f5 AP_Compass: pass backend instead of pointer to function
Just like was done for inertial sensor, different detect() functions
might need different arguments and passing a pointer to function here is
cumbersome. For example, it forces to have a method like "detect_i2c2"
rather than allowing hal.i2c2 to be passed as parameter.
2015-08-28 12:39:08 +10:00
Andrew Tridgell 69a86a78a6 AP_Compass: removed AVR1280 specific ifdef 2015-08-11 16:47:41 +10:00
Gustavo Jose de Sousa 58f300e78e AP_Compass: 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
Randy Mackay cedc9a8670 Compass: add last_update_usec per instance 2015-07-17 10:02:41 +09:00
Julien BERAUD 51c3c499e2 AP_Compass: support AK8963 on I2C 2015-07-10 16:46:30 +10:00
Julien BERAUD 0b41da0dea AP_Compass: rework to make the bus generic for AK8963
Supporting only MPU9250, prepare to implement another bus, i.e i2c on the
bebop
2015-07-10 16:46:29 +10:00
Staroselskii Georgii 26c8007c96 AP_Compass: updated backend detect method
Uses reimplemented AK8963 driver. There's also no need trying to detect this
compass twice. Actually, it might even be bad, because the current code can
allocate an AK8963 object twice.
2015-07-06 10:48:06 +10:00
Randy Mackay 43b1694c76 Compass: add third compass to PRIMARY param description 2015-07-02 14:19:30 +09:00
Andrew Tridgell edc21cfa38 AP_Compass: make having no compass backends non-fatal
thanks to Daniel for spotting this
2015-05-26 14:23:40 +10:00
Andrew Tridgell 91b4ba3588 AP_Compass: allow for more than one compass in HIL/SITL 2015-05-15 14:25:44 +10:00
Andrew Tridgell 015fce5183 AP_Compass: revert AP_Math class change 2015-05-05 13:27:06 +10:00
Tom Pittenger d09ef4783d AP_Compass: compiler warnings: reorder constructors 2015-05-05 13:26:52 +10:00
Tom Pittenger ad11a57f57 AP_Compass: compiler warnings: apply is_zero(float) or is_equal(float) 2015-05-05 13:26:51 +10:00
Tom Pittenger 16e71ec1ce Compass: fix compile warning re member init order 2015-04-24 14:15:00 +09:00
Andrew Tridgell dcb25632fb AP_Compass: removed old setHIL compass offset 2015-04-21 08:30:05 +10:00
Andrew Tridgell d7000c4105 AP_Compass: fixed compass timestamps in Replay 2015-04-20 15:12:51 +10:00
Andrew Tridgell 1962706a33 AP_Compass: fixed last_update, using last_update_usec()
this broke use of compass in the EKF
2015-03-14 12:31:23 +11:00
Andrew Tridgell fec2025469 AP_Compass: added set_hil_mode() 2015-03-13 22:52:55 +11:00
Andrew Tridgell 0efd3bacea AP_Compass: make new backend match old PX4 behaviour
when a compass is internal only apply board orientation, not user
specified rotation
2015-03-13 18:46:15 +11:00
Andrew Tridgell a871c87cad AP_Compass: use state array for compass variables 2015-03-13 18:46:15 +11:00
Víctor Mayoral Vilches d3b76cd8d3 AP_Compass: split compass into frontend/backend 2015-03-13 18:46:15 +11:00
Randy Mackay ffbc3862bd Compass: update compass orient param description
Update rotation 38 to Yaw293Pitch68Roll90
2015-01-02 17:19:12 +09:00
Randy Mackay 20f3f19285 Compass: add new rotation to ORIENT param description 2014-11-22 14:13:25 +09:00