TeslasuitDocumentation
APIs

Common Types

Types and structures that are common for different API modules.

Data Structures#

TsVersion#

Version number, for example of the API, firmware, or a mapping.

Follows major.minor.patch.build numbering. A change in the major version indicates a breaking, incompatible change; minor and patch changes are expected to remain compatible.

Fields

major uint32_t

Major version number; incremented on incompatible/breaking changes.

minor uint32_t

Minor version number; incremented on backward-compatible changes.

patch uint32_t

Patch version number; incremented on bug fixes.

build uint32_t

Build identifier for this specific version.


TsDevice#

Fields

uuid uint8_t[16]

16-byte UUID uniquely identifying the physical device.


TsVec2f#

2D floating-point vector.

Represents a point or offset in 2D space, for example a coordinate within a body mapping layout.

Fields

x float

X coordinate.

y float

Y coordinate.


TsVec3f#

3D floating-point vector.

Represents a point, offset, or measurement (e.g. acceleration) in 3D space.

Fields

x float

X coordinate.

y float

Y coordinate.

z float

Z coordinate.


TsQuat#

Quaternion representing a 3D rotation.

Encodes an object's orientation in 3D space, as used for skeleton bone rotations and raw sensor orientation output.

Fields

w float

Scalar (real) component of the quaternion.

x float

X component of the vector (imaginary) part.

y float

Y component of the vector (imaginary) part.

z float

Z component of the vector (imaginary) part.


TsMocapBone#

Pose of a single bone in the mocap skeleton.

Represents a skeleton bone's position and rotation for one frame of motion capture data, as returned when reading a TsMocapSkeleton.

Fields

position TsVec3f

Bone position in 3D space.

rotation TsQuat

Bone rotation as a quaternion.


TsMocapSensor#

Raw data from a single motion capture sensor.

Contains the unprocessed readings and derived orientation for one mocap sensor unit: a 9-axis fused orientation, a 6-axis fused orientation, accelerometer, gyroscope, and magnetometer readings, linear acceleration with gravity removed, and the timestamp of the capture.

Fields

quat9x TsQuat

Orientation fused from accelerometer, gyroscope, and magnetometer (9-axis).

quat6x TsQuat

Orientation fused from accelerometer and gyroscope only (6-axis).

accel TsVec3f

Raw accelerometer reading.

gyro TsVec3f

Raw gyroscope reading.

magn TsVec3f

Raw magnetometer reading.

linear_accel TsVec3f

Acceleration with the gravity component removed.

timestamp uint64_t

Timestamp at which this sample was captured.


TsForceFeedbackConfig#

Configuration for a single force feedback servomotor.

Describes how the servomotor at a given bone index should resist motion: the target angle in degrees, how firmly it resists (hardness_percent), and which direction of movement is locked.

Fields

bone TsBoneIndex

Bone whose joint this servomotor configuration applies to.

angle float

Target lock angle, in degrees.

hardness_percent uint8_t

Resistance strength of the lock, as a percentage.

lock_direction TsForceFeedbackLockDirection

Direction of movement being restricted.


TsHapticParam#

A single haptic parameter and its value.

Pairs a TsHapticParamType with the concrete TsHapticParamValue to apply for that parameter, used when configuring a haptic effect.

Fields

type TsHapticParamType

Which haptic parameter this entry configures.

value TsHapticParamValue

Value to apply for the parameter.


TsHapticParamMultiplier#

A scaling factor applied to a haptic parameter.

Pairs a TsHapticParamType with a float multiplier, used to scale an existing haptic parameter's value (e.g. to attenuate amplitude) rather than replace it outright.

Fields

type TsHapticParamType

Which haptic parameter this multiplier applies to.

value float

Scaling factor to apply to the parameter's value.


TsEmgOptions#

Configuration options for EMG (electromyography) acquisition.

Controls the filtering band and sampling of EMG signal acquisition on a device.

Fields

lower_bandwidth uint32_t

Lower bound of the acquisition filter bandwidth.

upper_bandwidth uint32_t

Upper bound of the acquisition filter bandwidth.

sampling_frequency uint32_t

