ubicoders-vrsdk
Python SDK for controlling Ubicoders virtual
robots running in the Unity simulator. It is a thin binding over the Rust core
(vrobots-sdk), which speaks zenoh + iceoryx2 with FlatBuffers on the wire — so
the Python, C++ and Rust surfaces share one implementation and behave
identically.
pip install ubicoders-vrsdk
vrobots topic list # is the sim publishing, and under which id?
from vrsdk import VirtualRobot, RobotType
def main():
# ===== setup =====
mr = VirtualRobot(RobotType.MULTIROTOR, sys_id=1)
mr.connect()
cam = mr.mount_camera("left", "720p", "rgb8")
# ===== loop =====
while True:
s = mr.states
x, y, z = s.kin.lin_pos
print(f"State t={s.elapsed:.3f} pos=({x:.3f},{y:.2f},{z:.2f})")
mr.set_mr_pwm(1501, 1501, 1501, 1501)
if cam.fresh:
img = cam.image # numpy (h, w, c) uint8, top-down, RGB
mr.rate(100)
if __name__ == "__main__":
main()
main() does setup and then owns the loop. There is no base class, no runner
and no callbacks — the SDK never calls your code.
Things that surprise people
statesnever blocks and never fails. If the sim stops it keeps handing back the last snapshot; watchelapsed, or callwait_new_state(), to notice.- Images are RGB, not BGR. Rows are already flipped top-down and the stride
is tight, but channel order is the renderer's. For OpenCV:
cv2.cvtColor(cam.image, cv2.COLOR_RGB2BGR). - States and frames are separate streams. No frame belongs to any state;
compare
t_nswhen fusing. - Robots outlive the process. Attach with
sys_id; onlydelete()removes one. Letting the handle be collected closes the session and leaves the robot flying. - Camera resolution is robot-wide, not per camera.
mount_cameraadds one camera andunmount_cameraremoves one by name; the robot's other cameras are left alone either way. - Commands are setpoints and are never acknowledged. Proof that one landed
is
states.actuator.pwmechoing it back.
Errors and logging
Every failure raises vrsdk.VrError carrying a stable numeric code:
try:
mr.connect()
except vrsdk.VrError as e:
if e.code == vrsdk.err.TIMEOUT:
print("no sim on the wire:", e.detail)
The core's tracing events are bridged into Python logging on import;
vrsdk.init_logging("info") turns the volume up.
Requirements
CPython 3.8 through 3.13 and later, on x86-64 Windows or Linux (one cp38-abi3
wheel per OS covers every one of them), plus numpy. opencv-python is only needed by
the image example. Camera streams use shared memory and are therefore
same-host only; states, commands and services work across a network with
VirtualRobot(..., router="tcp/<host>:7447").
Examples
The full series lives in examples/python: hello
states, control, image, service, car.
Release files for ubicoders-vrsdk 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ubicoders_vrsdk-0.1.7-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| ubicoders_vrsdk-0.1.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
Total release size: 15.9 MB
Release files / ubicoders_vrsdk-0.1.7-cp38-abi3-win_amd64.whl
| Download URL | ubicoders_vrsdk-0.1.7-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 7.9 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8e65bfda272b7cdc11e20798dae08a14f40a2b2700462749c8d96119eaf8f42d
|
|
BLAKE2b-256 checksum How to use checksums |
fe5befc736b5b5b683ef3d2f97470521a3051dca23abd0df432169a2cc8580f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / ubicoders_vrsdk-0.1.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ubicoders_vrsdk-0.1.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.0 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a59b9cc478d440377672885f448df8bf80bdec75914cf1b59d58921222bede63
|
|
BLAKE2b-256 checksum How to use checksums |
fa2875a10e2841244958c672a87f2cd49b0e3d4437c4df61e84a3269014f58f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|