Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 1.57 KB

README.md

File metadata and controls

29 lines (20 loc) · 1.57 KB

OptiTrack Swarm Tracker

A Python client that streams live motion-capture data from OptiTrack Motive and shows where every robot in a small swarm is, how fast each one moves, and whether tracking is valid.

I wrote this in July 2025 while setting up the OptiTrack camera system for a microrobotics lab at the University of Texas at San Antonio (Electrical and Computer Engineering).

What it does

  • Connects to Motive over NatNet (unicast) and receives every frame through a callback
  • Tracks each rigid body as a robot (Robot_<id>), skipping frames where tracking is invalid
  • Estimates velocity from position deltas and smooths it with an exponential moving average (alpha 0.3), ignoring jitter under 1 mm
  • Rate-limits the terminal display (two refreshes per second by default) so a high-rate stream stays readable
  • Three display modes: a summary table, a detailed per-robot view with quaternion rotation and tracking error, and a one-line minimal mode
  • Prints per-robot update counts on shutdown

Requirements

  • Python 3.8+
  • OptiTrack Motive with data streaming turned on (View, then Data Streaming)
  • NatNetClient.py from the Python sample in OptiTrack's NatNet SDK, placed next to optitrack_stream.py. The SDK file is not included here.

Run it

python optitrack_stream.py --server 192.168.1.10 --client 192.168.1.20
python optitrack_stream.py --server 192.168.1.10 --client 192.168.1.20 --mode detailed --rate 4

--server is the machine running Motive, --client is this machine. Press Ctrl+C to stop.