Kevin Lopez Alvarez
17f2393c1b
AP_Compass: Decrease LIS3MDL ODR and timer
2017-07-24 13:48:20 +10:00
Kevin Lopez Alvarez
08b531e6a8
AP_Compass: LIS3MDL correct orientation
2017-07-24 13:48:20 +10:00
Kevin Lopez Alvarez
cf8c1c2665
AP_Compass: Remove comments and use correct board number
2017-07-24 13:47:44 +10:00
Kevin Lopez Alvarez
1467daee2a
AP_Compass: add ppro support
...
disable lis3mdl for now
2017-07-24 13:47:06 +10:00
Andrew Tridgell
732dc5984a
AP_Compass: added COMPASS_TYPEMASK parameter
...
this allows driver type to be disabled, to avoid probing them and
wasting CPU on sensors that are not being used
This also moves UAVCAN compass to be detected last, as discussed in the
dev call
2017-07-19 15:53:22 +10:00
Peter Barker
6b53b5b5f3
AP_Compass: make handle_mag_cal_command return type stricter
2017-07-17 14:17:19 +01:00
ljwang
603e903ccd
AP_Compass: QMC5883 Add internal i2c bus and fix rotation error
2017-07-12 12:56:59 +10:00
Eugene Shamaev
aa1f6a7587
AP_Compass: united enumeration on startup, multiple CAN drivers, correct dev_id based on network and node ID
2017-07-03 11:44:32 +01:00
Miguel Arroyo
ee328c9683
AP_Compass: move SITL Compass to standard sensor backend model
2017-06-29 09:22:08 +10:00
Andrew Tridgell
f3d995a716
AP_Compass: improved robustness of BMM150 detection code
...
cope with bus errors on startup
2017-06-21 16:25:37 +10:00
Andrew Tridgell
68460144df
AP_Compass: added retries on init in BMM150
2017-06-21 16:25:37 +10:00
Andrew Tridgell
9b093c4a33
AP_Compass: fixed a numerical issue in BMM150 driver
...
we were getting the following:
ret=-32768 z=5 rhall=6267 z1=23743 z2=712 z3=-1035 z4=0 xyz1=6264 dividend=163840 dividend2=-1073577207 divisor=5253
the signed/unsigned casts for rhall and xyz1 did not produce the
desired result
2017-06-21 16:25:37 +10:00
Andrew Tridgell
0623db98d6
AP_Compass: cope with bus errors in BMM150
...
if we have bus errors the BMM150 can get confused, giving rubbish
output. This uses the checked register code to reset, and a full soft
reset after 250ms of no samples.
2017-06-21 16:25:37 +10:00
Andrew Tridgell
fa3d40af8a
AP_Compass: fixed shift typo
...
this doesn't affect LE MCUs like STM32
2017-06-21 16:25:37 +10:00
Andrew Tridgell
a0e4ec0f3a
AP_Compass: fixed bitmask typo
2017-06-18 18:15:47 +10:00
Touch
5da2e0b3fb
Update code format
2017-06-18 17:25:20 +10:00
ljwang
8fff1ec4d4
add QMC5883L driver for GPS compass module
2017-06-18 17:25:20 +10:00
ljwang
e648f2e61e
add QMC5883L driver for GPS compass module
2017-06-18 17:25:20 +10:00
Andrew Tridgell
bcd305c821
AP_Compass: fixes for merge with master
2017-06-09 14:56:33 +10:00
Andrew Tridgell
04430457d5
AP_Compass: attempts to diagnose the twitches in MMC3416
2017-06-09 14:56:33 +10:00
Andrew Tridgell
36932a2959
AP_Compass: implement full state machine for MMC3416
...
this uses 100Hz readings most of the time, but does slow offset
readings every 50 samples
2017-06-09 14:56:33 +10:00
Andrew Tridgell
167988b5c4
AP_Compass: implement MMC3416 temperature compensation
...
this is much slower, but removes temperature offset
2017-06-09 14:56:33 +10:00
Andrew Tridgell
736fb715ec
AP_Compass: MMC3416 magnetometer driver
2017-06-09 14:56:33 +10:00
Randy Mackay
1ce2a7fcee
AP_Compass: resolve AK09916 driver compiler warning
2017-06-07 20:38:12 +09:00
Andrew Tridgell
d946d5da6f
AP_Compass: enable AK09916 inside a ICM20948
...
the ICM20948 has an AK09916 which can be accessed via I2C bypass
2017-06-07 17:39:45 +10:00
mirkix
d9d3d97e54
AP_Compass: BeagleBone Blue add external compass HMC5843
2017-06-01 17:11:34 +01:00
Dr.-Ing. Amilcar Do Carmo Lucas
4c45b1c7ca
AP_Compass: Use SI units conventions in parameter units
...
Follow the rules from:
http://physics.nist.gov/cuu/Units/units.html
http://physics.nist.gov/cuu/Units/outside.html
and
http://physics.nist.gov/cuu/Units/checklist.html
one further constrain is that only printable (7bit) ASCII characters are allowed
2017-05-17 18:07:25 +10:00
murata
46cba2c970
libraries: Delete the setting value for specific editor.
2017-05-11 13:18:41 -07:00
Peter Barker
b39da462ec
AP_Compass: use HAL_SEMAPHORE_BLOCK_FOREVER macro
2017-05-08 10:23:03 +09:00
Andrew Tridgell
45f27ceb9c
AP_Compass: rename macros to avoid conflicts
...
these macros were also defined in NuttX in clock.h
2017-05-06 15:21:14 +10:00
Eugene Shamaev
b3d9126407
AP_Compass: removal of legacy UAVCAN support
2017-04-17 17:27:18 +10:00
Pierre Kancir
d3e27d8720
AP_Compass: example fix travis warning
...
missing function declaration
implicit cast
some style fix
2017-04-13 19:56:16 +01:00
Eugene Shamaev
3e044c7b8a
AP_Compass: support for UAVCAN connected magnetometers
2017-04-10 22:38:12 +01:00
Andrew Tridgell
ee2afd3242
AP_Compass: added COMPASS_OFFS_MAX
...
this allows setup of airframes with hatch magnets
2017-04-04 00:49:34 +01:00
Lucas De Marchi
5787b5a5c5
AP_Compass: IST8310: rename macros
...
Having "BIT" in the name gives the impression we are using the macro is
the bit position; however they have the values for those actions, not
the bit position. Rename BIT to VAL to be less confusing.
2017-03-24 12:06:19 +11:00
Lucas De Marchi
4bba643abb
AP_Compass: IST8310: use variable periodic callback
...
This is the equivalent of sleep and wait for the conversion time,
after had triggered a new sample request. However it also has the added
benefits of sharing a thread with other sensors on the same bus.
Now we don't read the status register anymore since we have a guaranteed
wait time.
2017-03-24 12:06:19 +11:00
Lucas De Marchi
ce1a13aa8f
AP_Compass: IST8310: use FSR to reject samples
2017-03-24 12:06:19 +11:00
Lucas De Marchi
d84851d8fa
AP_Compass: IST8310: improve initialization
...
- Make sure device is reset while initializing.
- Give better names to register macros
- Average X, Y and Z by 16: sensor is internally running at 200 sps
(theoretical, ~160 pratical). The wait time is ~6msec averaging
by 16. We do 10msec.
2017-03-24 12:06:19 +11:00
Tom Pittenger
c0691afc1f
AP_Compass: reject outlier data in IST8310 data by detecting >14bit data
2017-03-24 12:06:19 +11:00
Tom Pittenger
8415fde697
AP_Compass: IST8310 chip does not follow right-hand rule format, flip z
2017-03-24 12:06:19 +11:00
Lucas De Marchi
b339050e45
AP_Compass: IST8310: account for errors in measurment requests
...
If we don't recover for errors in the request for new sample, we may get
stuck with no sample anymore. Recover from bad transfers.
2017-03-24 12:06:19 +11:00
Lucas De Marchi
156efd6fec
AP_Compass: use IST8310 for aerofc
2017-03-24 12:06:19 +11:00
Andrew Tridgell
37c9e08316
AP_Compass: support AUAV21 board
2017-03-01 17:24:10 +11:00
Jacob Walser
7121910fa7
AP_Compass: Set default learn parameter to disabled for Sub
2017-02-21 11:26:14 +11:00
murata
bc7b2144e7
AP_Compass: Change from magic number 0 to definition name.
2017-02-18 14:12:36 +00:00
Lucas De Marchi
dd98fc75a9
AP_Compass: BMM150: fix sampling time
...
We configure the sensor with an ODR of 30 Hz. There's no need to keep
calling the update function at 100Hz.
2017-02-11 01:37:49 -08:00
Andrew Tridgell
64a8f00a77
AP_Compass: disable esoteric compass drivers on FMUv2
2017-01-29 16:31:06 +11:00
murata
af47a8e91c
AP_Compass: Unify from print or println to printf.
2017-01-27 18:20:22 +11:00
Randy Mackay
855125381d
AP_Compass: relax compass cal fitness and consistency checks
2017-01-27 11:20:02 +09:00
Randy Mackay
53d1585ebf
Compass: relax compass consistency checks for pixracer
2017-01-21 12:10:00 +09:00
Randy Mackay
0c4e3cd8e4
Compass: pixracer calibration fitness default relaxed
2017-01-21 10:15:11 +09:00
Andrew Tridgell
58a0a6a2fc
AP_Compass: disable lis3mdl for now
...
pending investigation of possible hw error
2017-01-14 12:40:04 +11:00
Lucas De Marchi
5472bc4de1
Global: change Device::PeriodicCb signature
...
Remove bool return as it's never being used and not supported on PX4.
2017-01-14 10:03:54 +11:00
murata
a2649949df
AP_Compass: Changed if statements to switch statement.
2016-12-19 22:28:34 +00:00
Andrew Tridgell
790d186c6c
AP_Compass: switched to unified Invensese driver for AK8963
2016-12-16 12:31:34 +11:00
Andrew Tridgell
a440ac4c9d
AP_Compass: use a set_and_notify for external and IDs
...
ensure that GCS that connects quickly gets the right value
fixes issue #5364
2016-12-09 14:36:01 -08:00
Lucas De Marchi
899fce53ff
AP_Compass: IST8310: minor fixes and refactors
...
- Inline code that needs to take and release the lock in init()
function, just like other drivers
- Minor changes to coding style and renames to be similar to other
drivers
2016-12-09 10:08:37 -08:00
Georgii Staroselskii
f061572e13
AP_Compass: add IST8310 support
...
One needs to specify I2C address and a bus number in AP_Compass.cpp to use it.
2016-12-09 10:08:37 -08:00
Pierre Kancir
385e5badd8
Ap_Compass: LIS3MDL fix order
2016-12-06 09:31:21 -08:00
Pierre Kancir
c49c851a57
Ap_Compass: AK09916 fix order
2016-12-06 09:31:21 -08:00
Andrew Tridgell
a1bce2b54d
AP_Compass: use get_random16()
2016-12-02 09:49:38 +11:00
Andrew Tridgell
4f1f6ec019
AP_Compass: added retries during init for i2c devices
...
higher in init, lower for run
2016-12-02 09:47:51 +11:00
Georgii Staroselskii
865ff753f3
AP_Compass: use LSM9DS1 as primary for Navio 2
...
This compass has been proved to work better on Navio boards. Users also
don't like high offsets (even though, they don't really mean much in
this context) reported by AK8963 in MPU9250 on Navio 2.
2016-11-30 12:04:53 -08:00
Alexey Bulatov
96db31635d
AP_Compass: set orientation ROLL_180 for LSM9DS1 on Navio2
2016-11-30 12:04:04 -08:00
Alexey Bulatov
163fa07ac0
AP_Compass: make orientation of LSM9DS1 compass configurable
2016-11-30 12:02:07 -08:00
Randy Mackay
5009e83b6d
AP_Compass: fix build warning for HMC5843
2016-11-30 18:00:12 +09:00
Andrew Tridgell
28b3de91cf
AP_Compass: fixed orientation of internal i2c compass for FMUv1
...
thanks to Peter for noticing
2016-11-28 13:02:15 +11:00
Andrew Tridgell
7d57f00ca0
AP_Compass: removed debug line
...
this is now common when using in-tree drivers
2016-11-25 18:23:53 +11:00
Andrew Tridgell
f62972d966
AP_Compass: fixed build on bhat
...
enable both compasses if found
2016-11-25 17:50:24 +11:00
Andrew Tridgell
1f403b02ef
AP_Compass: switch to continuous 155Hz mode for LIS3MDL
2016-11-25 17:50:24 +11:00
Andrew Tridgell
62805f59fa
AP_Compass: added AK09916 driver
...
yet another magnetometer!
2016-11-25 17:50:24 +11:00
Andrew Tridgell
17a117b324
AP_Compass: be a bit less verbose in startup
2016-11-25 17:50:23 +11:00
Andrew Tridgell
0e4b8781b2
AP_Compass: auto-detect LIS3MDL compass
2016-11-25 17:50:23 +11:00
Andrew Tridgell
b6b2919126
AP_Compass: don't panic on too many compasses
...
just use the first ones found. Panicing because you have too many
isn't useful
2016-11-25 17:50:23 +11:00
Andrew Tridgell
40ef68f104
AP_Compass: added a LIS3MDL compass driver
2016-11-25 17:50:23 +11:00
Lucas De Marchi
c6b0a71c47
AP_Compass: Calibrator: use inplace initializer on array
2016-11-18 20:03:30 -02:00
Siddharth Bharat Purohit
b36ee10e7c
AP_Compass: fix wrong memset in compass calibrator
2016-11-18 20:03:30 -02:00
Andrew Tridgell
e4454c5056
AP_Compass: setup for new PX4 board IDs
2016-11-11 08:08:55 +11:00
Andrew Tridgell
0eac781559
AP_Compass: don't run the AK8963 on the external MPU9250
...
this saves us one mag slot for another external mag, and leaves the
primary MPU9250 undisturbed by the mag traffic on the bus
2016-11-10 13:05:22 +11:00
Andrew Tridgell
3d5c57c5dc
AP_Compass: fixed orientation of PH2 in-tree compass drivers
2016-11-10 11:44:52 +11:00
Andrew Tridgell
4ba00720aa
AP_Compass: make init() private
...
not called from frontend
2016-11-10 11:44:52 +11:00
Andrew Tridgell
c68a6451cb
AP_Compass: use in-tree drivers for PH2SLIM
2016-11-10 11:44:52 +11:00
Andrew Tridgell
4602b4d679
AP_Compass: improve init and calibration of hmc5843
2016-11-09 17:08:15 +11:00
Andrew Tridgell
3d48a72f59
AP_C0mpass: switch pixracer to always use in-tree drivers
2016-11-09 17:08:14 +11:00
Andrew Tridgell
b363a65c2e
AP_Compass: enable in-tree drivers for PHMINI
2016-11-09 17:08:13 +11:00
Andrew Tridgell
875fa60452
AP_Compass: fixed external I2C HMC5983 rotation on pixhawk
2016-11-09 17:08:11 +11:00
Andrew Tridgell
bd8867be38
AP_Compass: cope with NULL dev pointer in driver probe functions
2016-11-09 17:08:11 +11:00
Andrew Tridgell
3b53caad87
AP_Compass: keep old hmc5843 ID
...
prevent re-use. thanks to Lucas
2016-11-09 17:08:10 +11:00
Andrew Tridgell
02c2ba1331
AP_Compass: fixed dup semaphore bug
...
thanks to Lucas for spotting this!
2016-11-09 17:08:10 +11:00
Andrew Tridgell
f31a017ace
AP_Compass: changes to HMC5843 driver
...
this makes the HMC5843 use single-shot mode, which makes it more
robust to bus resets. It also adds WHOAMI checking and enables
automatic temperature compensation.
Unfortunately this makes existing calibration values incompatible, so
a re-cal is required. The device ID has been changed to reflect the
driver change.
2016-11-09 17:08:10 +11:00
Andrew Tridgell
05769640d1
AP_Compass: support rotations on AK8963
2016-11-09 17:08:08 +11:00
Andrew Tridgell
2716ab8408
AP_Compass: added support for per-instance rotations
2016-11-09 17:08:08 +11:00
Andrew Tridgell
fac895b0e6
AP_Compass: setup read flag for SPI transfers
2016-11-09 17:08:08 +11:00
Andrew Tridgell
147b253e65
AP_Compass: make device IDs match PX4 drivers
...
match in-tree drivers to PX4Firmware drivers
2016-11-09 17:08:06 +11:00
Andrew Tridgell
de7913e8e9
AP_Compass: implement device IDs for compass drivers
2016-11-09 17:08:04 +11:00
Andrew Tridgell
ac0ea12b42
AP_Compass: enable HMC5843 on SPI for PH2
2016-11-09 17:08:03 +11:00
Andrew Tridgell
1c631ea037
AP_Compass: cleanup use of backend semaphores
...
fixed drivers that didn't protect accumulation counters
2016-11-09 17:08:01 +11:00
Andrew Tridgell
9afd51350e
AP_Compass: use thread per bus in more drivers
...
and removed use of timer suspend
2016-11-09 17:08:01 +11:00
Andrew Tridgell
974827aa82
AP_Compass: enabled AK8963 on PX4
2016-11-09 17:08:01 +11:00
Andrew Tridgell
2e4151d14e
AP_Compass: enable lsm303d mag on FMUv2
2016-11-09 17:08:00 +11:00
Andrew Tridgell
36190ba545
AP_Compass: use thread per bus for lsm303d mag
2016-11-09 17:08:00 +11:00
Andrew Tridgell
7bd52eb112
AP_Compass: allow for in-tree drivers for PX4
2016-11-09 17:07:58 +11:00
Andrew Tridgell
96adfccae3
AP_Compass: switch hmc5983 driver to use periodic callback on the bus
...
this does not yet work with the mpu6000 auxiliary bus
2016-11-09 17:07:55 +11: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
e4001e67e2
AP_Compass: add missing parameter metadata
2016-10-27 09:15:03 -07:00
Michael du Breuil
deec4ec6af
Compass: Rework compass calibrator
...
Summary of significant changes:
-Autsave doesn't depend on STREAM_EXTRA3
-Don't risk only saving one compass on copter if CAL_ALWAYS_REBOOT is set
-Only calibrate compasses that are both health and marked for use (there was a inconsistency in handling the mask)
-Fix incorrect failure reporting on DO_ACCEPT_MAG_CAL with a mask of 0 if a channel was specifically not started
-Fix not starting the buzzer if the delay is set to 0 seconds
-Always send MAG_CAL_REPORT until its acknowledged
-Correct the field in MAG_CAL_REPORT for autosave to indicate if the compass had actually been saved, rather then being scheduled to be saved
-Remmove unused public interfaces
2016-10-27 14:04:33 +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
Peter Barker
216a6493c9
AP_Compass: AP_Compass_LSM9DS1: remove unused variable
2016-10-24 08:57:56 -02: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
Andrew Tridgell
36ea946cf5
AP_Compass: use board defined compass ofs max in calibrator
2016-09-23 10:53:00 +10:00
Jonathan Challinger
17fb7dc88f
AP_Compass: initialize offset before beginning sphere fit
2016-09-23 10:52:51 +10:00
Jonathan Challinger
419f1bc00e
AP_Compass: change fixed point format for more range
2016-09-23 10:52:46 +10:00
Jonathan Challinger
0652d71a72
AP_Compass: correct wrapping behavior in conversion to fixed point
2016-09-23 10:52:44 +10:00
Andrew Tridgell
f82827ce79
AP_Compass: removed disco special compass offsets
...
not needed any more with newer hardware
2016-09-14 19:06:06 +10:00
Randy Mackay
ba5db0c5d8
Compass: add CAL_FIT parameter description values
...
No functional change
2016-09-14 09:57:52 +09:00
José Roberto de Souza
13287f61e3
AP_Compass: Make COMPASS_AERO probe BMM150
2016-09-03 01:03:17 -03:00
Gustavo Jose de Sousa
b259356703
AP_Compass: BMM150: convert it to use Device periodic callback
2016-09-03 01:03:07 -03:00
Lucas De Marchi
667fca60f5
AP_Compass: BMM150: reduce lock region
...
Use a semaphore to update the accumulated values instead of using the
timer semaphore.
2016-09-03 01:03:07 -03:00
Matt
9eca21c26a
AP_Compass: Removed duplicate code
2016-08-29 10:38:41 -03:00
Lucas De Marchi
4595a2b7d8
AP_Compass: Remove i2c lockup count
...
This was returned only for a single bus and on all supported platforms
this is hardcoded to 0.
2016-07-28 18:03:09 -03:00
Lucas De Marchi
c6edae7e8e
Revert "Global: workaround toolchain problem on windows"
...
This reverts commit 4e2b30b413
.
The toolchain for windows is now updated, we can remove this workaround.
2016-07-25 17:56:12 -03:00
Andrew Tridgell
018d8f732a
AP_Compass: work around poor magnetic setup on Disco
...
bring compass offsets into line with what the calibrator can handle
2016-07-20 13:38:17 +10:00
Lucas De Marchi
4e2b30b413
Global: workaround toolchain problem on windows
...
The minimum version for gcc was supposed to be 4.9 for any platform.
However our build instructions are outdated. Remove the problematic
parts that use the sparse-endian.h header while we don't fix the setup
for windows.
2016-07-19 09:30:39 +09:00
Lucas De Marchi
3ba27df405
AP_Compass: BMM150: minor refactors
...
- Correctly sort includes and add missing AP_Math.h
- Use anonymous struct for trim_registers in _load_trim_values,
renaming its members so they don't start with underscore
- Don't change _dig* values when we failed to read from sensor
- Add some blank lines
- Make _dig_* members be inside a _dig struct
- Use constrain_int32 instead of if/else chain
- s/time_us/time_usec/
- Construct raw_field with a single constructor in _update()
- Add missing copyright notice
- Group methods together in declaration
2016-07-06 10:04:05 -03:00
José Roberto de Souza
6e53854122
AP_Compass: Add BMM150 backend
2016-07-06 10:03:30 -03:00
Lucas De Marchi
9ccce2c980
AP_Compass: explicitely add compasses for erlebrain2, pxf and pxfmini
2016-05-18 18:24:14 -03:00
Lucas De Marchi
8372e74c0f
AP_Compass: simplify handling of sensors for Linux boards
...
In addition:
- bbbmini, navio and navio2 can force HMC5843 backend to
be external.
- there was a typo in the backend name that's now fixed:
AK8953 vs AK8963
2016-05-18 18:24:14 -03:00
Lucas De Marchi
1ddbafabdd
AP_Compass: add name field to internal compass drivers
2016-05-18 18:24:14 -03:00
Andrew Tridgell
f7ac6c8d86
AP_Compass: make internal compasses use a higher cal threshold
...
they tend to be a lot noisier
2016-05-18 16:32:32 +10:00
Gustavo Jose de Sousa
0c31354539
AP_Compass: implement completion mask
...
Fill the completion mask and send that through MAVLink while calibrating the
compass.
2016-05-16 19:08:36 -03:00
dgrat
f8540f1a80
AP_Compass: Do not use is_zero() for non-float types
2016-05-16 19:08:35 -03:00
Ricardo de Almeida Gonzaga
2e58653983
AP_Compass: Fix typos
2016-05-13 19:20:05 -03:00
Staroselskii Georgii
a2ae662b3e
AP_Compass: add an extra rotation for internal LSM9DS1 on Navio2
...
In order not to force users to set rotation themselves, we need this
hack to make an extra rotation needed for a second compass.
2016-05-10 17:24:43 -03:00
Staroselskii Georgii
2e5cfc2849
AP_Compass: added external compass autodetection on Navio
2016-05-10 17:24:43 -03:00
Staroselskii Georgii
62f2695e83
AP_Compass: added several compasses' autodetection on Navio 2
2016-05-10 17:24:43 -03:00
Staroselskii Georgii
71736a0ecc
AP_Compass: enable LSM9DS1 magnetometer for boards without default one
2016-05-10 17:24:43 -03:00
Staroselskii Georgii
b677f975e7
AP_Compass: added LSM9DS1 magnetometer support
2016-05-10 17:24:43 -03:00
Lucas De Marchi
68ae619448
AP_Compass: detect compasses for minlure
...
Minlure has an onboard compass (HMC5883L) as slave of MPU-6000, but also
allows the use of an external HMC5883L compass, which should be
connected to the lure's I2C port.
2016-05-10 16:08:39 -03:00
Gustavo Jose de Sousa
91246ad8af
AP_Compass: HMC5843: apply HMC5883L "arrow" rotation only if external
...
That rotation is done because of the "arrow" pointing the sensor direction in
3DR GPS+Compass kit (which isn't natural to the sensor orientation, by the
way). Thus, do that rotation only for external HMC5883L compasses.
2016-05-10 16:05:29 -03:00
Gustavo Jose de Sousa
35cddc7af0
AP_Compass: HMC5843: move hardcoded rotation to before call to rotate_field()
...
That rotation is set for AP_COMPASS_TYPE_HMC5883L, because it's usually
the compass from 3DR GPS+Compass kit, which has an arrow pointing the
"correct" direction. That rotation should be done before rotate_field()
as it represents the "standard" position for the kit.
This patch also makes published values consistent with respect to rotation.
Before this, raw fields used in calibration were published with a
rotation different from the filtered field when _product_id is
AP_COMPASS_TYPE_HMC5883L.
2016-05-10 15:56:38 -03:00
Gustavo Jose de Sousa
ad91a810b3
AP_Compass: Backend: add method is_external()
2016-05-10 15:55:58 -03:00
Gustavo Jose de Sousa
670b0071f9
AP_Compass: HMC5843: add parameter force_external to constructor
...
And to the detection probe() method. That way we don't need to use a board
`#ifdef` inside the class code. Additionally, we make raspilot board use it.
2016-05-10 15:52:54 -03:00
Andrew Tridgell
88a1ebaf0e
AP_Compass: allow setting of exact timestamp in HIL compass
2016-05-07 18:27:19 +10:00
Andrew Tridgell
0e32c047c3
AP_Compass: allow for COMPASS_EXTERNAL=2 for forced external
...
this allows users with unusual compass bus connections to force the
compass to external
2016-05-01 10:54:46 +10:00
Andrew Tridgell
ed999a283f
AP_Compass: added get_learn_type() API
...
this allows caller to determine if EKF offsets should be saved
2016-04-30 16:43:14 +10:00
mirkix
3df5a02448
AP_Compass: Add HMC5843 and second AK8963 autodetection to BBBmini
2016-04-24 10:57:57 -03:00
Randy Mackay
4aba25d2ef
AP_Compass_AK8963: remove unused _bus_sem, _last_accum_time
...
Resolves a compiler warning
2016-04-23 23:06:21 -07:00
Lucas De Marchi
46936767c1
AP_Compass: LSM303D: check for overruns in compass values
2016-03-23 17:50:38 -03:00
Lucas De Marchi
cf2d866d51
AP_Compass: LSM303D: used AP_HAL::Device interface
...
Initialization was also changed a little bit so we don't try to
initialize 25 times. We rather use the same methods as in the
AP_InertialSensor drivers.
Also move up the call to is_zero() in read_raw so we don't set
_mag_[x|y|z] in case of failure.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
5164fbb81b
AP_Compass: LSM303D: cleanup driver
...
Make it similar to other compass drivers, including method names.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
20a4a42cb3
AP_Compass: don't store raw and unfiltered fields
...
These are not used. The only place where raw fields are used are in the
compass calibrator and we don't need to store them.
Additionally remove duplicated documentation about the meaning of the
functions to avoid them getting out of sync.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
e6059f5197
AP_Compass: rename files to follow other libraries
...
AP_Compass.h is the main header to be exported and AP_Compass.cpp its
implementation. There's no need for an additional header.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
286697b844
AP_Compass: don't rebuild tree when single driver changes
...
Let the drivers be internal to the library so we don't need to rebuild
the entire tree when a single driver changes.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
d3831dbb98
AP_Compass: AK8963: use AP_HAL::I2CDevice abstraction
...
We still need the BusDriver (in some places called SerialBus) interface
since this driver can also be used on an AuxiliaryBus and that has a
different interface.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
41c1209169
AP_Compass: HMC5843: improve readability
...
- Capitalize and rename constants
- Make clear what gain is applied in calibration and what is the
"normal" gain
- Make the separation between HMC5883L and HMC5843 explicit when it
makes sense to improve readability
- Remove spurious delay in calibrate function
2016-03-23 17:50:38 -03:00
Lucas De Marchi
0291ad869b
AP_Compass: HMC5843: use AP_HAL::I2CDevice abstraction
...
We still need the BusDriver (in some places called SerialBus) interface
since this driver can also be used on an AuxiliaryBus and that has a
different interface.
Besides the usual conversion some more improvements:
- Use generic function to convert endianness
- Minor cleanups
- Reorder per-board ifdefs in compass instantiation: distinguish when
there's a default compass to when it should probe other compasses
2016-03-23 17:50:38 -03:00
Lucas De Marchi
abbe419823
AP_Compass: fix mismatched tag
...
In file included from /home/lucas/p/dronecode/ardupilot/libraries/AP_Compass/Compass.h:6:
/home/lucas/p/dronecode/ardupilot/libraries/AP_Compass/CompassCalibrator.h:86:5: warning: struct 'param_t' was previously declared as a class [-Wmismatched-tags]
struct param_t _params;
^
/home/lucas/p/dronecode/ardupilot/libraries/AP_Compass/CompassCalibrator.h:44:11: note: previous use is here
class param_t {
^
/home/lucas/p/dronecode/ardupilot/libraries/AP_Compass/CompassCalibrator.h:86:5: note: did you mean class here?
struct param_t _params;
^~~~~~
2016-03-18 22:39:39 -03:00
Lucas De Marchi
d5d6a10e63
AP_Compass: LSM303D now is part of LSM9DS0
2016-03-18 21:51:37 -03:00
Lucas De Marchi
a671b7f5b2
AP_Compass: remove misleading message
...
Not having data ready during initialization is normal. Don't print error
message since it can mislead people to think the compass was not
initialized successfully.
2016-03-18 21:51:37 -03:00
Lucas De Marchi
d8eb0d401d
AP_Compass: fix missing rename
...
cb8355c
(AP_HAL: fix compass define for bebop) renamed the constant in
AP_HAL but not in AP_Compass.
2016-03-17 11:49:38 -03:00
Lucas De Marchi
b3d26c5988
AP_Compass: remove trailing whitespaces in header
2016-03-17 02:57:05 -03:00
Gustavo Jose de Sousa
e5de4f2348
AP_Compass: AP_Compass_test: code enhancements
...
- Use panic() instead of looping forever.
- Readability improvement with the use of MAX() and MIN().
2016-03-09 10:12:14 -03:00
Gustavo Jose de Sousa
a61f9855d3
AP_Compass: AP_Compass_test: report multiple compasses
...
Report data from all available compasses, not just the primary one.
2016-03-09 10:12:10 -03:00
Gustavo Jose de Sousa
16acca865f
AP_Compass: AP_Compass_test: fix style
...
Used uncrustify and some manual changes.
2016-03-09 10:12:05 -03:00
Gustavo Jose de Sousa
0efbe8c80c
AP_Compass: allow calling calculate_heading() for different instances
2016-03-09 10:12:00 -03:00
Lucas De Marchi
71eefdfd2c
AP_Compass: remove trailing whitespaces
2016-03-07 14:49:35 -03:00
Lucas De Marchi
a46ca4c810
AP_Compass: HMC5883: reorganize header
2016-03-07 14:49:35 -03:00
dgrat
5148e41c1a
AP_Math: Cleaned macro definitions
...
Moved Definitions into a separate header. Replaced PI with M_PI and
removed the M_PI_*_F macros.
2016-02-27 02:51:33 -03:00
Lucas De Marchi
1a71c169fe
AP_Compass: replace header guard with pragma once
2016-02-18 14:52:34 -02:00
Lucas De Marchi
02a7fa5c2b
AP_InertialSensor: MPU9250: use AP_HAL::Device abstraction
...
This makes MPU9250 be almost the same as MPU6000 driver. Work has been
done here to make than similar so it's easier to spot the differences.
2016-02-16 19:49:09 -02:00
Lucas De Marchi
b55294920b
AP_Compass: AK8963: remove logging on fail to get semaphore
...
This is the only driver doing this, using the system_initializing() from
scheduler to log selectively. Remove the check together with removal of
unused wrapper methods to semaphore.
2016-02-08 13:28:32 -02: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
Víctor Mayoral Vilches
5d28fbfa1b
Compass: Erle-Brain 2 and PXFmini fix
2016-01-18 23:59:25 -02:00
Julien BERAUD
45d668df47
AP_Compass_AK8963: support for timesliced timers
...
fallback in case the current scheduler doesn't support it
2016-01-18 16:57:48 -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
Jonathan Challinger
9b5644fdb6
AP_Compass: fix example build
2015-12-29 10:46:35 -08: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
493ab96b29
AP_Compass: added QURT driver
2015-12-27 16:21:26 +11:00
Andrew Tridgell
3b546bb242
AP_Compass: added qflight driver
2015-12-27 16:12:27 +11:00
Lucas De Marchi
766252cd87
AP_Compass: don't use ternary operator in place of if/else
2015-12-21 15:54:30 +11:00
Aaron Wang Shi
5a085b1610
AP_Compass: add support to BH hat
2015-12-21 15:54:30 +11:00
Tom Pittenger
0aa0380db8
AP_Compass: compiler warnings - float to float compare and bool cast
2015-12-07 15:49:58 +09:00
Lucas De Marchi
0bcbcd07cc
AP_Compass: 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
Caio Marcelo de Oliveira Filho
cd7cfdef91
AP_Compass: examples use millis/micros/panic functions
2015-11-20 12:30:20 +09:00
Caio Marcelo de Oliveira Filho
86954cda0e
AP_CompassCalibrator: use millis/micros/panic functions
2015-11-20 12:30:14 +09:00
Caio Marcelo de Oliveira Filho
0d3fbbdd37
AP_Compass: use millis/micros/panic functions
2015-11-20 12:30:05 +09:00
Andrew Tridgell
8f4ce7f20b
build: removed all nocore.inoflag files
...
these were APM2 specific
2015-11-16 08:05:17 +11: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
bdc36349b4
AP_Compass: AK8963: Add support to use a AK8963 behind of a MPU9250 over I2C
...
To be able to use AK8963 connected to the auxiliary I2C bus of a
MPU9250 we need first initialize it.
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
Paul Riseborough
6698d4379d
AP_Compass: Enable usec timestamps to be retrieved for specified instance
2015-11-09 22:07:10 +11:00
Lucas De Marchi
eb75d73952
AP_Compass: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1
2015-11-04 12:14:11 +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
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
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
Gustavo Jose de Sousa
63b42e0632
AP_Compass: Calibrator: make calculations for theta only once
...
Additionally, format comment on sample acceptance formulas nicely.
2015-10-22 08:19:35 +11:00
Gustavo Jose de Sousa
f8433f82e6
AP_Compass: simplify calibration transition to COMPASS_CAL_RUNNING_STEP_ONE
2015-10-22 08:19:35 +11:00
Andrew Tridgell
4a8a24a1a2
AP_Compass: don't update last_update_usec for raw fields
...
this fixes a problem where the EKF gets compass samples at 50Hz
instead of the expected 10Hz
2015-10-21 13:22:24 +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
Lucas De Marchi
4004d5bf34
AP_Compass: remove check for HAL_CPU_CLASS
...
We don't support HAL_CPU_CLASS <= HAL_CPU_CLASS_16 anymore. This makes
COMPASS_MAX_INSTANCES and COMPASS_MAX_BACKEND constant for all supported
boards.
2015-10-21 10:05:18 +11:00
Caio Marcelo de Oliveira Filho
a3169d0a34
AP_Compass: remove unnecessary includes from 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
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
562db11159
AP_Compass: fix potential AP_Notify concurrency problem
2015-10-20 20:54:02 +09:00
José Roberto de Souza
3888579c07
AP_Compass: HMC5843: Use the correctly spelled method
2015-10-16 10:16:24 +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
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
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
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
Randy Mackay
825abdbedc
Compass: example sketch displays in milligauss
2015-10-07 21:35:24 +09:00
mirkix
ddb8e67954
AP_Compass: Add support for more then one AK8963
2015-10-06 10:38:21 +11: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
mirkix
eee9522ca5
AP_Compass: Add MPU9250 multiple instance support
2015-09-24 13:11:38 +10:00
raspilot
1b5e6849d9
AP_Compass: fix milligauss code in LSM303D driver
2015-09-16 16:52:17 +09: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
Julien BERAUD
5602e4055b
AP_Compass_AK8963: Fix Rotation on the Bebop
2015-09-15 14:45:17 +09:00
Andrew Tridgell
fa9ff5b604
AP_Compass: added parameter for compass calibration fitness threshold
2015-09-14 17:01:14 +10:00
Lucas De Marchi
309e75f9ac
AP_Compass: LSM303D: use c++11 initializer to avoid Wreorder
2015-09-14 14:22:15 +10:00
Lucas De Marchi
3a017c8702
AP_Compass: LSM303D: rename members to follow convention
...
Make the members have similar names as HMC5843 driver and prepend
underscore on private fields.
2015-09-14 14:22:15 +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
Andrew Tridgell
3699932417
AP_Compass: fixed SITL compass
2015-09-09 14:53:11 +10:00
Staroselskii Georgii
bd7c313bee
AP_Compass: fixed Compass::get_raw_field()
...
It seems as if it were a copy-paste error. A statis analyzer would
definetely be angry.
2015-09-09 10:38:17 +10:00
Staroselskii Georgii
e93ff44a97
AP_Compass: make a transition to milligauss in Compass library
2015-09-09 10:38:16 +10:00
Staroselskii Georgii
693613aa0f
AP_Compass: convert AK8963 measurements to uT
...
AK8963 is configured in 16-bit ADC mode which implies sensitivity of 0.15 uT/LSb. Knowing this fact we can convert the measurements to the proper units. The change will make users recalibrate their compasses.
2015-09-09 10:38:16 +10:00
Staroselskii Georgii
c207d8c6a8
AP_Compass: add milligauss counterparts to get_field() and get_offsets()
...
From now on there's a pair get_field_milligauss() and
get_offsets_milligauss() that can make the transition to the common
units across all compasses easier.
2015-09-09 10:38:16 +10:00
Andrew Tridgell
6991a1b9e9
AP_Compass: ensure we have payload space to send MAG_CAL messages
2015-09-07 08:58:11 +10:00
Andrew Tridgell
2baa0ac2f2
AP_Compass: disable COMPASS_LEARN when mag calibration used
2015-09-07 08:07:17 +10:00
Andrew Tridgell
079161ef3a
AP_Compass: fixed raw_field init in AK8963 driver
...
thanks to Peter for spotting this
2015-09-03 21:27:22 +10:00
Andrew Tridgell
e4b2fc711d
AP_Compass: added message for compass cal when armed
2015-09-03 16:59:22 +10:00
Andrew Tridgell
f4cdf57d8f
AP_Compass: added handling of compass calibration mavlink messages
2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit
75829f5533
AP_Compass: remove extra compass field correction
2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit
3abdf85796
AP_Compass_Calibrator: remove unrequired variables
2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit
c126017035
AP_Compass: reduce to if healthy check from if-else
2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit
2fb002798c
generate.sh
2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit
63973bff31
AP_Compass_AK8963: move variable declarations before goto
2015-09-03 16:59:14 +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
Gustavo Jose de Sousa
46774136a6
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-09-03 16:59:13 +10:00
Siddharth Bharat Purohit
cdd8bae6ac
AP_Compass: publish raw and unfiltered field for HMC5843 compass
2015-09-03 16:59:13 +10:00
Siddharth Bharat Purohit
8cdc9748b3
AP_Compass: publish raw and unfiltered field for AK8963 compass
2015-09-03 16:59:13 +10:00
Siddharth Bharat Purohit
f085e274c7
AP_Compass: add explaination for sample acceptance based on angular distance
2015-09-03 16:59:13 +10:00
Jonathan Challinger
f108383c11
AP_Compass: initialize CompassCalibrator _sample_buffer to NULL
2015-09-03 16:59:13 +10:00
Jonathan Challinger
358736a592
AP_Compass: correct calibrator sample acceptance math
2015-09-03 16:59:13 +10:00
Jonathan Challinger
bff9b9065e
AP_Compass: CompassCalibrator comment update
2015-09-03 16:59:13 +10:00
Siddharth Bharat Purohit
137bd25220
AP_Compass: add info about compass calibrator procedure
2015-09-03 16:59:12 +10:00
Siddharth Bharat Purohit
f5fbc2fac1
AP_Compass: use AP_Math inverse library
2015-09-03 16:59:12 +10:00
Jonathan Challinger
0edf1df28e
AP_Compass: loosen calibration acceptance tolerance
2015-09-03 16:59:12 +10:00
Jonathan Challinger
987f55387e
AP_Compass: style cleanup
2015-09-03 16:59:12 +10:00
Jonathan Challinger
5ef713f3db
AP_Compass: set AP_Notify::compass_cal_failed
2015-09-03 16:59:12 +10:00
Jonathan Challinger
5a12991d29
CompassCalibrator: remove dependence on AP_Notify
2015-09-03 16:59:12 +10:00
Jonathan Challinger
de600ca3da
AP_Compass: configured() only checks compasses with _USE set
2015-09-03 16:59:12 +10:00
Jonathan Challinger
72c8d0f530
AP_Compass: add samples to calibrator when published
2015-09-03 16:59:11 +10:00
Jonathan Challinger
cc36401b7c
AP_Compass: add calibration interface
2015-09-03 16:59:11 +10:00
Jonathan Challinger
05d3616e0d
AP_Compass: fix sitl build
2015-09-03 16:59:11 +10:00
Jonathan Challinger
7cb9fa8898
AP_Compass: Correct parameter checks in compass cal
2015-09-03 16:59:11 +10:00
Jonathan Challinger
6d45660568
AP_Compass: refactor run_fit_chunk logic
2015-09-03 16:59:11 +10:00
Jonathan Challinger
f2acf2cb88
AP_Compass: more parameter checks in compass calibrator
2015-09-03 16:59:11 +10:00
Jonathan Challinger
929ddb5685
AP_Compass: fix a math error in the compass calibrator
2015-09-03 16:59:10 +10:00
Jonathan Challinger
328cf82c3d
CompassCalibrator: update AP_Notify on failure
2015-09-03 16:59:10 +10:00
Jonathan Challinger
bfdbb55528
AP_Compass: make compasscalibrator running() public
2015-09-03 16:59:10 +10:00
Jonathan Challinger
d31d385490
AP_Compass: changes and fixes to LMA-based compass calibrate
2015-09-03 16:59:10 +10:00
bugobliterator
c66bfc95e1
Compass: Add Levenberg-Marquadt for ellipsoid fit
2015-09-03 16:59:10 +10:00
bugobliterator
7711dde2ad
Compass: implement 9 parameter ellipsoid fit
2015-09-03 16:59:10 +10:00
bugobliterator
35555c7b21
Compass: Add math for 9 parameter fitting
2015-09-03 16:59:10 +10:00
bugobliterator
7295537e8a
Compass: decrease sphere coverage to 1/3rd
...
for faster sample collection
2015-09-03 16:59:10 +10:00
bugobliterator
a2bd4e8997
Compass: Add less complex equations to calculate jacobians
2015-09-03 16:59:10 +10:00
bugobliterator
2ca0e80dc5
Compass: Add conditions to check sanity of results
2015-09-03 16:59:10 +10:00
bugobliterator
54bc28c96d
Compass: Add Levenberg-Marquadt optimiser for sphere_fit
...
increase iterations to get good results from LM
better check for convergence, comparison with initial fitness is a better way to determine if convergence occurs, if fitness has not improved compared to initial fitness it means optimiser has failed.
2015-09-03 16:59:10 +10:00
Jonathan Challinger
c0a662c819
AP_Compass: CompassCalibrator initial commit
2015-09-03 16:59:10 +10:00
Jonathan Challinger
f20ef69777
Compass: add soft-iron corrections
2015-09-03 16:59:09 +10:00
Jonathan Challinger
5fe6db0dc9
AP_Compass_PX4: use new compass backend interface
2015-09-03 16:59:09 +10:00
Jonathan Challinger
ade39abc7f
AP_Compass_HMC5843: use new compass backend interface
2015-09-03 16:59:09 +10:00
Jonathan Challinger
8800d03fce
AP_Compass_HIL: use new compass backend interface
2015-09-03 16:59:09 +10:00
Jonathan Challinger
cd5cf45ba8
AP_Compass_AK8963: use new compass backend interface
2015-09-03 16:59:09 +10:00
Jonathan Challinger
add1b8c257
AP_Compass: modify backend interface to push raw samples to frontend
2015-09-03 16:59:09 +10:00
Jonathan Challinger
b990eaed68
AP_Compass: add interface for raw and unfiltered field
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
628e446e3e
AP_Compass: HMC5843: use a struct for raw value
...
Like is done in AK8963, declare a raw_value struct.
2015-08-28 12:39:09 +10:00
Lucas De Marchi
9ecd1daf81
AP_Compass: HMC5843: remove useless delay
...
There's no need to add a delay after suspending timer in the
initialization. Also initialize _bus_sem earlier, like is done in
AK8963.
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
Staroselskii Georgii
3eb6be64c9
AP_Compass: ignore first two readings in a clearer way
...
This way we don't mix two different conditionals: settling and data validation.
2015-08-28 12:39:09 +10:00
Staroselskii Georgii
633330db14
AP_Compass: rename calibration array in HMC
...
I think naming the variable "scaling" makes more sense.
2015-08-28 12:39:09 +10:00
Staroselskii Georgii
d8bddcbf3a
AP_Compass: fix indentation in HMC's driver
2015-08-28 12:39:09 +10:00
Staroselskii Georgii
79ffddc6db
AP_Compass: add a macro for checking calibration values in HMC
2015-08-28 12:39:08 +10:00
Lucas De Marchi
f61386ae43
AP_Compass: HMC5843: release the lock before read
...
read() calls accumulate() which takes the lock by itself so we must
release it like we were doing before 669ae26 ("AP_Compass: encapsulated
calibration in HMC").
2015-08-28 12:39:08 +10:00
Staroselskii Georgii
a9e8c1c464
AP_Compass: encapsulated calibration in HMC
2015-08-28 12:39:08 +10:00
Staroselskii Georgii
0fbc295d97
AP_Compass: encapsulated version detection in HMC driver
2015-08-28 12:39:08 +10:00
Lucas De Marchi
868d0bf3c3
AP_Compass: AK8963: refactor constructors
...
Declare a common constructor that others can call.
2015-08-28 12:39:08 +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
Lucas De Marchi
7e997564bf
AP_Compass: 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
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
66469d7529
Compass_HMC5843: remove unnecessary i2c semaphore give
2015-08-07 15:50:36 +09:00
Julien BERAUD
39b42a4e6e
AP_Compass_AK8963: suspend timer while reading
...
Protection in case a timer falls while reading data, because it could end up
with corrupted data
2015-08-03 22:50:08 +09:00
Julien BERAUD
0aa2fe7a0b
AP_Compass_AK8963: fix sem handling
...
In case of error or zeroed data, the i2c semaphore wasn't given.
It happened at first startup on Bebop and caused a failure:
"PANIC: failed to take _bus->sem 100 times in a row..."
2015-08-03 20:57:46 +09:00
Lucas De Marchi
8240e5ae65
AP_Compass: AK8963: reduce bytes read
...
We are not using INFO and ST1 registers, so there's no need to read
extra 2 bytes for each transaction.
2015-07-23 17:44:36 +10:00
Lucas De Marchi
2b9c46e1ff
AP_Compass: AK8963: don't oversample AK8963
...
Reduce the frequency with which MPU9250 reads AK8963 to reduce the
chance of errors.
2015-07-23 17:44:36 +10:00
Lucas De Marchi
6c2ceea165
AP_Compass: AK8963: remove author and connection comment
...
Authorship and how sensor is connected get outdated (as it already is).
Our code is on git so let it track who wrote each line.
2015-07-23 17:44:36 +10:00
Staroselskii Georgii
8ab33c46ce
AP_Compass: revisited AK8963 code
...
Reduced duplication a bit and revisited the update method which is now
split into several logical hunks.
2015-07-23 17:44:36 +10:00
Lucas De Marchi
fffedae3e0
AP_Compass: AK8963: reduce stack usage and zero out buffers
...
Since we are not using MPU9250's fifo to get samples from AK8963 we will
always read only 1 sample (+ control registers).
2015-07-23 17:44:35 +10:00
Lucas De Marchi
37734886a5
AP_Compass: AK8963: remove repeated comments
...
No need to repeat the same comments on 3 different places. Instead add a
single comment to explain how start_measurements() and read_raw() are
related.
2015-07-23 17:44:35 +10:00
Lucas De Marchi
27d95b67a8
AP_Compass: AK8963: remove state machine
...
Don't use a state machine in AK8963: the start_measurements() method
should be called only once. Even if there's a magnetic sensor overflow
the only thing we should do is to discard the new data.
This also moves the _collect_samples() method to be inside _update()
since it's the only place it should be called from, the one running on
the timer thread.
2015-07-23 17:44:35 +10:00
Lucas De Marchi
e232543fca
AP_Compass: AK8963: change initialization and rename methods
...
We need to check the AK8963's id before anything else Here we are
reordering the calls to _calibrate() and _check_id(). After that we
don't need to read and write again the AK8963_CNTL1 register.
While at it do some renames as well:
- _configure() -> _setup_mode(): since now there's a
_bus->configure() it became confusing what actually it's
doing.
- make error messages say what we were actually trying to do but
couldn't. Also remove PSTR since this is linux-only.
- start_conversion() -> start_measurements(): We are instructing the
bus to start to get the samples, not to tell the chip to start an
analog->digital conversion like in other sensors.
2015-07-23 17:44:35 +10:00
Lucas De Marchi
ae5d9baddb
AP_Compass: AK8963: remove defines not used anymore
...
The MPUREG_PWR_MGMT_1 defines were used when we cared about the MPU9250
initialization code. Now all initialization is done by the MPU9250 class
itself, so remove these defines.
Also remove AK8983_SELFTEST_MAGNETIC_FIELD_ON that is never used and let
the defines always with 2 bytes to improve readability.
2015-07-23 17:44:34 +10:00
Lucas De Marchi
cae895bfdf
AP_Compass: AK8963: group members together
...
Besides being semantically related, this removes the hole due to
alignment. The size is the same since the hole is actually turned into
padding.
2015-07-23 17:44:34 +10:00
Lucas De Marchi
28d3d775a4
AP_Compass: AK8963: remove resolution member
...
We only use the highest one and there's no intention to support the
14bits one. Just use the define rather than saving it as a member.
2015-07-23 17:44:34 +10:00
Lucas De Marchi
86b3312112
AP_Compass: AK8963: factor out common code of read_raw()
...
Similar code was added in the read_raw() implementation for each bus.
Add a new POD struct read_raw to contain the registers from the AK8963
and use it instead as argument.
2015-07-23 17:44:33 +10:00
dgrat
d941174978
AP_Compass: AK8963: enhance the readability
...
Reduce the deepness of indentation and fix coding style.
2015-07-23 17:44:33 +10:00
Lucas De Marchi
fd5d25b1d5
AP_Compass: use ARRAY_SIZE macro
2015-07-21 14:25:17 +09: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
Julien BERAUD
0cd584c293
AP_Compass: fix rotation for bebop AK8963
...
Set the correct rotation for bebop
2015-07-10 16:46:29 +10:00
Julien BERAUD
7dd0b5fae6
AP_Compass: removed _spi_sem and _spi
2015-07-10 16:46:29 +10:00
Andrew Tridgell
c83d5b1f08
AP_Compass: only build AK8963 driver on Linux
...
must match MPU9250 build
2015-07-09 11:57:27 +10:00
Randy Mackay
d192b3ccea
Compass: set device id for ak8963 and hmc5843
2015-07-06 21:04:46 +09:00
dgrat
f56f584233
Compass: Improved field rounding in learning
...
Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2015-07-06 11:31:58 +10:00
Lucas De Marchi
1deb837e70
AP_Compass: Use common function in MPU9250 for initialization
2015-07-06 10:48:07 +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
Staroselskii Georgii
7a417d1151
AP_Compass: AK8963 rework
...
Got rid of extra abstraction layer. There is no need for that now.
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
5b0394eb05
AP_Compass: start MPU9250 driver at low speed
...
this raises the chances of successful init of the MPU9250
2015-07-02 08:48:06 +10:00
Andrew Tridgell
d6a1bd98e6
AP_Compass: convert example from .pde to .cpp
2015-06-01 16:58:11 +10: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
Lucas De Marchi
95627cf412
AP_Compass: use functor macros
...
Functor is not yet being used but let's make is macro fallback to the
previous Delegate implementation for easy of transition between the two.
2015-05-26 13:46:52 +10:00
Andrew Tridgell
2475ee9630
AP_Compass: setup HIL/SITL for two compasses
2015-05-16 07:06:04 +10:00
Andrew Tridgell
91b4ba3588
AP_Compass: allow for more than one compass in HIL/SITL
2015-05-15 14:25:44 +10:00
Randy Mackay
ade4f81c77
Compass: fix example sketch
2015-05-15 11:53:28 +09: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
Andrew Tridgell
be3d6c924e
AP_Compass: rename enum values to avoid header conflicts for 'ERROR'
2015-05-05 09:45:53 +10:00
Tom Pittenger
16e71ec1ce
Compass: fix compile warning re member init order
2015-04-24 14:15:00 +09:00
Tom Pittenger
bf1d128d70
Compass: fix compile warnings re float constants
...
Also fix example sketch
2015-04-24 12:29:07 +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
Lucas De Marchi
996739df12
AP_Compass: Do not panic if compass is not found
...
Copter uses 2 compasses for linux configuration, but one of them may not
be available. Do not panic if a AK8963 isn't found.
2015-04-14 09:29:12 +10:00
Andrew Tridgell
c8b0970e61
AP_Compass: show compass count in example
2015-03-14 20:00:29 +11:00
Andrew Tridgell
f4455d063e
AP_Compass: fixed example
2015-03-14 17:07:39 +11: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
86fc90f54c
AP_Compass: removed spurious rotation in PX4 backend
...
and cleanup rotation macros
2015-03-14 08:52:37 +11:00
Andrew Tridgell
d7bac39539
AP_Compass: removed two unused functions
2015-03-14 08:52:37 +11:00
Andrew Tridgell
fec2025469
AP_Compass: added set_hil_mode()
2015-03-13 22:52:55 +11:00
Andrew Tridgell
8f6982860f
AP_Compass: fixed devid for 2nd compass
2015-03-13 20:46:32 +11:00
Andrew Tridgell
7b51c907f5
AP_Compass: zero some more variables in constructor and init
2015-03-13 19:22:11 +11:00
Andrew Tridgell
4bc92b6373
AP_Compass: removed _product_id var
2015-03-13 18:59:52 +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
13f0aa5ecd
AP_Compass: Separate common code into backend
...
_copy_to_frontend function takes care of abstracting
this code from the driver. For now the function takes
care of the offset and rotation that is common.
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
Andrew Tridgell
99ed508903
AP_Compass: change for new PX4 paths
2015-02-14 12:25:43 +11:00
Grant Morphett
52c5db8440
AP_Compass: Changes to fix the warnings in rover sitl build.
...
We are starting the process of resolving all the warnings in the
ardupilot builds of all vehicles and platforms.
2015-02-11 18:16:45 +11:00
Emile Castelnuovo
5e8c1b61b5
AP_Compass: AP_Compass_VRBRAIN.cpp added _is_external overwrite to deal with external compass attached to internal I2C BUS
2015-02-02 08:44:00 +11:00
Randy Mackay
635ff92d6b
Compass: fix example sketch
2015-01-28 17:15:39 +09:00
mirkix
9a65a8c8fb
AP_Compass: add AK8963 to auto-detect in test suite
2015-01-22 14:34:23 +11:00
mirkix
e9d4165a8d
AP_Compass: add AK8963 support to test suite
2015-01-22 14:34:17 +11:00
Staroselskii Georgii
c16eb5d330
AP_Compass: fixed corrections for AK8963
2015-01-09 06:38:22 +11:00
Staroselskii Georgii
4394f0cf75
AP_Compass: fixed external compass detection for AK8963
2015-01-09 06:38:22 +11:00
Staroselskii Georgii
f0753e965e
AP_Compass: eliminated possible division by zero in AK8963
2015-01-09 06:38:22 +11:00
Staroselskii Georgii
b804430276
AP_Compass: changed default orientation for AK8963 on Navio
2015-01-09 06:38:22 +11:00
Andrew Tridgell
9835544163
AP_Compass: fixed build on non-Linux platforms
2015-01-07 08:41:14 +11:00
Staroselskii Georgii
0d1cf347c7
AP_Compass: added AK8963 support
2015-01-07 08:41:12 +11:00
Randy Mackay
ffbc3862bd
Compass: update compass orient param description
...
Update rotation 38 to Yaw293Pitch68Roll90
2015-01-02 17:19:12 +09:00
Andrew Tridgell
a686494127
AP_Compass: fixed example build
2014-11-28 10:40:34 +11:00
Randy Mackay
20f3f19285
Compass: add new rotation to ORIENT param description
2014-11-22 14:13:25 +09:00
Staroselskii Georgii
7f00dd413f
AP_Compass: fixed HMC5883's initialisation code
2014-11-14 10:21:04 +11:00
Randy Mackay
31087e4f20
Compass: shorten EXTERNAL2/3 to EXTERN2/3
...
Bug discovered by Michael Day
2014-11-08 10:21:22 +09:00
Andrew Tridgell
7db0244dac
AP_Compass: added some comments
2014-10-19 17:02:45 +11:00
Jonathan Challinger
9054dd3f9a
AP_Compass: use apply_correction_function to eliminate duplication
2014-10-19 17:02:45 +11:00
Andrew Tridgell
b437977547
AP_Compass: added set_offsets() interface
...
this will be used by Replay to prevent the need for saving parameters
2014-10-15 09:16:31 +11:00
Randy Mackay
7caa611eb1
Compass_HIL: use instance specific orient and external
2014-10-01 13:02:03 +10:00
Randy Mackay
86aac4f40c
Compass_HMC5843: use instance specific orient and external
2014-10-01 13:02:03 +10:00
Randy Mackay
900896977c
Compass_VRBrain: use instance specific orient and external
2014-10-01 13:02:03 +10:00
Randy Mackay
85e82a0399
Compass_PX4: use instance specific orient and external
2014-10-01 13:02:03 +10:00
Randy Mackay
023b6afe8b
Compass: add ORIENT2 and EXTERNAL2 params
2014-10-01 13:02:03 +10:00
Randy Mackay
16058cb730
Compass_VRBrain: primary compass based on use_for_yaw
2014-10-01 13:02:02 +10:00
Randy Mackay
01fa4ba619
Compass_PX4: primary compass based on use_for_yaw
2014-10-01 13:02:02 +10:00
Randy Mackay
798cc36e64
Compass: use_for_yaw for each compass
2014-10-01 13:02:02 +10:00
Randy Mackay
84d792216e
Compass: use_for_yaw to use primary compass health
...
This allows the internal compass to be used if the external compass
fails.
2014-10-01 13:02:02 +10:00
Randy Mackay
e14ae0c0b1
Compass: param descriptions for OFS2, MOT2
2014-09-27 17:59:26 +09:00
Randy Mackay
c2c5807ec7
Compass: always default devid to zero
2014-09-23 20:35:18 +09:00
Andrew Tridgell
9f6d1f987b
AP_Compass: removed use of hrt_absolute_time()
2014-08-20 08:41:28 +10:00
Andrew Tridgell
41e65c2415
AP_Compass: fixed default orientation for PXF
2014-08-19 10:08:17 +10:00
Emile Castelnuovo
3b53c167a0
AP_Compass: VRBRAIN. Deal with external mag connected on internal I2C on VRBRAIN 4.5
...
This enables user to set the external parameter to true even if only one compass is connected
2014-08-16 20:28:50 +10:00
Andrew Tridgell
c49981c03d
AP_Compass: fixed example build
2014-08-13 22:11:25 +10:00
Emile Castelnuovo
1092447360
AP_Compass_VRBrain: add support for two compasses
2014-07-23 20:51:12 +09:00
Emile Castelnuovo
4deafffb3e
AP_Compass: VRBRAIN corrected function definition
...
Add support for two compasses.
2014-07-23 20:47:19 +09:00
Randy Mackay
a6c29ba1c3
Compass_PX4: get_primary made public
2014-07-22 22:01:23 +09:00
Randy Mackay
c16672a529
Compass_VRBrain: get_primary made public
2014-07-22 22:01:22 +09:00
Randy Mackay
d291594d7c
Compass: get_primary method made public
2014-07-22 22:01:09 +09:00
Randy Mackay
1f579563e6
Compass: set_motor_compensation takes instance as first parameter
...
Also get_motor_compensation uses primary compass
2014-07-22 21:59:04 +09:00
Randy Mackay
47801a6c4d
Compass: bug fix to init of device id
...
Also init members to reduce compiler warnings
2014-07-16 14:29:10 +09:00
Markus Koetter
701aa9ac4c
AP_Compass: DEVIOCGDEVICEID is (currently) not defined in VRNuttX
2014-07-15 11:42:37 +10:00
Andrew Tridgell
1e20f89f90
AP_Compass: use HAL_COMPASS_DEFAULT in example code
2014-07-14 09:44:36 +10:00
Randy Mackay
bbf4805b0e
Compass: update pixhawk expected device ids
2014-07-11 11:10:18 +09:00
Craig Elder
c9f3adcb5c
Compass: Updated COMPASS_PRIMARY parameter description
2014-07-10 15:32:06 -07:00
Craig Elder
0ecd12b1c6
AP_Compass: Corrected typo in parameter description
...
Corrected typo in parameter description
2014-07-10 14:19:19 -07:00
Randy Mackay
4995b9ada8
Compass: default device id to zero
2014-07-10 20:25:36 +09:00
Randy Mackay
16d4af8346
Compass: sanity check instance in set_and_save_offsets
2014-07-10 20:25:32 +09:00
Randy Mackay
cf7e1a6339
Compass: example sketch update for set_and_save_offsets
2014-07-10 20:25:13 +09:00
Randy Mackay
a778522cef
Compass: add learn_offsets_enabled accessor method
2014-07-10 20:25:11 +09:00
Randy Mackay
108c878b04
Compass: set_offsets modified to also save offsets
2014-07-10 20:25:08 +09:00
Randy Mackay
124bd4b489
Compass: save_offsets accepts compass instance
2014-07-10 20:25:05 +09:00
Randy Mackay
070f1c1bbb
Compass: add dev_id for VRBrain
2014-07-10 20:24:49 +09:00
Randy Mackay
f42c9579d7
Compass: add dev_id for PX4
...
dev_id is retrieved from PX4Firmware via ioctl call
2014-07-10 20:24:46 +09:00
Randy Mackay
b7f33d81ad
Compass: add DEV_ID param and configured method
...
These allow checking the offsets were created with the current compass
device.
2014-07-10 20:24:44 +09:00
Andrew Tridgell
c138244155
AP_Compass: support 3 mags on PX4
2014-07-04 12:07:47 +10:00
Emile Castelnuovo
8f3a4bc88b
VRBRAIN: correction to AP_Compass_VRBRAIN.cpp
2014-06-19 11:27:45 +02:00
LukeMike
8f552d5758
VRBRAIN: Changed the management of VirtualRobotix's boards.
2014-06-19 11:27:38 +02:00
Andrew Tridgell
e9e1799700
AP_Compass: fixed VRBrain build
2014-06-02 10:42:37 +10:00
Andrew Tridgell
2d9e9d9bc3
AP_Compass: added COMPASS_PRIMARY parameter
...
this allows selection of which compass is the primary. Useful if the
first compass starts giving spurious data (as happened in our plane)
2014-05-25 22:03:44 +10:00
Jonathan Challinger
e883b889b6
SITL: Add compassmot interference
2014-05-15 21:14:20 +10:00
Kevin Hester
b7bed437c2
Compass: fixup line endings
2014-04-15 15:56:57 +09:00
Emile Castelnuovo
1bc199c5bd
AP_Compass: new files and definition for VRBRAIN board
2014-04-08 16:19:19 +10:00
Andrew Tridgell
485ae596fc
AP_Compass: fixed last_update for secondary compass with primary failed
...
this ensures EKF and DCM will use a secondary compass if the primary
fails
2014-03-23 22:05:17 +11:00
Matthew Lloyd
60a4f74de6
AP_Compass: avoid division by zero if we haven't received any mag reports
...
Otherwise, get_field() will return NaNs after once every few calls to
read() during compassmot on PX4 platforms, which causes compassmot to fail.
This is a quick hack around the deeper issue, which could be something
like the PX4 mag driver experiencing starvation and skipping mag reports,
buffer overrun or something else that causes mag reports to be dropped.
Or perhaps we should never expect in the first place that we will always
receive at least one mag report between calls to read().
2014-03-23 21:22:32 +11:00
Andrew Tridgell
db48ed9218
AP_Compass: fixed showing of is_external for 2nd compass
2014-03-13 16:26:43 +11:00
Andrew Tridgell
cf148fa76c
AP_Compass: improved COMPASS_ORIENT and COMPASS_EXTERNAL for Pixhawk
2014-02-27 12:46:27 +11:00
Andrew Tridgell
189d635493
AP_Compass: constrain compass offsets to +/- 2000
...
this is prompted by a user log showing NaN compass offsets, resulting
in a crash. The patch ensures we never end up with NaN offsets, and
also constrains the offsets to a reasonable limit
2014-02-16 13:33:41 +11:00
Andrew Tridgell
9bb8f73d56
Compass: split compass learning out to its own C++ file
2014-02-16 13:21:06 +11:00
Andrew Tridgell
54562b0b9a
AP_Compass: prevent bad initial values from affecting HMC5883 calibration
...
the first couple of values after we enter strap mode may be low, but
just above our 0.7 threshold. We now discard the first two values to
prevent these affecting the average.
Also added some commented out debug code and a comment on the scaling
of the calibration code
2014-01-22 17:15:34 +11:00
Andrew Tridgell
bc2d17e76e
AP_Compass: added vector compass setHIL method
2013-12-30 14:35:24 +11:00
Andrew Tridgell
c44d8b45ce
AP_Compass: auto-select healthy compass
2013-12-09 20:01:42 +11:00
Andrew Tridgell
61f564d7c9
AP_Compass: support motor compensation for multiple compasses
...
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-12-09 19:45:31 +11:00
Andrew Tridgell
0a7a935f63
AP_Compass: fixup
2013-12-09 17:54:54 +11:00
Andrew Tridgell
c538816825
AP_Compass: support compass health status on multiple compasses
2013-12-09 17:46:41 +11:00
Andrew Tridgell
bde89fd4e2
AP_Compass: added compass offsets for 2nd compass
2013-12-09 17:34:07 +11:00
Andrew Tridgell
8a97042fb1
AP_Compass: updates to support multiple compasses
2013-12-09 17:34:07 +11:00
Andrew Tridgell
cb16733918
AP_Compass: switched to a vector based interface
...
this is more consistent with other APIs and makes multi-device support
easier
2013-12-09 17:34:06 +11:00
Randy Mackay
84fdff4cd6
Compass: slightly relax HMC5843 calibration limits
...
Some users have reported Z axis values as high as 1.33. Their compasses
seem otherwise health so extending the limits slightly.
2013-11-27 15:36:34 +09:00
Andrew Tridgell
1ccd6bb7ef
AP_Compass: don't wait more than 1ms for compass sample
...
this prevents 5ms delays in compass accumulate
2013-10-08 11:50:54 +11:00
Andrew Tridgell
f286369990
AP_Compass: fixed orientation on Linux
2013-10-08 11:50:54 +11:00
Andrew Tridgell
83c942a512
AP_Compass: prevent NULL deref on enable mag while running
2013-10-08 11:50:53 +11:00
Andrew Tridgell
da14ad2e2d
AP_Compass: neaten up HMC5883 debug
2013-09-28 21:24:02 +10:00
Andrew Tridgell
ce7d458855
AP_Compass: added Linux support to the compass test
2013-09-28 21:24:02 +10:00
Andrew Tridgell
6fc5b06043
AP_Compass: fixed some old Serial.print calls
2013-09-28 21:24:02 +10:00
Andrew Tridgell
1243ab9e63
AP_Compass: added HAL_Linux support
2013-09-28 21:24:02 +10:00
Andrew Tridgell
3f0f8dfa62
AP_Compass: removed SMACCM support
2013-09-26 22:38:31 +10:00
Mike McCauley
2fa0c39f3a
AP_Compass: added Flymaple orientation
2013-09-24 13:18:35 +10:00
Mike McCauley
4c65c42411
AP_Compass: fixed ARM 32 bit compatibility
2013-09-23 18:10:21 +10:00
Andrew Tridgell
229841052a
AP_Compass_PX4: removed MAGIOCSSAMPLERATE call
2013-09-09 18:04:41 +10:00
Andrew Tridgell
db14a85fc5
AP_Compass: added more debugging to AP_Compass_PX4 driver
...
this helps debug compass initialisation issues
2013-09-09 18:04:40 +10:00
Andrew Tridgell
b8b72819c1
AP_Compass: ignore COMPASS_ORIENT for internal compass
...
this means if COMPASS_ORIENT is not 0 and the external compass fails
to start on boot we don't end up with a bad compass orientation
2013-09-07 16:49:51 +10:00
Andrew Tridgell
9320e82ac2
AP_Compass: added in new orientations
2013-08-30 14:19:03 +10:00
Andrew Tridgell
fbf79c07f0
AP_Compass: added COMPASS_EXTERNAL option
...
this allows configuring of a compass as being externally attached
2013-08-30 14:02:09 +10:00
Andrew Tridgell
97b7130bb9
libraries: update license header to GPLv3
...
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell
1ff669eb97
AP_Compass: simplify PX4 compass driver
...
we can now rely on queueing in the NuttX driver
2013-08-30 13:01:34 +10:00
Andrew Tridgell
feac9d1306
AP_Compass: fixed a bug in the tilt compass calculation
...
The simplification applied a few months ago was incorrect
2013-08-18 21:08:52 +10:00
Tobias
ab311d1dd4
AP_Compass: removed comparison out of range compiler warning
...
uint_ >= 0 (-Wtype-limits)
2013-07-08 14:57:25 +10:00
Andrew Tridgell
a6c7bd3612
AP_Compass: fixed rotations for COMPASS_ORIENT
...
this matches AHRS_ORIENTATION again
2013-07-08 12:17:59 +10:00
Craig@3DR
1a3ed2d80b
AP_Compass: Corrected COMPASS_ORIENT Parameter Description
2013-06-26 19:14:24 -07:00
Andrew Tridgell
4007b7b1e9
AP_Compass: fixed indent-tabs-mode
2013-05-30 09:52:30 +10:00
Randy Mackay
80bd458f29
Compass: update parameter description
...
We do not want people modifying the COMPASS_MOTCT manually
2013-05-11 14:50:36 +09:00
Andrew Tridgell
9a87b3f3c1
AP_Compass: use const on more functions and remove old calculate_heading()
...
the calculate_heading() based on roll/pitch is not needed anywhere
2013-05-09 09:24:06 +10:00
Andrew Tridgell
f78de63a09
AP_Compass: more efficient calculate_heading() implementation
...
Thanks to piersh for this improvement. See
b5f0635455 (commitcomment-3171806)
2013-05-09 09:24:06 +10:00
Andrew Tridgell
c90d44c121
AP_Compass_HIL: fixed indentation
2013-05-02 21:31:17 +10:00
Andrew Tridgell
f72dd560cb
AP_Compass: fixed the HIL sensors compass
...
this sets up good compass values for HIL sensors
2013-05-02 14:59:33 +10:00
Andrew Tridgell
86027f6e0f
AP_Compass: fixed PX4 build
2013-05-02 13:00:52 +10:00
Andrew Tridgell
af50b652f8
AP_Compass: removed old orientation defines
...
we now use the rotations in libraries/AP_Math/rotations.h
2013-05-02 12:48:14 +10:00
Andrew Tridgell
217f34e155
AP_Compass: added COMPASS_ORIENT parameter, to support external compasses
...
this allows the user to configure the compass for any orientation
supported by our rotation library
2013-05-02 12:48:14 +10:00
Andrew Tridgell
ba83950fc4
libraries: replace constrain() with constrain_float()
...
this makes the type much more obvious. Thanks to Tobias for the
suggestion.
2013-05-02 10:25:40 +10:00
Andrew Tridgell
0fce0eb488
AP_Compass_PX4: fixed handling of a saturated compass
...
a saturated compass is now marked unhealthy, rather than causing the
code to spin waiting for a valid sample. This fixes a problem with
strong magnets causing the main flight loop to stop
2013-05-01 08:54:53 +10:00
Andrew Tridgell
26fa5c40f1
Compass: use const references for some functions
2013-04-22 13:26:49 +10:00
Randy Mackay
b8974dec99
Copter: compass learn off by default
2013-04-16 18:47:39 +09:00
Randy Mackay
b48864e1ad
Copter: allow CH6 tuning of compass declination
2013-04-15 21:50:44 +09:00
Christopher Hrabia
9760cdf2d7
Compass: corrected space
2013-03-18 14:27:49 +09:00
Randy Mackay
b8d492b504
Compass: current based compensation added
2013-03-03 23:02:12 +09:00
Randy Mackay
e113eb526b
Compass: add get_motor_compensation
...
Remove redundant set_motor_compensation call
2013-03-02 17:53:03 +09:00
Randy Mackay
bfb29ce22b
Compass: remove virtual functions to save RAM
2013-03-02 00:07:32 +09:00
Randy Mackay
886725291c
Compass: enable motor compensation for 1280
...
Expand motor compenstion vector's range limit
2013-03-02 00:03:29 +09:00
Randy Mackay
8093c98cd3
Compass: add motor compensation to HIL library
2013-03-02 00:03:24 +09:00
Randy Mackay
d8515ff85e
Compass: basic compensation for motor interference
2013-03-02 00:03:16 +09:00
Andrew Tridgell
80eaa52ed8
AP_Compass: use report timestamp on PX4 for accurate timing
2013-01-22 21:22:01 +11:00
James Bielman
4fa7bb1486
Add AVR compatibility header for missing math.h definitions.
...
- Define float versions of math functions to the double versions
on AVR (eg. #define sinf sin).
- These macros appear to be missing in older versions of avr-libs.
- Include AP_Math.h rather than math.h to get these definitions.
2013-01-16 13:52:17 +11:00
James Bielman
5631f865b2
Update floating point calculations to use floats instead of doubles.
...
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell
60a4447a86
AP_Compass: added set_board_orientation() method
2013-01-13 17:32:48 +11:00
Andrew Tridgell
8f424cdf21
AP_Compass: ensure we check we got the semaphore
2013-01-09 20:42:20 +11:00
James Bielman
eca1417858
AP_HAL: Add semaphores to I2C driver.
...
- Guard I2C transactions with this semaphore in the MS5611 and
HMC5843 drivers.
2013-01-04 15:43:43 -08:00
Andrew Tridgell
26bc278181
AP_Compass: use queue length 10 in PX4 driver
...
and remove unnecessary poll() call
2013-01-04 20:12:03 +11:00
Andrew Tridgell
741174f5d5
AP_Compass: first cut at a PX4 compass driver
2013-01-04 16:21:24 +11:00
rmackay9
bf77a0f2e4
AP_Compass: added parameter descriptions
2013-01-02 16:08:44 +09:00
Andrew Tridgell
374af1cd14
build: change from Arduino.mk to apm.mk
2013-01-02 17:29:37 +11:00
Andrew Tridgell
a180437028
AP_Compass: disable auto-declination on 1280
...
this saves a few k of flash space
2012-12-20 14:53:23 +11:00