The AHRS mainloop was reading the mag data on every
loop regardless of whether new data was actually
available. Now that the MAG_DRDY signal is monitored,
we can read only at the rate (10Hz) new data is actually
produced by the sensor.
This also enables future improvements that will remove the
filtering work that is still being done on the mag data on
every iteration.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1630 ebee16cc-31ac-478f-84a7-5cbb03baadba
Way too much was being exposed in the API for the
HMC5843. This commit properly hides internal
details of the driver.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1629 ebee16cc-31ac-478f-84a7-5cbb03baadba
The DRDY signal from the magnetometer is connected to PB8
on the STM32. This pin is now configured as an external
interrupt and is now used to signal when new data is
available from the magnetometer.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1628 ebee16cc-31ac-478f-84a7-5cbb03baadba
The EOC EXTI interrupt configuration was incorrectly
pointing at GPIOG pin 8 rather than GPIOC pin 15.
This was preventing the EOC interrupt from working
properly.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1626 ebee16cc-31ac-478f-84a7-5cbb03baadba
I2C bus errors are now recoverable. The bus is properly reset
and an error indication is now provided to the caller whenever
a bus error occurs during processing of the transaction list.
For now, the users of the I2C layer just retry infinitely on
failure. The BMP085 and HMC5843 code should be changed to
report errors to its callers to allow a more sensible retry
strategy.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1625 ebee16cc-31ac-478f-84a7-5cbb03baadba
AUTO transitions in the FSM are now handled immediately
after processing each newly injected event rather than only
at the end of the EV ISR.
This consolidation allows the upcoming addition of event
injection from both the EV and ER ISR contexts.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1624 ebee16cc-31ac-478f-84a7-5cbb03baadba
Occasionally, the I2C driver races with the STM32 I2C peripheral
at the end of a bus cycle. This leaves the bus in an errored
state and the stop condition is not properly asserted on the bus.
The polling for the stopped condition was previously implemented
in ISR context since it was expected to be nearly instananeous.
In the error condition, however, the stop condition will never
happen. The polling for this case is now done by the initiating
task (or mainloop on the AHRS) to prevent the timeout condition
from triggering the watchdog.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1623 ebee16cc-31ac-478f-84a7-5cbb03baadba
The info field in the pios_i2c_txn list can now be used
to provide a const string which describes the context
for this transaction.
This is very helpful when diagnosing an error that occurs
somewhere in the middle of the I2C FSM since the FSM runs
primarily in the ISR where the original context for the
transactions is no longer available in the traceback.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1622 ebee16cc-31ac-478f-84a7-5cbb03baadba
Differentiate the _FSM_ faulted from the (soon to
exist _BUS_ faulted state.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1621 ebee16cc-31ac-478f-84a7-5cbb03baadba
Squashed commit of the following:
commit 897e3365ab6c762584c34238efd12dc144e72af0
Author: James Cotton <peabody124@gmail.com>
Date: Mon Sep 13 22:15:21 2010 -0500
AHRS: Getting it running nice and quickly.
commit 53d72fb849164730c89873cab81c9e09be0b112b
Author: James Cotton <peabody124@gmail.com>
Date: Mon Sep 13 15:57:46 2010 -0500
AHRS: Make more variables volatile for -Os.
commit 4fa90821b5d3d8c2ea5e67756313a8a63c0eeb8c
Author: James Cotton <peabody124@gmail.com>
Date: Mon Sep 13 15:11:31 2010 -0500
AHRS/Makefile: -O0 not added to allow me to try various space flags that don't break code.
commit 5bd17a304dc28dc271c2f3e8c6cb8ad4a830404f
Author: James Cotton <peabody124@gmail.com>
Date: Mon Sep 13 14:44:05 2010 -0500
AHRS: Make debuggign USART easy to disable
commit 5453f2a7939492769fe9e9cc822e69c107320670
Author: James Cotton <peabody124@gmail.com>
Date: Mon Sep 13 14:38:37 2010 -0500
AHRS: Explicitly expand covariance prediction. Brings computations from 160 to 90. Makes it not fit in AHRS though.
commit b6712da7eece2a464a2073d24b77be22bfa47094
Author: James Cotton <peabody124@gmail.com>
Date: Sun Sep 12 22:59:42 2010 -0500
AHRS: Make it easy to comment out the I2C/Magnetometers.
commit 8c84d0091f3d6f6bedc7a0224a4ed9cb099b022b
Author: James Cotton <peabody124@gmail.com>
Date: Thu Sep 9 00:49:50 2010 -0500
AHRS: Small change to INSGPS analysis tools
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1613 ebee16cc-31ac-478f-84a7-5cbb03baadba
Implement low-level utility functions for sending/receiving
the opahrs proto v0 (bootloader) messages. These are used
by the OP firmware loader and the AHRS bootloader.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1586 ebee16cc-31ac-478f-84a7-5cbb03baadba
Some functions were returning -1 instead of one of the
valud enum values.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1585 ebee16cc-31ac-478f-84a7-5cbb03baadba
This cleans up some of the boiler plate code that is
repeasted for simple (empty) requests that expect a
response.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1584 ebee16cc-31ac-478f-84a7-5cbb03baadba
This makes the AHRS continually process SPI messages
while waiting for new samples to be ready. This has
the side effect of making the CPU utilization on the
AHRS pin at 99-100% (ie. we make use of all of our
otherwise idle time).
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1581 ebee16cc-31ac-478f-84a7-5cbb03baadba
Change from using vTaskDelay to using vTaskDelayUntil to
ensure that we're trying to stay periodic rather than
just waiting a fixed amount of time after each loop of
processing.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1580 ebee16cc-31ac-478f-84a7-5cbb03baadba
in. Also change the velocity variance in indoor mode to lower to make it get a better attitude estimate (primarily faster convergence - probably will tweak this in the future dynamically). Finally decreased barometer variance - in scope it's actually quite reasonable, normally within +/- .5 m.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1546 ebee16cc-31ac-478f-84a7-5cbb03baadba
No functional changes.
The closing comment on some of the USB_HID related
ifdefs was outdated. Fixed.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1541 ebee16cc-31ac-478f-84a7-5cbb03baadba
The resultant error could range from -360º -> +360º
Since this is only used for Helicopters / multi rotors, and the aircraft can rotate in any direction, I added the modulo logic so that it is now from -180º -> +180º this should now take quickest path to correct the error.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1464 ebee16cc-31ac-478f-84a7-5cbb03baadba
The Wiki (http://wiki.openpilot.org/Unit_Standards) states this should be 0 - 360º
Made the code match the wiki.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1463 ebee16cc-31ac-478f-84a7-5cbb03baadba
As pointed out by osnwt in the forum, the
criteria for success of this function was
wrong.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1456 ebee16cc-31ac-478f-84a7-5cbb03baadba
This creates a new UAVObject called GPSSatellites to hold
information about which satellites the GPS receiver can see
and the quality of their signals.
NMEA GSV sentences are now parsed. The full set of GSV data
may be split across multiple GSV sentences, each containing
info for at most 4 satellites. Once an entire set of GSV
records has been collected, the GPSSatellites UAVObject is
updated.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1453 ebee16cc-31ac-478f-84a7-5cbb03baadba
Remove asserts on bad data, only assert on coding errors.
Remove unnecessary inline qualifier to reduce code size.
Handle more lat/lon precisions in conversion to fixed-point.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1452 ebee16cc-31ac-478f-84a7-5cbb03baadba
Change from spaces to <TAB> to match the formatting in
the template. No functional changes, just whitespace.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1451 ebee16cc-31ac-478f-84a7-5cbb03baadba
The number of retries and delay between retries was
increased in a previous commit. This doesn't appear
to be necessary so I'm reverting the increases.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1432 ebee16cc-31ac-478f-84a7-5cbb03baadba
GPS module now updates GPSPosition UAVObject
rather than the PositionActual object. The
GPSPosition object is intended to be consumed
only by the AHRS. The AHRS will use this (and
other inputs) to compute a filtered version of
the position in the PositionActual object.
This commit will cause temporary breakage of the
GPS functionality in the GCS until the PositionActual
object is properly updated by the AHRS. Most of the
GCS should continue to use PositionActual. The only
exception to this might be any tool for specifically
visualizing the raw GPS state.
GPS.c is now only responsible for receiving a
complete NMEA sentence from the COM interface.
NMEA parsing is now factored out into NMEA.[ch]
which is where GPSPosition is now updated based
on the complete NMEA sentences obtained from the
GPS.
Latitude and Longitude are now encoded in a
fixed-point notation in units of degrees x 10^-7
to prevent truncation of precision due to encoding
into a float.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1431 ebee16cc-31ac-478f-84a7-5cbb03baadba
No functional changes. Whitespace/tab fixups only.
Use TRUE/FALSE instead of 1/0.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1430 ebee16cc-31ac-478f-84a7-5cbb03baadba
No need to have boolean flags being floats.
Some of the attitude message was being populated twice.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1428 ebee16cc-31ac-478f-84a7-5cbb03baadba
Since there are a lot of autogenerated changes the important ones are:
flight/OpenPilot/UAVObjects/inc/uavobjecttemplate.h - added description and define to make the ObjectReadOnly query
flight/OpenPilot/UAVObjects/uavobjecttemplate.c
flight/OpenPilot/UAVObjects/uavobjectmanager.c - added the UAVObjReadOnly query
ground/src/libs/uavobjgenerator/uavobjectparser.cpp - added parsing of description field
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1425 ebee16cc-31ac-478f-84a7-5cbb03baadba
This has throttle and pitch curves implemented and can be configured for many swashplate configurations.
This has flown a 450 clone (with training wheels) and the ccpm worked well.
Still need to neaten up some stuff and work out how to implement yaw stabilisation in manual mode.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1412 ebee16cc-31ac-478f-84a7-5cbb03baadba