Skip to content
Claire edited this page Apr 11, 2017 · 6 revisions

Welcome to the Balloons VALBAL wiki! Below is a collection of questions we had while going through the VALBAL code.

Avionics

What are the criteria for a vent/drop to be triggered?

  1. We ask for a force vent/drop via RockBLOCK, setting the system flag (data.FORCE_VALVE). This flag sets itself back to false after forcing a valve.
  2. The respective incentive exceeds 1 + data.INCENTIVE_NOISE and the respective queue is almost empty. We perform that second check so that we don't continuously add 20 seconds to the queue while the system is still reacting to previous actions on the order of milliseconds.

What is data.INCENTIVE_NOISE?

data.INCENTIVE_NOISE is the assumed error of BMP sensors that the system no longer trusts. It is added to the default incentive threshold of 1.

Fewer sensors means greater error in VALBAL's knowledge of its altitude. The fewer the trustworthy sensors, the greater INCENTIVE_NOISE and the incentive thresholds will be, and the harder it is for an action (vent or drop) to be triggered.

What is manual mode and when is it used?

When VALBAL is in manual mode, it maintains normal operation except it skips over the actuation of the valve and ballast. It continues to queue values and simulate counting down, in order to maintain simulated behavior.This way, if VALBAL is acting oddly during a mission (like venting or ballasting a lot), we can enable manual mode, see what the controller is thinking without actually letting it act, and debug over RockBLOCK. In manual mode, it's ok for both the valve and ballast incentives to be >= 1 at the same time; in fact we want to see that to help our debugging.

Manual mode is on by default so that VALBAL doesn't attempt to vent or drop while we're setting it up for launch (and presumably jiggling it around quite a bit). We then switch into "control" mode via RockBLOCK command right before launch.

Controller

How is the incentive calculated?

The incentive is the sum of three terms (mimicking a PID-esque controller on ascent rate):

  1. "Proportional" term = C1 * ascent rate
  2. "Integral" term = C2 * (current altitude - setpoint)
  3. "Derivative" term = C3 * (current altitude - altitude of last vent/drop)

What are RE_ARM_CONSTANT and the corrected altitude since last vent/drop?

(We'll walk through this for the valve first.) Say VALBAL's altitude is currently very close to the valve setpoint and we very recently vented. Thus our proportional and integral terms are essentially 0, and we're left with derivative control, which is inherently oscillatory. Not good! That's where altitudeSinceLastVentCorrected comes in. Instead of blindly using the altitude since last vent, we use the corrected term:

float altitudeSinceLastVentCorrected = min(altitudeSinceLastVent, altitude + RE_ARM_CONSTANT);

where

RE_ARM_CONSTANT = incentive threshold / (C2 + C3) 

Note that C2 and C3 are both less than 1, so RE_ARM_CONSTANT will end up being greater than 1. If we're descending after a very recent vent, altitude + RE_ARM_CONSTANT will be less than altitudeSinceLastVent

ok i'm very confused now so i will stop attempting to explain incorrectly

What is firstBallastDropped?

This is related to altitudeSinceLastDropCorrected... (something about we don't want to be ballasting during our entire ascent, so we only turn on altitudeSinceLastDropCorrected once we reach a threshold altitude, also FILLER) finish me

Power States

Why do we need to keep track of the power states for RockBLOCK, GPS, and heaters?

This prevents us from getting stuck in a bootloop if, for example, the heaters draw to much current and end up killing the processor. On boot, we read off of EEPROM whether or not we were successfully available to start up. If we are given the go-ahead, we write to EEPROM that we failed to start it up, and then boot up the subsystem and wait a second. If the system crashes, we reboot, and then skip that subsystem. If we don't crash, we write to EEPROM that we were successful, and will attempt to startup again on the next boot.

GPS

What is hot start?

In order to operate the GPS at altitude, we need to set it to flight mode. However, doing so requires us setting the registers when we are below the cutoff altitude, which is impossible to do mid-flight. In order to overcome this, we simulate a restart trough software and not electrical shutdown, so that the bits in the register stay set and the GPS boots up already in flight mode.

Clone this wiki locally