natnet¶
NatNet client library.
Copyright (c) 2017, Matthew Edwards. This file is subject to the 3-clause BSD license, as found in the LICENSE file in the top-level directory of this distribution and at https://github.com/mje-nz/python_natnet/blob/master/LICENSE. No part of python_natnet, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.
-
class
natnet.Client(conn, clock_synchronizer, log, model_definitions=NOTHING, expected_markers=NOTHING, model_names=NOTHING, callback=None, model_callback=None)[source]¶ NatNet client.
This class connects to a NatNet server and calls a callback whenever a frame of mocap data arrives.
-
classmethod
connect(server=None, logger=<natnet.logging.Logger object>, timeout=1)[source]¶ Connect to a NatNet server.
Raises
DiscoveryErrorif server is not provided and discovery fails.Parameters: - server (str) – IPv4 address of server (hostname probably works too), or None to autodiscover
- logger (
Logger) - timeout (int) – How long to wait for server(s) to respond
-
set_callback(callback)[source]¶ Set the frame callback.
It will be called with a list of
RigidBody, a list ofLabelledMarker, and aTimestampAndLatency.
-
set_model_callback(callback)[source]¶ Set the model definition callback.
It will be called with a list of
RigidBodyDescription, a list ofSkeletonDescription, and a list ofMarkersetDescription, immediately and whenever the tracked models change.
-
classmethod
-
class
natnet.MessageId[source]¶ Message IDs for each NatNet message (as in NatNetTypes.h).
Variables: - Connect – Request for server info
- ServerInfo – Motive version, NatNet version, clock frequency, data port, and multicast address
- RequestModelDef – Request for model definitions
- ModelDef – List of definitions of rigid bodies, markersets, skeletons etc
- FrameOfData – Frame of motion capture data
- EchoRequest – Request server to immediately respond with its current time (used for clock sync)
- EchoResponse – Current server time (and time contained in EchoRequest message)
-
Connect= 0¶
-
Disconnect= 9¶
-
DisconnectByTimeout= 11¶
-
Discovery= 14¶
-
EchoRequest= 12¶
-
EchoResponse= 13¶
-
FrameOfData= 7¶
-
KeepAlive= 10¶
-
MessageString= 8¶
-
ModelDef= 5¶
-
Request= 2¶
-
RequestFrameOfData= 6¶
-
RequestModelDef= 4¶
-
Response= 3¶
-
ServerInfo= 1¶
-
UnrecognizedRequest= 256¶
-
class
natnet.Version[source]¶ NatNet version, with correct comparison operator.
Believe it or not, this is performance-critical.
Variables: - major (int) –
- minor (int) –
- build (int) –
- revision (int) –