UKHAS Wiki

UK High Altitude Society

User Tools

Site Tools


projects:high_altitude_slug:software

This is an old revision of the document!


Software documentation

Note: this is mainly for our reference!

Onboard

The on board software is written entirely in C. Non-realtime IPC is done with a TCP server that repeats back any information sent to it. This makes debugging/monitoring/controlling over a network very simple. Realtime data is stored in shared memory.

Processes

There are 5 major processes:

main.c

Forks, controls and handles errors from other processes. This also controls the shared memory,

flight.c

This process manages the flight (ie, keeps track of when it is ascending/descending/landed, sends text messages etc) and keeps a list of waypoints. The main waypoint tasks:

  • Keeping a list of waypoints. Waypoints consist of a position and an optional required altitude.
  • Calculating “sub waypoints” for circling around to get to required altitudes etc.
  • Calculating when a waypoint is reached based on GPS position and thresholds
  • Calculating headings to go in based on the current position and the next waypoint (continuous so it will not drift off course)

Currently for development, there is a very simple waypoint manager that cycles around a set of waypoints in an array.

roll.c

  • Maintaining straight/level flight.
  • Calculate current heading
  • Bank and turn based on heading to next waypoint and current heading

pitch.c

  • Maintain constant airspeed, maybe based on stall speed at current altitude or fixed pitch. Without a pressure sensor, this will have to be done purely with ground speed, so a fixed pitch may be necessary. I shall have to look into attaching a pitot pressure sensor.

Currently for powered flight development, this process is just maintaining a certain altitude.

gps_reader.c

  • Reads GPS data from gpsd using libgps and sticks it in shared memory.

thermopile_reader.c

  • Reads data from thermopiles with i2c-io-api and puts it in shared memory.

data_logger.c

  • Logs data to a CSV file.

Libraries

attitude.c

  • Calculates roll and pitch attitude (in degrees) from thermopile inputs.

calculations.c

  • Various calculations, currently converts two sets of GPS coordinates to bearings and distances.

client.c

See client

  • Client for server.

logger.c

  • Logs errors and messages.

servos.c

  • Controls servos via i2c.

Logging

Error and message logging is logged to seperate log files by logger.c.

Data logging is done to a single CSV file by data_logger.c, in the format:

[ISO 8601 date and time],[flight status],[latitude],[longitude],[altitude],[speed],[vertical speed],[heading],[x thermopile],[y thermopile],[z thermopile]

Other pages

Possible ground station

To display:

  • Readings from sensors.
  • Flight plan and waypoints
  • Attitude/artificial horizon
  • Altitude.
  • GPS position.
  • Speed.
  • Rate of descent/ascent.
  • Payload status (ascending, descending, landed etc).
  • Raw output from log.
  • Battery voltages.
  • Space remaining on disk.
  • Number of photos taken and, depending on bandwidth, a compressed version of the last image.

To send:

  • Cut down.
  • Take photo.
  • Change/add to flight plans.
  • Edit/add to waypoints.
  • Manual control for emergencies.
  • Release parachute.
projects/high_altitude_slug/software.1153417432.txt.gz · Last modified: 2008/07/19 23:31 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki