natnet.protocol.MocapFrameMessage¶
FrameOfData message implementation.
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.
This is the most complicated message.
All positions are given as (x, y, z) tuples of floats, in meters, in whatever co-ordinate frame Motive is using (Y-up or Z-up depending on the streaming settings). All orientations are given in quaternion form as (x, y, z, w) tuples of floats.
Note that I have only tested rigid bodies – skeletons, force plates and peripheral devices may or may not work.
-
class
natnet.protocol.MocapFrameMessage.Markerset(name, markers)[source]¶ Vaguely-defined grouping of markers which doesn’t seem to serve any useful purpose.
Variables: - name (str) – Markerset name
- markers (list[tuple[float, float, float]]) – Position for each marker
-
class
natnet.protocol.MocapFrameMessage.RigidBody(id_, position, orientation, mean_error, params)[source]¶ Rigid body data.
Note that as of NatNet 3, the individual marker positions, IDs and sizes are not included here (and if you don’t need them you can prevent Motive from streaming them at all). If you need them, search the list of LabelledMarkers for markers with the right model ID.
Variables: - id (int) – Streaming ID
- position (tuple[float, float, float]) –
- orientation (tuple([float, float, float, float]) –
- mean_error (float or None) – Mean error per marker, if available
-
tracking_valid¶ True if rigid body is being tracked successfully.
-
class
natnet.protocol.MocapFrameMessage.Skeleton(id_, rigid_bodies)[source]¶ Skeleton data, which consists of a set of rigid bodies.
Apparently the rigid bodies will have their ID equal to skeleton_id << 16 + bone_id.
Variables: - id_ (int) – Skeleton ID (I’m not sure where this is set)
- rigid_bodies (list[
RigidBody]) –
-
class
natnet.protocol.MocapFrameMessage.LabelledMarker(model_id, marker_id, position, size, params, residual)[source]¶ A single marker and associated information.
Note that this is not only markers that are part of rigid bodies.
Variables: - model_id (int) – ID of containing rigid body, or 0 if the marker is not part of a rigid body
- marker_id (int) – Marker ID (starting at 0 for rigid body markers, or a large number otherwise)
- position (tuple[float, float, float]) –
- size (float) – Estimated marker size in meters
- residual (float or None) – Marker error in mm/ray, if available
-
active¶ True if the marker is an actively labeled LED marker.
-
has_model¶ True if the marker has an associated asset in the data stream (e.g. rigid body).
-
model_solved¶ True if the marker is “model solved” i.e. its position was calculated from a rigid body.
-
occluded¶ True if the marker is occluded.
-
point_cloud_solved¶ True if the marker is “point cloud solved” i.e. its position was calculated directly.
-
unlabelled¶ True if the marker is ‘unlabelled’, but has a point cloud ID i.e. does not have an associated asset.
-
class
natnet.protocol.MocapFrameMessage.TimingInfo(timecode, timecode_subframe, timestamp, camera_mid_exposure_timestamp, camera_data_received_timestamp, transmit_timestamp)[source]¶ Timing information.
Variables: - timecode (int) – SMPTE timecode, if available
- timecode_subframe (int) – SMPTE timecode subframe, if available
- timestamp (float) – Software timestamp (in seconds since software startup)
- camera_mid_exposure_timestamp (int or None) – Camera mid exposure time (in performance counter ticks), if available
- camera_data_received_timestamp (int or None) – Time camera data was received (in performance counter ticks), if available
- transmit_timestamp (int or None) – Time frame was transmitted (in performance counter ticks), if available
-
class
natnet.protocol.MocapFrameMessage.MocapFrameMessage(frame_number, markersets, rigid_bodies, skeletons, labelled_markers, force_plates, devices, timing_info, params)[source]¶ Frame of mocap data.
Variables: - frame_number (int) –
- markersets (list of
Markerset) – - rigid_bodies (list of
RigidBody) – - skeletons (list of
Skeleton) – - labelled_markers (list of
LabelledMarker) – A LabelledMarker instance for each tracked marker, whether part of a rigid body or not - force_plates (list of
Device) – - devices (list of
Device) – - timing_info (
TimingInfo) – Timestamps (in server time)
-
classmethod
deserialize(data, version)[source]¶ Deserialize a FrameOfData message.
Parameters: - data (
ParseBuffer) - version (
Version)
Returns: MocapFrameMessage – Deserialized message
- data (
-
is_recording¶ True if Motive is recording.
-
tracked_models_changed¶ True if the tracked models have changed since the last frame.