Commit Graph

1010 Commits

Author SHA1 Message Date
Leonard Hall 447b20efa5 AP_InertialSensor: reduce accel filter to 10hz 2017-06-01 14:53:48 +09:00
Andrew Tridgell 62b826953d AP_InertialSensor: use AP_Math rand_float() 2017-05-03 20:12:04 +10:00
Andrew Tridgell bfd8d151c8 AP_InertialSensor: lower slave rate with fast sampling
On an invensense IMU with fast sampling we need to lower the slave
sample rate for slave sensors such as the built-in AK8963 compass on a
MPU9250.

The slave rate is set as a multiple of the main rate, so it needs to be
much lower for fast sampling. If we leave it high then it greatly
impacts on IMU sample rate.

Without this change a MPU9250 with fast sampling and a compass enabled
will give a gyro rate of around 7200Hz. With this change it gets 7760Hz
2017-05-02 12:11:08 +10:00
Andrew Tridgell 519a293af9 AP_InertialSensor: fixed instance usage in set_gyro_oversampling()
thanks Francisco!
2017-05-02 08:27:11 +10:00
Andrew Tridgell 112b22516a AP_InertialSensor: fixed use of accel2_noise
thanks Francisco!
2017-05-02 08:24:50 +10:00
Andrew Tridgell 2876f1467c AP_InertialSensor: converge sensor rate quickly, then slowly
converge fast for the first 60 seconds, then more slowly to reduce
noise
2017-05-01 15:13:56 +10:00
Andrew Tridgell db25b6e966 AP_InertialSensor: estimate and log sensor rates for all IMUs
this adds IMU.GHz and IMU.AHz log fields so we can see the actual
observed sensor rates of each IMU
2017-05-01 15:06:46 +10:00
Andrew Tridgell 49cc0965c0 AP_InertialSensor: separate handling of FIFO and non-FIFO sensors
FIFO sensors produce data at a well known rate, but samples come in
bunches, so we can't use the system clock to calculate deltaT.

non-FIFO sensors produce data when we sample them, but that rate is
less regular due to timing jitter.

For FIFO sensors this changes makes us use a learned sample rate,
which allows for different clock speeds on sensor and system board.

For non-FIFO sensors we use the system clock to measure deltaT

the overall effect is a fix for sensors that produce samples at other
than the claimed datasheet rate.
2017-05-01 15:06:46 +10:00
Andrew Tridgell 74eb7a7243 AP_InertialSensor: make SITL sensor rate match a Pixhawk1
use 760Hz 2nd gyro and 800 Hz 2nd accel
2017-05-01 15:06:46 +10:00
Andrew Tridgell 25cd16a275 AP_InertialSensor: fixed LSM303D registered sample rate
we are running the LSM303D at 1600Hz, and are sampling it at 1kHz. We
need to tell the AP_InertialSensor layer that samples will arrive at 1kHz
2017-05-01 15:06:46 +10:00
Andrew Tridgell e62fdad12c AP_InertialSensor: added get_last_update_usec()
this will be used by the inter-EKF scheduling changes
2017-05-01 14:24:55 +10:00
Andrew Tridgell c952e58edb AP_InertialSensor: fixed invensense driver temp reading
different parts have quite different zero offsets in temperature
2017-04-03 10:06:27 +10:00
Lucas De Marchi 2e4e4365d0 AP_InertialSensor: enable fast sampling for aerofc 2017-03-24 12:06:19 +11:00
Lucas De Marchi 87846fe049 AP_InertialSensor: use MPU6500 on aerofc 2017-03-24 12:06:19 +11:00
Andrew Tridgell 875274e761 AP_InertialSensor: added support for ICM-20602
treat the same as a 20608
2017-03-02 14:21:36 +11:00
Andrew Tridgell b86513f503 AP_InertialSensor: support AUAV21 board 2017-03-01 17:24:10 +11:00
Lucas De Marchi 2d50eb312c AP_InertialSensor: add support to MPU6500
Just like and MPU9250 without mag and with different WHOAMI register.
2017-02-26 13:37:13 +11:00
murata a3f5b4f319 AP_InertialSensor: Change from magic number 0 to definition name. 2017-02-18 14:12:36 +00:00
Lucas De Marchi 9535b45cc9 AP_InertialSensor: examples: fix double to float warnings
While at it add function prototype.
2017-02-12 01:22:35 +00:00
Andrew Tridgell 01da36295d AP_InertialSensor: support the L3GD20H gyro
this is used by the MRo Pixhawk1
2017-01-31 07:39:36 +11:00
murata 0733d760f6 AP_HAL_VRBRAIN: Unify from print or println to printf.
AP_InertialSensor: Unify from print or printin to printf.
2017-01-27 18:20:22 +11:00
murata 2643e7e906 AP_InertialSensor: Unify from print or println to printf. 2017-01-27 18:20:22 +11:00
Julien Beraud 3d9dacb227 AP_InertialSensor: push gyro data for opticalflow
Do it only if there is an optical flow in the current HAL
2017-01-23 21:23:16 +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
mirkix 62fabca19d AP_InertialSensor: Enable I2C bypass for MPU9250 conntected via I2C to access internal AK8963 2017-01-11 21:44:24 -08:00
Randy Mackay 946d30476a AP_InertialSensor: fix whoami for MPU6k 2017-01-05 10:29:51 +09:00
murata d56bad781f AP_InertialSensor: change if statements to switch statement
No functional change
2016-12-24 12:23:59 +09:00
murata 398b7b83dd AP_InertialSensor: minor formatting fixes
No functional change
2016-12-24 12:23:58 +09:00
Lucas De Marchi 9569ed94a9 AP_InertialSensor: Invensense: use capital letters for define 2016-12-20 09:23:30 +09:00
Andrew Tridgell a30745903a AP_InertialSensor: use ACC2_BIAS 2016-12-19 08:07:15 +11:00
priseborough 60ebe97e10 AP_InertialSensor: remove unused EKF1 include 2016-12-19 08:07:11 +11:00
Andrew Tridgell 65b9b86099 AP_InertialSensor: unify MPU6000 and MPU9250 drivers
make a single AP_InertialSensor_Invensense driver. This avoids a lot
of duplication and will save time as new varients are added
2016-12-16 12:31:34 +11:00
Pierre Kancir de05e6ba29 InertialSensor : MPU9250 utilize an explicit type cast to avoid the loss of a fractional part 2016-12-05 12:39:30 -08:00
Pierre Kancir 13c16e187f InertialSensor: MPU6000 utilize an explicit type cast to avoid the loss of a fractional part 2016-12-05 10:59:45 -08:00
Randy Mackay dfd58cc57b AP_InertialSensor: fix build warning for MPU9250 2016-11-30 18:00:14 +09:00
Randy Mackay 699279ed1f AP_InertialSensor: fix build warning for MPU6000 2016-11-30 18:00:13 +09:00
Andrew Tridgell f9845c93b1 AP_InertialSensor: keep transfers nicely setup for DMA on stm32
this avoids using stack based bounce buffers which may not support DMA
on stm32
2016-11-27 11:26:10 +11:00
Andrew Tridgell 771cedca3d AP_InertialSensor: reduced number of SPI transfers
use cached copy of temperature in MPU6000 and MPU9250 to detect FIFO
error when possible
2016-11-26 19:02:22 +11:00
Andrew Tridgell 27605b0258 AP_InertialSensor: run invensese reg checking at low speed
config register read/write should be at low bus speed.

