Commit Graph

62 Commits

Author SHA1 Message Date
Mykhailo Kuznietsov 633bb159bf AP_Compass: Fix some typos
Fixed some typos found in the code.
2023-10-12 18:30:42 +11:00
Andrew Tridgell 863b4bf928 AP_Compass: fixed zero compass diagonals
this fixes a regression from 4.2 to 4.3.

previously we automatically set the diagnoals to 1,1,1 if they were
0,0,0. We don't do that any more. I was helping a user who had copied
an old config with 0,0,0 for diagonals and did not understand two
things:

- the compass did not work in 4.3
- large vehicle mag cal didn't work
2023-01-17 12:05:19 +11:00
Peter Barker aef745c693 AP_Compass: fix compilation when removing diagonals state 2022-11-09 21:14:04 +11:00
Andrew Tridgell af224dab1e AP_Compass: fixed AP_Periph compass
diagonals are no longer initialised to 1.0, which leaves us with zero
compass after matrix mul
2022-09-30 21:25:36 +10:00
Andrew Tridgell b6bcd6346d AP_Compass: switch to a general method of heater compensation
this allows any board to easily setup heater compensation for an
internal compass. The offsets are in body frame (previously in sensor
frame) and are sensor specific using bus device IDs
2022-08-02 17:26:46 +10:00
Iampete1 cdf930effe AP_Compass: defualt diagonals vector to 1.0 2022-07-28 16:51:33 +10:00
Iampete1 209ad965be AP_Compass: remove custom rotations 2022-03-02 18:16:42 +11:00
Andrew Tridgell 8eb40bafc5 AP_Compass: revert compass parameter changes 2021-12-04 16:51:53 +11:00
Iampete1 071ff39ff8 AP_Compass: move instance params to shared table 2021-11-30 08:14:43 +09:00
Pierre Kancir 12e1f67326 AP_Compass: only update last_update_ms on raw_field update if on calibration 2021-10-13 19:45:03 +11:00
Siddharth Purohit f55ee264a7 AP_Compass: reset compass ids not present after compass cal
also implement replacement mechanism for UAVCAN compasses
2020-07-27 19:48:15 +10:00
Siddharth Purohit c0eb27cc35 AP_Compass: pull compass calibrator out into a separate thread 2020-06-05 09:38:40 +10:00
Andy Piper 63b5711a4d AP_Compass: use a separate slot for the custom compass rotation 2020-05-24 07:46:17 +10:00
Andy Piper b7b2d9a6ce AP_Compass: add support for custom compass rotation via COMPASS_CUS_{ROLL,PIT,YAW}
add reboot required for parameters that need it
disable custom rotation on AP_Periph devices
2020-05-05 09:25:18 +10:00
Michael du Breuil 9b404669c8 AP_Compass: Skip rotating the mag data when the board orientation is none 2020-04-28 10:37:00 +10:00
Siddharth Purohit 8d227d401a AP_Compass: modify compass driver to support consistent ordering and hotplugging 2020-02-19 13:59:53 +09:00
Andrew Tridgell 6fd0ca36aa AP_Compass: added estimation of compass scale factor
this adds new COMPASS_SCALE, COMPASS_SCALE2 and COMPASS_SCALE3
parameters, which give the sensor scaling factor. It is used to
compensate for an incorrect scaling in a compass.

The 3D compass calibration process will set the correct value
automatically, otherwise users can set the value to a known value for
an existing compass
2019-12-03 20:48:23 +11:00
Andrew Tridgell f4576ec8f3 AP_Compass: reduce firmware size for AP_Periph 2019-08-27 10:29:56 +10:00
Michael du Breuil 58dbbd6d0e AP_Compass: Refactor battery current backend 2019-07-14 00:28:00 -07:00
Michael du Breuil 9fc954b030 AP_Compass: Reduce scope of BattMonitor include 2019-06-18 10:02:05 +10:00
Andrew Tridgell 9e7929adf6 AP_Compass: removed unusued AP_Common/Semaphore.h 2019-05-15 15:33:48 +10:00
Andrew Tridgell 925555c995 AP_Compass: move accum fields to frontend
this is needed to ensure they are per-instance. Without this the SITL
backend produces zero for all but the first instance. The same would
be true for any multi-instance backend
2018-10-17 12:54:22 +11:00
Andrew Tridgell a260792e9e AP_Compass: use WITH_SEMAPHORE()
and removed usage of hal.util->new_semaphore()
2018-10-17 12:54:22 +11:00
Lucas De Marchi 329516373c AP_Compass: add common method to accumulate and drain samples
Instead of repeating on each driver the same sequence of steps,
let's move them to the common parent class. This only implements
it, but no driver was ported yet.
2018-10-15 14:41:09 -07:00
Lucas De Marchi 4039b51810 AP_Compass: stop passing frontend pointer
Let AP_Compass_Backend call AP::compass() *once* instead of passing
the frontend pointer over and over.
2018-09-06 08:23:02 +10:00
Jonathan Challinger 878e84a015 AP_Compass: correct edge case where checks pass when saved dev_id != detected dev_id 2018-08-07 10:00:10 +10:00
Andrew Tridgell cbd6f4cc21 AP_Compass: fixed compass for tailsitters in SITL 2018-07-20 14:21:06 +10:00
Andrew Tridgell 2fe2c8fbda AP_Compass: initialise compass IDs saved in SITL
this ensures we don't get uncalibrates compasses in SITL
2018-07-13 10:19:01 +10:00
Jacob Walser 6699c59ad3 AP_Compass: add support for custom board orientations 2018-04-24 13:04:37 +01:00
Andrew Tridgell eccc4f375b AP_Compass: fixed build warning 2018-04-12 11:50:44 +10:00
night-ghost f26bb0cfbe AP_Compass: added range filter to backend, added its use in some sensors (thanks khancyr for style correction) 2018-04-11 14:46:42 +10:00
Michael du Breuil c66d15efd7 AP_Compass: Read current for compensation from the battery singleton 2018-03-27 22:12:21 +01:00
Andrew Tridgell ca30f6aec8 AP_Compass: added per-motor compass calibration
this allows for a motor calibration vector per motor
2018-02-08 17:36:33 +11:00
Michael du Breuil fb77d0739e AP_Compass: Remove unused time calls, stash the time in the read loop 2017-09-07 19:53:14 +01: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
Andrew Tridgell 2716ab8408 AP_Compass: added support for per-instance rotations 2016-11-09 17:08:08 +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
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
Gustavo Jose de Sousa ad91a810b3 AP_Compass: Backend: add method is_external() 2016-05-10 15:55:58 -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
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
Caio Marcelo de Oliveira Filho 0d3fbbdd37 AP_Compass: use millis/micros/panic functions 2015-11-20 12:30:05 +09: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
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
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 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