Robotics.dev AI robotics app builder
Project description
ROBOTICS.DEV App Builder
Run P2P AI Robotics.dev apps anywhere!
pip install robotics-dev
Usage:
await robotics.connect({
'server': 'ws://192.168.0.47:3001',
'robot': 'eeeaa722-...-9a53-c945a5822b60',
'token': '5a66b323-...-9169-77a95014f339'
}, handle_message)
robotics.speak('eeeaa722-...-9a53-c945a5822b60', 'this is a test')
robotics.twist('eeeaa722-...-9a53-c945a5822b60', forward_twist)
Here's an example python script:
import asyncio
import signal
import base64
import sys
from pathlib import Path
# Add the src directory to Python path for local testing
src_path = Path(__file__).parent.parent / 'src'
sys.path.append(str(src_path))
# Import for local testing
from robotics_dev.robotics import robotics
# For production, use:
# from robotics_dev import robotics
# Create twist message for moving forward at 20% speed
forward_twist = {
"linear": {
"x": 0.2, # 20% forward velocity
"y": 0.0,
"z": 0.0
},
"angular": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
}
# Create stop twist message
stop_twist = {
"linear": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"angular": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
}
one_time = True
async def handle_message(ros_message):
global one_time
# ros_message is already parsed by the SDK
print('Received p2p data:', ros_message)
if one_time:
one_time = False
await robotics.speak('eeeaa722-...-9a53-c945a5822b60', 'this is a test')
print('Moving robot forward at 20% speed...')
await robotics.twist('eeeaa722-...-9a53-c945a5822b60', forward_twist)
# Stop after 5 seconds
await asyncio.sleep(5)
print('Stopping robot...')
await robotics.twist('eeeaa722-...-9a53-c945a5822b60', stop_twist)
async def main():
# Set up signal handlers for graceful shutdown
loop = asyncio.get_running_loop()
for sig in (signal.SIGINT, signal.SIGTERM):
loop.add_signal_handler(sig, lambda: asyncio.create_task(cleanup()))
try:
# Connect to robotics.dev
await robotics.connect({
'server': 'ws://192.168.0.47:3001',
'robot': 'eeeaa722-...-9a53-c945a5822b60',
'token': '5a66b323-...-9169-77a95014f339'
}, handle_message)
# Keep running until interrupted
while True:
await asyncio.sleep(1)
except asyncio.CancelledError:
print("Shutdown requested...")
except Exception as e:
print(f"Error: {e}")
async def cleanup():
print("Disconnecting...")
await robotics.disconnect()
# Stop the event loop
loop = asyncio.get_running_loop()
loop.stop()
if __name__ == "__main__":
asyncio.run(main())
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
robotics_dev-0.0.17.tar.gz
(11.5 kB
view details)
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 robotics_dev-0.0.17.tar.gz.
File metadata
- Download URL: robotics_dev-0.0.17.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0981d1d899fcdf95b92431fcded472db66df1907067f292043cc44dea525d2ef
|
|
| MD5 |
48098cd895df69599a5512fdb09768b6
|
|
| BLAKE2b-256 |
37328dbcaedfd218158b4572eda09b450cab8f7ce0bb44adbe5feba07061a17c
|
File details
Details for the file robotics_dev-0.0.17-py3-none-any.whl.
File metadata
- Download URL: robotics_dev-0.0.17-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
087446fca6c78e673ac435c93169feaf225ca76519f316d286159c80f84e4929
|
|
| MD5 |
4381c2591d8bb2bdc5cdd06589108050
|
|
| BLAKE2b-256 |
e91038339ba68e70492d303c18ddec3619db352caee309274d338faaedee1350
|