Commit Graph

77 Commits

Author SHA1 Message Date
Andrew Tridgell e5e4cdee18 AP_InertialSensor: added wait_for_sample() API call
this waits for a new INS sample to arrive, using whatever method is
most efficient on each INS type
2013-10-08 17:31:15 +11:00
Andrew Tridgell dda68bddcb AP_InertialSensor: updates for AP_HAL::MemberProc 2013-09-30 21:06:42 +10:00
Andrew Tridgell 03036c632d AP_InertialSensor: use new scheduler API 2013-09-28 21:24:03 +10:00
Randy Mackay f7ba0438ef InertialSensor: remove DMP
this saves 3K of flash
2013-09-27 10:43:33 +09:00
Andrew Tridgell 14636e1cdf AP_InertialSensor: changed num_samples_available() to sample_available()
this makes the interface clearer. It also fixes a 3D accel cal bug.
2013-09-27 10:49:00 +10:00
Andrew Tridgell 1ec5cbed81 AP_InertialSensor: removed SMACCM support 2013-09-26 22:38:31 +10:00
Andrew Tridgell 770b7b5901 AP_InertialSensor: prevent a lockup in MPU6000 driver
thanks to the VRBrain port for noticing this bug.

Failing to get the semaphore is an expected error with the MPU6000, as
we read data both from timer context and mainline code. That means
semaphore conflicts are inevitable. We shouldn't consider them an
error, and shouldn't panic when some arbitrary number of them have
happened since boot.

Instead the wait_for_sample() code checks that we receive new data at
least every 50ms. That is a much safer test.
2013-09-23 22:48:36 +10:00
Andrew Tridgell 76e20150e9 AP_InertialSensor: ensure parent class is initialised in instance classes 2013-04-12 14:30:35 +10:00
Randy Mackay af13f6795c INS: switch to global definition of GRAVITY_MSS
saves 4 bytes of RAM
2013-04-05 22:57:46 +09:00
Randy Mackay 318a831b57 INS: set default filter to 20hz for APM2.x and PX4 2013-03-01 19:35:34 +09:00
Andrew Tridgell a63275d284 AP_InertialSensor: expand register range in MPU6000 _dump_registers() 2013-02-13 19:33:40 +11:00
Andrew Tridgell 7b1245937c AP_InertialSensor: always sample at 200Hz in MPU6000
this changes the sampling to 200Hz regardless of requested rate, and
it is downsampled inside num_samples_available() using a shift. This
gives better noise resistance in ArduPlane.

This patch also makes it possible to update the filter frequency while
running, which is very useful for bench testing with a vibration
source
2013-02-07 10:23:08 +11:00
Randy Mackay bad81a5113 AP_InertialSensor_MPU6k: remove unnecessary check of sign when receiving fifo packet from dmp 2013-01-27 11:22:39 +09: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 d7996acdf7 AP_InertialSensor: added set_board_orientation() method 2013-01-13 17:32:48 +11:00
Andrew Tridgell 6142eac4b4 AP_InertialSensor: simplify get_delta_time() API
use a single float return rather than two APIs.

This also changes the MPU6k driver to match the new 2.9 behaviour of
using the MPU6k sample timing instead of micros()
2013-01-11 21:17:21 +11:00
Pat Hickey 910e09fc96 AP_InertialSensor_MPU6000: fix sync/async semaphore usage with new scheduler 2013-01-10 14:12:19 -08:00
James Bielman 8e38ef6567 MPU6000: Flip Y and Z axes for SMACCM_HAL.
- The accelerometer is upside-down on the PX4FMU vs the APM2.
2013-01-09 11:19:51 -08:00
James Bielman 1309b7332a MPU6000: Use signed addition when accumulating readings.
- Fixes very erratic accel readings on the PX4 board.
2013-01-09 11:19:51 -08:00
Andrew Tridgell f48790a56e AP_InertialSensor: poll for new data in num_samples_available()
this lowers the latency for new data
2013-01-09 20:31:09 +11:00
Andrew Tridgell 4ab1cddd15 AP_InertialSensor: ensure we always have the SPI semaphore for MPU6k 2013-01-09 20:30:20 +11:00
Andrew Tridgell b39166b71a MPU6000: fixed minor timing bug
if we miss a sample due to SPI contention we shouldn't update last
sample time
2013-01-07 11:07:29 +11:00
James Bielman d84ba8ef59 Use HAL suspend/resume timer procs rather than atomic.
- Preparation for removing begin/end atomic.
2013-01-03 17:33:13 -08:00
Pat Hickey d808c19c10 AP_InertialSensor_MPU6000: uses new semaphores
* some refactoring to fix differences between timerprocess
  and non-timerprocess usage
