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

56 Commits

Author SHA1 Message Date
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
fda6fc8371 Merge branch 'mac_support'
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1324 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-18 14:29:53 +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
dschin
9ae9c87574 Six point sensor cal for accels and/or mags
Uploaded here for now - belongs in GCS probably.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1310 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-17 19:02:07 +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
dschin
ae18a8e89c Added general functions for coordinate conversions
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1306 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-17 00:09:32 +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
peabody124
ed70cb4794 [AHRS] Missed a setting for the ADC configuration.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1292 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-15 01:12:00 +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
dschin
487b61473e git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1268 ebee16cc-31ac-478f-84a7-5cbb03baadba 2010-08-11 16:18:24 +00:00
stac
f74c6ffdd5 i2c: rewrite i2c layer
The STM32 I2C block has a number of errata associated with it.
These errata are primarily related to timing sensitivities between
the peripheral and the interrupt handler.  In particular, the
correct generation of the stop bit relies on the I2C IRQ running
immediately and not being held off for any reason.

NOTE: The I2C interrupts must be the highest priority IRQs in the
      system to ensure correct operation.

I2C protocol is now implemented as a formal state machine.
See: stm32_i2c_fsm.{dot,jpg} for FSM description.

I2C init is now expressed by const initializers in pios_board.c
for both OP and AHRS boards.

I2C device drivers (ie. bmp085/hmc5843) now pass in const arrays
of an unlimited number of bus transfers to be done atomically.
The I2C adapter driver now handles all bus-level locking across the
list of transactions.  Generation of start/restart/stop conditions
are handled automatically over the list of transactions.

Timeouts have been removed from the API for now.  May be added
back later.

This driver has run error free on both the OP and AHRS boards for
up to 48hrs but it still sometimes fails earlier than that on the OP
board.  There is another possible set of improvements to the driver
that could employ the DMA engine for transfers of >= 2bytes.  This
change would reduce the timing sensitivities between the peripheral
and the driver but unfortunately, both the SPI and I2C interfaces
share the DMA1 engine.  That means only one of these two peripherals
can use the DMA engine and right now, SPI between OP and AHRS is
already using it.

Failures are currently fatal and will lock up the CPU.  This allows
useful information to be obtained in the failure cases.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1241 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-08 04:15:08 +00:00
stac
9050b9d26a ahrs_fsm: minor style fixups
No functional changes.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1238 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-08 04:14:55 +00:00
dankers
1a0f2e81e8 Foundations for PipBee modem code.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1203 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-04 09:37:09 +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
a3a2dbd634 spi: Add support for hardware CRC generation/checking
PIOS SPI devices may now make use of automatic CRC generation
and checking on block transfers.  Only supports CRC8 for now.

Since the SPI interface CRC calculation continues across message
boundaries (ie. not reset on every transfer), we must manually reset
the CRC registers for every transfer to allow the two sides of the
link to resynchronize.

Unfortunately, resetting the CRC registers requires disabling the
SPI peripheral which must now be done on every block transfer.

Note: The last byte of the tx buffer is never sent and is assumed to
      be a place holder for the tx CRC8.
Note: The last byte of the rx buffer is expected to hold the rx CRC8.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1011 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:42 +00:00
stac
0e6294ca27 spi: remove internal pull-up from input data lines
The input data lines between the OP and AHRS boards had internal
pull-ups enabled.  This seemed to be causing issues early on
during development of the inter-board comms.  Not sure if this
is still necessary but this is how the current code was tested.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1006 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:26 +00:00
stac
e3824a6d78 ahrs spi: Add AHRS SPI link management FSM
To the outside world, the AHRS can be in one of only a few
primary states:
 Not present - AHRS is absent or non-responsive via SPI
 Inactive - Only link-level status messages are processed
 Ready - Ready to receive the next application level message
 Busy - Application level message is being processed

Internal to the AHRS, there are many more states that need to be
managed.  This FSM provides the necessary decoupling between the
ISR (which is being driven by the SPI link) and the AHRS main
processing loop which must continue to run its filters independently
of the SPI messaging rate.

With this structure, SPI messages can be received at any time but
processed at only specific points within the filter chains.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1005 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:22 +00:00
stac
89a6d6d912 ahrs spi: Add definition of OP<->AHRS SPI protocol
This defines the SPI message format as well as a few
initial messages for moving data across the link.

The v0 messages are place holders for firmware download
in the bootloader.

The v1 messages are to be used by the main application.

Note: This is not the final protocol definition.
      Subject to change without notice.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1004 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:15 +00:00
stac
3eceef43d3 spi: Connect device specific DMA IRQ handlers
Mark the device specific DMA IRQ handlers as strongly linked
aliases for the genericly named interrupt vector symbol.

Here's how this works...
 * The address of the symbol DMA1_Channel2_IRQHandler is written
   into the DMA1/Channel2 interrupt vector by the linker script.
 * The startup_*.S file specifies Default_Handler() as a weakly
   linked alias for DMA1_Channel2_IRQHandler.
 * We now override the weakly linked alias with the strongly linked
   PIOS_SPI_sdcard_irq_handler().
 * This results in the address of PIOS_SPI_sdcard_irq_handler() being
   written to the vector table for the DMA1/Channel2 interrupt.
 * The PIOS_SPI_sdcard_irq_handler() function is now called whenever
   the DMA1/Channel2 interrupt fires.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1003 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:13 +00:00
stac
5c230e734d ahrs: Turn on -Werror for AHRS build
Disallow warnings of any kind in AHRS code.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@997 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:20:54 +00:00
FredericG
3bc938d45e lowered I2C timoout whne using RTOS
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@842 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-21 09:19:02 +00:00
FredericG
5d9a718430 Made pios_com_num_devices const
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@837 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-20 17:59:48 +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
stac
90f9e6d309 openocd: support OP and AHRS at the same time
Split the floss-jtag.cfg file into separate versions
for OP and AHRS.

Push AHRS onto non-default ports for gdb, tcl and
telnet.

Update the AHRS gdb setup script to point at the new
gdb port.

Add (commented out) example sytax to support distinguishing
between multiple floss-jtag boards that don't have serial
numbers.  Uses the usb bus address of each device as the
selector.  See this patch posted to the openocd mailing list
for how to add this functionality to openocd:
  http://lists.berlios.de/pipermail/openocd-development/2010-June/015785.html

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@755 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-13 04:22:30 +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
fe9aa9e38f Small USART scalability fix.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@616 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-12 01:56:00 +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