Sampling frequency used for EMG acquisition.

sample_size uint8_t

Size of a single acquired sample.


TsBiaConfig#

Configuration for BIA (bioelectrical impedance analysis) measurement.

Specifies which channels to measure and the sweep of excitation frequencies to use when performing a BIA measurement.

Fields

channels uint32_t*

Array of channel indices to include in the measurement.

number_of_channels uint32_t

Number of entries in the channels array.

start_frequency uint32_t

Starting excitation frequency of the sweep.

frequency_step uint32_t

Frequency increment applied at each step of the sweep.

number_of_steps uint32_t

Number of frequency steps in the sweep.


TsComplex#

Complex integer value representation.

Used to represent a complex-valued measurement, such as impedance derived from a BIA measurement, as separate real and imaginary integer components.

Fields

real_value int

Real part of the complex value.

im_value int

Imaginary part of the complex value.


TsHrv#

Heart rate variability (HRV) metrics derived from PPG data.

Contains the standard set of time- and frequency-domain HRV metrics computed from a window of successive heartbeat (RR) intervals.

Fields

mean_rr float

Mean of the RR (beat-to-beat) intervals.

sdnn float

Standard deviation of RR intervals (SDNN).

sdsd float

Standard deviation of successive RR interval differences (SDSD).

rmssd float

Root mean square of successive RR interval differences (RMSSD).

sd1 float

Short-term (beat-to-beat) variability from the Poincare plot (SD1).

sd2 float

Long-term variability from the Poincare plot (SD2).

lf_hf float

Ratio of low-frequency to high-frequency spectral power (LF/HF).


Enumerations#

TsBoneIndex#

Index of a bone in the Teslasuit mocap skeleton.

Identifies a specific bone within the full-body skeleton model used by motion capture and force feedback. Values are stable indices into the skeleton's bone array and are used to address a specific bone when reading mocap data or configuring force feedback.

Members

TsBoneIndex_Hips 0 TsBoneIndex_LeftUpperLeg 1 TsBoneIndex_RightUpperLeg 2 TsBoneIndex_LeftLowerLeg 3 TsBoneIndex_RightLowerLeg 4 TsBoneIndex_LeftFoot 5 TsBoneIndex_RightFoot 6 TsBoneIndex_Spine 7 TsBoneIndex_Chest 8 TsBoneIndex_UpperSpine 9 TsBoneIndex_Neck 10 TsBoneIndex_Head 11 TsBoneIndex_LeftShoulder 12 TsBoneIndex_RightShoulder 13 TsBoneIndex_LeftUpperArm 14 TsBoneIndex_RightUpperArm 15 TsBoneIndex_LeftLowerArm 16 TsBoneIndex_RightLowerArm 17 TsBoneIndex_LeftHand 18 TsBoneIndex_RightHand 19 TsBoneIndex_LeftThumbProximal 20 TsBoneIndex_LeftThumbIntermediate 21 TsBoneIndex_LeftThumbDistal 22 TsBoneIndex_LeftIndexProximal 23 TsBoneIndex_LeftIndexIntermediate 24 TsBoneIndex_LeftIndexDistal 25 TsBoneIndex_LeftMiddleProximal 26 TsBoneIndex_LeftMiddleIntermediate 27 TsBoneIndex_LeftMiddleDistal 28 TsBoneIndex_LeftRingProximal 29 TsBoneIndex_LeftRingIntermediate 30 TsBoneIndex_LeftRingDistal 31 TsBoneIndex_LeftLittleProximal 32 TsBoneIndex_LeftLittleIntermediate 33 TsBoneIndex_LeftLittleDistal 34 TsBoneIndex_RightThumbProximal 35 TsBoneIndex_RightThumbIntermediate 36 TsBoneIndex_RightThumbDistal 37 TsBoneIndex_RightIndexProximal 38 TsBoneIndex_RightIndexIntermediate 39 TsBoneIndex_RightIndexDistal 40 TsBoneIndex_RightMiddleProximal 41 TsBoneIndex_RightMiddleIntermediate 42 TsBoneIndex_RightMiddleDistal 43 TsBoneIndex_RightRingProximal 44 TsBoneIndex_RightRingIntermediate 45 TsBoneIndex_RightRingDistal 46 TsBoneIndex_RightLittleProximal 47 TsBoneIndex_RightLittleIntermediate 48 TsBoneIndex_RightLittleDistal 49 TsBoneIndex_BonesCount 50

