Get Controller Frequency
SUMMARY
Get Controller Frequency measures and returns the controller update rate in Hz by sampling the timestamp field over a short window.
UNITS
Returns the controller update rate in Hz.
The Skill
frequency = robot.get_controller_frequency()The Code
Example: Measure and Log Controller Frequency
Read the controller update frequency and log the result.
"""
Measures the controller's update rate by polling get_timestamp() and computing 1 / mean_step_time.
Supports Universal Robots (UR).
Usage:
python get_controller_frequency.py [--ip <ROBOT_IP>]
"""
import argparse
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots
def main(ip: str | None) -> None:
"""Log the measured controller update frequency [Hz]."""
#===================== Create Robot ==========================================
robot = universal_robots.UniversalRobotsUR10E(name='UR10e')
try:
#===================== Connect Robot ==========================================
if ip:
robot.connect(ip=ip)
# ==================== Run Skill ============================================
frequency = robot.get_controller_frequency(window_s=0.2)
logger.success(f"Controller frequency [Hz]: {frequency:.2f}")
except (ConnectionError, OSError) as e:
logger.error(f"Error occurred: {e}")
finally:
robot.disconnect()
robot.shutdown()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Read controller frequency Synapse example")
parser.add_argument("--ip", type=str, default=None,
help="UR robot IP address for real hardware, e.g. 192.168.1.100")
args = parser.parse_args()
main(ip=args.ip)Running the Example
python get_controller_frequency.py --ip 192.168.1.100For all options:
python get_controller_frequency.py --helpParameter Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
window_s | float | 0.2 | Measurement window in seconds (minimum 0.0). Longer windows give a more stable estimate. |
Returns
| Type | Description |
|---|---|
float | Controller update frequency in Hz. Typically 500 Hz on UR e-Series and UR-Series, 125 Hz on CB3-Series. Returns 0.0 if fewer than two unique timestamps are collected during the window. |
Raises
| Exception | Condition |
|---|---|
RuntimeError | The robot is not connected |
ConnectionError / OSError | The connection to the controller fails or drops during the surrounding hardware session |
How to Tune the Parameters
get_controller_frequency measures the controller update rate by sampling timestamps over window_s and computing the average inter-sample rate. The default 0.2 s window is enough for a stable estimate on UR's 500 Hz controllers; widen it if the measurement looks noisy or if 0.0 is returned because fewer than two unique timestamps were collected in the window (e.g. on a slower or heavily loaded controller). Use the result to set sampling intervals, validate that the controller is running at its rated frequency, or compute the number of control steps per unit time.
Where to Use the Skill
- Validate controller health before starting a time-critical task.
- Compute sampling intervals for state-logging loops.
- Confirm the controller is not operating in a degraded or reduced-rate mode.