Commit Graph

214 Commits

Author SHA1 Message Date
Andrew Tridgell fd23f6bd33 InertialSensor: added PX4 example sketch 2013-01-04 14:26:14 +11:00
Andrew Tridgell ae09b31176 AP_InertialSensor: added PX4 gyro/accel driver 2013-01-04 14:25:57 +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
rmackay9 e594f18b75 AP_InertialSensor: added parameter descriptions 2013-01-02 16:32:43 +09:00
Andrew Tridgell 374af1cd14 build: change from Arduino.mk to apm.mk 2013-01-02 17:29:37 +11:00
Andrew Tridgell 3f6f0b6d79 Oilpan: removed reference to DESKTOP_BUILD 2013-01-02 15:39:41 +11:00
rmackay9 a76aec675a AP_InertialSensor: resolved compile warning re uninitialised variable 2013-01-02 09:18:03 +11:00
Andrew Tridgell 0adc4afcb5 InertialSensor: add reboot option in MPU6000 test 2012-12-27 21:29:00 +11: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 fcb09c3993 InertialSensor: fixed example app for new syntax 2012-12-23 12:49:34 +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 f504e2ec67 InertialSensor: removed sample rate in example
not needed any more
2012-12-20 15:16:43 +11:00
Pat Hickey 6437bd3a08 AP_InertialSenor MPU6000 test: fixed for user interact changes 2012-12-20 14:53:23 +11:00
Pat Hickey 9055681b3a AP_InertialSensor: use AP_InertialSensor_UserInteract
* permits polymorphic user interaction, so we can plug in a
  pure mavlink interface
2012-12-20 14:53:23 +11:00
Pat Hickey a2cf47e769 AP_InertialSensor: start implementing UserInteract
* untested implementation in terms of BetterStream
2012-12-20 14:53:23 +11:00
Andrew Tridgell bada70d871 InertialSensor: fixed example build on 1280 2012-12-20 14:53:22 +11:00
Andrew Tridgell 3c0440b0b4 Math: use common degrees() and radians() functions 2012-12-20 14:53:22 +11:00
Andrew Tridgell 7277d4934d AP_InertialSensor: move constructor into cpp 2012-12-20 14:53:22 +11:00
Andrew Tridgell b06e072c87 AP_InertialSensor: fixed example build 2012-12-20 14:52:36 +11:00
Pat Hickey eb530b86e8 move Arduino.mk to /mk/Arduino.mk 2012-12-20 14:52:35 +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 7d27e420ae AP_HAL: remove unnecessary Arduino.h includes 2012-12-20 14:52:30 +11:00
Andrew Tridgell 2c1682f310 InertialSensor: use AP_HAL progmem 2012-12-20 14:51:39 +11:00
Andrew Tridgell c064becf28 AP_InertialSensor: updates for new AP_Param API 2012-12-20 14:51:39 +11:00
Pat Hickey 475da4eca4 CONFIG_HAL_BOARD - test sketches fixed up, build all passes 2012-12-20 14:51:37 +11:00
Andrew Tridgell 38031edc9d AP_InertialSensor: removed spurious init() method 2012-12-20 14:51:36 +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 dbcc4fc6a5 AP_InertialSensor: variable wibble 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 a4f1f6a5db AP_Progmem: fix dependencies for all sketches touched by AP_HAL_AVR 2012-12-20 14:51:28 +11:00
Pat Hickey 4acf2c8591 AP_InertialSensor: ported to AP_HAL 2012-12-20 14:51:26 +11:00
Pat Hickey 3f1d9d7f69 AP_Param: #include <AP_Param.h> fixups for libraries & sketches
* I mostly went through with grep and added an #include <AP_Param.h> below
  every #include <AP_Common.h>. Not all of these example sketches might
  strictly need AP_Param.
2012-12-20 14:51:19 +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
rmackay9 8b5f66255e AP_InertialSensor: add comments to give credit for accel calibration method to Rolfe Schmidt 2012-12-05 09:35:55 +09:00
rmackay9 a92b7f3477 AP_InertialSensor: add comments to give credit for accel calibration method to Rolfe Schmidt 2012-12-05 09:20:31 +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 5e77119377 AP_InertialSensor: fixed stub driver to work correctly with sensors HIL 2012-12-03 23:27:21 +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 4f868e04cc AP_InertialSensor: return the example sample count in Oilpan 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 7ea18d5a61 AP_InertialSensor: fixed example build 2012-11-24 21:08:06 +11:00
rmackay9 74daf73c49 AP_InertialSensor: increase acceptable Z accel offset to be 3.0 G
Note: Z offsets do tend to be larger than x and y offsets
2012-11-23 00:34:42 +09:00
Andrew Tridgell 11141d0af0 INS: make it possible to do accel cal on a different serial port 2012-11-21 21:41:34 +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 a7e537d6c0 INS: set the acceptable calibration error equal on all axes 2012-11-20 19:28:49 +11:00
Andrew Tridgell 40fc0feaf9 INS: show calibration values on failure
this will help debug bad calibrations
2012-11-20 19:28:15 +11:00
Andrew Tridgell 85e050f16c INS: get check for send_msg the right way around!
I broke this in my previous commit
2012-11-20 19:10:30 +11:00
Andrew Tridgell fd3993287d INS: disable accel calibration on the 1280
this would put us well over 128k in sketch size
2012-11-20 18:41:04 +11:00
Andrew Tridgell 9c811671f1 INS: make calibrate_accel() return a bool
this will allow APM to auto set MANUAL_LEVEL to 1
2012-11-20 18:32:27 +11:00
Andrew Tridgell 152c12c283 INS: fixed raw accel offset for APM1
we now get reasonable offset values
2012-11-20 18:32:27 +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
rmackay9 921ab3fe12 ArduCopter: bug fix to DMP initialisation (it was freezing due to SPI bus conflicts) 2012-09-28 18:34:23 +09:00
Andrew Tridgell 7e544e8ead MPU6k: save 72 bytes of memory
the buffer can be on the stack
2012-09-18 13:58:50 +10:00
rmackay9 9f1033dc42 AP_InertialSensor_Stub: added num_samples_available method to fix HIL build 2012-09-10 11:38:13 +09:00
rmackay9 130f3b0030 AP_InertialSensor_MPU6000: move _last_sample_time_micros to capture time data_interrupt was called 2012-09-10 11:38:08 +09:00
rmackay9 7a265dbf61 AP_InertialSensor: use AP_TimerProcess's queue_process to run read from MPU6000 after any currently running processes complete 2012-09-10 11:38:03 +09:00
rmackay9 0a6219695b AP_InertialSensor: changed read of sensor from MPU6000 to happen immediately
This reduces the delay between when data arrives and when it is used
by up to 1ms.