also change to check every 20 calls to reduce checking cost
2016-11-25 20:31:40 +11:00
Andrew Tridgell 0f984290c3 AP_InertialSensor: enable fast sampling by default on some boards 2016-11-25 17:59:54 +11:00
Andrew Tridgell f3a778f980 AP_InertialSensor: fixed freeing of fifo buffer 2016-11-25 17:50:19 +11:00
Andrew Tridgell 6f28c61c8d AP_InertialSensor: changed SIZE to LEN
thanks to Lucas for suggestion
2016-11-25 17:50:19 +11:00
hiro2233 cb7f46d653 AP_InertialSensor: fixed handling of user_ctrl register
with aux bus implementations
2016-11-25 17:50:18 +11:00
Andrew Tridgell 9b4c588c09 AP_InertialSensor: adapt drivers for SPI-DMA capable systems
no longer need accumulate() transfers with SPI enabled DMA on stm32
2016-11-25 17:49:58 +11:00
Andrew Tridgell 28daddaaf2 AP_InertialSensor: don't use accumulate approach on Linux or I2C 2016-11-25 17:49:57 +11:00
Andrew Tridgell d9c8db7024 AP_InertialSensor: implement a new strategy for fast sampling
this moves to using a 1p filter on the high rate data, followed by
averaging down to 1kHz then a 2p filter to apply configured cutoff
frequency.

It also fixes the FIFO reset to not cause data corruption. We need to
disable all FIFO channels before doing the reset, and wait for the
FIFO to stop in the sensor.

Finally it moves sampling of the MPU6000 and MPU9250 into the main
thread. That significantly improves scheduling performance as we no
longer get long FIFO SPI transfers happening during other tasks. All
transfers happen at the start of the fast loop. That makes timing much
more predictable.

Thanks to Leonard and Paul for help with this design!
2016-11-25 17:49:57 +11:00
Lucas De Marchi 87c6d5da13 AP_InertialSensor: replace panic() with return
When blocking forever there's no reason to call panic later since it
will never going to be reached. This reduces binary size in a few bytes
since the message isn't required anymore.
2016-11-21 18:04:10 -02:00
Andrew Tridgell 6129b1abb6 AP_InertialSensor: wait forever for semaphore on startup
some boards take a silly amount of time to get semaphore on startup
2016-11-21 17:57:21 -02:00
Andrew Tridgell 216cf53922 AP_InertialSensor: handle FIFO overflow for MPU6k and 9250
this prevents temporary corruption of INS data on FIFO overflow
2016-11-19 12:54:22 +11:00
Andrew Tridgell 18d4286166 AP_InertialSensor: fixed pixfalcon 9250 detection 2016-11-18 14:24:39 +11:00
Andrew Tridgell cb1a5d4c74 AP_InertialSensor: take semaphore for update of accumulators
this fixes a race in update of delta angle and delta velocity between
backend and frontend
2016-11-18 06:32:17 +11:00
Andrew Tridgell f3f1f6b0b6 AP_InertialSensor: fixed gyro orientation on l3gd20H on pixhawk 2016-11-16 20:33:56 +11:00
Andrew Tridgell 6af00027ab AP_InertialSensor: removed unused variables
thanks to Francisco for noticing
2016-11-16 08:41:06 +11:00
Francisco Ferreira bfbb275577 AP_InertialSensor: on accel cal failure don't save values to zero
When the accel calibration fails leave the previous values saved but set them to defaults (scale default is ones, not zeros) and notify the GCS
This fixes an arithmetic exception when doing a second accel cal after the first one failed
2016-11-15 11:42:54 -08:00
Andrew Tridgell 624178f3be AP_InertialSensor: added INS_FAST_SAMPLE parameter
this allows enable/disable of fast sampling per IMU, making
experimentation easier.