2013-01-03 13:48:07 -08:00
James Bielman acf05a29ee AP_InertialSensor_MPU6000: Poll status register if there is no data ready pin. 2013-01-03 13:48:06 -08:00
Andrew Tridgell 212728be34 InertialSensor: ensure MPU6000 is out of sleep mode before configuring
the MPU6000 starts in sleep mode, and can take a while to wakeup
2012-12-27 21:28:41 +11:00
Andrew Tridgell 122b8716a7 InertialSensor: added auto reset of MPU6000 on startup failure
this works around the problem of the MPU6000 failing to come up on DTR
reset or warm reboot
2012-12-24 07:17:03 +11:00
Andrew Tridgell 44ad850542 InertialSensor: latch the data ready pin high on new data
this ensures we don't miss a sample due to another source of delay
2012-12-23 17:46:36 +11:00
Andrew Tridgell e2edad8a3f InertialSensor: fixed last sample time in MPU6000
we lost this in the final work on the DTR bug
2012-12-23 08:59:35 +11:00
Andrew Tridgell 1a53bc783c InertialSensor: poll data ready pin instead of an interrupt for MPU6k 2012-12-22 09:16:31 +11:00
Andrew Tridgell 9548e7e79e InertialSensor: simplify the data_ready interrupt handling
this avoids using the defer process code, and fixes a nasty bug that
caused the APM to lockup on reset
2012-12-21 20:01:19 +11:00
Andrew Tridgell 44f860e102 InertialSensor: fixed some compiler warnings 2012-12-20 14:52:35 +11:00
Pat Hickey b502732249 AP_InertialSensor: rewrite basic code for spi device transactions
* I'm not touching that DMP stuff because I'm pretty convinced it should
  instead be deprecated
2012-12-20 14:52:32 +11:00
Pat Hickey a4f41c1d29 AP_InertialSensor: MPU6000 uses scheduler panic 2012-12-20 14:52:31 +11:00
Andrew Tridgell 2c1682f310 InertialSensor: use AP_HAL progmem 2012-12-20 14:51:39 +11:00
Andrew Tridgell c9a81d7de6 AP_InertialSensor: fixed sign of 16 bit SPI transfer
this gets accels and gyros working again
2012-12-20 14:51:36 +11:00
Pat Hickey 9aca19415a AP_InertialSensor: robust semaphores 2012-12-20 14:51:36 +11:00
Pat Hickey 1019fb45e7 AP_InertialSensor: remove sei in data interrupt handler 2012-12-20 14:51:36 +11:00
Pat Hickey 4acf2c8591 AP_InertialSensor: ported to AP_HAL 2012-12-20 14:51:26 +11:00
rmackay9 b4e5176e2a ArduCopter, AP_InertialSensor: restore mpu6k sample rate to 200hz but keep default filtering at 42hz. 2012-12-09 14:27:33 +09:00
Andrew Tridgell 3b18c57691 AP_InertialSensor: removed axis getters for accel/gyro
these were only being used in one place, and in that place were used
incorrectly!
2012-12-04 09:11:55 +11:00
Andrew Tridgell b237c0583d AP_InertialSensor: Added INS_MPU6K_FILTER option
this allows the user to select the MPU6000 filtering frequency
2012-11-30 07:15:19 +11:00
Andrew Tridgell 089ae0f9f3 AP_InertialSensor: allow specification of sample rate in init() call
this lets the caller not need to know the underlying sample rate. They
just ask for what rate updates happen. 

This also changes the MPU6k filtering to be less than half the sample
rate
2012-11-30 07:15:18 +11:00
Andrew Tridgell f843705da3 INS: switch to SREG = oldSREG pattern for interrupt mask/restore 2012-11-20 22:31:23 +11:00
Andrew Tridgell 3776e6108f INS: use vector subtraction to make code clearer 2012-11-20 18:32:27 +11:00
rmackay9 8ccac5da3d AP_InertialSensor: correct typo to datasheet's filename 2012-11-20 00:37:42 +09:00
rmackay9 d9b4407e64 AP_InertialSensor: changes after review with Tridge.
sanity checking added to accelerometer calibration routine.
user feedback is sent using gcs_send_text_fmt instead of Serial.printf.
moved ins parameters to new eeprom number to avoid conflicts with older parameters.
other small changes including renaming of functions and parameters.
2012-11-07 19:21:15 +09:00
rmackay9 49de46a548 AP_InertialSensor: merge in calibration features from IMU library
add gauss-newton method of accelerometer calibration
2012-11-07 19:20:27 +09:00
rmackay9 8c6fd340d7 AP_AHRS: added scheduler parameter to init
Required by the AP_AHRS_MPU6000 class which needs to disable timed processes that could interfere with it's communication with the mpu6000
2012-09-29 13:51:21 +09:00
rmackay9 41fbb19cf5 AP_InertialSensor_MPU6000: replaced _cs_pin parameter with #define and saved 1 byte of memory
Updated ArduCopter, ArduPlane and example sketches in AP_InertialSensor, AP_IMU and AP_AHRS libraries because they no longer need to pass in cs_pin to the constructor
2012-09-28 19:21:59 +09:00