Skip to main content
Version: QTrobot V3

Camera

robot.camera is a plugin namespace exposing QTrobot's RealSense 3D camera — it's the only plugin currently available in the TypeScript/Node.js SDK. It must be enabled before use. These examples assume you already have a connected robot — see Connection if you haven't set one up yet.

Like the Python SDK, the camera is served by a separate process, qtrobot-realsense-driver, running on QTPC — not the main service hub. That's why it's a plugin: robot.camera only becomes available once you explicitly enable it. See the Python Camera tutorial for the full architecture breakdown (driver internals, default streams, config.yaml) if you want the details.

Setup

<script src="https://cdn.jsdelivr.net/npm/@luxai-qtrobot/robot-sdk/dist/qtrobot-sdk.umd.js"></script>
npm install @luxai-qtrobot/robot-sdk

Enable the plugin

Over a WebRTC connection, each plugin gets its own independent peer connection with its own media track:

const robot = await Robot.connectWebrtcMqtt(broker, robotId)
await robot.enablePluginWebrtcMqtt('camera', 'qtrobot-realsense-driver')

Intrinsics and depth scale

These are plain RPC calls:

const colorIntrinsics = await robot.camera!.getColorIntrinsics()
console.log('Color intrinsics:', colorIntrinsics)

const depthScale = await robot.camera!.getDepthScale()
console.log('Depth scale:', depthScale)

Show the live camera feed (WebRTC)

This is the full pattern from web/webrtc/camera.html — once the plugin is enabled, grab its video track and attach it to a <video> element:

const track = await robot.camera!.extra.receiveVideoTrack('/camera/color/image')
const videoEl = document.getElementById('video-el') as HTMLVideoElement
videoEl.srcObject = new MediaStream([track])

See the full example on GitHub for the connect/enable-plugin UI around it, and live-video-call.html for a complete two-way demo that combines this with sending your own camera/microphone to the robot (see Video and Audio).

Next steps

See the full robot.camera namespace in the TypeScript/Node.js API Reference, or head back to the Tutorials overview to explore Python or ROS2.