Skip to content

Get Timestamp

SUMMARY

Get Timestamp returns the time elapsed (in seconds) since the robot controller was powered on or restarted.

This value is useful for timestamping state samples, synchronizing data streams, and computing motion durations.

SUPPORTED ROBOTS

This skill is currently supported on Universal Robots only. Calling this method on other robot brands will raise a NotImplementedError.

The Skill

python
timestamp = robot.get_timestamp()

The Code

Example: Read Controller Timestamp

Connect to the robot and read the current controller timestamp.

python
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots

robot_ip = "192.168.1.2"  # replace with your robot's IP

robot = universal_robots.UniversalRobotsUR10E()
# Connect
robot.connect(ip=robot_ip)

timestamp = robot.get_timestamp()
logger.success(f"Timestamp: {timestamp} s")

# Disconnect
robot.disconnect()

The Explanation of the Code

get_timestamp queries the robot controller's internal clock and returns the number of seconds elapsed since the controller started. The value is a monotonically increasing float.

Use successive calls to measure the duration of operations or to attach a controller-side timestamp to logged data.

How to Tune the Parameters

This skill takes no input parameters.

Return Value

TypeDescription
floatSeconds elapsed since the robot controller started.

Where to Use the Skill

  • State logging — Attach a controller-side timestamp to every sampled data point
  • Duration measurement — Record the timestamp before and after a motion to measure execution time
  • Data synchronization — Align robot state samples with external sensor streams using the controller clock

When Not to Use the Skill

Do not use Get Timestamp when:

  • Wall-clock time is required — use Python's time.time() or datetime.now() for real-world time