Not a bone; equal to the total number of bones in the skeleton, useful for sizing arrays indexed by TsBoneIndex.


TsBiomechanicalIndex#

Index of a biomechanical (joint-angle) channel in the mocap skeleton.

Identifies a specific clinically relevant joint angle (e.g. hip flexion, knee flexion, shoulder rotation) derived from the raw skeleton pose. These indices are used to address individual biomechanical measurements, for example in gait or posture analysis, as opposed to raw bone transforms addressed by TsBoneIndex.

Members

TsBiomechanicalIndex_PelvisTilt 0 TsBiomechanicalIndex_PelvisList 1 TsBiomechanicalIndex_PelvisRotation 2 TsBiomechanicalIndex_HipFlexExtR 3 TsBiomechanicalIndex_HipAddAbdR 4 TsBiomechanicalIndex_HipRotR 5 TsBiomechanicalIndex_KneeFlexExtR 6 TsBiomechanicalIndex_AnkleFlexExtR 7 TsBiomechanicalIndex_AnkleProSupR 8 TsBiomechanicalIndex_HipFlexExtL 9 TsBiomechanicalIndex_HipAddAbdL 10 TsBiomechanicalIndex_HipRotL 11 TsBiomechanicalIndex_KneeFlexExtL 12 TsBiomechanicalIndex_AnkleFlexExtL 13 TsBiomechanicalIndex_AnkleProSupL 14 TsBiomechanicalIndex_ElbowFlexExtR 15 TsBiomechanicalIndex_ForearmProSupR 16 TsBiomechanicalIndex_WristFlexExtR 17 TsBiomechanicalIndex_WristDeviationR 18 TsBiomechanicalIndex_ElbowFlexExtL 19 TsBiomechanicalIndex_ForearmProSupL 20 TsBiomechanicalIndex_WristFlexExtL 21 TsBiomechanicalIndex_WristDeviationL 22 TsBiomechanicalIndex_ShoulderAddAbdR 36 TsBiomechanicalIndex_ShoulderRotR 37 TsBiomechanicalIndex_ShoulderFlexExtR 38 TsBiomechanicalIndex_ShoulderAddAbdL 39 TsBiomechanicalIndex_ShoulderRotL 40 TsBiomechanicalIndex_ShoulderFlexExtL 41


TsProductType#

Product type of a Teslasuit device.

Identifies which hardware product family a connected device belongs to. Use this to decide which subsystems and mappings are applicable to a given device.

Members

TsProductType_Undefined 0

Product type is unknown or has not been determined yet. TsProductType_Suit 1 Full-body Teslasuit haptic suit. TsProductType_Glove 2 Teslasuit haptic/force-feedback glove.


TsDeviceSide#

Physical side (left/right) of a Teslasuit device.

Applies to devices that come in a left/right pair, such as gloves. Can be Undefined for devices where handedness does not apply.

Members

TsDeviceSide_Undefined 0

Side does not apply to this device or has not been determined. TsDeviceSide_Right 1 Device is the right-hand unit of a pair. TsDeviceSide_Left 2 Device is the left-hand unit of a pair.


TsDeviceEvent#

Connection events reported for a Teslasuit device.

Delivered to a TsDeviceEventCallback whenever a device is connected to or disconnected from the system, so the application can track the set of currently attached devices.

Members

TsDeviceEvent_DeviceAttached 1

A device has been connected and is ready to use. TsDeviceEvent_DeviceDetached 2 A device has been disconnected and is no longer available.


TsDeviceEventPolicy#

Policy controlling how a device event callback is invoked once registered.

Members

TsDeviceEventPolicy_Enumerate 1

Set the callback and immediately fire it once for every device that is already attached, in addition to future attach/detach events.


TsForceFeedbackLockDirection#

Direction in which a force feedback servomotor locks joint motion.

Specifies which side of a joint's movement range is restricted by the servomotor when force feedback is engaged.

Members

TsForceFeedbackLockDirection_Up 1

Restrict movement in the upward/extension direction. TsForceFeedbackLockDirection_Down 2 Restrict movement in the downward/flexion direction. TsForceFeedbackLockDirection_Both 3 Restrict movement in both directions.


Type Aliases#

TsStatusCode#

typedef int TsStatusCode;

Result code returned by most Teslasuit C API functions.

Every value below 0x80000000 (the Good* family) indicates the call succeeded, optionally with extra context about the outcome. Every value at or above 0x80000000 (the Bad/error family) indicates the call failed and no meaningful side effect occurred. Callers should always check the returned code before relying on any output parameters.

Possible values:

  • Good = 0U, the call completed successfully.
  • GoodNotInitialized, the call succeeded but the relevant subsystem was not yet initialized.
  • GoodAlreadyInitialized, the call succeeded; the subsystem was already initialized, so no work was needed.
  • GoodAlreadyExists, the call succeeded; the requested object already existed.
  • GoodNothingTodo, the call succeeded but had no effect because there was nothing to do.
  • Bad = 0x80000000U, generic failure code, the base value for all error results.
  • InvalidArgument, one or more arguments passed to the function are invalid.
  • BadPointer, a required pointer argument was null or otherwise invalid.
  • BadAlreadyExists, the call failed because the object already exists.
  • OutOfMemory, the call failed because memory allocation failed.
  • NotInitialized, the call failed because the required subsystem has not been initialized.
  • BadCommand, the command could not be executed or is not recognized.
  • NotImplemented, the requested functionality is not implemented.
  • NotFound, the requested object or resource could not be found.
  • NotValid, the requested object or data is not in a valid state.
  • NotSupported, the requested operation is not supported by the current device or configuration.
  • BadState, the call failed because the subsystem or device is in an unexpected state.
  • BadSize, a size argument or buffer size is invalid.
  • IpcFail, inter-process communication with the Teslasuit service failed.
  • SessionLimitExceeded, the maximum number of concurrent sessions has been reached.
  • ParseFail, parsing of input data failed.
  • FileOpenFailed, the call failed because a required file could not be opened.
  • FileFlushFailed, the call failed because a file could not be flushed to disk.
  • FileWriteFailed, the call failed because writing to a file failed.
  • AccessDenied, the caller does not have permission to perform the operation.
  • ServiceNotStarted, the call failed because the Teslasuit background service is not running.
  • NoDevice, the call failed because no matching device is attached.
  • InProgress, the operation is already in progress.
  • Unexpected, an unexpected internal error occurred.

TsDeviceHandle#

typedef struct TsDeviceHandle TsDeviceHandle;

TsDeviceEventCallback#

typedef void(* TsDeviceEventCallback) (const TsDevice *dev, TsDeviceEvent event, void *user_data);

Callback invoked when a device is attached to or detached from the system.

Register this callback with ts_set_device_event_callback to be notified of device connection changes.


TsAssetType#

typedef unsigned int TsAssetType;

Type of a Teslasuit content asset.

Identifies what kind of binary asset (effect, animation, material, etc.) has been loaded by the asset manager, so it can be dispatched to the right subsystem.

Possible values:

  • Undefined = 0, unknown asset type.
  • Spline = 1, spline animation asset.
  • HapticEffect = 2, haptic effect asset.
  • Material = 3, haptic material asset.
  • TouchSequence = 4, touch sequence asset.
  • PresetAnimation = 5, preset animation asset.
  • SceneAnimation = 6, scene animation asset.

TsAsset#

typedef struct TsAsset TsAsset;

TsMapping2dBoneContent#

typedef void* TsMapping2dBoneContent;

TsMapping2dVersion#

typedef unsigned char TsMapping2dVersion;

Version of the 2D body mapping used by a device.

Identifies which revision of the sensor/actuator mapping layout a device or asset was built for. Different hardware generations and product variants (suit vs. left/right glove) use different mapping versions, so this value is used to select the correct mapping data for a device.

