TeslasuitDocumentation
APIs

TsMapper

teslasuit_sdk.ts_mapper.TsMapper

Provides access to TESLASUIT 2D device mappings.

A mapping describes the physical layout of all actuator and sensor elements on a device projected onto a 2D surface. Elements (cells or channels) are represented as 2D polygons and are grouped into layouts; each layout belongs to a single bone in the skeleton, and bones are organised within a

Methods#

__init__#

def __init__(lib):

Initialize the mapper with the C API library.

Parameters

lib

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


get_mapping_by_device#

def get_mapping_by_device(device) -> Optional[int]:

Retrieve the default 2D mapping handle for a device.

Parameters

device

Device handle.

Returns: int

Opaque mapping handle.


get_mapping_by_version#

def get_mapping_by_version(version: TsMapping2dVersion) -> c_void_p:

Retrieve a 2D mapping handle by its version identifier.

Parameters

version: TsMapping2dVersion

Mapping version to retrieve.

Returns: ctypes.c_void_p

Opaque mapping handle wrapped in a c_void_p.


get_number_of_layouts#

def get_number_of_layouts(mapping: int) -> int:

Retrieve the number of layouts contained in a mapping.

Parameters

mapping: int

Opaque mapping handle.

Returns: int

Number of layouts in the mapping.


get_layouts#

def get_layouts(mapping: int) -> List[int]:

Retrieve all layout handles from a mapping.

Parameters

mapping: int

Opaque mapping handle.

Returns: list

List of opaque layout handles.


get_layout_index#

def get_layout_index(layout: int) -> int:

Retrieve the index of a layout within its type group.

Parameters

layout: int

Opaque layout handle.

Returns: int

Layout index.


get_layout_type#

def get_layout_type(layout: int) -> int:

Retrieve the type of a layout.

Parameters

layout: int

Opaque layout handle.

Returns: int

Layout type value (see TsLayout2dType).


get_layout_element_type#

def get_layout_element_type(layout: int) -> int:

Retrieve the element type of a layout.

Parameters

layout: int

Opaque layout handle.

Returns: int

Layout element type value (see TsLayout2dElementType).


get_number_of_bones#

def get_number_of_bones(layout: int) -> int:

Retrieve the number of bones in a layout.

Parameters

layout: int

Opaque layout handle.

Returns: int

Number of bones in the layout.


get_layout_bones#

def get_layout_bones(layout: int) -> List[int]:

Retrieve all bone handles from a layout.

The returned handles can be used to query per-bone content (cells and channels). Use get_number_of_bones() to determine how many bones to expect before calling this method.

Parameters

layout: int

Opaque layout handle.

Returns: list

List of opaque bone handles.


get_bone_index#

def get_bone_index(bone_handle: int) -> int:

Retrieve the index of a bone.

Parameters

bone_handle: int

Opaque bone handle.

Returns: int

Bone index (see TsBone2dIndex).


get_bone_side#

def get_bone_side(bone_handle: int) -> int:

Retrieve the surface side of a bone.

Parameters

bone_handle: int

Opaque bone handle.

Returns: int

Bone side value (see TsBone2dSide).


get_bone_number_of_contents#

def get_bone_number_of_contents(bone_handle: int) -> int:

Retrieve the number of content entries (cells or channels) for a bone.

Parameters

bone_handle: int

Opaque bone handle.

Returns: int

Number of content entries.


get_bone_contents#

def get_bone_contents(bone_handle: int) -> List[int]:

Retrieve all content handles for a bone.

The returned handles represent the individual cells or channels mapped to this bone. Use get_bone_number_of_contents() to determine the expected count before calling this method.

Parameters

bone_handle: int

Opaque bone handle.

Returns: list

List of opaque bone content handles.


get_bone_number_of_points#

def get_bone_number_of_points(bone_handle: int) -> int:

Retrieve the number of 2D shape points for a bone content entry.

Parameters

bone_handle: int

Opaque bone content handle.

Returns: int

Number of polygon points describing the element shape.


get_bone_points#

def get_bone_points(bone_handle: int) -> List[TsVec2f]:

