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, calculates pitch and bank angles and puts it in shared memory.

data_logger.c

  • Logs data to a CSV file. Could potentially relay data for the ground station.

Libraries

client.c

See client

  • Client for server.

coordinates.c

  • Various coordinate conversions.

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:

[UNIX timestamp],[flight status],[latitude],[longitude],[altitude],[speed],[vertical speed],[heading],[x thermopile normalised reading],[y thermopile normalised reading],[z thermopile normalised reading]

Other pages

Ground station

Data will be transmitted down to a slug on the ground. The slug and the Gumstix are both little endian, so data can simply be transmitted without any conversion. The slug will run a server on the ground, anything sent to that server will be relayed up onto the server on the slug, giving us pretty much full control.

Some data will be sent down to the ground station slug automatically in the same format used for IPC on the glider. Other data can be requested.

projects/high_altitude_slug/software.1153841237.txt.gz · Last modified: 2008/07/19 23:31 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki