Python TS API
The TsApi class serves as the central interface for interacting with the Teslasuit API. It provides access to core functionalities, including device management, asset management, and mapping subsystems. This class is essential for initializing and managing the Teslasuit API and its associated components.
Class TsApi#
The TsApi class is an aggregate class that initializes the Teslasuit API and provides access to its core components, such as the device manager, mapper, and asset manager.
Attributes#
mapper(TsMapper) — Provides 2D channel/bone mapping for the connected device.asset_manager(TsAssetManager) — Handles loading and unloading of haptic assets.
Constructor#
TsApi(lib_path=None)#lib_path (str, optional): Absolute path to the teslasuit_api.dll (Windows) or libteslasuit_api.so (Linux) native library. If omitted, the SDK checks the TESLASUIT_API_LIB_PATH environment variable, then falls back to a system PATH search. Non-admin accounts often need this configured explicitly — see Configure the native library path.
Class methods#
get_device_manager(self)#Returns the TsDeviceManager instance, which provides access to connected Teslasuit devices.
Returns:
- TsDeviceManager: The device manager instance.
Usage example#
from teslasuit_sdk.ts_api import TsApi
# Initialize the API
api = TsApi(lib_path="/path/to/libteslasuit_api.dylib")
# Access the device manager
device_manager = api.get_device_manager()
# Perform operations with the device manager
# ...Notes#
- The
TsApiclass must be initialized before accessing any Teslasuit functionalities.
What to read next#
Explore these references and guides to build on TsApi and get the most out of the Teslasuit core API:
Essential API references#
- API: Device Manager: Access and manage connected devices through the manager returned by
get_device_manager(). - API: Mapper: Work with the 2D channel/bone mapping exposed via the
mapperattribute. - API: Asset Manager: Load and unload haptic assets through the
asset_managerattribute. - API: Device: The
TsDeviceentry point for interacting with a connected suit and its subsystems.
Practical guides & examples#
- Getting Started: Install the SDK, configure the native library path, and connect your first device.
- Examples Overview: End-to-end code samples that start from
TsApiinitialization.
Deeper dives & broader concepts#
- Teslasuit Main Concepts: Fundamental articles covering Teslasuit's core technology and how its subsystems interact.