It also fixes the fast sampling to always average over 8 samples, and
fixes the 9250 to use the correct accumulator when not doing fast
sampling
2016-11-15 21:16:40 +11:00
Andrew Tridgell c0303ffe8a AP_InertialSensor: temporarily disable fast sampling
a problem has been found with the filtering with fast sampling on
ICM-20608 and MPU9250. Disable until it is solved.
2016-11-14 18:18:17 +11:00
Andrew Tridgell c794ad9ee8 AP_InertialSensor: use smaller FIFO buffers
this allows for reading multiple chunks from the fifo per callback
2016-11-13 13:16:22 +11:00
Andrew Tridgell 8d19808152 AP_InertialSensor: fixed missing checked register goto
thanks to Francisco for spotting
2016-11-11 08:08:56 +11:00
Andrew Tridgell 49856c37f2 AP_InertialSensor: reduce checked register count
thanks to Francisco for spotting this
2016-11-11 08:08:56 +11:00
Andrew Tridgell 4be8f05ad4 AP_InertialSensor: added register checking for LSM9DS0 2016-11-11 08:08:56 +11:00
Andrew Tridgell 77a83c091a AP_InertialSensor: added register checking for MPU6000/ICM20608 2016-11-11 08:08:56 +11:00
Andrew Tridgell 95a849f472 AP_InertialSensor: added register checking for MPU9250 2016-11-11 08:08:56 +11:00
Andrew Tridgell 3289e90134 AP_InertialSensor: added error count increments in drivers 2016-11-11 08:08:55 +11:00
Andrew Tridgell 4ebf3309f7 AP_InertialSensor: auto-handle invensense sensor changes
some boards swap out MPU6000 for MPU9250 or ICM20608
2016-11-11 08:08:55 +11:00
Andrew Tridgell af0ec41652 AP_InertialSensor: fixed accel clip detection with fast sampling
we need to check on every sample at the full rate
2016-11-10 13:39:17 +11:00
Andrew Tridgell 70c27a85de AP_InertialSensor: on PH2 run the first MPU9250 at 8kHz 2016-11-10 13:04:15 +11:00
Andrew Tridgell 1ea4c6938c AP_InertialSensor: allow auxiliary bus with fast sampling 2016-11-10 11:44:52 +11:00
Andrew Tridgell 8da42b7a8b AP_InertialSensor: fixed temperature for fast sampling case 2016-11-10 11:44:52 +11:00
Andrew Tridgell cb70bae167 AP_InertialSensor: use in-tree drivers for PH2SLIM 2016-11-10 11:44:52 +11:00
Andrew Tridgell e27a76e460 AP_InertialSensor: fixed auxiliary bus with FIFO enabled
make sure fifo reset doesn't check I2C master enable
2016-11-10 11:44:51 +11:00
Andrew Tridgell 46785e8ecf AP_InertialSensor: improved method for FIFO integrity checking
check temperature every 255 samples against FIFO data
2016-11-10 11:44:51 +11:00
Andrew Tridgell 8a3f6a8902 AP_InertialSensor: use FIFO and implement fast sampling for MPU9250 2016-11-10 11:44:51 +11:00
Andrew Tridgell e25a391a8f AP_InertialSensor: fixed typo 2016-11-09 17:08:15 +11:00
Andrew Tridgell d2f6a514b9 AP_InertialSensor: catch FIFO alignment errors using temperature reading
Two cases of what seems to be FIFO alignment errors have been seen on
a Pixracer-beta board with a ICM-20608. At a cost of 2 extra bytes per
transfer we can catch these by looking for sudden temperature changes
caused by bad data in the temperature registers.
2016-11-09 17:08:15 +11:00
Andrew Tridgell d248b33104 AP_InertialSensor: simplify config of MPU6000
use zero sample rate divider on both MPU6000 and ICM20608
2016-11-09 17:08:14 +11:00
Andrew Tridgell 7137d5c6f2 AP_InertialSensor: switch pixracer to always use in-tree drivers 2016-11-09 17:08:14 +11:00
Andrew Tridgell 84c3e29891 AP_InertialSensor: use AP_HAL rotations for MPU6000 2016-11-09 17:08:14 +11:00
Andrew Tridgell 2f01dfe81c AP_InertialSensor: fixed from review by Lucas 2016-11-09 17:08:13 +11:00
Andrew Tridgell 81b933d9d0 AP_InertialSensor: use int32_t summation for fast sampling
very slightly faster
2016-11-09 17:08:13 +11:00
Andrew Tridgell 03b7bc9e65 AP_InertialSensor: use internal drivers for PHMINI
this gets us fast sampling
2016-11-09 17:08:12 +11:00
Andrew Tridgell af1c5fd6d3 AP_InertialSensor: always use FIFO on MPU6000
and enable fast sampling on ICM20608 if on SPI
2016-11-09 17:08:12 +11:00
Andrew Tridgell fde80a9408 AP_InertialSensor: modify LSM303D settings to match PX4 driver
this allows existing accel calibration to be used
2016-11-09 17:08:12 +11:00
Andrew Tridgell a9a5e50bd1 AP_InertialSensor: removed timer callback for MPU6000
Thanks to Lucas for pointing out this is not needed
2016-11-09 17:08:11 +11:00
Andrew Tridgell bd84e592f8 AP_InertialSensor: check for NULL device pointer in probe()
handle missing devices
2016-11-09 17:08:10 +11:00
Andrew Tridgell 3d7d773883 AP_InertialSensor: added support for ICM20608 on Pixracer 2016-11-09 17:08:08 +11:00
Andrew Tridgell 2c1e9024f1 AP_InertialSensor: detect missing accels or gyros 2016-11-09 17:08:07 +11:00
Andrew Tridgell 106a91c64c AP_InertialSensor: use init_gyro() on startup
this saves the calibration parameters which should be done on
calibration
2016-11-09 17:08:07 +11:00
Andrew Tridgell 408593465f AP_InertialSensor: fixed rotation for mpu9250 on pixracer 2016-11-09 17:08:07 +11:00
Andrew Tridgell 790dd4769b AP_InertialSensor: simplify rotations for MPU9250 2016-11-09 17:08:07 +11:00
Andrew Tridgell aa4025bdf9 AP_InertialSensor: make INS sensor IDs match for PX4
in-tree driver IDs now match PX4Firmware driver IDs on Pixhawk2
2016-11-09 17:08:06 +11:00
Andrew Tridgell 9e7e1b2f01 AP_InertialSensor: fixed merge conflicts with patches from Lucas 2016-11-09 17:08:06 +11:00
Lucas De Marchi 104e29acf2 AP_InertialSensor: MPU6000: change accel scale to 16G
Also change the ID of MPU6000 so previous calibration values are not
considered valid.
2016-11-09 17:08:06 +11:00
Lucas De Marchi dc09661b9e AP_InertialSensor: MPU6000: save driver version
When registering accel and gyro we use the upper 16bits of the id to
store the driver version. When changing the driver behavior in
non-compatible ways, changing this version will trigger a request for
calibration.
2016-11-09 17:08:06 +11:00
Lucas De Marchi 0d3adef8b2 AP_InertialSensor: MPU6000: remove TODO leftover
This will never be done as blindly changing speed is not the way to fix
communication issues.
2016-11-09 17:08:05 +11:00
Andrew Tridgell 0a1616cc71 AP_InertialSensor: use correct device IDs on PX4 driver 2016-11-09 17:08:05 +11:00
Lucas De Marchi 469efb00f6 AP_InertialSensor: save id for gyro and accel instances
This allows each sensor to be uniquely identified in the system by using
either the index inside the backend or for those that use the Device
interface, to use the bus type, location, and device id.