Retrieve the 2D polygon points that describe a bone content element's shape.

Parameters

bone_handle: int

Opaque bone content handle.

Returns: list

List of TsVec2f points forming the element polygon.


get_layout_by_type#

def get_layout_by_type(mapping: int, layout_type: int, layout_element_type: int) -> Optional[int]:

Find the first layout matching a given type and element type.

Parameters

mapping: int

Opaque mapping handle.

layout_type: int

Layout type to match (see TsLayout2dType).

layout_element_type: int

Element type to match (see TsLayout2dElementType).

Returns: int or None

The matching layout handle, or None if not found.


get_haptic_electric_channel_layout#

def get_haptic_electric_channel_layout(mapping: int) -> Optional[int]:

Retrieve the electric-channel layout used for haptic stimulation.

Parameters

mapping: int

Opaque mapping handle.

Returns: int or None

Layout handle for the electric channel layout, or None if not found.


Data Structures#

ts_mapper.TsVec2f#

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

Fields

x float

X coordinate.

y float

Y coordinate.


ts_mapper.TsBoneContentType#

C structure describing the layout and element type of a bone content entry.

Fields

layout_type int

Layout type identifier (0–5, see TsLayout2dType).

element_type int

Element type identifier (0–2, see TsLayout2dElementType). .. deprecated:: 1.0 Not used internally. The same information is available via TsLayout.


ts_mapper.TsBoneId#

C structure identifying a bone by its index and surface side.

Fields

bone_index int

Bone index (0–49, see TsBone2dIndex).

bone_side int

Bone side (0–2, see TsBone2dSide). .. deprecated:: 1.0 Not used internally. The same information is available via TsBone.


ts_mapper.TsBone#

C structure representing a bone entry within a 2D mapping layout.

Fields

id int

Internal bone identifier.

bone_index int

Bone index (see TsBone2dIndex).

bone_side int

Bone surface side (see TsBone2dSide).

channels int

Number of channels associated with this bone.


ts_mapper.TsLayout#

C structure representing a layout entry within a 2D mapping.

Fields

id int

Internal layout identifier.

layout_type int

Layout type (see TsLayout2dType).

element_type int

Element type (see TsLayout2dElementType).

layout_index int

Index of the layout within its type group.

bone TsBone

Pointer to the bone associated with this layout.


ts_mapper.TsMappingData#

C structure holding a 2D mapping handle and its array of layouts.

Fields

mapping_handle int

Opaque pointer to the mapping object.

layouts TsLayout

Pointer to the array of layout entries.


Enumerations#

ts_mapper.TsMapping2dVersion#

Enumeration of supported 2D mapping versions.

  • Undefined (0)
  • Mapping_4_5_4 (1)
  • Mapping_4_5_5 (2)
  • Mapping_4_6_0 (3)
  • MappingLeftGlove_1_0_0 (4)
  • MappingRightGlove_1_0_0 (5)
  • Mapping_4_5_4_Legacy (6)
  • Mapping_4_5_5_Legacy (7)
  • Mapping_5_0_0 (8)
  • MappingLeftGlove_1_2_0 (9)
  • MappingRightGlove_1_2_0 (10)
  • Mapping_5_0_1 (11)
  • Mapping_5_0_2 (12)
  • Mapping_5_0_3 (13)
  • Mapping_4_7_0 (14)
  • MappingLeftGlove_1_3_0 (15)
  • MappingRightGlove_1_3_0 (16)
  • Mapping_4_X_Medical (17)
  • Mapping_4_5_6 (18)
  • Mapping_5_1_0_Men (19)
  • Mapping_5_1_0_Women (20)

Members

Undefined 0 Mapping_4_5_4 1 Mapping_4_5_5 2 Mapping_4_6_0 3 MappingLeftGlove_1_0_0 4 MappingRightGlove_1_0_0 5 Mapping_4_5_4_Legacy 6 Mapping_4_5_5_Legacy 7 Mapping_5_0_0 8 MappingLeftGlove_1_2_0 9 MappingRightGlove_1_2_0 10 Mapping_5_0_1 11 Mapping_5_0_2 12 Mapping_5_0_3 13 Mapping_4_7_0 14 MappingLeftGlove_1_3_0 15 MappingRightGlove_1_3_0 16 Mapping_4_X_Medical 17 Mapping_4_5_6 18 Mapping_5_1_0_Men 19 Mapping_5_1_0_Women 20


