xfly – Factory default “Fly with CodeX” program

CodeAIR factory test and remote flight interface.

This program allows a CodeX to be paired with the CodeAIR for remote controlled flight and telemetry. Pairing is done via close-range infrared (IR), while remote flight is via radio link.

class codeair.xfly.FlightControl[source]

Manage flying commands from remote paired CodeX

abort()[source]

Stop immediately, plummet to the ground! Also, recover from ‘CRASHED’ state.

calc_target_height(z_vel)[source]

Return the target height at given z_vel considering poll rate

land()[source]

Descend gracefully to ground

stop()[source]

Called after landing, or to catastrophically Abort flight

takeoff()[source]

Ascend autonomously to self.TAKEOFF_CEILING

track_poll_rate()[source]

Call each time we’re polled, maintains accurate poll rate

update_dat(front, up, down, heading, thrust, info, batt)[source]

Called from radio controller poll loop. Should be called at 100ms rate.

update_setpoint(x_vel, z_vel, yaw)[source]

Handle new OTA setpoint received from radio controller

codeair.xfly.cycle_blue()[source]

Call periodically to cycle blue LEDs in KITT pattern

codeair.xfly.enter_ctrl_mode()[source]

Control loop - receive and execute remote commands

codeair.xfly.get_saved_pairing()[source]

Return (ch, nid) or None if no save file found.

codeair.xfly.radio_poll(timeout=0.1)[source]

Wait up to timeout secs to receive a CodeAIR packet. Return (ch, id, op, args) or None

codeair.xfly.radio_send(op, args=())[source]

Transmit a CodeAIR packet (ch, id, op, args) to paired CodeAIR

codeair.xfly.run()[source]

Main program

codeair.xfly.save_pairing(ch, nid)[source]

Save pairing info to local file.

codeair.xfly.seek_pairing()[source]

Wait to receive IR pairing message over infrared. Return paired (ch, nid).

Download Source