We leave 16-bit for each sensor to be able to change its own
identification in future, which allows them to be changed in an
incompatible manner forcing a re-calibration.
2016-11-09 17:08:05 +11:00
Lucas De Marchi bbb9bfa95e AP_InertialSensor: save only gyro calibration
When we are initializing the gyro and then saving the calibration we are
also saving the calibration values for the accelerometers. Right now
this is non-problematic, but we want to check that the ID of the
accelerometer corresponds to the ID of the sensor detected. If we also
save accel calibrations we would actually override the ID of the
accelerometer.

Rename the method to _save_gyro_calibration() and save only on gyro
values.
2016-11-09 17:08:05 +11:00
Lucas De Marchi f81dba2100 AP_InertialSensor: add doc to get_id() of backend
This is different from get_id() of Device and ultimately from each
sensor this this is identifying the backend, not the sensor.
2016-11-09 17:08:05 +11:00
Lucas De Marchi ace61087a1 AP_InertialSensor: remove product_id
We only leave the parameter there for backward-compatibility. However
product id on the inertial sensor is not much useful since it's only
kept for the first instance.

A better implementation per-gyro and per-accel is needed in order to
avoid problems with sensors taking the offsets configured for another
sensor.
2016-11-09 17:08:05 +11:00
Andrew Tridgell 64a5d3938c AP_InertialSensor: implement device IDs for MPU6000 and MPU9250 AuxilaryBus 2016-11-09 17:08:04 +11:00
Andrew Tridgell ac2c25539b AP_InertialSensor: implement device IDs for AuxilaryBus 2016-11-09 17:08:04 +11:00
Andrew Tridgell 4ef92b5e39 AP_InertialSensor: enable all 3 IMUs on PH2 2016-11-09 17:08:04 +11:00
Andrew Tridgell 5cf768ced2 AP_InertialSensor: fixed missing return 2016-11-09 17:08:02 +11:00
Andrew Tridgell 38ff8b3536 AP_InertialSensor: removed unused product_id function in L3G4200D 2016-11-09 17:08:01 +11:00
Andrew Tridgell a5c5e033d2 AP_InertialSensor: fixed threading and locking in remaining backends
use a backend semaphore for shared data and use thread per bus where
available
2016-11-09 17:08:01 +11:00
Andrew Tridgell b92c48548a AP_InertialSensor: added per-instance rotation for LSM9DS0 2016-11-09 17:08:00 +11:00
Andrew Tridgell 2df6ed08c2 AP_InertialSensor: added optional per-instance orientation
this is needed for multi-sensor boards to get orientation right for
each sensor
2016-11-09 17:08:00 +11:00
Andrew Tridgell ac2572384d AP_InertialSensor: added start() method for LSM9DS0
needed to get sensor ordering right on multi-sensor boards
2016-11-09 17:08:00 +11:00
Andrew Tridgell 7832f1a1b6 AP_InertialSensor: allow for in-tree drivers for PX4 2016-11-09 17:07:58 +11:00
Andrew Tridgell 919aa61918 AP_InertialSensor: support AuxiliaryBus without register_periodic_callback() 2016-11-09 17:07:57 +11:00
Andrew Tridgell 2b66df68a1 AP_InertialSensor: use thread-per-bus for lsm303d and mpu6000 2016-11-09 17:07:56 +11:00
Andrew Tridgell 90dc9e3327 AP_InertialSensor: dummy implementation of register_periodic_callback()
for AuxiliaryBus
2016-11-09 17:07:55 +11:00
Lucas De Marchi 91c4bf470f AP_InertialSensor: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03: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
Andrew Tridgell afe2c31ae7 AP_Inertial_Sensor: use const reference 2016-10-27 15:06:11 +11:00
priseborough 7460d97c9a AP_InertialSensor: Update parameter documentation
Add brief description of body frame conventions.
2016-10-27 14:54:45 +11:00
priseborough 470f5c4562 AP_InertialSensor: Correct SITL IMU1 accel for position in body frame 2016-10-27 14:54:45 +11:00
priseborough 54a431a51d AP_InertialSensor: Update position offset parameter documentation
Notify users of the potential for velocity noise when using larger offset values..
Specific advice in terms of values has not been provided because it is highly dependent on Gyro noise levels.
2016-10-27 14:54:43 +11:00
priseborough 6db93d8a21 AP_InertialSensor: Add parameters defining accelerometer position offset 2016-10-27 14:54:41 +11:00
Martin Evans 0e19b8c9a0 AP_HAL_Linux: Set initial rotation on Dark to None 2016-10-24 10:00:24 -02: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 17883f6683 AP_InertialSensor: fix INS_generic example (call BoardConfig.init()) 2016-10-24 11:00:22 +09: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
Julien Beraud 714c8fd318 AP_InertialSensor_MPU6000: Add support for fsync bit for Bebop
Already present on Disco
2016-10-03 12:20:03 -03:00
Andrew Tridgell 6f9530ebaa AP_InertialSensor: added optional FSYNC external sync bit
used to synchronise with image sensor on Disco
2016-09-05 12:55:32 +10:00
Gustavo Jose de Sousa 68fe536da3 AP_InertialSensor: use BMI160 for Intel Aero 2016-09-03 01:03:07 -03:00
Gustavo Jose de Sousa b6c0e11200 AP_InertialSensor: BMI160: convert it to use Device periodic callback
Some notes:
 - The only place that made sense to use
   suspend_timer_procs()/resume_timer_procs() calls were where we registered
   the timer process. Now there's no need for that anymore. Remove those calls
   from other place in the source too.
 - There's no need to acquire the device lock now that we are running as a
   periodic callback.
