For the complete documentation index, see llms.txt. This page is also available as Markdown.

Flight Telemetry

This section explains how to use the flight control capabilities of the API. It includes examples for subscribing to live data and sending flight commands, providing precise, real-time control of the system.

For more details, see Flight or the GitHub repository.

Subscribe flight state

Provides real-time data about the system’s operational status. By using the flight state information, applications can monitor system performance, ensure operation within safe limits, and more.

def flight_telemetry(
 on_message_callback: Callable[[dict[str, object]], None],
    access_token: str = "",
    max_messages: int | None = None,
) -> None:
    """Subscribes to flight telemetry updates from the System.

    Args:
        on_message_callback: Callback function to handle incoming telemetry messages.
        access_token: The authentication token to use in the websocket connection.
        max_messages: Maximum number of messages to receive before unsubscribing. Defaults to None(read forever).
    """
    ws_url = f"{BASE_WEBSOCKET_API_URL}/telemetry/flight/subscribe"
    try:
        with connect(
            ws_url, additional_headers={"Authorization": f"Bearer {access_token}"}
        ) as websocket:
            logging.info("Connected to flight telemetry")
            count = 0
            while True:
                message = websocket.recv()
                data = json.loads(message)
                on_message_callback(data)
                count += 1
                if max_messages is not None and count >= max_messages:
                    break
    except Exception as e:
        logging.error(f"Error in flight telemetry: {e}")

Flight control

To control the system, you must use the endpoints in the /control namespace. It is important to note that these endpoints are part of the Control Handoff mechanism. Control Handoff ensures that only one client can control the system at any given time. Before using any endpoint in the /control namespace, the API must first request control.

The API does not block or wait for a command to complete. Command execution must be verified through flight state data, which indicates changes in the aircraft’s status.

The example demonstrates how to send a take off command.

Last updated