Skip to content

Repository files navigation

IgcLogger Library

This Arduino library provides a way for logging a flight in the format of an IGC file to a Stream (typically on an SD card).

For more information on the igc file format, some good resources are:

Library Usage.

Setup Headers.

The A-Record to identify the device requires a manufacturer ID, a logger ID (to tell the difference if there are multiple devices from the same manufacturer), and an Optional Id Extension string to identify either the device or the flight.

Unless your device is tested or registered with GFAC, the manufacturer ID should start with an 'X'.

Default Settings

Manufacturer_id: XSI ... for (S)cottyob/(I)gc-Logger
logger_id: Igc
id_extension: LoggerLib

Produces:
AXSIIgcLoggerLib

Setup I Records

Before you can start logging position updates, "I" records, or, any additional attributes to a location update must also be defined.

the logIRecords method does this. If you want to log the GPS Fix Accuracy (FXA) to be between bytes 36 and 40 (just after the manditory fields), and Satellites In Use (SIU), you'd call the following

// Add I records to extend our fixes with "FXA" and
// "ISU" records (GPS Fix Accuracy, and Satellites In Use)
const IRecordExtension extensions[] = {IRecordExtension(3, "FXA"), IRecordExtension(2, "SIU")};
logger.writeIRecord(sizeof(extensions) / sizeof(extensions[0]), extensions);

Logging tasks

Tasks can be logged with C records after the header/I records and before the first B record. The declaration line is followed by point lines for takeoff, start, turn points, finish and landing. If takeoff or landing are not known, they can be recorded as zero coordinates.

logger.writeCDeclarationRecord("012025", "195815", "000000", "0000", 1, "Training task");
logger.writeCPointRecord("0000000N", "00000000E");
logger.writeCPointRecord("3728466N", "12151573W", "START Start Point");
logger.writeCPointRecord("3729466N", "12152573W", "TURN Turn Point");
logger.writeCPointRecord("3730466N", "12153573W", "FINISH Finish Point");
logger.writeCPointRecord("0000000N", "00000000E");

Turn radii and observation-zone details are not part of the standard C record fields. Applications can include them with manufacturer L records when needed:

logger.writeLRecord("OZN=0,Style=1,R1=1000.0m,A1=180.0,R2=0.0m,A2=0.0");

Logging comments

Comments can be logged and useful for however you want to display or parse them.

A popular mobile tool uses formats such as:

LXNA::PHASE:onGround

To do such a comment as this, you simply need to:

logger.writeLRecord("::PHASE:onGround");

Logging events

Events can be logged with a 3-character event code and optional text. Pilot-initiated events use the PEV code, and should be followed by a B record with the same timestamp to show where the event occurred.

logger.writeERecord("195819", "PEV", "SAVE POINT");
logger.writeBRecord("195819", "3728460N", "12151576W", true, 693, 692, "00504");

Full Example

IgcLogger logger(Serial);

// Write the header the header
strcpy(logger.date, "012025");
logger.pilot = "Some Pilot";
logger.glider_type = "Awesome Glider 19";
logger.firmware_version = "1.0.0";
logger.hardware_version = "Some Variometer";
logger.logger_type = "Igc-Logger based Vario";
logger.gps_type = "uBlox 7";
logger.pressure_type = "MS5611";
logger.time_zone = "-8";
logger.writeHeader();

// Add I records to extend our fixes with "FXA" and
// "ISU" records (GPS Fix Accuracy, and Satellites In Use)
const IRecordExtension extensions[] = {IRecordExtension(3, "FXA"), IRecordExtension(2, "SIU")};
logger.writeIRecord(sizeof(extensions) / sizeof(extensions[0]), extensions);

// Write a task declaration before the first B record
logger.writeCDeclarationRecord("012025", "195815", "000000", "0000", 1, "Training task");
logger.writeCPointRecord("0000000N", "00000000E");
logger.writeCPointRecord("3728466N", "12151573W", "START Start Point");
logger.writeCPointRecord("3729466N", "12152573W", "TURN Turn Point");
logger.writeCPointRecord("3730466N", "12153573W", "FINISH Finish Point");
logger.writeCPointRecord("0000000N", "00000000E");
logger.writeLRecord("OZN=0,Style=1,R1=1000.0m,A1=180.0,R2=0.0m,A2=0.0");

// Write some B records
logger.writeBRecord("195816", "3728466N", "12151573W", true, 696, 694, "00504");
logger.writeBRecord("195817", "3728464N", "12151574W", true, 695, 693, "00504");
logger.writeBRecord("195818", "3728462N", "12151575W", true, 694, 693, "00504");
logger.writeERecord("195819", "PEV", "SAVE POINT");
logger.writeBRecord("195819", "3728460N", "12151576W", true, 693, 692, "00504");
logger.writeBRecord("195820", "3728459N", "12151576W", true, 693, 692, "00504");
logger.writeBRecord("195821", "3728457N", "12151577W", true, 692, 691, "00504");
logger.writeBRecord("195822", "3728455N", "12151578W", true, 692, 691, "00504");
logger.writeBRecord("195823", "3728454N", "12151580W", true, 692, 691, "00504");
logger.writeBRecord("195824", "3728452N", "12151580W", true, 692, 691, "00504");
logger.writeBRecord("195825", "3728450N", "12151580W", true, 692, 690, "00504");
logger.writeBRecord("195826", "3728448N", "12151579W", true, 692, 690, "00504");
logger.writeBRecord("195827", "3728446N", "12151579W", true, 691, 690, "00504");

logger.writeGRecord();

Will produce:

AXSIIgcLoggerLib
HFDTEDATE:012025
HFPLTPILOTINCHARGE:Some Pilot
HFGTYGLIDERTYPE:Awesome Glider 19
HFDTMGPSDATUM:WGS84
HFRFWFIRMWAREVERSION:1.0.0
HFRHWHARDWAREVERSION:Some Variometer
HFFTYFRTYPE:Igc-Logger based Vario
HFGPSTYPE:uBlox 7
HFPRSPRESSALTSENSOR:MS5611
HFTZNTIMEZONE:-8
I023639FXA4042SIU
C012025195815000000000001Training task
C0000000N00000000E
C3728466N12151573WSTART Start Point
C3729466N12152573WTURN Turn Point
C3730466N12153573WFINISH Finish Point
C0000000N00000000E
LXSIOZN=0,Style=1,R1=1000.0m,A1=180.0,R2=0.0m,A2=0.0
B1958163728466N12151573WA006960069400504
B1958173728464N12151574WA006950069300504
B1958183728462N12151575WA006940069300504
E195819PEVSAVE POINT
B1958193728460N12151576WA006930069200504
B1958203728459N12151576WA006930069200504
B1958213728457N12151577WA006920069100504
B1958223728455N12151578WA006920069100504
B1958233728454N12151580WA006920069100504
B1958243728452N12151580WA006920069100504
B1958253728450N12151580WA006920069000504
B1958263728448N12151579WA006920069000504
B1958273728446N12151579WA006910069000504
GNotImplemented

Record Types:

This library is currently pretty minimal. Currently, these record types are supported:

Supported:

A - FR manufacturer and identification
B - Fix
C - Task/declaration
E - Event
G - Security
H - File header
I - List of extension data included at end of each fix B record
L - Logbook/comments

Unsupported:

D - Differential GPS
F - Constellation
J - List of data included in each extension (K) Record
K - Extension data

About

Arduino IGC Logger

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages