Embodied City Python SDK
Project description
embodied-city-python-sdk
A Simple Python SDK to interact with the Embodied City API. Users can easily achieve perception and control of drone agents through the following functions. When the command is issued via the API, changes in the agent's first-person view will be observed in the Console.
Installation
pip install embodiedcity
Usage
Acquire ID and token
Before you can use the SDK, you need to acquire a drone and obtain its token. You can get one by signing up at Embodied City.
In the website, you should go to the "Console" page, choose an available drone, and click on the "Acquire" button. After that, you will see a token with the drone ID.
ATTENTION: The token is a secret key that should not be shared with anyone.
ATTENTION: The token will expire after a certain period of time if you do not use it. (the time constrain will be notified in the website)
Initialize the client
from embodiedcity import DroneClient, ImageType, CameraID
base_url = "https://embodied-city.fiblab.net"
drone_id = "xxx"
token = "xxxxxxxx"
client = DroneClient(base_url, drone_id, token)
Move the drone
# Move the drone forward by 10 meter (Short movement distance may result in action failure)
client.move_back_forth(10)
Obtain the RGB image of the front camera
# Get a RGB image from the front-center camera
image = client.get_image(ImageType.Scene, CameraID.FrontCenter)
Get the depth image
# Get an image of the depth from the front-center camera
image = client.get_image(ImageType.DepthPlanar, CameraID.FrontCenter)
Release the drone
After you finish using the drone, you should release it to make it available for others.
You can do this by clicking on the "Release" button in the "Console" page.
FAQ
After invoking the control action, the drone did not move.
It is possible that the drone collided with a building. Try issuing a command to move the drone in a direction without obstacles. Alternatively, use the function DroneClient.move_to_position to force it to a specified location.
What should I do if I need the drone to perform more complex operations?
Please download and install the full embodiedcity simulator.
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
File details
Details for the file embodiedcity-0.1.4.tar.gz
.
File metadata
- Download URL: embodiedcity-0.1.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe7d93a00dbc155847f0283e0c6b2fc15bfbff57d50cc8a87c9bfbe4c7fd3a51 |
|
MD5 | 6761a25bd9a0ed31bdb6e4feee25a04e |
|
BLAKE2b-256 | d6b59624c8779c844872666a149b5b7f5d3da91d63f81c88b86482f7bfad49d8 |
File details
Details for the file embodiedcity-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: embodiedcity-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e62be9699506877282c10ee3b6f6ddb23656c50bc54e7a81c014c1c96f86a230 |
|
MD5 | 1842e94436b753103d90543fef672a8c |
|
BLAKE2b-256 | 61959f87b4964292d496a49eb4a839d9fd15cf9b7fdb98d043a0596deb3a2378 |