aerofiles.flarmcfg

class aerofiles.flarmcfg.Writer(fp=None)

A writer for the Flarm configuration file format:

with open('flarmcfg.txt', 'w') as fp:
    writer = Writer(fp)

see FTD-14 FLARM Configuration Specification and annotated example flarmcfg.txt

write_competition_class(competition_class)

Write the competition class configuration:

writer.write_competition_class('Club')
# -> $PFLAC,S,COMPCLASS,Club
Parameters:

competition_class – competition class of the glider

write_competition_id(competition_id)

Write the competition id configuration:

writer.write_competition_id('TH')
# -> $PFLAC,S,COMPID,TH
Parameters:

competition_id – competition id of the glider

write_copilot(copilot)

Write the copilot name configuration:

writer.write_copilot('John Doe')
# -> $PFLAC,S,COPIL,John Doe
Parameters:

copilot – name of the copilot

write_glider_id(glider_id)

Write the glider registration configuration:

writer.write_glider_id('D-4449')
# -> $PFLAC,S,GLIDERID,D-4449
Parameters:

glider_id – the registration of the glider

write_glider_type(glider_type)

Write the glider type configuration:

writer.write_glider_type('Hornet')
# -> $PFLAC,S,GLIDERTYPE,Hornet
Parameters:

glider_type – the type of glider

write_logger_interval(interval)

Write the logger interval configuration:

writer.write_logger_interval(4)
# -> $PFLAC,S,LOGINT,4
Parameters:

interval – competition class of the glider

write_pilot(pilot)

Write the pilot name configuration:

writer.write_pilot('Tobias Bieniek')
# -> $PFLAC,S,PILOT,Tobias Bieniek
Parameters:

pilot – name of the pilot

write_task_declaration(description=None)

Start a new task declaration. Any old task declaration will be cleared by this command:

writer.write_task_declaration('My Task')
# -> $PFLAC,S,NEWTASK,My Task
Parameters:

description – optional text description of task, e.g. “500km triangle”; can be an empty string; will be trimmed to 50 characters

write_waypoint(latitude=None, longitude=None, description=None)

Adds a waypoint to the current task declaration. The first and the last waypoint added will be treated as takeoff and landing location, respectively.

writer.write_waypoint(
    latitude=(51 + 7.345 / 60.),
    longitude=(6 + 24.765 / 60.),
    text='Meiersberg',
)
# -> $PFLAC,S,ADDWP,5107345N,00624765E,Meiersberg

If no latitude or longitude is passed, the fields will be filled with zeros (i.e. unknown coordinates). This however should only be used for takeoff and landing points.

Parameters:
  • latitude – latitude of the point (between -90 and 90 degrees)

  • longitude – longitude of the point (between -180 and 180 degrees)

  • description – arbitrary text description of waypoint

write_waypoints(points)

Write multiple task declaration points with one call:

writer.write_waypoints([
    (None, None, 'TAKEOFF'),
    (51.40375, 6.41275, 'START'),
    (50.38210, 8.82105, 'TURN 1'),
    (50.59045, 7.03555, 'TURN 2'),
    (51.40375, 6.41275, 'FINISH'),
    (None, None, 'LANDING'),
])
# -> $PFLAC,S,ADDWP,0000000N,00000000E,TAKEOFF
# -> $PFLAC,S,ADDWP,5124225N,00624765E,START
# -> $PFLAC,S,ADDWP,5022926N,00849263E,TURN 1
# -> $PFLAC,S,ADDWP,5035427N,00702133E,TURN 2
# -> $PFLAC,S,ADDWP,5124225N,00624765E,FINISH
# -> $PFLAC,S,ADDWP,0000000N,00000000E,LANDING

see the write_waypoint() method for more information.

Parameters:

points – a list of (latitude, longitude, text) tuples.