Deep dive

From remote debugging to data discovery, learn how Formant works from top to bottom.

    Send teleop data using API

    Prerequisite

    Make sure Formant python module is installed and Formant agent is running. For ROS based robots, the Formant agent detects the streams automatically. The specifications of the stream and views can be configured.

    Sending real-time data

    This section goes through the code to send real-time data from the agent to Formant's teleop interface.

    Video

    Use post_image to stream images. Configure the stream on Formant app to encode it to a video stream. Refer to sending images for a basic example.

    Status Indicators

    Use post_bitset with stream name "Status". For instance:

    fclient.post_bitset("Status", {
        "FLIR online": False,
        "Motors responsive:" True,
        "Walk mode": False,
        "Camera mode": True,
    })

    The bitset will be streamed to the Formant teleop interface in real-time when a teleop session is active.

    Handling real-time data

    This section goes through the code to receive and handle real-time data sent from Formant's teleop interface to the device.

    Buttons and joystick

    Use the register_teleop_callback method. Example:

    def handle_teleop_controls(datapoint):
        if datapoint.stream == "Buttons":
            handle_button(datapoint.bitset)
        elif datapoint.stream == "Joystick":
            handle_joystick(datapoint.twist)
    
    
    fclient.register_teleop_callback(handle_teleop_controls)

    Control datapoints will be streamed to the provided callback. Control datapoints with the stream name "Buttons" will contain Bitsets with the button control information. Joystick control datapoints have a user-configured stream name (although "Joystick" is a common choice) and they will contain Twists.

    Refer to our public protos for the exact data model of Bitset and Twist.

    Unregister a callback function with unregister_teleop_callback.

    Please refer to the teleop examples for more information.

    © 2020 Formant • 1999 Bryant St · San Francisco, CA 94110