Possible values:

  • Undefined = 0, unknown or unset mapping version.
  • Mapping_4_5_4 = 1, suit mapping revision 4.5.4.
  • Mapping_4_5_5 = 2, suit mapping revision 4.5.5.
  • Mapping_4_6_0 = 3, suit mapping revision 4.6.0.
  • MappingLeftGlove_1_0_0 = 4, left glove mapping revision 1.0.0.
  • MappingRightGlove_1_0_0 = 5, right glove mapping revision 1.0.0.
  • Mapping_4_5_4_Legacy = 6, legacy variant of suit mapping revision 4.5.4.
  • Mapping_4_5_5_Legacy = 7, legacy variant of suit mapping revision 4.5.5.
  • Mapping_5_0_0 = 8, suit mapping revision 5.0.0.
  • MappingLeftGlove_1_2_0 = 9, left glove mapping revision 1.2.0.
  • MappingRightGlove_1_2_0 = 10, right glove mapping revision 1.2.0.
  • Mapping_5_0_1 = 11, suit mapping revision 5.0.1.
  • Mapping_5_0_2 = 12, suit mapping revision 5.0.2.
  • Mapping_5_0_3 = 13, suit mapping revision 5.0.3.
  • Mapping_4_7_0 = 14, suit mapping revision 4.7.0.
  • MappingLeftGlove_1_3_0 = 15, left glove mapping revision 1.3.0.
  • MappingRightGlove_1_3_0 = 16, right glove mapping revision 1.3.0.
  • Mapping_4_X_Medical = 17, medical variant of the 4.x suit mapping.
  • Mapping_4_5_6 = 18, suit mapping revision 4.5.6.

TsLayout2dType#

typedef unsigned char TsLayout2dType;

Type of sensor or actuator layout described by a mapping.

Identifies which physical modality a given 2D layout within a mapping represents.

Possible values:

  • Undefined = 0, unknown or unset layout type.
  • Electric = 1, electrical stimulation layout.
  • Temperature = 2, thermal (heating/cooling) layout.
  • Vibration = 3, vibrotactile haptic layout.
  • Emg = 4, EMG (electromyography) sensor layout.
  • Ecg = 5, ECG (electrocardiography) sensor layout.

TsLayout2dElementType#

typedef unsigned char TsLayout2dElementType;

Type of an individual element within a 2D layout.

Possible values:

  • Undefined = 0, unknown or unset element type.
  • Cell = 1, a single addressable cell/pad element in the layout.
  • Channel = 2, a channel element grouping one or more cells.

TsBone2dSide#

typedef unsigned char TsBone2dSide;

Side of a bone's body surface a layout element belongs to.

Distinguishes the front (anterior) and back (posterior) surfaces of a bone's body region for mapping purposes.

Possible values:

  • Undefined = 0, side not applicable or not set.
  • Front = 1, front (anterior) surface of the bone region.
  • Back = 2, back (posterior) surface of the bone region.

TsMapping2dBone#

typedef void* TsMapping2dBone;

TsMapping2d#

typedef void const* TsMapping2d;

TsLayout2d#

typedef void* TsLayout2d;

TsMocapSkeleton#

typedef void const* TsMocapSkeleton;

TsMocapSensorSkeleton#

typedef void const* TsMocapSensorSkeleton;

TsMocapSkeletonCallback#

typedef void(* TsMocapSkeletonCallback) (TsDeviceHandle *dev, TsMocapSkeleton skeleton, void *user_data);

Callback delivering a new frame of processed mocap skeleton data.

The callback is called after subscribing and starting mocap streaming. Received skeleton can be parsed by bones with ts_mocap_skeleton_get_bone.


TsMocapSensorSkeletonCallback#

typedef void(* TsMocapSensorSkeletonCallback) (TsDeviceHandle *dev, TsMocapSensorSkeleton skeleton, void *user_data);

Callback delivering a new frame of raw mocap sensor data.

The callback is called after subscribing and starting mocap streaming. Received skeleton can be parsed by bones with ts_mocap_sensor_skeleton_get_bone.


