summaryrefslogtreecommitdiff
path: root/src/ao_flight.c
Commit message (Collapse)AuthorAge
* altos: use raw height while waiting for landingKeith Packard2011-08-13
| | | | | | | | This avoids any noise introduced by the kalman filter, making landing detection much more reliable. This patch also changes the interval to 10s so that the height bounds can be increased to 4m. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Require sequencing through 'main' state before landingKeith Packard2011-08-02
| | | | | | | | | | | | | The old version of the code would permit the flight to go straight from 'drogue' to 'landed' without passing through 'main' at all. This meant that a false landing detection would leave the main charge unfired, potentially causing the airframe to land on drogue alone. Requiring that the flight sequence pass through main ensures that the main charge will get fired at the right time, although if the airframe lands higher than that altitude, it will not go to 'landed' mode ever. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Average height values for landing detectionKeith Packard2011-08-02
| | | | | | | | | | | | Instead of using the direct output of the kalman filter and hoping that is quiet enough to detect landing, filter that with a long exponential decay filter and then check to make sure that doesn't change more than 2m in 5 seconds as a trigger for landing detection. Tested with existing telemetrum flight logs and it correctly detects landing in all cases. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Switch ao_flight and ao_flight_nano __xdata to __pdataKeith Packard2011-07-06
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Run RDF beacon after apogee instead of waiting for landingKeith Packard2011-03-29
| | | | | | This provides tracking when GPS fails, or on TeleMini. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Split up flight code into separate flight/sample/kalman bitsKeith Packard2011-03-28
| | | | | | | | | | | | | | | The flight code mashed together data processing, filtering and actual flight managament into one giant pile. Split things up so that we have: ao_sample.c: Sensor data processing. Reads the ring, handles calibration ao_kalman.c: Filter the data to track the accel/speed/height values ao_flight.c: Flight state management, specific to rocketry. The plan is to re-use ao_sample.c and ao_kalman.c for hardware not specifically designed for rocketry, like TeleNano. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Ignore alt error for fast->coast. Allow larger error for baro apogee.Keith Packard2011-03-23
| | | | | | | | | | | | | | With the fixed kalman filter, transitions across mach don't cause bumps in the merged filter. And, with working kalman bits, the signal for broken baro detection is stronger and so we can allow for baro apogee detection in cases where noise occurs close to apogee. Bump the kalman filter to trust the baro less so that the model tracks across mach. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Missing parens and some bad arithmetic in the kalman codeKeith Packard2011-03-22
| | | | | | Fixed point computations are a pain. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add ao_flight_debug codeKeith Packard2011-03-22
| | | | | | Trace the kalman filter to make sure it's working. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up some debug stuff in ao_flight.cKeith Packard2011-03-22
| | | | | | | Remove some spurious printf debugging. Remove an attempt at discovering broken accelerometer code. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Compute a 'trust' value for the barometerKeith Packard2011-03-22
| | | | | | | | Instead of making the baro use/don't-use decision binary, use a 'trust value' which slowly migrates from baro+accel to accel-only mode. This eliminates bumps in the data from a rapid shift. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Switch telemetrum over to kalman filterKeith Packard2011-03-22
| | | | | | | | | | | | This changes the full telemetry stream to include kalman data instead of the old ad-hoc flight data. It's compatible in that the packet sizes are the same so teledongle can receive either and figure out which it has received. A few plotting and testing tools are added to make validating the new code easier. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: The kalman code requires a constant sample rateKeith Packard2011-03-19
| | | | | | | | The kalman function can't handle a variable sample rate, so keep the ADC running at full speed for the whole flight instead of slowing it down after apogee. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Baro-only boards must not detect launch on accel or speed dataKeith Packard2011-03-19
| | | | | | | The baro sensor generates too much noise to use small changes in computed speed or acceleration to cause a false launch detect. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add kalman filters for baro-only boardsKeith Packard2011-03-18
| | | | | | | | This adds a baro-only kalman filter to track the state of the rocket, and then uses it to control flight events instead of the existing ad-hoc mechanisms. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Start with packet slave running. Turn off in pad mode.Keith Packard2011-03-16
| | | | | | | | Instead of turning slave mode on in idle mode, start with it running and disable it in pad mode instead. This means packet mode is available in startup mode too. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make serial, usb, beeper and accelerometer optional componentsKeith Packard2011-03-16
| | | | | | | Not all boards will have these, so fix places that use them to deal with that. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use 5V reference data to correct accelerometer measurements.Keith Packard2011-01-16
| | | | | | | | | When the 3.3V and 5V values shift relative to each other (usually due to changes in power consumption), the measured acceleration will appear to shift. This patch converts the 3.3V referenced acceleration value into a 5V referenced acceleration, eliminating this error. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Optimize fetching of ADC data in flight codeKeith Packard2011-01-16
| | | | | | | This stores the address of the desired sample in a local variable and then fetches through that. Saves quite a few instructions. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Ensure flight code gets first crack at new ADC dataKeith Packard2011-01-16
| | | | | | | | Instead of having everyone wait on the raw ADC ring, have the flight code wait on that and have everyone else wait for the flight code to finish looking at the data and move its pointer forwards. Signed-off-by: Keith Packard <keithp@keithp.com>
* Rework invalid accel cal detection codeMike Beattie2011-01-17
| | | | | | | | Slightly reduces code space. Uncalibrated accelerometer now enters invalid state as well. Signed-off-by: Mike Beattie <mike@ethernal.org>
* altos: Added check for out of bounds accelMike Beattie2011-01-16
| | | | | | Chose invalid flight mode instead of idle to give user feedback. Signed-off-by: Mike Beattie <mike@ethernal.org>
* altos: Added check for an accel value above 1.5gMike Beattie2011-01-16
| | | | | | | When detecting flight or idle mode, this should indicate that accel cal values are out of whack. Signed-off-by: Mike Beattie <mike@ethernal.org>
* altos: average 512 accel/baro samples at startup instead of 1000Keith Packard2011-01-16
| | | | | | | This lets us use a simple shift instead of a divide, saving a huge amount of code space. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Remove redundant initialization of ao_interval variablesAnthony Towns2011-01-07
| | | | | | These are all initialized in the ao_flight_drogue state transition. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Remove unused accel_vel_mach and accel_vel_boost variablesAnthony Towns2011-01-07
| | | | | | Presumably left-over debugging code. Signed-off-by: Keith Packard <keithp@keithp.com>
* Log GPS data on pad after boost detect.Keith Packard2010-02-13
| | | | | | | | | This wakes up the two GPS reporting tasks and gets them to report out any existing GPS data to the log file. To make sure the timestamps in that GPS data are accurate, this also records GPS time on receipt of the GPS data instead of when that is logged. Signed-off-by: Keith Packard <keithp@keithp.com>
* Force idle mode by shorting the SPI clock to ground at boot time.Keith Packard2010-01-09
| | | | | | | | This allows you to override the flight mode detection code in case the accelerometer calibration is broken somehow. Hold the SPI clock shoted to ground until the LED comes on, then remove it. Signed-off-by: Keith Packard <keithp@keithp.com>
* Loosen tolerances for main->landed transitionKeith Packard2009-11-14
| | | | | | | | | | | | | | | Detecting that the rocket has landed is required for the system to flush the eeprom log and re-enable the RDF beacon. This patch changes the landed state entry requirements for the accelerometer to require only that the accelerometer stay within a quarter of a g (down from 1/10g) and changes the testing interval from 20 seconds to 5 seconds. The requirement that the barometric altitude be within 1000m of the launch altitude and that the barometer change by no more than 0.05kPa are unchanged. Signed-off-by: Keith Packard <keithp@keithp.com>
* Remove "f" commandKeith Packard2009-11-02
|
* Add two-point accelerometer calibration.Keith Packard2009-11-02
| | | | | | | Calibration now uses two values, one upside right and the other upside down instead of a single horizontal value. This allows the use of other accelerometers and compensates for variations in the divider circuit to provide more accurate data.
* Enable packet-based communcation to command processorKeith Packard2009-11-01
| | | | | | | This splits the packet code into master/slave halves and hooks the slave side up to the getchar/putchar/flush logic in ao_stdio.c Signed-off-by: Keith Packard <keithp@keithp.com>
* Save some DSEG space by marking cmd functions __reentrantKeith Packard2009-10-16
| | | | | | | __reentrant causes the compiler to place args and locals on the stack instead of in the data segment. Signed-off-by: Keith Packard <keithp@keithp.com>
* Make RDF beacon only run on pad and after landing.Keith Packard2009-09-04
| | | | | | | | | | | | It's pretty much impossible to RDF the rocket during flight, and it interferes with the telemetry data stream. Leave it enabled on the pad so that radios can be tested, and then re-enable it once the rocket has landed. This patch also turns the rdf 'on' time into a parameter so it can be changed, and then sets that parameter to 500ms, once every 5 seconds. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add back the RDF tone generatorKeith Packard2009-09-04
| | | | | | | | | Tracking the rocket on the ground may be easier using tones than using the digital data stream, so we'll try that and see what we think. This reverts commit 3a3bfd471a868d546d83cdc431b53c8f5208edb9. Signed-off-by: Keith Packard <keithp@keithp.com>
* Rename state apogee -> coastKeith Packard2009-06-14
|
* rename states. launchpad -> pad, coast -> fastKeith Packard2009-06-14
|
* Use autotools, move altos to src subdirKeith Packard2009-06-04
Signed-off-by: Keith Packard <keithp@keithp.com>