Skip to main content
Version: QTrobot V3

QTrobot ROS2 API Reference

The QTrobot ROS2 gateway exposes the robot's capabilities as standard ROS2 services and topics, all under the /qtrobot/ namespace, defined in the qtrobot_interfaces package. See Connection for installation instructions.

Two independent gateway nodes are available — launch the ones you need:

GatewayModuleConnects toLaunch
QTrobotgateway.qtrobot_ros2qtrobot-service-hub (robot API)python -m gateway.qtrobot_ros2 --ros-args -p robot_ip:=<ROBOT_IP> -r __ns:=/qtrobot
RealSensegateway.realsense_ros2qtrobot-realsense-driver (camera/IMU, camera)python -m gateway.realsense_ros2 --ros-args -p realsense_ip:=<ROBOT_IP> -r __ns:=/qtrobot
ParameterGatewayDefaultDescription
robot_ipQTrobot127.0.0.1IP address of the QTrobot service hub.
realsense_ipRealSense127.0.0.1IP address of the RealSense driver host.
rpc_timeoutboth30.0Service call timeout, in seconds.

Both gateways are remapped onto the same /qtrobot namespace above, so they appear as one consistent API even though they're separate processes — this is why the camera/IMU services and topics below are documented alongside everything else, but require the RealSense gateway specifically to be running.

Not exposed over ROS2

ASR (speech recognition) and kinematics are available in the Python API but are not yet bridged to ROS2 — there are no /qtrobot/asr/... or /qtrobot/kinematics/... interfaces.

Discovering the API

Every service, topic, and message type is fully self-describing in ROS2 — the tables below are a curated map, but the robot's own introspection tools are the source of truth and will never go stale:

# Confirm the gateway(s) are running
ros2 node list

# List everything QTrobot exposes
ros2 service list | grep qtrobot
ros2 topic list | grep qtrobot

# Look up the type of a specific service/topic
ros2 service type /qtrobot/tts/engine/say/text
ros2 topic type /qtrobot/motor/joints/state/stream

# Inspect the exact request/response or message fields
ros2 interface show qtrobot_interfaces/srv/TtsEngineSayText
ros2 interface show qtrobot_interfaces/msg/MotorJointsStateFrame

# Check a topic's live publish rate and subscriber/publisher count
ros2 topic info /qtrobot/motor/joints/state/stream -v

Core concepts

Every service response includes a status field (bool) indicating success, alongside a result field where applicable. A call that times out or fails raises the usual rclpy service-call error for its rpc_timeout window (see the launch parameters above).

Calling a service and subscribing to a topic both follow the standard rclpy patterns:

import rclpy
from rclpy.node import Node
from qtrobot_interfaces.srv import TtsEngineSayText
from qtrobot_interfaces.msg import MotorJointsStateFrame

class Example(Node):
def __init__(self):
super().__init__('example')
# Service client
self.tts_client = self.create_client(TtsEngineSayText, '/qtrobot/tts/engine/say/text')
# Topic subscriber
self.create_subscription(MotorJointsStateFrame, '/qtrobot/motor/joints/state/stream', self.on_state, 10)

def say(self, text: str):
req = TtsEngineSayText.Request()
req.text = text
future = self.tts_client.call_async(req)
rclpy.spin_until_future_complete(self, future)
return future.result()

def on_state(self, msg: MotorJointsStateFrame):
for joint in msg.joints:
self.get_logger().info(f'{joint.name}: {joint.position}')

The same shape applies to every service/topic below — only the request fields, message fields, and topic name change. See Connection for a full service-call walkthrough, and Motor or Microphone for topic-subscription walkthroughs.

On this page: tts · face · gesture · motor · media · speaker · microphone · camera


tts

