Hi guys,
I'm not sure whether I should post it here, but I feel that the problem I have been struggling with might be of interest for those of you who would like to squeeze out more functionality from SFE's Razor 9DOF.
The starting point of the story is the AR7212, a 12 channel receiver with autopilot extensions for the Spektrum DX7. More at:
http://www.mcselec.com/index.php?option=com_content&task=view&a.... Although the AR7212 board has dedicated ports for thermopile sensors I became interested in feeding in Euler angles directly from a suitable module - mainly because I don't like sensors on the outer skin of gliders like Alpinas, etc. The AR7212 is AT1280/2560-based and thus has 4 UARTs. I use two of them for the Spektrum satellites, one for a sensor gadget called Unilog (very popular in Germany and approved for competition. It brings in barometric altitude, temperature, airspeed, battery voltage, system current and more). The forth for telemetry. So I was missing two further ports, one for GPS and one for the Euler angles.
I can imagine that the way I solved it is not new and that I just miss the technical term for it. Here it is at the HW side: Connect GPS TX to RX of the Razor. Connect the Razor's TX to the AR7212-RX (UART1). Connect the AR7212-TX to the telemetry radiomodem (HAC UM9600). This way you have 3 gadgets on one port.
Here is the drawback: The bottleneck of such a "serial chain" is that the whole is limited by the comm speed of the slowest device - in my case the UM96.
The solution was GPS + Euler angle data compression. I ported Doug Weibel's/JJulio's Razor implementation of Bill Premerlani's DCM to Bascom and did the following changes:
''**************************** Changed in Bascom *******************************
''(1) No free running ADC interrupting the program, instead: Single ADC and
'' averaging is done when main loop is not busy with DCM, GPS, KIX. Sampling
'' of the three analog sensors (gyros) occurs around 7 times per 20 ms cycle,
'' 16 times when KIX and GPS processing is disabled (for comparison). Timebase
'' from 16-bit Timer1 at 1µs resolution. Code philosophy: "Let it flow (nobody likes
" work interrupts;-)), but know the time precisely". Well - at least Bascom doesn't
" like very much interrupting.
''(2) General overwritables instead of local variables. This needs more care
'' during coding but saves the processor from avoidable stack pushs and pops.
''(3) Bascomized variants of Arduino commands for ADC and I2C operations.
''(4) 1D equivalents for Matrix operations as described in AN#176 at MCSelec
'' (Mini Matrix Algebra)
''(5) Kixline support for GPS and Euler Angles as described in AN#174 at MCselec
'' (Kixlines - Tetrasexagesimal number compression to speed up serial communi-
'' cations)
''(6) AR7212x compatibility (AN#172)
''
''******************************************************************************
The result is that we have a 50 Hz stream of Euler angles plus 2 Hz GPS plus speed extraction for centrifugal acceleration correction from the 9DOF razor - without any HW change. The code mods
taken together with the DCM part occupy 50% of the 328 flash.
The GGA + RMC excerpt (not localized - but for the whole planet) takes 25 chars when kixlined at
"full" GPS accuracy (20 cm resolution) - compression to around 20%. It includes the full set of information except geoid hight. When "localizing" latitute, longitude, altitude, and just including heading and speed over gnd, the compression goes down to 10% of NMEA.
I'm not sure whether another AN should follow - but anybody interested can have this portation.
Thanks to Bill (Premerlani) for really great stuff !!! - followed by a question: Is there any reason why not taking:
speed = Sqr (sog^2 + (dAltitude/dt)^2) instead of sog = speed over ground
for centrifugal accel correction? The GPS altitude is drifty and noisy - but at speeds around 20-30 m/s it should be better than nothing..
Regards,
Natalius
PS: Here is how the whole looks:
AR7212 + Razor 9DOF + Unilog + HAC UM96 + EB-85A is the flying sausage in the middele. Keen to see it in the air next weekend.