2016-09-03 01:03:07 -03:00
mirkix a4d0ad8571 AP_InertialSensor: Fix name of sensor 2016-08-23 11:25:59 +09:00
Murilo Belluzzo 36bdd7f1f1 AP_InertialSensor: MPU6000: Add missing read() check 2016-08-03 00:18:20 -03:00
Gustavo Jose de Sousa cd0d65dc3f AP_InertialSensor: don't check {gyro,accel}_available twice
That gives a slightly simpler code.
2016-07-22 19:58:08 -03:00
Gustavo Jose de Sousa 69405cc99a AP_InertialSensor: fix timing debug macro
- Use "INS_" prefix for the name in order to limit the scope for that macro.

- Don't define it in the code and check if it is defined instead of checking
  the value. With that, there's no need to touch the code for enabling debug,
  only a reconfiguration is necessary (e.g., `CXXFLAGS='-DINS_TIMING_DEBUG' waf
  configure ...`).
2016-07-21 19:01:28 -03:00
José Roberto de Souza dd36952efe AP_InertialSensor: BMI160: Register poll function with the timer lock 2016-07-21 15:42:32 -03:00
Andrew Tridgell d30e55fa44 AP_InertialSensor: initial support for Disco
setup right orientation
2016-07-20 13:38:17 +10:00
Lucas De Marchi 6d1acc5813 AP_InertialSensor: BMI160: remove stray call to set speed
It's already supposed to be on high speed there.
2016-07-18 11:20:49 -03:00
Gustavo Jose de Sousa ee7c40be61 AP_InertialSensor: BMI160: add backend
The reason of defining BMI160_MAX_FIFO_SAMPLES as 8 can be found on the
following histogram of the number of samples in the FIFO on each read while
performing the accelerometer calibration process:

Samples Count   Freq Acc. Freq
------------------------------
      1  3842 0.1201  0.120111
      2 13172 0.4118  0.531904
      3  9065 0.2834  0.815300
      4  2710 0.0847  0.900022
      5  2231 0.0697  0.969769
      6   816 0.0255  0.995279
      7   137 0.0043  0.999562
      8    13 0.0004  0.999969
     13     1 0.0000  1.000000
2016-07-15 16:46:06 -03:00
Andrew Tridgell eee9fc88a1 AP_InertialSensor: avoid ifdef for AP_MODULE_SUPPORTED 2016-07-14 13:39:47 +10:00
Andrew Tridgell 33ce1213a2 AP_InertialSensor: call gyro_sample and accel_sample AP_Module hooks 2016-07-14 13:39:47 +10:00
Andrew Tridgell cb858d2c99 AP_InertialSensor: fixed typo 2016-07-01 15:35:22 +10:00
Andrew Tridgell 834acaffee AP_InertialSensor: provide IMU temperature to HAL for all boards 2016-07-01 15:29:52 +10:00
Lucas De Marchi 1f96336f7c Global: rename bus type enum entries 2016-06-27 17:51:41 -03:00
Gustavo Jose de Sousa f6bebc96c0 AP_InertialSensor: INS_generic: remove unused includes 2016-06-27 17:22:43 -03:00
Gustavo Jose de Sousa e85ac8b2c5 AP_InertialSensor: inform maximum gyro average difference
While at it, define GYRO_INIT_MAX_DIFF_DPS.
2016-06-27 17:22:43 -03:00
Gustavo Jose de Sousa e6f62080f5 AP_InertialSensor: fix best_diff on gyro initialization
Without this patch, if accel_diff.length() > 0.2f and j == 0, then
best_diff[k] would be zero forever since diff_norm[k] >= 0 for any j.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa de94392759 AP_InertialSensor: MPU9250: remove _bus_type field
Use _dev->bus_type instead.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 83feb2e2ae AP_InertialSensor: MPU9250: let Device handle read flag
There's no need to handle that in MPU9250 anymore.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 1e99a7125c AP_InertialSensor: MPU9250: remove _register_write_check()
That function isn't used in the code base and there should be a better way to
debug writes on registers.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa a6e5eb9e14 AP_InertialSensor: MPU6000: remove _bus_type field
Use _dev->bus_type instead.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 0718649c8b AP_InertialSensor: MPU6000: let Device handle read flag
There's no need to handle that in MPU6000 anymore.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 309fe4a88c AP_InertialSensor: MPU6000: remove _register_write_check()
That function isn't used in the code base and there should be a better way to
debug writes on registers.
2016-06-27 17:20:51 -03:00
Grant Morphett 34fa2a39bd AP_InertialSensor: Changing the default gyro filter from 10 to 4
This change is only for Rovers.
2016-06-16 14:37:55 +09:00
Lucas De Marchi b067bce140 AP_InertialSensor: remove support for flymaple 2016-05-23 21:49:45 -03:00
Lucas De Marchi 7503c1b6d4 AP_InertialSensor: update doc about used ids 2016-05-23 21:49:45 -03:00
Ricardo de Almeida Gonzaga d5a2c57c5e AP_InertialSensor: Fix typos 2016-05-13 19:20:05 -03:00
dgrat 41661f815f AP_Math: Replace the pythagorous* functions with a variadic template
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
Andrew Tridgell be41d402b5 AP_InertialSensor: added set of delta angle time for replay 2016-04-26 15:50:46 +10:00
Andrew Tridgell 4401cbec72 AP_InertialSensor: cope with zero delta angle time from Replay 2016-04-26 15:37:11 +10:00
mirkix c3a6a56ebb AP_InertialSensor: Add second MPU9250 autodetection to BBBmini 2016-04-24 10:57:57 -03:00
Lucas De Marchi f304fcf4da AP_InertialSensor: examples: add coding style fixes
Several coding style problems were already fixed by previous commit,
just finish the cleanup on this example:

  - replace tabs with spaces
  - remove unneeded \r
  - remove extra spaces
