Python SDK for Cyberwave
Project description
Cyberwave Python SDK
The official Python SDK for Cyberwave. Create, control, and simulate robotics with ease.
Installation
pip install cyberwave
Quick Start
1. Get Your Token
Get your API token from the Cyberwave platform:
- Log in to your Cyberwave instance
- Navigate to Profile → API Tokens
- Create a token and copy it
2. Create Your First Digital Twin
from cyberwave import Cyberwave
# Configure with your token
cw = Cyberwave(
token="your_token_here",
)
# Create a digital twin from an asset
robot = cw.twin("the-robot-studio/so101")
# Change position and rotation in the environemtn
robot.edit_positon(x=1.0, y=0.0, z=0.5)
robot.edit_rotation(yaw=90) # degrees
# Move the robot arm to 30 degrees
robot.joints.set("1", 30)
# Get current joint positions
print(robot.joints.get_all())
Core Features
Working with Workspaces and Projects
from cyberwave import Cyberwave
cw = Cyberwave(
token="your_token_here"
)
# You can also set your token as an environment variable: export CYBERWAVE_TOKEN=your_token_here
# in that case, you can simply do:
cw = Cyberwave()
# List workspaces
workspaces = cw.workspaces.list()
print(f"Found {len(workspaces)} workspaces")
# Create a project
project = cw.projects.create(
name="My Robotics Project",
workspace_id=workspaces[0].uuid
)
# Create an environment
environment = cw.environments.create(
name="Development",
project_id=project.uuid
)
Managing Assets and Twins
# To instantiate a twin, you can query the available assets from the catalog.
# This query will return both the public assets availaable at cyberwave.com/catalog and the private assets available to your organization.
assets = cw.assets.search("so101")
robot = cw.twin(assets[0].registry_id) # the registry_id is the unique identifier for the asset in the catalog. in this case it's the-robot-studio/so101
# Edit the twin to a specific position
robot.edit_position([1.0, 0.5, 0.0])
# Update scale
robot.edit_scale(x=1.5, y=1.5, z=1.5)
# Move a joint to a specific position using radians
robot.joints.set("shoulder_joint", math.pi/4)
# You can also use degrees:
robot.joints.set("shoulder_joint", 45, degrees=True)
# You can also go a get_or_create for a specific twin an environment you created:
robot = cw.twin("the-robot-studio/so101", environment_id="YOUR_ENVIRONMENT_ID")
Environment Variables
If you are always using the same environment, you can set it as a default with the CYBERWAVE_ENVIRONMENT_ID environment variable:
export CYBERWAVE_ENVIRONMENT_ID="YOUR_ENVIRONMENT_ID"
export CYBERWAVE_TOKEN="YOUR_TOKEN"
python your_script.py
And then you can simply do:
from cyberwave import Cyberwave
cw = Cyberwave()
robot = cw.twin("the-robot-studio/so101")
This code will return you the first SO101 twin in your environment, or create it if it doesn't exist.
Video Streaming (WebRTC)
Stream camera feeds to your digital twins using WebRTC.
To stream you will need to install FFMPEG if you don't have it.
On Mac with brew:
brew install ffmpeg pkg-config
On Ubuntu:
sudo apt-get install ffmpeg
Then install the additional deps for camera streaming, you can select between standard cameras or intel realsense ones:
# Install with camera support
pip install cyberwave[camera]
pip install cyberwave[realsense]
import asyncio
from cyberwave import Cyberwave
# Initialize client
cw = Cyberwave()
camera = cw.twin("cyberwave/standard-cam")
# Start streaming
async def stream_camera():
await camera.start_streaming()
# Stream runs until stopped
await asyncio.sleep(60) # Stream for 60 seconds
await streamer.stop_streaming()
# Run the async function
asyncio.run(stream_camera())
Advanced Usage
Joint Control
You can change a specific joint actuation. You can use degrees or radiants:
robot = cw.twin("the-robot-studio/so101")
# Set individual joints (degrees by default)
robot.joints.set("shoulder_joint", 45, degrees=True)
# Or use radians
import math
robot.joints.set("elbow_joint", math.pi/4, degrees=False)
# Get current joint position
angle = robot.joints.get("shoulder_joint")
# List all joints
joint_names = robot.joints.list()
# Get all joint states at once
all_joints = robot.joints.get_all()
To check out the available endpoints and their parameters, you can refer to the full API reference here.
Changing data source
By default, the SDK will send data marked as arriving from the real world. If you want to send data from a simulated environment using the SDK, you can initialize the SDK as follows:
from cyberwave import Cyberwave
cw = Cyberwave(source_type="sim")
You can also use the SDK as a client of the Studio editor - making it appear as if it was just another editor on the web app. To do so, you can initialize it as follows:
from cyberwave import Cyberwave
cw = Cyberwave(source_type="edit")
Lastly, if you want to have your SDK act as a remote teleoperator, sending commands to the actual device from the cloud, you can init the SDK as follows:
from cyberwave import Cyberwave
cw = Cyberwave(source_type="tele")
Examples
Check the examples directory for complete examples:
- Basic twin control
- Multi-robot coordination
- Real-time synchronization
- Joint manipulation for robot arms
Testing
Unit Tests
Run basic import tests:
poetry install
poetry run python tests/test_imports.py
Support
- Documentation: docs.cyberwave.com
- Issues: GitHub Issues
- Community: Discord
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 cyberwave-0.2.23.tar.gz.
File metadata
- Download URL: cyberwave-0.2.23.tar.gz
- Upload date:
- Size: 156.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.9.25 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bee8d17a0f4f832ee36c5fd09fe73f3d8ac73d501c0e74f820893296fa97607
|
|
| MD5 |
166edf3ba5b4645545656c1693939d4f
|
|
| BLAKE2b-256 |
b45206586872f5c0f7a0e45ea60689cb280f72bb92a6f1634e0cad3507879bcf
|
File details
Details for the file cyberwave-0.2.23-py3-none-any.whl.
File metadata
- Download URL: cyberwave-0.2.23-py3-none-any.whl
- Upload date:
- Size: 347.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.9.25 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d199351594e4e6af93126dcecf8133214f0526b5bae660da0b82696d6d5680d2
|
|
| MD5 |
0e371e97a25c9ad3f9626c994ef54e39
|
|
| BLAKE2b-256 |
78ead22bc404c87ddf16accdb6ebbf4ceecea95901e18c8ad7a9d6e67628cdf5
|