TeslasuitDocumentation
APIs

TsMocap

teslasuit_sdk.subsystems.ts_mocap.TsMocap

Interface for streaming motion capture data from a TESLASUIT device.

Provides access to raw IMU sensor data, solved skeleton bone poses, and biomechanical joint angles. Streaming must be started before data is available via the get_*_on_ready blocking methods.

Methods#

__init__#

def __init__(lib, device_handle):

Initialize the mocap interface for a specific device.

Parameters

lib

Loaded TESLASUIT C API library object (CDLL or WinDLL).

device_handle

Handle to the open TESLASUIT device.


start_streaming#

def start_streaming() -> None:

Start mocap data streaming for the device.

Subscribes to the raw sensor and skeleton data update callbacks, then starts the C API streaming pipeline. Has no effect if streaming is already active.


stop_streaming#

def stop_streaming() -> None:

Stop mocap data streaming for the device.

Halts the C API streaming pipeline. Has no effect if streaming is not currently active.


calibrate_skeleton#

def calibrate_skeleton() -> None:

Trigger a skeleton model calibration.

Initiates the calibration procedure to improve the accuracy of solved bone poses.


get_raw_data_on_ready#

def get_raw_data_on_ready() -> Dict[TsBone2dIndex, TsMocapSensor]:

Block until a new raw sensor frame is available and return it.

Returns: dict

Dictionary mapping TsBone2dIndex to


get_skeleton_data_on_ready#

def get_skeleton_data_on_ready() -> Dict[TsBone2dIndex, TsMocapBone]:

Block until a new solved skeleton frame is available and return it.

Returns: dict

Dictionary mapping TsBone2dIndex to


get_biomechanical_angles_on_ready#

def get_biomechanical_angles_on_ready() -> Dict[TsBiomechanicalIndex, c_float]:

Block until new biomechanical angle data is available and return it.

Returns: dict

Dictionary mapping TsBiomechanicalIndex to ctypes.c_float angle values.


get_sensor_data#

def get_sensor_data(bone_index: TsBone2dIndex, data_ptr: int) -> TsMocapSensor:

Retrieve raw IMU sensor data for a single bone from a data frame pointer.

Parameters

bone_index: TsBone2dIndex

Index of the bone to retrieve data for.

data_ptr: int

Opaque pointer to the raw sensor data frame.

Returns: TsMocapSensor

Raw sensor data for the specified bone.


get_skeleton_data#

def get_skeleton_data(bone_index: TsBone2dIndex, data_ptr: int) -> TsMocapBone:

Retrieve solved skeleton bone data for a single bone from a data frame pointer.

Parameters

bone_index: TsBone2dIndex

Index of the bone to retrieve data for.

data_ptr: int

Opaque pointer to the skeleton data frame.

Returns: TsMocapBone

Solved position and rotation of the specified bone.


get_biomechanical_angle#

def get_biomechanical_angle(biomech_index: TsBiomechanicalIndex, data_ptr: int) -> c_float:

Retrieve a single biomechanical joint angle from a data frame pointer.

Parameters

biomech_index: TsBiomechanicalIndex

Index of the biomechanical angle to retrieve.

data_ptr: int

Opaque pointer to the skeleton data frame.

Returns: ctypes.c_float

Joint angle value in degrees.


Data Structures#

ts_mocap.TsVec2f#

2D float vector representing a point in 2D space.

Fields

x float

X coordinate.

y float

Y coordinate.


ts_mocap.TsVec3f#

3D float vector representing a point in 3D space.

Fields

x float

X coordinate.

y float

Y coordinate.

z float

Z coordinate.


ts_mocap.TsQuat#

Quaternion representing an orientation in 3D space.

Fields

w float

Scalar (real) component.

x float

X component of the vector part.

y float

Y component of the vector part.

z float

Z component of the vector part.


ts_mocap.TsMocapBone#

C structure holding the solved position and rotation for a single skeleton bone.

Fields

position TsVec3f

World-space position of the bone.

rotation TsQuat

World-space orientation of the bone as a quaternion.


ts_mocap.TsMocapSensor#

C structure holding raw IMU sensor data for a single bone sensor.

Fields

q6 TsQuat

6-axis quaternion (accelerometer + gyroscope, no magnetometer).

q9 TsQuat

9-axis quaternion (accelerometer + gyroscope + magnetometer).

accel TsVec3f

Accelerometer reading in m/s².

gyro TsVec3f

Gyroscope reading in rad/s.

magn TsVec3f

Magnetometer reading in µT.

linear_accel TsVec3f

Linear acceleration (gravity-compensated) in m/s².

timestamp int

Sensor timestamp in microseconds.