2016-03-31 14:54:17 -03:00
AndersonRayner 10e7d43007 AP_InertialSensor: Add output of all IMUs to example 2016-03-31 14:54:17 -03:00
ashwinvasudevan e33812e1cb AP_InertialSensor: added missing brackets 2016-03-23 17:46:41 +09:00
raspilot 1d1d224c18 AP_InertialSensor: Enable dual IMU for raspilot 2016-03-18 21:51:37 -03:00
Lucas De Marchi f75c12f57c AP_InertialSensor: LSM9DS0: change mode of drdy pins to input 2016-03-18 21:51:37 -03:00
raspilot c83e4df002 AP_InertialSensor: LSM9DS0: Disable I2C at init to avoid SDA hanging by slave. 2016-03-18 21:51:37 -03:00
raspilot 557beb4bb1 AP_InertialSensor: LSM9DS0: Fixed wrong call to _register_read_xm() 2016-03-18 21:51:37 -03:00
Lucas De Marchi 057822b51c AP_InertialSensor: AuxiliaryBus: fix return value
We should return the number of bytes written/read, not 0 on success.
This number may be useful in some cases so return it.

While at it fix a simple wrong space in the header.
2016-03-17 02:55:39 -03:00
Gustavo Jose de Sousa 4613b68efb AP_InertialSensor: waf: skip VibTest example
The code is currently broken.
2016-03-14 11:54:31 -03:00
Staroselskii Georgii da550e5e98 AP_Inertial_Sensor: do not rotate MPU9250 on Navio2 2016-02-27 03:06:50 -03:00
AndersonRayner c9d5c548a6 Corrects a bracket error for the LSM9DS0 IMU
Switches the probe of the accel and gyro so they boot correctly (was
failing the WHOAMI with a switched result)
2016-02-25 20:08:01 -03:00
Jonathan Challinger c454631be8 AP_InertialSensor: work around gyro and accel errors on startup 2016-02-19 16:40:52 +09: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 d2b267d026 AP_InertialSensor: LSM9DS0: use AP_HAL::SPIDevice abstraction 2016-02-16 19:49:09 -02:00
Lucas De Marchi 58f4624f8c AP_InertialSensor: L3G4200D: use AP_HAL::I2CDevice abstraction 2016-02-16 19:49:09 -02:00
Lucas De Marchi af846636e4 AP_InertialSensor: MPU60x0: use AP_HAL::Device abstraction 2016-02-16 19:49:09 -02:00
Lucas De Marchi c1d19fa4dc AP_InertialSensor: LSM9DS0: sanitize whitespaces 2016-02-01 14:18:51 -02:00
Lucas De Marchi 9c6bd38e91 AP_InertialSensor: sanitize includes
Due to the way the headers are organized changing a single change in an
inertial sensor driver would trigger a rebuild for most of the files in
the project. Time could be saved by using ccache (since most of the
things didn't change) but we can do better, i.e. re-organize the headers
so we don't have to re-build everything.

With this patch only AP_InertialSensor/AP_InertialSensor.h is exposed to
most users. There are some corner cases to integrate with some example
code, but most of the places now depend only on this header and this
header doesn't depend on the specific backends.

Now changing a single header, e.g. AP_InertialSensor_L3G4200D.h triggers
a rebuild only of these files:

	$ waf copter
	'copter' finished successfully (0.000s)
	Waf: Entering directory `/home/lucas/p/dronecode/ardupilot/build/minlure'
	[ 80/370] Compiling libraries/AP_InertialSensor/AP_InertialSensor.cpp
	[ 84/370] Compiling libraries/AP_InertialSensor/AP_InertialSensor_L3G4200D.cpp
	[310/370] Linking build/minlure/ArduCopter/libArduCopter_libs.a
	[370/370] Linking build/minlure/bin/arducopter
	Waf: Leaving directory `/home/lucas/p/dronecode/ardupilot/build/minlure'
2016-02-01 14:18:51 -02:00
Lucas De Marchi 1ca03006ad AP_InertialSensor: MPU9150: remove driver
This is not used by any board and has a lot of commented out code. For
example, the compass is not enabled.  The comment in the beginning of
the driver says it should serve as an example, but we should rather use
a working driver as an example. If this was at least a bit simpler and
that worked in the past we could refactor it to the new I2CDevice API.
This is not the case.
2016-02-01 14:18:51 -02:00
Lucas De Marchi 22f2a2ee09 AP_InertialSensor: L3G4200D: fix coding style
- remove trailing and leading whitespaces
  - remove unecessary void from functions taking no parameters
2016-02-01 14:18:51 -02:00
Lucas De Marchi 637b53f4ce AP_InertialSensor: L3G4200D: sanitize includes 2016-02-01 14:18:51 -02:00
Lucas De Marchi 5088dca072 AP_InertialSensor: MPU60x0: coding style fixes 2016-02-01 14:18:51 -02:00
Lucas De Marchi ed653f8dbb AP_InertialSensor: MPU60x0: add comment about 8G/16G 2016-02-01 14:18:51 -02:00
Jonathan Challinger 4c2e6af6ee AP_InertialSensor: statically register with AP_AccelCal 2016-01-23 10:35:34 +09:00
Randy Mackay 081beacb8d AP_InertialSensor: replace sqrt with safe_sqrt to resolve compiler warning
Also add suppressing comment for missing break at end of switch
2016-01-23 10:10:17 +09: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
Andrew Tridgell 24d8610013 AP_InertialSensor: use SIM_GYR_SCALE in SITL 2016-01-19 15:29:08 +11:00
Andrew Tridgell ee453783eb AP_InertialSensor: added get_delta_angle_dt() API 2016-01-19 09:50:21 +11: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
Víctor Mayoral Vilches e493bfcae4 AP_InertialSensor: add PXFmini support 2016-01-05 15:35:56 -02:00
Andrew Tridgell b2745bb545 AP_InertialSensor: we only need peak hold for negative X for now 2016-01-02 09:58:32 +11:00
Tom Pittenger 3aaf2b1d2b AP_InertialSensor: add pos/neg peak detector
new functions that get a filtered min/max accel peaks on each axis with fixed 500ms timeout:
    Vector3f get_accel_peak_hold_pos()
    Vector3f get_accel_peak_hold_neg()

This allows slower mechanisms, such as is_flying, to detect accel spikes which would indicate ground or object impacts. Vibe is too filtered. Independent positive and negative peaks are available
2016-01-02 09:58:31 +11:00
Jonathan Challinger bae16a61e2 AP_InertialSensor: fix segfault 2015-12-29 23:10:56 -08:00
Jonathan Challinger 0a3c2774e9 AP_InertialSensor: fixes in response to review 2015-12-29 22:55:04 -08:00
Jonathan Challinger 137ace473d AP_InertialSensor: add accel_cal_requires_reboot 2015-12-29 10:46:35 -08:00
Jonathan Challinger f6a41a8936 AP_InertialSensor: ensure that accel calibration object isn't allocated more than once 2015-12-29 10:46:35 -08:00
Jonathan Challinger 492223cb84 AP_InertialSensor: support AP_AccelCal 2015-12-29 10:46:34 -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 3fb0b8f69d AP_InertialSensor: fixed example build 2015-12-27 14:57:30 +09:00
Andrew Tridgell 17fc58f3cd AP_InertialSensor: re-work for more flexible main loop rates 2015-12-27 14:57:12 +09:00
Andrew Tridgell 93ef881109 AP_InertialSensor: added get_loop_delta_t() API 2015-12-27 14:57:10 +09:00
Andrew Tridgell 6639c23685 AP_InertialSensor: added QURT driver 2015-12-27 16:21:26 +11:00
Andrew Tridgell 28230556bb AP_InertialSensor: added qflight driver 2015-12-27 16:12:27 +11:00
Don Gagne 47586dae07 AP_InertialSensor: fix invalid Range meta data 2015-12-27 16:10:44 +11:00
Aaron Wang Shi 3a31970056 AP_InertialSensor: add support to BH hat
- MPU6050 I2C for BH v0.1
    - MPU9250 SPI for BH v0.2
2015-12-21 15:54:30 +11:00
Julien BERAUD a27d7f8a93 AP_InertialSensor_MPU6000: Fix FIFO reset
Change the sequence. Previous sequence was sometimes causing failure
to initialize the IMU.
2015-12-16 08:16:10 +11:00
Lucas De Marchi e1d90c78d8 AP_InertialSensor: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:43 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Lucas De Marchi 2591261af6 Global: rename min and max macros to uppercase
The problem with using min() and max() is that they conflict with some
C++ headers. Name the macros in uppercase instead. We may go case by
case later converting them to be typesafe.

Changes generated with:

	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)max(/\1MAX(/g'
	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)min(/\1MIN(/g'
2015-12-01 16:28:09 -02:00
Lucas De Marchi d19c5035b6 Global: Rename printf format attribute
As commented in 8218140 ("AP_Common: add scanf format macro"), "FORMAT"
was a bad name for this macro since there's also the scanf. Rename to
FMT_PRINTF to follow the scanf name.
2015-12-01 07:22:12 +11:00
Andrew Tridgell 774e257a88 AP_InertialSensor: support FMUv4 2015-11-27 18:54:30 +11:00
Andrew Tridgell 9cdd5f3944 AP_InertialSensor: catch NAN errors in accel and gyro filters 2015-11-22 17:30:29 +11:00
Caio Marcelo de Oliveira Filho d7601095fa AP_InertialSensor: use millis/micros/panic functions 2015-11-20 12:31:41 +09:00
Andrew Tridgell f36b2e415a AP_InertialSensor: fixed flymaple build 2015-11-17 08:52:49 +11:00
Andrew Tridgell 32ed0d58f3 AP_InertialSensor: fixed filter setup on 2nd accel/gyro 2015-11-16 17:57:36 +11:00
Andrew Tridgell 4a768d47f3 AP_InertialSensor: created a SITL specific backend 2015-11-16 17:57:35 +11:00
Andrew Tridgell ccd915eb67 AP_InertialSensor: moved raw gyro and accel logging to common code
this brings raw logging to non-PX4 ports
2015-11-16 17:57:35 +11:00
Andrew Tridgell 75ea8f3dc0 AP_InertialSensor: removed "have sample" logic from drivers
the frontend has all the information it needs, so we can simplify the
drivers some more
2015-11-16 17:57:35 +11:00
Andrew Tridgell 0e4bab74ba AP_InertialSensor: simplify sensor backends
use common code for filtering and update, allowing each sensor driver
to be simpler and more consistent
2015-11-16 17:57:35 +11:00
José Roberto de Souza d1ff4286c2 AP_InertialSensor: Make detect_backends() public
This method will be used to initialize and configure I2C backends that
have an auxiliary I2C bus that can be connected to the main I2C bus,
like MPU6000 and MPU9250.
2015-11-11 14:29:07 +11:00
José Roberto de Souza 0cbe99a862 AP_InertialSensor: MPU9250 I2C: Connect the auxiliary I2C bus to the main bus
Using MPU9250 over I2C we can connect the auxiliary bus where there is
a AK8963 and connect this bus to the main one, this way we don't need
any AuxiliaryBus infrastructure as we need with SPI and we can talk
with AK8963 as we would talk with a standalone AK8963.
2015-11-11 14:29:07 +11:00
José Roberto de Souza b3322ed1ae AP_InertialSensor: Add MPU9250 over I2C to detect_backends() 2015-11-11 14:29:07 +11:00
José Roberto de Souza 607ab5b005 AP_InertialSensor: MPU9250: Add I2C support 2015-11-11 14:29:07 +11:00
José Roberto de Souza c3dae6fcec AP_InertialSensor: MPU9250: Remove methods not used anymore
Those methods were used by AK8963 before it started to use auxiliary bus.
2015-11-11 14:29:06 +11:00
José Roberto de Souza 588df53429 AP_InertialSensor: Add support to get auxiliary bus of multiple instances of the same sensor 2015-11-11 14:29:06 +11:00
José Roberto de Souza 3e1b974fd2 AP_InertialSensor: MPU9250: Export auxiliary bus 2015-11-11 14:29:06 +11:00
José Roberto de Souza 206f0fb773 AP_InertialSensor: MPU9250: Add BusDriver abstraction
This adds a similar abstraction to the one in MPU60XX so it's possible to use
MPU9250 in other bus. The I2C implementation will come later.
2015-11-11 14:29:06 +11:00
Víctor Mayoral Vilches 30faf7e92a AP_InertialSensor: Add Erle-Brain 2 support 2015-11-04 13:58:24 +11:00
Lucas De Marchi 3142f21363 AP_InertialSensor: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:12 +11:00
Gustavo Jose de Sousa 8e351a058d AP_InertialSensor: MPU6000: enable data-ready pin for minlure
Data-ready pin wasn't being used before due to a bug in the Kernel with
concurrent accesses to GPIO in Intel Baytrail platforms. That has been fixed in
Kernel version 4.2.
2015-11-04 12:12:47 +11:00
Lucas De Marchi 3d1d6286e9 AP_InertialSensor: fix example build after PSTR removal 2015-11-04 12:11:59 +11:00
Lucas De Marchi 62ba8266ef AP_InertialSensor: fix wrong printf format for printf
"%S" is used for wide string, but we are passing a char*. Use lowercase
in this case to remove warnings like this:

libraries/AP_InertialSensor/AP_InertialSensor.cpp: In member function
'bool AP_InertialSensor::calibrate_accel(AP_InertialSensor_UserInteract*, float&, float&)':
libraries/AP_InertialSensor/AP_InertialSensor.cpp:620:61: warning:
format '%S' expects argument of type 'wchar_t*', but argument 3 has type 'const char*' [-Wformat=]
                 "Place vehicle %S and press any key.\n", msg);
                                                             ^
2015-10-30 14:35:40 +09: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 1b07dabeb7 Replace prog_char and prog_char_t with char
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.

AVR-specific places were not changed.
2015-10-30 14:35:30 +09:00
Lucas De Marchi 132303db4b AP_InertialSensor: use printf() rather than _printf_P() 2015-10-30 14:35:27 +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 7ceffb1e2b Replace use of vprintf_P() with vprintf() 2015-10-30 14:35:23 +09:00
Lucas De Marchi 6f4904189b Replace use of println_P() with println() 2015-10-30 14:35:22 +09:00
Lucas De Marchi a964ac38ec Replace use of print_P() with print() 2015-10-30 14:35:21 +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 84d5fb006f Remove use of Util::{v,}snprintf_P()
These are now the same function as Util::snprintf().
2015-10-30 14:35:05 +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
Andrew Tridgell 142aa59bce AP_InertialSensor: fixed vibration logging after recent changes 2015-10-26 07:26:17 +11:00
Gustavo Jose de Sousa be8070e335 AP_InertialSensor: MPU9250: publish gyro raw sample rate
So that delta angle calculation is enabled.
2015-10-22 16:53:12 +11:00
Gustavo Jose de Sousa 887f81274d AP_InertialSensor: MPU6000: publish gyro raw sample rate
So that delta angle calculation is enabled.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 31a49d318c AP_InertialSensor: PX4: publish gyro raw sample rate
That enables delta angle calculation.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 25a499a41f AP_InertialSensor: use raw sample rate terminology
In order to avoid confusion between sample rate from sensor and sample rate
from the frontend class (AP_InertialSensor), use "raw sample rate" to refer to
the former.

The changes in the code were basically done with the following commands:

git grep -wl _accel_sample_rates | xargs sed -i "s,\<_accel_sample_rates\>,_accel_raw_sample_rates,g"
git grep -wl _set_accel_sample_rate | xargs sed -i "s,\<_set_accel_sample_rate\>,_set_accel_raw_sample_rate,g"
git grep -wl _accel_sample_rate | xargs sed -i "s,\<_accel_sample_rate\>,_accel_raw_sample_rate,g"

git grep -wl _gyro_sample_rates | xargs sed -i "s,\<_gyro_sample_rates\>,_gyro_raw_sample_rates,g"
git grep -wl _set_gyro_sample_rate | xargs sed -i "s,\<_set_gyro_sample_rate\>,_set_gyro_raw_sample_rate,g"
git grep -wl _gyro_sample_rate | xargs sed -i "s,\<_gyro_sample_rate\>,_gyro_raw_sample_rate,g"

And also with minor changes on indentation and comments.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 6feea5f64f AP_InertialSensor: Backend: remove function _publish_delta_angle()
Delta angle calculation is now unified, so there is no need for such a method.
That also avoids developers thinking they need that method being called
somewhere in their new drivers.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 7fef515555 AP_InertialSensor: unify delta angle calculation
This commit basically moves delta angle calculation that was previously done in
AP_InertialSensor_PX4 to a common place. Instances must publish their gyro raw
sample rate to enable delta angle calculation.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 4e83f7b02c AP_InertialSensor: PX4: don't calculate delta angle
Delta angle calculation will be unified.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 9e05041234 AP_InertialSensor: allow publishing gyro raw sample rate to frontend
That information will be used for a unified delta angle calculation.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa dfd671c54e AP_InertialSensor: Backend: add hook for new gyro sample arrival
That hook will do common tasks for when new gyro raw sample is available.
2015-10-22 16:53:10 +11:00