During a teleop session, a continuous stream of empty protocol messages are sent from the operator to the device at a rate of 50Hz with UDP-like reliability settings.
This stream of messages represents a near-continuous signal that the operator is able to control the device.
A teleop heartbeat message provides a timestamp, an ID for the session which is connected to the device, and the type of session. The session types are:
A typical heartbeat message looks like this:
Received heartbeat callback at 1683819820.846151 Received heartbeat: peer_id: "2b278980-a1a4-4dba-9b0d-85329eb1a28c" session_type: "TELEOP"
For safety or UX reasons, your Agent SDK application running on your robot may want to know if the operator or device has lost the ability to receive heartbeats.
session_type message allows you to make decisions based on the type of connection to your device. For example, your code may halt all activity if a disconnection is detected from
session_type: "TELEOP", but may ignore disconnections of
Reacting to missing heartbeats is the fastest way to react to a lost network signal or lag spike in teleop on the robot-side application.
The following example is available on our GitHub page. This code sample monitors heartbeat messages coming from the Formant UI and reports the timestamp, session ID, and session type. If there is a lag between heartbeat messages longer than 0.1 sec, it calls a function to alert the user that the session has been disconnected.