Python SDK for the TNY-360 robotics platform.
Project description
tny-robotics-sdk
The official Python SDK for all TNY Robotics robots
🚀 Overview
tny-robotics-sdk provides a clean, asynchronous API to communicate with your TNY Robotics robot.
It handles all the complex binary WebSocket framing and event loop bindings under the hood using asyncio, letting you focus on building advanced robotics applications, telemetry scripts, or AI/control algorithms.
✨ Features
- Native Async: Built entirely on top of
asyncioandwebsocketsfor high-performance, non-blocking I/O. - Fully Typed: Strict type hints and
TypedDictimplementations for excellent auto-completion and Developer Experience (DX) in VS Code, PyCharm, etc. - Modular: Access robot features cleanly through dedicated modules (
robot.system,robot.joint,robot.power, etc.).
📦 Installation
Install the package using pip (or your preferred environment manager like poetry or pipenv):
pip install tny-robotics-sdk
💻 Quick Start
Here is a simple example to connect to your TNY-360 and test the connection latency:
import asyncio
import time
from tny_robotics import TNY360
async def main():
print('Creating TNY-360 instance...')
# Replace with your robot's IP address
robot = TNY360('192.168.4.1')
try:
print('Connecting to TNY-360...')
await robot.connect()
print('Connected successfully!')
except Exception as err:
print('Connection error:', err)
return
# Ping test
print('Sending pings...')
start = time.time()
for _ in range(10):
await robot.system.ping()
end = time.time()
# Calculate average time in milliseconds
avg_time = ((end - start) * 1000) / 10
print(f"Average response time: {avg_time:.2f} ms.")
# Clean disconnect
await robot.disconnect()
if __name__ == '__main__':
asyncio.run(main())
🧩 API Structure
The SDK is organized into intuitive modules. Here are some examples of what you can do:
System & Settings
# Get robot statistics
stats = await robot.system.get_statistics()
print(f"Temperature: {stats['temp_c']}°C, CPU0 Usage: {stats['cpu_usage']['core0']}%")
# Change AutoLife mode
from tny_robotics import AutoLifeLevel
await robot.system.set_auto_life_level(AutoLifeLevel.Safeguard)
Motion & Joints
import math
from tny_robotics import MotorId
# Set the front-right knee joint to 30 degrees (converted to radians)
await robot.joint.set_angle(MotorId.FrontRightKneePitch, 30 * (math.pi / 180))
# Get the current angle of the back-left hip roll joint
cur_angle = await robot.joint.get_feedback_angle(MotorId.BackLeftHipRoll)
print(f"Current Hip Roll Angle: {cur_angle * (180 / math.pi):.2f} degrees")
Sensors & Telemetry (Coming soon)
# Subscribe to continuous Lidar distance updates
# (Implementation in progress)
🤝 Contributing
This SDK is part of the open-source TNY-Robotics ecosystem. Found a bug or want to add a new module? Open an Issue or submit a Pull Request!
📄 License
This SDK is licensed under the MIT License. You are free to use it in your open-source or commercial applications, just include the copyright notice.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tny_robotics_sdk-0.9.1.tar.gz.
File metadata
- Download URL: tny_robotics_sdk-0.9.1.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34f57ce6cdc37a72fe79b8479e03686b49801f8be7234dc783d9869921e1de30
|
|
| MD5 |
6a1346133f600f1779bbd2e6faf2ff60
|
|
| BLAKE2b-256 |
6637fa52018ee97cb55dabe9889b497cb1d3e077c65c69d2cae1435edd6459e6
|
Provenance
The following attestation bundles were made for tny_robotics_sdk-0.9.1.tar.gz:
Publisher:
publish.yml on TNY-Robotics/SDK-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tny_robotics_sdk-0.9.1.tar.gz -
Subject digest:
34f57ce6cdc37a72fe79b8479e03686b49801f8be7234dc783d9869921e1de30 - Sigstore transparency entry: 1779752655
- Sigstore integration time:
-
Permalink:
TNY-Robotics/SDK-Python@e5d4165ff214c9c429aa3d5073d2305bbda55901 -
Branch / Tag:
refs/tags/v0.9.1 - Owner: https://github.com/TNY-Robotics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e5d4165ff214c9c429aa3d5073d2305bbda55901 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tny_robotics_sdk-0.9.1-py3-none-any.whl.
File metadata
- Download URL: tny_robotics_sdk-0.9.1-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93fb4a9a7334ee0b56f340b7192f031630645fa631e3130aef70a687aeda5872
|
|
| MD5 |
c17a7024487263442e9d73a544813120
|
|
| BLAKE2b-256 |
3ab173993ad836e0ba1da716fc8d1e9ddbf448922f1eefe49c3a1d2694db102e
|
Provenance
The following attestation bundles were made for tny_robotics_sdk-0.9.1-py3-none-any.whl:
Publisher:
publish.yml on TNY-Robotics/SDK-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tny_robotics_sdk-0.9.1-py3-none-any.whl -
Subject digest:
93fb4a9a7334ee0b56f340b7192f031630645fa631e3130aef70a687aeda5872 - Sigstore transparency entry: 1779753844
- Sigstore integration time:
-
Permalink:
TNY-Robotics/SDK-Python@e5d4165ff214c9c429aa3d5073d2305bbda55901 -
Branch / Tag:
refs/tags/v0.9.1 - Owner: https://github.com/TNY-Robotics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e5d4165ff214c9c429aa3d5073d2305bbda55901 -
Trigger Event:
push
-
Statement type: