Commit Graph

43 Commits

Author SHA1 Message Date
Andrew Tridgell 3fe5b3151b allow MAG_ENABLE to be changed in flight
this disables the compass in DCM if MAG_ENABLE is changed in
flight. Without this we would use a fixed yaw once the compass is
disabled

This also makes sure we don't pass the compass to DCM till we have
done a read. This ensures we have a good compass fix for the initial
DCM heading
2012-02-25 14:51:09 +11:00
Andrew Tridgell b231112957 DCM: renorm_sqrt_count is now called renorm_range_count 2012-02-23 08:16:08 +11:00
Andrew Tridgell faa098b2b6 adapt mainline APM code to AP_Param 2012-02-13 16:22:51 +11:00
Andrew Tridgell c95a295fd6 allow for lower serial baud rates
not many people will use less than 9600 baud, except for those wanting
to test extreme range radios, which is what I'm trying to do :-)
2012-02-04 19:07:18 +11:00
Doug Weibel 622217357c Bug fix for compass.
This is a fix for an interesting bug when a DCM matrix reset was added to the ground start.  This bug only showed up if (A) a ground start were performed after an air start or due to use of the "Calibrate Gryo" action, (B) if the current orientation were sufficiently different from 0/0/0, and (C.) if the particular magnetometer had sufficiently large offsets.  Why did resetting the DCM matrix to 0/0/0 pitch/roll/yaw at ground start cause a bug?  The magnetometer offset nulling determines the proper offsets for the magnetometer by comparing the observed change in the magnetic field vector with the expected change due to rotation as calculated from the rotation in the DCM matrix.  This comparison is made at 10Hz, and then filtered with a weight based on the amount of rotation to estimate the offsets. Normally it would take considerable time at normal in-flight rotation rates for the offset estimate to converge. 

If a DCM matrix reset occurs when the offset nulling algorithm is up and running, the algorithm sees the DCM reset as a instantaneous rotation, however the magnetic field vector did not change at all.  Under certain conditions the algorithm would interpret this as indicating that the offset(s) should be very large.  Since the "rotation" could also have been large the filter weighting would be large and it was possible for a large erroneous estimate of the offset(s) to be made based on this single (bad) data point.

To fix this bug methods were added to the compass object to start and stop the offset nulling algorithm.  Further, when the algorithm is started, it is set up to get fresh samples.  The DCM matrix reset method now calls these new methods to stop the offset nulling before resetting the matrix, and resume after the matrix has been reset.
2012-01-12 14:44:24 -07:00
Andrew Tridgell 645eac6f38 I2c: default to 5ms timeout, and faster bus speed
we will slow down the speed when we get a failure
2012-01-04 16:36:47 +11:00
Andrew Tridgell c6b8a08918 APM: convert to new I2C library 2011-12-28 20:41:53 +11:00
Andrew Tridgell b108b907e0 APM: Update for DataFlash changes 2011-12-28 16:00:49 +11:00
Doug Weibel 7779dff355 Correct a bug in throttle failsafe feature 2011-12-24 15:34:31 -07:00
Andrew Tridgell 66029af574 setup the main loop failsafe after RC library is setup 2011-12-23 11:13:01 +11:00
Andrew Tridgell c6633d7bc9 fixed HIL build 2011-12-21 23:31:39 +11:00
Andrew Tridgell ad63c10ab7 APM: added failsafe support
we now pass all channels through at 50Hz if the main loop stops
running, regardless of why. This gives us a reasonable failsafe, as
long as the low level RC library is still working, and interrupts
don't get completely disabled.
2011-12-21 23:31:39 +11:00
Andrew Tridgell 8a7d064842 APM: run mavlink loop while erasing logs 2011-12-18 10:19:52 +11:00
Andrew Tridgell 5d2301ef47 fixed airspeed sensor for ArduPlane on APM2
we were trying to use a non-existant ADC chip!
2011-12-17 07:29:09 +11:00
Andrew Tridgell ed17f64459 geofence: added FENCE_TRIGGERED_PIN
this allows for a digital pin to be set high when the geofence
triggers. This pin can be connected to an external failsafe device
2011-12-17 07:29:08 +11:00
Andrew Tridgell e8617fc929 DCM: reset the DCM matrix after a ground start 2011-12-13 21:33:07 +11:00
Andrew Tridgell c007fb49b8 IMU: update ACM and APM for flash_leds change in IMU init 2011-12-13 18:19:41 +11:00
Andrew Tridgell dd4498d113 desktop: fixed Wire.begin() build problem 2011-12-12 15:14:55 +11:00
Pat Hickey 85b82e75f6 ArduPlane: update AP_Baro construtors and initializers 2011-12-11 15:21:10 -08:00
Pat Hickey 6710cf5c5a 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
Pat Hickey c64e3f5772 ArduPlane: calibrate accel with imu.init_accel after imu.init
* complements commit 73418559, where init_accel was eliminated
  from AP_IMU_INS::init cold start.
2011-12-10 13:32:47 -08:00
Doug Weibel aa6c336479 Add DataFlash.Init before doing a forced log erase on eeprom reset.
Add progress indication during log erase
2011-11-28 19:42:27 -07:00
Pat Hickey a6bf2d9cd6 ArduPlane: LED digital writes use LED_OFF and LED_ON 2011-11-25 20:00:19 -08:00
Andrew Tridgell 7467bf649c ArduPlane: rename purple to APM2 2011-11-25 20:00:19 -08:00
Andrew Tridgell 0604f2c667 USB-MUX: auto-switch telemetry port based on UXB mux for ArduPlane
when USB is unplugged, switch baud rate to the SERIAL3_BAUD rate from
EEPROM
2011-11-25 20:00:19 -08:00
Andrew Tridgell 2db5a2b5e2 purple: add the remaining hw defines for purple hardware 2011-11-25 20:00:18 -08:00
Andrew Tridgell 01cfd64327 timer_scheduler doesn't exist in HIL_MODE_ATTITUDE 2011-11-25 20:00:18 -08:00
Andrew Tridgell ee3254ef8f adc.Init() takes timer_scheduler 2011-11-25 20:00:17 -08:00
Pat Hickey 71ebf1f543 removed old commented out code 2011-11-25 20:00:17 -08:00
Pat Hickey fefc7da1d1 purple: added new parameters needed for new library APIs
new APIs pass in timer_scheduler. We also to init the isr_registry
2011-11-25 20:00:17 -08:00
Andrew Tridgell 32073eaa51 mod barometer.Init() based on hardware 2011-11-25 20:00:15 -08:00
Andrew Tridgell 2cc0cd65b4 zero airspeed on ground start when initiated by MAVLink
If the users asks for a new calibration, that should include the
airspeed sensor
2011-11-21 20:29:18 +11:00
Doug Weibel a11ea12ca8 Change to logging file system.
This commit is somewhat temporary as I have come up with a better scheme and will be modifying this.  Just making this commit in case I need to roll back
2011-11-17 21:25:51 -07:00
Andrew Tridgell 4a92048ef0 fixed "Free RAM" display on bootup 2011-10-28 21:34:10 +11:00
Andrew Tridgell c0c771042f CLI: enable "hit enter 3 times" support for CLI
if you hit enter 3 times before you send any mavlink packets, we will
enter CLI mode
2011-10-27 21:54:07 +11:00
Andrew Tridgell dcc6f30af1 don't initialise DataFlash if logging is disabled
this fixes HIL without an IMU
2011-10-09 22:08:59 +11:00
Andrew Tridgell e927cf94d7 use memcheck_available_memory() instead of freeRAM()
this gives a more accurate view of free memory
2011-10-09 22:08:59 +11:00
Andrew Tridgell de18df06b5 GCS: make the two GCS links gcs0 and gcs3
the artifical separation between 'gcs' and 'hil' just leads to
confusion. This also simplifies the code a bit more, and saves us a
bit more text
2011-09-19 11:04:02 +10:00
Andrew Tridgell 9fed709be2 removed some more dead messages, and convert MSG_* to an enum
this make it safer to add a new message while keeping deferred queue
the right size
2011-09-19 11:04:02 +10:00
Andrew Tridgell 7d6301976e remove unused MESSAGE_COMMAND_LIST 2011-09-19 11:04:02 +10:00
Andrew Tridgell bc1bfed22d HIL: first step in simplifying the HIL/GCS code
this gets rid of the messy #ifdefs around HIL_PORT, and removes
non-MAVLink GCS and HIL support
2011-09-19 11:04:01 +10:00
Amilcar Lucas c9d9ee0d3b Merge some small misc improvements from APM_Camera branch 2011-09-17 20:25:31 +02:00
Andrew Tridgell 89fa70520f imported ArduPlane from ArduPilotMega svn 2011-09-09 11:29:39 +10:00