ts_mapper.TsLayout2dType#

Enumeration of layout types within a 2D mapping.

  • Undefined (0): Layout type not specified.
  • Electric (1): Electrical stimulation layout.
  • Temperature (2): Temperature feedback layout.
  • Vibration (3): Vibration feedback layout.
  • Emg (4): EMG sensor layout.
  • Ecg (5): ECG sensor layout.

Members

Undefined 0 Electric 1 Temperature 2 Vibration 3 Emg 4 Ecg 5


ts_mapper.TsLayout2dElementType#

Enumeration of element types within a 2D layout.

  • Undefined (0): Element type not specified.
  • Cell (1): Individual cell element.
  • Channel (2): Channel element.

Members

Undefined 0 Cell 1 Channel 2


ts_mapper.TsBone2dIndex#

Enumeration of bone indices used in 2D mapping and motion capture data.

  • Hips (0) through RightLittleDistal (49) cover the full humanoid skeleton including spine, limbs, and all finger segments for both hands.

Members

Hips 0 LeftUpperLeg 1 RightUpperLeg 2 LeftLowerLeg 3 RightLowerLeg 4 LeftFoot 5 RightFoot 6 Spine 7 Chest 8 UpperChest 9 Neck 10 Head 11 LeftShoulder 12 RightShoulder 13 LeftUpperArm 14 RightUpperArm 15 LeftLowerArm 16 RightLowerArm 17 LeftHand 18 RightHand 19 LeftThumbProximal 20 LeftThumbIntermediate 21 LeftThumbDistal 22 LeftIndexProximal 23 LeftIndexIntermediate 24 LeftIndexDistal 25 LeftMiddleProximal 26 LeftMiddleIntermediate 27 LeftMiddleDistal 28 LeftRingProximal 29 LeftRingIntermediate 30 LeftRingDistal 31 LeftLittleProximal 32 LeftLittleIntermediate 33 LeftLittleDistal 34 RightThumbProximal 35 RightThumbIntermediate 36 RightThumbDistal 37 RightIndexProximal 38 RightIndexIntermediate 39 RightIndexDistal 40 RightMiddleProximal 41 RightMiddleIntermediate 42 RightMiddleDistal 43 RightRingProximal 44 RightRingIntermediate 45 RightRingDistal 46 RightLittleProximal 47 RightLittleIntermediate 48 RightLittleDistal 49


ts_mapper.TsBone2dSide#

Enumeration of the surface side for a bone in 2D mapping.

  • Undefined (0): Side not specified.
  • Front (1): Front-facing surface.
  • Back (2): Back-facing surface.

Members

Undefined 0 Front 1 Back 2


ts_mapper.TsBiomechanicalIndex#

Enumeration of biomechanical joint-angle indices used in mocap data.

Each value identifies a specific plane of movement for a joint, covering pelvis, hip, knee, ankle, elbow, forearm, wrist, and shoulder joints for both left and right sides.

Members

PelvisTilt 0 PelvisList 1 PelvisRotation 2 HipFlexExtR 3 HipAddAbdR 4 HipRotR 5 KneeFlexExtR 6 AnkleFlexExtR 7 AnkleProSupR 8 HipFlexExtL 9 HipAddAbdL 10 HipRotL 11 KneeFlexExtL 12 AnkleFlexExtL 13 AnkleProSupL 14 ElbowFlexExtR 15 ForearmProSupR 16 WristFlexExtR 17 WristDeviationR 18 ElbowFlexExtL 19 ForearmProSupL 20 WristFlexExtL 21 WristDeviationL 22 ShoulderAddAbdR 36 ShoulderRotR 37 ShoulderFlexExtR 38 ShoulderAddAbdL 39 ShoulderRotL 40 ShoulderFlexExtL 41