Teleop Button Status

Teleop Button Status

A teleop button is a special type of button that comes packaged with a boolean-controlled indicator light. For example, in this EStop button below, we've configured the light on the bottom edge of the button will turn blue when the EStop is engaged.

292

Toggled Off

324

Toggled On

The status of this light can be tied to a ROS topic or the API. In this overview, we'll look at using the Agent SDK to set the status of this button.

After adding a button with the API, the name you give to the button will be the name you reference in your skit. For the above button, we've titled it ESTOP, so in our API, it will be referred to it as the string "ESTOP".

To toggle the status on and off, we must send a bitset via the API. Here's an example code to toggle the above button:

import time
from formant.sdk.agent.v1 import Client as FormantClient

toggle = True

if __name__ == "__main__":
    fclient = FormantClient(
        ignore_throttled=True,
        ignore_unavailable=True
    )

    # Toggles enabled status of API "testbtn" every second
    while True:
        print("toggling testbtn status")
        fclient.post_bitset(
            "Buttons",
            {
                "ESTOP": toggle,
            },
        )
        time.sleep(1)
        toggle = not toggle

👋

If you notice an issue with this page or need help, please reach out to us! Use the 'Did this page help you?' buttons below, or get in contact with our Customer Success team via the Intercom messenger in the bottom-right corner of this page, or at [email protected].