RBQ SDK — Python Overview
The RBQ Python SDK (rbq_sdk/python/) is a Python package (rbq_sdk_py) that wraps the same CycloneDDS infrastructure as the C++ SDK, exposing SportClient API and DDS channel utilities in pure Python.
Package layout
rbq_sdk/python/
├── rbq_sdk_py/
│ ├── core/
│ │ └── channel.py # ChannelFactoryInitialize, ChannelPublisher, ChannelSubscriber
│ └── sport/
│ ├── sport_client.py # SportClient — Python binding to the Network service
│ └── sport_api.py # ID_DEFAULT_MODE, ID_RUNNING_MODE, ID_CLIMB_MODE constants
└── example/
├── sport/
│ ├── rbq_sport_client.py # Terminal CLI for SportClient commands
│ └── rbq_sport_client_joy.py # Joystick-driven SportClient
└── idl/
└── _rbq_idl/ # Generated Python IDL bindingsNote — examples under development:
rbq_high_level.pyandrbq_low_level.pyare currently in development and not yet released. Onlyrbq_sport_client.pyandrbq_sport_client_joy.pyare available.
Requirements
| Item | Minimum |
|---|---|
| OS | Ubuntu 22.04 |
| Python | 3.8 or later |
| CycloneDDS Python binding | Installed via rbq_sdk/python/setup.py |
Install
cd rbq_sdk/python
pip install -e .Initialize DDS
from rbq_sdk_py.core.channel import ChannelFactoryInitialize
# argv[1] is the network interface, e.g. "eth0"
ChannelFactoryInitialize(0, nic)Pass None (or omit the second argument) to let CycloneDDS auto-detect the interface.
SportClient
from rbq_sdk_py.sport.sport_client import SportClient
sport = SportClient()
sport.Init()
sport.BalanceStand()
sport.Move(vx=0.5, vy=0.0, vyaw=0.0)
sport.SwitchGait(ID_DEFAULT_MODE)
sport.Damp()Publishing custom messages
from rbq_sdk_py.core.channel import ChannelPublisher
# IDL types are imported from the example's _rbq_idl package
from _rbq_idl import HighLevelCommand_, Bool_
pub = ChannelPublisher("rt/rbq/cmd/highLevel", HighLevelCommand_)
pub.Init()
msg = HighLevelCommand_()
msg.gait_state = 1
msg.vel_x = 0.5
pub.Write(msg)Subscribing to messages
from rbq_sdk_py.core.channel import ChannelSubscriber
from _rbq_idl import Imu_
def on_imu(sample):
print(sample.angular_velocity.x)
sub = ChannelSubscriber("rt/rbq/info/imu", Imu_)
sub.Init(handler=on_imu, queueLen=4)Joystick (Linux /dev/input/js*)
The Python examples include a self-contained Joy class that reads raw Linux joystick events without any external dependency:
joy = Joy("/dev/input/js0")
joy.open()
while True:
joy.poll()
lx = deadzone(joy.ax[AXIS_LX], DEADZONE)
ly = deadzone(joy.ax[AXIS_LY], DEADZONE)
joy.end_frame()
time.sleep(0.01)The pick_joy_path(argv) helper auto-detects a connected gamepad (prefers Logitech/Xbox/Wireless by name, then falls back to the first /dev/input/js* node).
Example programs
| Example | What it demonstrates |
|---|---|
| Sport Client (Python) | Terminal CLI for all SportClient commands |
| Sport Client Joystick (Python) | Gamepad-driven SportClient with full button mapping |
Related documentation
- C++ SDK Overview — equivalent C++ implementation
- ROS2 SDK — ROS 2 interface