Added num_samples_available method to all InertialSensors to allow
main loop timing to be synced with sensors.
2012-09-10 11:37:33 +09:00
rmackay9 c965963d7b AP_InertialSensor_MPU6000: bug fix. DMP was being enabled by default so although the results were not being used, this caused a delay in the main loop 2012-08-28 17:02:07 +09:00
uncrustify ad51ac5e11 uncrustify libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.h 2012-08-21 19:03:14 -07:00
uncrustify 323ab9acf4 uncrustify libraries/AP_InertialSensor/AP_InertialSensor_Oilpan.h 2012-08-21 19:03:14 -07:00
uncrustify 8e5a031987 uncrustify libraries/AP_InertialSensor/AP_InertialSensor_Stub.h 2012-08-21 19:03:14 -07:00
uncrustify ac3960b3e7 uncrustify libraries/AP_InertialSensor/AP_InertialSensor.h 2012-08-21 19:03:14 -07:00
uncrustify e6c2616769 uncrustify libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp 2012-08-21 19:03:14 -07:00
uncrustify 77729b847f uncrustify libraries/AP_InertialSensor/AP_InertialSensor_Oilpan.cpp 2012-08-21 19:03:14 -07:00
uncrustify 0c322fb18a uncrustify libraries/AP_InertialSensor/AP_InertialSensor_Stub.cpp 2012-08-21 19:03:14 -07:00
uncrustify 25eaeff6a8 uncrustify libraries/AP_InertialSensor/examples/MPU6000/MPU6000.pde 2012-08-21 19:03:14 -07:00
Andrew Tridgell 0763bbd1af MPU6000: fixed some build warnings 2012-08-09 16:19:21 +10:00
Andrew Tridgell 518d6365ff AP_Param: update remaining libraries for new constructor syntax 2012-08-08 12:11:57 +10:00
rmackay9 5077674043 AP_InertialSensor_MPU6000: another attempt at fixing the SITL build 2012-07-28 17:19:19 +09:00
rmackay9 7683e9d870 AP_InertialSensor_MPU6000: changed DMP memory definition (dmpMem) to const uint8_t to remove SITL compile errors (hopefully)
Removed unused 'dump' variable from dmp_load_mem to reduce compiler warnings
2012-07-28 16:33:04 +09:00
rmackay9 48074f4766 AP_InertialSensor_Oilpan: changed initialisation order of parameters to remove compiler warning 2012-07-28 15:22:37 +09:00
rmackay9 6cd0918134 AP_InertialSensor: methods added to access DMP functionality 2012-07-28 14:14:43 +09:00
Jason Short c9d3ab5413 Oilpan ADC parameters added
including a function that configures each Accel Axis
Defaults matching old behavior
Added param group
2012-07-18 22:57:11 -07:00
Andrew Tridgell acc6adf6e9 MPU6k: removed an unused variable 2012-06-29 21:54:09 +10:00
Craig Elder 69bf5700cd IMU: expose IMU_PRODUCT_ID as EEPROM Variable
this will allow us to log the Product ID in tlogs
2012-05-09 18:30:36 -07:00
Craig Elder 4a1d8b0875 AP_InertialSensor: Return product ID from sensor initialization
this exposes the product ID to the IMU Layer
2012-05-09 18:30:36 -07:00
Craig Elder ed99940bee MPU6000: Fixed Scaling on Accelerometers Rev C vs Rev D
Rev C have non standard scaling factor that is 1/2 of the data sheet
Rev D chips conform to the specification
2012-05-09 18:30:35 -07:00
Andrew Tridgell 2dd655d87d MPU6k: added suspend/resume on init 2012-05-01 12:06:54 +10:00
Andrew Tridgell b02ca58901 InertialSensor: fixed HIL build 2012-03-10 10:34:34 +11:00
Andrew Tridgell 9296ac494d AP_InertialSensor: added a get_gyro_drift_rate() interface
this returns the expected max drift rate for the particular type of
gyro being used
2012-03-10 10:34:33 +11:00
Andrew Tridgell 3e960f8ef9 InertionSensor: update for new Ch6() interface 2012-03-10 10:34:32 +11:00
Andrew Tridgell a9dea35310 AP_InertialSensor: added new_data_available() interface 2012-03-10 10:34:28 +11:00
Randy Mackay ed19c25a97 Arduino 1.0 - changed all #includes of "WProgram.h", "wiring.h" and "WConstants.h to "Arduino.h".
Modified FastSerial's write function to return size_t (number of bytes written).
2012-01-28 12:25:47 +09:00
Andrew Tridgell e1c9c063a5 MPU6k: don't init the Wire library
we don't use Wire any more
2011-12-28 20:41:53 +11:00
Andrew Tridgell 6ca613337b MPU6000: protect the driver from double initialisation
initialising twice can lockup the driver
2011-12-28 16:00:48 +11:00
Andrew Tridgell 18d26dc74e MPU6000: minor fixes
the hardware functions should be private, and cs_pin should be uint8_t
2011-12-28 16:00:48 +11:00
Andrew Tridgell 04daeab7c0 MPU6000: change to 98Hz low pass filter
based on recommendation from Pat
2011-12-26 19:17:11 +11:00
Andrew Tridgell 10ca54ef8f MPU6000: use data ready interrupt to prevent stale data
We listen for a data ready interrupt and only read new data in read()
if there is new data
2011-12-26 19:17:11 +11:00
Andrew Tridgell 760aa62c75 fixed the MPU6000 test sketch 2011-12-26 19:17:11 +11:00
Andrew Tridgell b72f9c2e9f added MPU6000 test sketch
this doesn't work yet - Pat, any idea why?
2011-12-25 12:03:39 +11:00
Andrew Tridgell f97b405b56 MPU6k: update driver for new ap_proceduce prototype 2011-12-21 23:31:38 +11:00
Andrew Tridgell bc9e943969 rollover is not a bug
subtracting unsigned numbers does the right thing
2011-12-21 23:31:38 +11:00
Andrew Tridgell 97f8d21c1b added code format markers to AP_InertialSensor library 2011-12-21 23:31:38 +11:00
Andrew Tridgell d442bad413 Revert "ADC: added an enable_channel() API"
This reverts commit dafeac01d8f14162600cf821404ba4072dcae14d.

ADC will be disabled on APM2
2011-12-17 07:29:09 +11:00
Andrew Tridgell 9591317dbc ADC: added an enable_channel() API
enable_channel() must be used before the Ch6() method is called to
enable gathering of data on the required channels
2011-12-16 20:09:40 +11:00
Pat Hickey f3ad7f3af8 Wire and SPI Init: move to sketch system.pde from libraries
* Wire.begin removed from AP_Baro_BMP085::init()
* SPI.begin  removed from AP_Baro_MS5611::init()
* SPI.begin  removed from AP_InertialSensor_MPU6000::hardware_init()

* Both Wire.begin and SPI.begin added very early in init_ardupilot in
  ArduCopter/system.pde and ArduPlane/system.pde
2011-12-11 15:21:10 -08:00
Andrew Tridgell 41caa949ca fixed InertialSensor stub build 2011-11-25 20:00:18 -08:00
Pat Hickey d2a0bd35f4 hil-sensors: added stub libraries for InertialSensor and PeriodicProcess
* Also added dummy ivar to APM_BMP085_hil
2011-11-25 20:00:18 -08:00
Andrew Tridgell 8245835ea3 desktop: make AP_InertialSensor pure virtual
fixed a link error in Desktop build

thanks to Pat for the C++ foo
2011-11-25 20:00:17 -08:00
Pat Hickey 82b48784ef purple: added AP_InertialSensor library
this abstracts the way of getting inertial sensor (gyro and
accelerometer) data for the APM1 and purple hardware. The Oilpan code
is based closely on the old APM1 code
2011-11-25 20:00:16 -08:00