TsForceFeedbackPositionContainer#

typedef const void* const TsForceFeedbackPositionContainer;

TsForceFeedbackPositionUpdatedCallback#

typedef void(* TsForceFeedbackPositionUpdatedCallback) (TsDeviceHandle *dev, TsForceFeedbackPositionContainer container, void *user_data);

Callback delivering a new frame of force feedback joint positions.

A callback will be called after subscribing and starting position streaming. Received container can be parsed by bones with ts_force_feedback_get_flexion_angle and ts_force_feedback_get_abduction_angle


TsHapticParamType#

typedef unsigned int TsHapticParamType;

Kind of parameter that controls a haptic effect.

Identifies which characteristic of a haptic (electrical or vibrotactile) signal a TsHapticParam or TsHapticParamMultiplier applies to.

Possible values:

  • Undefined = 0, unknown or unset parameter type.
  • Period = 1, signal period/frequency parameter.
  • Amplitude = 2, signal amplitude/strength parameter.
  • PulseWidth = 3, pulse width parameter of an electrical stimulation signal.
  • Temperature = 4, thermal parameter for temperature-based feedback.

TsHapticParamValue#

typedef unsigned long long TsHapticParamValue;

Value of a haptic parameter.

The raw magnitude for a given TsHapticParamType; its interpretation (e.g. units, scale) depends on the parameter type and target subsystem.


TsEmgData#

typedef void const* TsEmgData;

TsHrvData#

typedef void const* TsHrvData;

TsPpgData#

typedef void const* TsPpgData;

TsRawPpgData#

typedef void const* TsRawPpgData;

TsBiaData#

typedef void const* TsBiaData;

TsCurrentFeedbackData#

typedef void const* TsCurrentFeedbackData;

TsEmgUpdatedCallback#

typedef void(* TsEmgUpdatedCallback) (TsDeviceHandle *dev, const TsEmgData emg_data, void *user_data);

Callback delivering a new frame of EMG channel data.

A callback will be called after subscribing and starting EMG streaming. Received EMG data can be parsed with ts_emg_get_channel_data.


TsHrvUpdatedCallback#

typedef void(* TsHrvUpdatedCallback) (TsDeviceHandle *dev, const TsHrvData hrv_data, void *user_data);

Callback delivering a newly computed HRV result.

A callback will be called after subscribing and starting PPG streaming. Received HRV data can be parsed with ts_hrv_get_data.


TsPpgUpdatedCallback#

typedef void(* TsPpgUpdatedCallback) (TsDeviceHandle *dev, const TsPpgData ppg_data, void *user_data);

Callback delivering a new frame of processed PPG data.

A callback will be called after subscribing and starting PPG streaming. Received processed PPG data can be parsed with ts_ppg_get_heart_rate


TsRawPpgUpdatedCallback#

typedef void(* TsRawPpgUpdatedCallback) (TsDeviceHandle *dev, const TsRawPpgData raw_ppg_data, void *user_data);

Callback delivering a new frame of raw PPG data.

A callback will be called after subscribing and starting raw PPG streaming. Received processed PPG data can be parsed with ts_ppg_raw_get_infrared_data, ts_ppg_raw_get_red_data, ts_ppg_raw_get_blue_data, ts_ppg_raw_get_green_data


TsBiaUpdatedCallback#

typedef void(* TsBiaUpdatedCallback) (TsDeviceHandle *dev, const TsBiaData bia_data, void *user_data);

Callback delivering a new frame of BIA (bioelectrical impedance analysis) data.

A callback will be called after subscribing and starting BIA streaming. Received BIA data can be parsed with ts_bia_get_channel_frequency_complex_value.


TsCurrentFeedbackUpdatedCallback#

typedef void(* TsCurrentFeedbackUpdatedCallback) (TsDeviceHandle *dev, const TsCurrentFeedbackData feedback_data, void *user_data);

Callback delivering a new frame of current feedback data.

A callback will be called after subscribing and starting current feedback streaming. Received data can be parsed with ts_current_feedback_get_channel_value.