ServiceTypeParameters
/qtrobot/tts/engine/say/textTtsEngineSayTexttext, lang, voice, pitch, rate, volume, style, engine
/qtrobot/tts/engine/say/ssmlTtsEngineSaySsmlssml, engine
/qtrobot/tts/engine/cancelTtsEngineCancelengine (optional)
/qtrobot/tts/engines/listTtsEnginesList
/qtrobot/tts/engine/voices/getTtsEngineVoicesGetengine (optional)
/qtrobot/tts/engine/languages/getTtsEngineLanguagesGetengine (optional)
/qtrobot/tts/default_engine/getTtsDefaultEngineGet
/qtrobot/tts/default_engine/setTtsDefaultEngineSetengine
/qtrobot/tts/engine/configure/getTtsEngineConfigureGetengine (optional)
/qtrobot/tts/engine/configure/setTtsEngineConfigureSetconfig (JSON dict), engine (optional)
/qtrobot/tts/engine/supports/ssmlTtsEngineSupportsSsmlengine (optional)
ros2 service call /qtrobot/tts/engine/say/text qtrobot_interfaces/srv/TtsEngineSayText \
"{text: 'Hello, I am QTrobot.'}"

ros2 service call /qtrobot/tts/engine/cancel qtrobot_interfaces/srv/TtsEngineCancel "{}"

face

ServiceTypeParameters
/qtrobot/face/emotion/listFaceEmotionList
/qtrobot/face/emotion/showFaceEmotionShowemotion (string, required), speed (float)
/qtrobot/face/emotion/stopFaceEmotionStop
/qtrobot/face/lookFaceLookl_eye, r_eye (JSON list), duration (float)
ros2 service call /qtrobot/face/emotion/show qtrobot_interfaces/srv/FaceEmotionShow \
"{emotion: 'QT/happy'}"

ros2 service call /qtrobot/face/emotion/stop qtrobot_interfaces/srv/FaceEmotionStop "{}"

gesture

ServiceTypeParameters
/qtrobot/gesture/file/listGestureFileList
/qtrobot/gesture/file/playGestureFilePlaygesture (required), speed_factor (float)
/qtrobot/gesture/playGesturePlaykeyframes (JSON dict), rate_hz, speed_factor, resample
/qtrobot/gesture/cancelGestureCancel
/qtrobot/gesture/record/startGestureRecordStartmotors (JSON list), timeout_ms, release_motors, ...
/qtrobot/gesture/record/stopGestureRecordStop
/qtrobot/gesture/record/storeGestureRecordStoregesture (required)
ros2 service call /qtrobot/gesture/file/play qtrobot_interfaces/srv/GestureFilePlay \
"{gesture: 'QT/send_kiss'}"

Stream: progress

TopicTypeRateDescription
/qtrobot/gesture/progress/streamGestureProgressFramestreamingGesture playback progress (0–100%) and elapsed time (µs)
ros2 topic echo /qtrobot/gesture/progress/stream

motor

ServiceTypeParameters
/qtrobot/motor/listMotorList
/qtrobot/motor/onMotorOnmotor (required)
/qtrobot/motor/on/allMotorOnAll
/qtrobot/motor/offMotorOffmotor (required)
/qtrobot/motor/off/allMotorOffAll
/qtrobot/motor/move/homeMotorMoveHomemotor (required)
/qtrobot/motor/move/home/allMotorMoveHomeAll
/qtrobot/motor/velocity/setMotorVelocitySetmotor, velocity (required)
ros2 service call /qtrobot/motor/on/all qtrobot_interfaces/srv/MotorOnAll "{}"
ros2 service call /qtrobot/motor/move/home/all qtrobot_interfaces/srv/MotorMoveHomeAll "{}"
ros2 service call /qtrobot/motor/velocity/set qtrobot_interfaces/srv/MotorVelocitySet \
"{motor: 'HeadYaw', velocity: 50}"

Stream: joint state, errors, and commands

TopicTypeRateDescription
/qtrobot/motor/joints/state/streamMotorJointsStateFrame10 HzPer-joint position (deg), velocity (deg/s), effort (Nm), voltage (V), temperature (°C)
/qtrobot/motor/joints/error/streamMotorJointsErrorFrameon changePer-joint error flags: overload, voltage, temperature, sensor
/qtrobot/motor/joints/command/streamMotorJointsCommandFrame(subscribed)Send joint position/velocity commands to the robot

