Coder Social home page Coder Social logo

gordon-n-stevenson / natnetclient Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ratcave/natnetclient

0.0 1.0 0.0 120 KB

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

License: GNU General Public License v2.0

Python 100.00%

natnetclient's Introduction

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.

##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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.