Skip to content
This repository has been archived by the owner on Sep 25, 2022. It is now read-only.

ratcave/natnetclient

Repository files navigation

Build Status

Window Build Status

Coverage Status

natnetclient

Python NatNet Client for retrieving NaturalPoint's Optitrack data from their Motive software using socket depacketization. This project cross-platform and compatible with both Python 2 and Python 3.

NOTE This proejct only works for quite old Motive/NatNet setups; I recommend https://github.com/mje-nz/python_natnet; it works great!

##Installation

pip install natnetclient

Quick Guide

Connecting to Motive

Before connecting, make sure that your Motive software is actually streaming NatNet data. Also, note the IP address and data and command socket port numbers. If they don't match, there won't be a connection. Then, simply use the NatClient class to connect:

import natnetclient as natnet
client = natnet.NatClient(client_ip='127.0.0.1', data_port=1511, comm_port=1510)

Get Rigid Bodies

Once the NatClient is connected, it will automatically and continuously get the latest information on its own thread.

Rigid bodies are stored in a dictionary, and classes exist for Rigid Bodies and Markers, each with their own properties, supplied by Motive:

hand = client.rigid_bodies['Hand'] # Assuming a Motive Rigid Body is available that you named "Hand"
print(hand.position)
print(hand.rotation)

hand_markers = hand.markers  # returns a list of markers, each with their own properties
print(hand_markers[0].position)

Troubleshooting

NatClient is timing out and not connecting.

  • Make sure that Motive is streaming--for some reason, recent versions of Motive have this off by default.
  • Make sure the IP and ports in NatClient match Motive's settings, so they can talk to each other.

NatClient's Rigidbody dictionary is Empty

  • Make sure Motive's "Stream Rigid Bodies" option is turned on. Recently, Motive's default is to not stream that info.

About

Python NatNet Client for retrieving NaturalPoint's Optitrack data from their Motive software using depacketization.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages