Handle disconnections safely

In mission critical teleop applications, it is necessary to detect and react to session disconnections within milliseconds. This can be achieved by listening to a high frequency streaming heartbeat that is continually sent from the operator to device during teleop. This heartbeat is communicated over SCTP and requires less than 0.004Mbps. The robot application can listen to the teleop’s heartbeat and handle disconnects immediately, or time out when the teleop heartbeat stalls.

See example usage with the Python SDK below

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


def f(heartbeat):
   print("Received heartbeat callback at", time.time())
   print(heartbeat.is_disconnect)


if __name__ == "__main__":
   fclient = FormantAgentClient(ignore_unavailable=True)
   fclient.register_teleop_heartbeat_callback(f)
   try:
       while True:
           time.sleep(0.1)
   except KeyboardInterrupt:
       exit()

Did this page help you?