MotorJointsStateFrame carries a joints array of MotorJointState entries (name, position, velocity, effort, voltage, temperature). MotorJointsCommandFrame carries a joints array of MotorJointCommand entries (name, position, velocity).

ros2 topic echo /qtrobot/motor/joints/state/stream

media

ServiceParameters
/qtrobot/media/audio/fg/file/playuri (required)
/qtrobot/media/audio/fg/file/pause / resume / cancel
/qtrobot/media/audio/fg/volume/get / setvalue (0.0–1.0)
/qtrobot/media/audio/fg/stream/pause / resume / cancel
/qtrobot/media/audio/bg/*Background audio — same API as fg
/qtrobot/media/video/fg/file/playuri (required), speed, with_audio
/qtrobot/media/video/fg/file/pause / resume / cancel
/qtrobot/media/video/fg/set_alphavalue (0.0–1.0)
/qtrobot/media/video/fg/stream/pause / resume / cancel
/qtrobot/media/video/bg/*Background video — same API as fg
ros2 service call /qtrobot/media/audio/fg/file/play qtrobot_interfaces/srv/MediaAudioFgFilePlay \
"{uri: '/data/audio/hello.wav'}"

Streamed audio/video

TopicTypeDescription
/qtrobot/media/audio/fg/stream / bg/streamAudioFrameRawStream PCM audio to the foreground/background player
/qtrobot/media/video/fg/stream / bg/streamImageFrameRawStream image frames to the foreground/background display

speaker

ServiceTypeParameters
/qtrobot/speaker/volume/getSpeakerVolumeGet
/qtrobot/speaker/volume/setSpeakerVolumeSetvalue (0.0–1.0)
/qtrobot/speaker/volume/muteSpeakerVolumeMute
/qtrobot/speaker/volume/unmuteSpeakerVolumeUnmute
ros2 service call /qtrobot/speaker/volume/set qtrobot_interfaces/srv/SpeakerVolumeSet "{value: 0.8}"

microphone

ServiceParameters
/qtrobot/microphone/int/tunning/get
/qtrobot/microphone/int/tunning/setname, value

Stream: audio and voice activity

TopicTypeDescription
/qtrobot/mic/int/audio/ch0ch4/streamAudioFrameRawInternal mic (ch0 beamformed, ch1–4 raw)
/qtrobot/mic/ext/audio/ch0/streamAudioFrameRawExternal mic
/qtrobot/mic/int/event/streamMicEventFrameVoice activity (activity: bool) and direction of arrival (direction: int32, 0–359°)
ros2 topic echo /qtrobot/mic/int/event/stream

camera

The 3D camera and IMU come from a separate gateway process (gateway.realsense_ros2, see the launch table above) — start it alongside the QTrobot gateway to use these services and topics.

ServiceType
/qtrobot/camera/color/intrinsicsCameraColorIntrinsics
/qtrobot/camera/depth/intrinsicsCameraDepthIntrinsics
/qtrobot/camera/depth/scaleCameraDepthScale
ros2 service call /qtrobot/camera/depth/scale qtrobot_interfaces/srv/CameraDepthScale "{}"

Stream: images and IMU

TopicTypeRateDescription
/qtrobot/camera/color/imageImageFrameRaw15 HzRGB color image (default 848×480)
/qtrobot/camera/depth/imageImageFrameRaw15 HzRaw depth image (Z16, in depth units)
/qtrobot/camera/depth/aligned/imageImageFrameRaw15 HzDepth aligned to color frame
/qtrobot/camera/depth/color/imageImageFrameRaw15 HzColorized depth for visualization
/qtrobot/camera/gyroImuFrame200 HzRequires use-gyro on the driver
/qtrobot/camera/accelerationImuFrame63 HzRequires use-accel on the driver

ImuFrame carries x, y, z — angular velocity (rad/s) for gyro, linear acceleration (m/s²) for acceleration.

ros2 topic hz /qtrobot/camera/color/image
ros2 topic echo /qtrobot/camera/depth/aligned/image --field encoding

See the ROS2 Tutorials for full node examples (service clients, topic subscribers/publishers, and the RealSense gateway).