1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00
Commit Graph

140 Commits

Author SHA1 Message Date
peabody124
2019edd612 AHRS: Store running time to make detect resets easier. Update OP and AHRS in
parallel for this update.  Also removed comment for rawhid

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2012 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-27 14:31:32 +00:00
peabody124
300195ff18 AHRS: A few small changes
1) Moved the criteria for using GPS to defines in anticipation of moving into
AHRSSettings
2) Only use the mags for updates if the vector length is within 20% of nominal
to avoid updating when it's nonsense
3) Reinitialize position when swapping between indoor and outdoor
4) Dont use mags for first 5 seconds after initialization, sometimes seems to
cause issues
5) Dont use mags until magnetic field at your location is set and a magnetic
field is loaded
6) Dont use GPS if home location hasnt been set

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1959 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-14 01:36:30 +00:00
peabody124
016bcad24a AHRS: Detect when more than 2 seconds since last GPS update and in that case
reinit INSGPS to new location

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1958 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-14 01:36:28 +00:00
peabody124
e72b6051b5 AHRS: Make mag variance account for the vector length of magnetic field. Also
moved around where the axis are swapped and made the negative sign come from
calibration.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1931 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-10 00:46:01 +00:00
peabody124
0a9ab6ca5f AHRS: Send PositionActual and VelocityActual out
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1919 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-08 15:38:19 +00:00
sambas
e32ddd5230 Flight/AHRS: gyrotemp raw actually shows now raw temp
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1903 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-06 18:14:12 +00:00
peabody124
dea5c91646 AHRSCalibration: Make default values correct now Les extended
uavobjectgenerator to support multiple fields (thanks Les!).  Also
changed default scale on mag to +/-6g

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1899 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-06 14:26:42 +00:00
peabody124
66bf9d53d4 AHRS: Paramaterize the variance used for the indoor algorithm.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1898 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-06 14:26:40 +00:00
peabody124
e743678d89 AHRS: This fixes the mags, I forgot to normalize the magnetic flux at your
home location.  If you use INSGPS_INDOORS make sure your HomeLocation.Be fields
are correct for your GPS coordinates
http://maps.alfiordalis.com/declination.html

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1862 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-03 20:35:22 +00:00
peabody124
a9495e2cbb UAVObjects/AttitudeSettings: Remove unused object, moving data to AHRSettings.
Added attitude bias to AHRSSettings.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1855 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-03 18:14:34 +00:00
peabody124
840df39b78 AHRS: Export gyro data as deg/s instead of rad/s to match the object label
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1851 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-03 15:22:09 +00:00
peabody124
9165fb87b2 AHRS: Calibration values were sent but not locked into EKF
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1847 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-03 04:34:07 +00:00
peabody124
87a822e3f9 AHRS: Add back home location setting north axis
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1846 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-03 04:34:05 +00:00
peabody124
5c9b5f4a99 AHRS: Get calibration working again
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1842 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-02 03:10:04 +00:00
peabody124
0c30101f54 AHRS: Made an object setting to allow the downsampling rate to be changed on the
fly (EKF rate up to a limit).  Also, now the algorithm selects if you are
indoor or outdoor as well as if you use a mag indoor (if you do set the z
variance higher than it calibrates to).

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1841 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-02 03:10:01 +00:00
peabody124
104dc165a9 AHRS: Max downsample that doesn't cause huge amounts of drops right now is 20
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1840 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-02 02:17:34 +00:00
peabody124
ea3fb03c7f Flight/AHRS Communications: Switch to Les' very nice UAVObject communication
scheme

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1835 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-02 02:17:18 +00:00
peabody124
e2d63cbf19 Flight & Ground/AHRS Calibration: Made variance estimation into a two pass
approach again because ran out of numerical precision for single pass.  Also
made ground force the gyro signs to be correct.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1806 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-30 04:30:29 +00:00
peabody124
6d811cc4db OP-140 AHRS: Don't run INSGPS until OP says board is initialized. This will
also block heart beat.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1767 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-26 03:06:57 +00:00
peabody124
a3ea9a5461 AHRS: Add a weak mag correction in indoor mode to remove gyro bias and try and
get a reliable heading

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1765 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-26 03:06:51 +00:00
peabody124
77b68e5169 Flight/Guidance: Initial template for guidance module
Flight: Create PositionDesired (the active waypoint) UAVObject and make the FlightSituationActual no update since it not used.
Flight: New velocity desired object that passes information between the look computing the desired velocity and the PID loop to get it (updated at different rates)
UAVObjects/PositionActual: Remove unused GPS fields
UAVObjects/PositionActual VelocityActual: Split the velocity into a separate object.  ALso make sure all the information telemetered around is in cm to avoid using floats.
UAVObject/GuidanceSettings: New guidance settings object for the guidance module
Flight/Posix: Add the new objects to the Posix sim
Flight/Guidance: Computes a desired velocity based on position error than runs a PID loop to control roll and pitch to achieve that velocity.  All distances are in cm, and updated the PositionActual fields to reflect this and use int32.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1760 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-26 03:06:27 +00:00
peabody124
a01783b2a8 OP-140 AHRS: Explicilty deal with if it is initialized or not, use that to
determine retransmitting calibration, home location and such.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1755 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-25 21:05:38 +00:00
peabody124
9b28f2d72c OP-167 OP-157 AHRS/Calibration: Added mag scale and really cleaned up calibration.
Calibration should take less time now too (using second moments to estimate
variance in one pass).  Now need to change to multiple messages to get the
calibration in to keep the request message size minimal.  Also currently
running sensor calibrate doesn't store the gyro bias so if you want to use this
you'll have to tweak it manually.  I'll fix that step tomorrow.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1741 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-25 09:20:38 +00:00
peabody124
a1a3b0774f Flight/AHRS: Update code to coding conventions.
find ./flight/AHRS/ \! \( -name '*~' -a -prune \) -type f    | xargs -I{} bash -c 'echo {}; dos2unix {}; gnuindent -npro -kr -i8 -ts8 -sob -ss -ncs -cp1 -il0 {};'

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1707 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-21 19:29:39 +00:00
peabody124
0ea95fbad1 AHRS: Separate covariance prediction from state prediction to get updated state out of spi a few milliseconds sooner.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1675 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-17 18:15:00 +00:00
peabody124
92c36114f3 AHRS: No longer reinit after a comms glitch. Allow time for EKF to converge (2-3 seconds) after power up.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1674 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-17 18:14:20 +00:00
peabody124
832b61ab86 OP-117 AHRS: Binary streaming of the raw data within EKF. Doesn't keep up while running this but does give accurate data that went into algorithm. Once we can dynamically change sampling rate will be good.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1655 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-16 05:26:14 +00:00
peabody124
885c966e53 AHRS: Added a tracker for number of ADC updates the EKF misses. Also updated the Telemetry autogenerated files to accomodate the 11500 baud rate.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1652 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-16 02:59:00 +00:00
peabody124
ff1b303083 AHRS: Only do EKF correction with mag when new data available
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1651 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-16 02:58:56 +00:00
peabody124
19e80da928 AHRS: Update UAVObject with information about AHRS rate
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1650 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-16 01:54:21 +00:00
stac
cdb8aa37a0 ahrs: Only read mag data when it has been updated
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
2010-09-15 14:21:05 +00:00
stac
55d90970ed hmc5843: hide internal #defines and functions
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
2010-09-15 14:21:04 +00:00
stac
139da048f6 ahrs: remove unused debug code
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1620 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-15 14:20:51 +00:00
peabody124
c5fe985a45 AHRS: Gets timing working correctly to compute the EKF rate and idle time in real values
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1615 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-14 07:03:36 +00:00
peabody124
0875dc8442 AHRS: First pass refactoring the ADC code into another function. Still want to clean up a few constants make the downsampling go into a smaller circularbuffer nicely.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1614 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-14 07:03:34 +00:00
peabody124
1051d894b9 AHRS: Merged in some new code from Dschin that expliclity writes the prediction terms in the covariance matrix. Also made changes to compile with -Os. Now runs around 125 - 150 Hz depending on corrections used (this will become adjustable from GCS shortly).
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
2010-09-14 06:42:56 +00:00
pip
7da2fc2ba7 made ahrs_state 'volatile' in ahrs.c to prevent compiler optimization lockup
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1612 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-13 20:56:58 +00:00
peabody124
76971a807c AHRS: Some more tweaking of the timings.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1603 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-12 22:18:18 +00:00
peabody124
ba34bb8c24 AHRS: Oops, didn't notice the message processing was removed from end of loop. Adding back.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1597 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-12 12:44:57 +00:00
peabody124
59758122e1 AHRS: Cannot process messages while idling as this makes the main loop execution time non-deterministic based on OP (i.e. could get three messages and push the time up). It would be a nice featuer since you can get a raw and EKF update in the same step, but if the AHRS_Comm loop is fast (which is should be to keep update latency low) then this will hammer the AHRS with redunant requests.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1594 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-12 02:54:51 +00:00
peabody124
56131476ef AHRS: Switch to sampling at 2khz, plenty of CPU usage. However need to make EKF rate different for outdoor mode with this patch because otherwise will drop samples :-(
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1592 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-12 02:54:47 +00:00
stac
d1dc300081 ahrscomms: remove unused sync and switch_proto messages
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1582 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-11 23:06:25 +00:00
stac
80c92ba54b ahrs: process SPI messages while idle
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
2010-09-11 23:06:23 +00:00
peabody124
6cdb9b0b48 AHRS: Added Matlab code to analyze the INSGPS friendly data dump format and plot the important variables. This requires "DUMP_FRIENDLY" be enabled in the file.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1560 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-08 06:15:21 +00:00
peabody124
e499f33fd5 AHRS: Improved code to stream raw data from AHRS and added a matlab function to acquire and analyze the data. The QT program to analyze it should work but QextSerial seems to have a bug and drops or inserts data
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1559 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-08 06:15:18 +00:00
peabody124
9895b403c7 Ground/SerialLogging: Improved the serial dump from AHRS to have a big random frame header and to detect it on the logging program.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1556 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-07 16:33:10 +00:00
peabody124
e06162fa3a Flight/AHRS: Reorganized the code a little to make sure indoor used by default unless GPS updates come
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
2010-09-06 07:54:19 +00:00
peabody124
404e0c2f44 OP-132 AHRS: Changes to the Indoor flight handling to only use the barometer indoors and update with a zero for velocity and high variance.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1517 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-04 02:19:04 +00:00
peabody124
a406034ed9 OP-132 Flight/AHRS: Changed the heuristics regarding GPS quality and INSGPS updates. Now if satellites < 7 or PDOP > 3.5 it does not perform GPS updates. Professor is working on some code to fix parts of the covariance matrix. If indoor updates high a 0 position and velocity and high variance.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1515 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-04 02:19:00 +00:00
peabody124
12657440c3 OP-132 AHRS: Added an indoor flight mode and also add an ad-hoc quality heuristic to the GPS signal to increase the measurement variance from GPS when fix quality is poor or when in indoor flight mode. In addition corrected the indentation to conform to the tab/space convention forum discussion.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1474 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-31 02:11:09 +00:00
peabody124
f202884ce8 AHRS: Numerous changes. Added CPU load monitoring for AHRS as well as some friendly debugging output options. Also added a new CalibrationMode setting to AHRS (Echo) to speed up sensor calibration. Cleaned up the 6 point calibration interface to make it more friendly, but I think Edouard will clobber it with something nice and sexy :).
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1455 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-29 06:38:30 +00:00
peabody124
8128c3bbfa OP-118 AHRS: Added 6 point calibration routine to AHRS config widget. To use it, click "Cal Mode", then place the AHRS on each of 6 sides of a cube then click save position. Finally click compute to push the updated scale abd bias terms to the AHRS. Also fixed a bug in UAVObjectField that would not allow you to setDouble for extra fields.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1449 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-28 18:48:51 +00:00
stac
47df1faa8d ahrs: whitespace adjustments
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
2010-08-27 02:14:58 +00:00
stac
670452307d ahrs: remove unnecessary memset() of rx message buffer
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1429 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-27 02:14:56 +00:00
stac
0a7088c24a ahrs: fix type on flags, remove redundant code
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
2010-08-27 02:14:54 +00:00
peabody124
c07e1416b7 AHRS: Serial output option for AHRS and corresponding serial logger.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1414 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-26 06:25:11 +00:00
peabody124
beac0c0ea9 AHRS: Get the signs for the simple algorithm correct
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1385 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-23 04:12:14 +00:00
peabody124
bd8fffe4d0 AHRS/Flight: Renamed AttitudeSettings to AhrsSettings to make it more intuitive. Added the ability to change the algorithm from GCS.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1383 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-23 03:39:13 +00:00
peabody124
2596f43511 OP-120 AHRS: Moved conversion of quaternion to RPY over from AHRS to OP to minimize transfer and computational load on AHRS.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1381 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-23 02:35:39 +00:00
peabody124
5662d85c4e OP-120 AHRS: Tightened up the communication protocol so it runs more quickly. Looks ok in gdb but GCS not crashing right now (rendering error) so I can't test it properly.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1366 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-22 00:21:54 +00:00
peabody124
8897c441fa OP-118 AHRS: Added AHRSCalibration object and messages associated with that to AHRS. Also made AHRS run calibration only when requested. We will create a GCS plugin that runs through computing the calibration settings. To compute the variances on the AHRS set the measure variances to true, wait ten seconds, then set it to false to read it back.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1363 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-21 21:46:02 +00:00
stac
b36d251bd9 ahrs: remove debug code in attitude handler
Debug code was previously using the q4 element
in the attitude message to encode a cycle counter
to measure performance on the AHRS.  This is no
longer valid.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1357 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-21 16:23:14 +00:00
peabody124
2031cfe4d0 OP-119 AHRS: Added error counters for the messages as well as changed an error on AHRS echo back for the HomeLocation message.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1344 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-20 22:52:13 +00:00
peabody124
ef0b307353 [OP-119] Flight/AHRS: Created a HomeLocation object which is updated when the GPS gets an initial 3D fix and populated with the information to convert from LLA from the GPS to NED reference frame. Also added a message for passing the MagneticNorth vector to the AHRS and removed that computation from AHRS.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1337 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-19 20:38:27 +00:00
peabody124
3c4def13cc AHRS: Added message to pass GPS information into AHRS from OP. This is then converted
into NED reference frame and used in the INSGPS algorithm, although currently this
information isn't propagated back to OP.  Data structures related to the GPS position
into the algorithm and the position estimate out will likely be in flux.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1334 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-19 05:18:34 +00:00
peabody124
cfd20922cd AHRS: Added the filtered data to the attitude raw object. Even though this seems like an oxymoron it's still raw to the EKF algorithm, and nice to see the real values after filtering to make sure nothing weird is going on. However, if people don't like this I'm open to suggestions/patches. I'd maybe suggest the whole attituderaw object be converted to ahrsraw anyway since it's more like that (eg. none of the values are actually attitude estimates).
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1325 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-18 14:54:24 +00:00
peabody124
4cba4929c2 AHRS: Fixed another bug in decimation code - I stupidly used Matlab 1 based indexing. Adjusted timing of AHRS so it can process all the data and doesn't miss updates. Finally adjust all inputs to INS to have correct sign and orientation (I think). This is X is forward, Y is right, and Z is down which is mentioned in the forum as our standard and fits the algorithm. The magnetic sensor driver should be modified to return in this order (currently reads X,Y,Z registers which maps to left, back, up) but maybe since it's a board dependent orientation it's better where it is.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1315 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-18 05:47:44 +00:00
peabody124
64bcebb87a AHRS: Fixed bug in the downsampling code (used a += a + blah, dumb). Also added initialization of the magnetic flux based on fixed GPS settings (I hope you're near Houston). I will add the GPS communication shortly.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1307 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-17 05:32:07 +00:00
peabody124
f74268b5e5 Cleanup and documentation.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1304 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-16 16:58:24 +00:00
peabody124
a23f3c66f4 Behaving reasonably, added calibration code which runs by default on startup and take 6 seconds - this will be called from GCS in future and saved to SD card.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1303 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-16 16:58:22 +00:00
peabody124
e0d63103ec Added a testing function for INS - currently doesn't stabilize for fixed inputs. Fixed two bugs I found in INSGPS (R[10] instead of R[9] initialized and Nav.Pos[2] was set to wrong X element).
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1302 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-16 16:58:20 +00:00
peabody124
d2e234b53a Adding the code from Dr. Dale to the AHRS. Currently diverges though, but not on the PC.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1301 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-16 16:58:18 +00:00
peabody124
ddbd4f8c80 Simple attitude calculation based on gravity and magnetic vector
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1298 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-15 06:03:44 +00:00
peabody124
3f408ad655 AHRS: Changing AHRS to use a DMA double buffering scheme with continuous samping for the analog data, then a simple fixed point FIR/decimate function. Currently all the oversampling parameters are hard coded as definitions, but will be updated to be configurable via settings.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1297 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-15 04:09:01 +00:00
peabody124
cc2441d41b Adding ADC downsampling code
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1296 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-15 04:08:57 +00:00
stac
3125ecfc4e AHRSComms: altitude sensor data is now sent to AHRS
Altitude/pressure sensor data is sent to the AHRS whenever
the AltitudeActual object is updated.

Altitude, Pressure and Temperature are sent as floats.
Same as in the UAVObject that goes to the GCS.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1291 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-15 01:02:13 +00:00
peabody124
d4c5dba234 [PIOS] The ADC mappings are strange because of the way the DMA engine works. Basically data is packed 16 bits ADC2 then 16 bits ADC1 channels, so the accels are pins [4 2 0] currently. Also there is inconsistency between the names of the pins in the config file which uses 1 based indexing and the index for PIOS_ADC_PinGet which is zero based and has to account for this interleaving. Probably should adjust config file to be zero based and then to make those pin numbers map to the function call. The actual order they appear is arbitrary as the ADC engine can scan in whatever order.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1290 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-15 00:53:30 +00:00
stac
c3e509c2cb attituderaw: Replace HeadingActual with AttitudeRaw
AttitudeRaw now includes:
 - magnetometers XYZ (in mG)
 - gyros XYZ (raw ADC samples)
 - accelerometers XYZ (raw ADC samples)
 - placeholder for gyro temp sensors (read as zero for now)

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1289 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-14 23:42:14 +00:00
stac
05485e5b63 ahrs: tie main loop into SPI link FSM
- AHRS mainloop now runs flat out updating sensor data and
processing any messages sent from the OP board.
- Raw data is provided from the magnetometers
- Fake data is provided for attitude solution
- Correct data is provided for serial number queries

Note: There is a bug in the i2c code that very quickly leaves the
      magnetometer in a broken state and returning incorrect values.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1013 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:47 +00:00
stac
29a8f05ac9 mag sensor: put some bounds on the parameters
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1012 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:45 +00:00
stac
771a56ca9d com/usart: generalize com driver API
- Created a pluggable COM layer
- Converted COM + USART init into static initializers
  rather than typedefs
- Generalized the USB HID COM API to match the USART
  API.
- Changed USART and COM layers to be data driven rather
  than #ifdef'ing/switching on the specifics of each port

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@760 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-13 04:24:26 +00:00
stac
8d015a57d0 pios spi: support both master and slave configs
Added support for SPI slave configurations to the pios SPI layer.

Converted the board specific configuration for the PIOS SPI layer to
use const static initializers rather than #defines (see pios_board.c).

SPI interface between the OP board and the AHRS is now operational at
a basic level, capable of moving simple single byte messages between
boards.  Multi-byte, CRC protected messages will be added on top of this.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@759 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-13 04:23:44 +00:00
gussy
5991a93739 Added GPIO functions for accelerometer full-scale selection.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@625 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-15 15:27:52 +00:00
gussy
73b5e29e02 Finalised and verified PIOS_HMC5843 library.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@624 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-15 12:50:05 +00:00
gussy
f9256b22d0 AHRS basic sensor test code revision.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@619 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-13 09:40:00 +00:00
gussy
22fbd8e4bd ADC Updates.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@618 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-12 12:09:35 +00:00
gussy
ff73ab5a80 More updates to cross-target compatibility.
Added PIOS_I2C into AHRS code.
Added PIOS_HMC5843 Module.




git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@617 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-12 08:18:49 +00:00
gussy
8f3c2dbafb Changes to PiOS to be compatible with the AHRS.
Updates to AHRS code.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@615 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-11 13:36:13 +00:00
dankers
c8c0e8be9e Comment changes
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@220 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-03-02 00:57:09 +00:00
gussy
fbb175e01c Initial commit of AHRS project code base.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@212 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-02-28 12:10:48 +00:00