Mapper
The Mapper subsystem provides functionality to handle 2D mapping of device elements, including layouts, bones, and their associated data.
Note. Since TsMapper interacts with device mappings, it cannot be used independently without an active Teslasuit device.
Class TsMapper#
Mapping represents a set of device's elements mapped on 2d space. Elements are described by the 2D Polygon - an array of points. Elements are bound to bones, a full set of bones is included in a layout, multiple layouts with the same element types are contained in an array, an array of layouts with same type are packed by TsLayout2dType and TsLayout2dElementType. Mappings might have different versions. Mapping can be requested by a mapping version or by a device handler because each device has a bound mapping version by default.
Class methods#
get_mapping_by_device(self, device)#Get the default mapping handler for a device.
Args:
device class(TsDevice): Device handle.
Returns:
TsMapping2d: Mapping handler.
get_mapping_by_version(self, version)#Get the mapping handler by the mapping version.
Args:
version(TsMapping2dVersion): Mapping version.
Returns:
TsMapping2d: Mapping handler.
get_number_of_layouts(self, mapping)#Get the number of layouts in the mapping.
Args:
mappingTsMapping2d: Mapping handler.
Returns:
int: Number of layouts.
get_layouts(self, mapping)#Get all layouts in the mapping.
Args:
mappingTsMapping2d: Mapping handler.
Returns:
list: List of layouts.
get_layout_index(self, layout)#Get the index of a layout.
Args:
layout(TsLayout): Layout handle.
Returns:
int: Layout index.
get_layout_type(self, layout)#Get the type of a layout.
Args:
layoutTsLayout: Layout handle.
Returns:
int: Layout type.
get_layout_element_type(self, layout)#Get the element type of a layout.
Args:
layoutTsLayout: Layout handle.
Returns:
int: Layout element type.
get_number_of_bones(self, layout)#Get the number of bones in a layout.
Args:
layoutTsLayout: Layout handle.
Returns:
int: Number of bones.
get_layout_bones(self, layout)#Get all bones in a layout.
Args:
layoutTsLayout: Layout handle.
Returns:
list: List of bones.
get_bone_index(self, bone_handle)#Get the index of a bone.
Args:
bone_handleTsBone: Bone handle.
Returns:
int: Bone index.
get_bone_side(self, bone_handle)#Get the side of a bone.
Args:
bone_handleTsBone: Bone handle.
Returns:
int: Bone side.
get_bone_number_of_contents(self, bone_handle)#Get the number of contents in a bone.
Args:
bone_handleTsBone: Bone handle.
Returns:
int: Number of contents.
get_bone_contents(self, bone_handle)#Get all contents of a bone.
Args:
bone_handleTsBone: Bone handle.
Returns:
list: List of bone contents.
get_bone_number_of_points(self, bone_handle)#Get the number of points in a bone content.
Args:
bone_handleTsBone: Bone handle.
Returns:
int: Number of points.
get_bone_points(self, bone_handle)#Get the points representing the shape of a bone content in 2D space.
Args:
bone_handleTsBone: Bone handle.
Returns:
list: List of points.
get_haptic_electric_channel_layout(self, mapping)#Get the electric channel layout for haptic feedback.
Args:
mappingTsMapping2d: Mapping handler.
Returns:
- TsLayout: Electric channel layout handle.
Mapping utils#
get_layout_by_type(self, mapping, layout_type, layout_element_type)#Get a layout by its type and element type.
Args:
mappingTsMapping2d: Mapping handler.layout_type(int): Layout type.layout_element_type(int): Layout element type.
Returns:
- TsLayout: Layout handle.
What to read next#
Explore these references and tools to put the mapper to work mapping bones and channels:
Essential API references#
- API: Device: Retrieve the default mapping for a device via
get_mapping(). - API: Core Data Structures: Reference for
TsMapping2d,TsLayout,TsBone, and related types. - API: Haptic Subsystem: See how channel layouts feed haptic playback.
Interactive & visual tools#
- Body & Channel Map: Explore an interactive visualization of how bones map to physical haptic and EMS channels.
Practical guides & examples#
- Examples Overview: Step-by-step code samples that use mapping data.
Deeper dives & broader concepts#
- Teslasuit Main Concepts: Fundamental articles covering Teslasuit's core technology and how its subsystems interact.
