Motor
robot.motor lists motors, controls torque/homing/velocity, and streams joint state, errors, and commands. These examples assume you already have a connected robot — see Connection if you haven't set one up yet.
Setup
mkdir ~/example
cd ~/example
python -m venv .venv
# or: uv venv .venv
source .venv/bin/activate
pip install luxai-robot
# or: uv pip install luxai-robot
Connect
from luxai.robot.core import Robot
robot = Robot.connect_zmq(robot_id="QTRD000123")
print(f"connected to {robot.robot_id} ({robot.robot_type})")
See Connection for MQTT, WebRTC, and other connection options.
List motors
# List all configured motors and their parameters
motors = robot.motor.list()
for name, info in motors.items():
Logger.info(f" {name}: {info}")
Torque control
import time
# Disable torque on a single motor, wait, then re-enable it
robot.motor.off("HeadYaw")
time.sleep(2)
robot.motor.on("HeadYaw")
# Or affect every motor at once:
# robot.motor.on_all()
# robot.motor.off_all()
Homing
# Move a single motor to its home position
robot.motor.home("HeadYaw")
# Move all motors to their home positions
robot.motor.home_all()
Set velocity
# Set the default velocity for an individual motor
robot.motor.set_velocity("HeadYaw", 50)
Joint state stream
from luxai.robot.core.frames import JointStateFrame
def on_joint_state(data: JointStateFrame):
for joint in data.joints():
Logger.info(
f"[{joint}] pos: {data.position(joint):.2f}, vel: {data.velocity(joint):.1f}, "
f"eff: {data.effort(joint):.1f}, temp: {data.temperature(joint):.1f}, volt: {data.voltage(joint):.1f}"
)
def on_joint_error(data):
Logger.warning(f"Joint error: {data.value}")
robot.motor.stream.on_joints_state(on_joint_state)
robot.motor.stream.on_joints_error(on_joint_error)
Joint command stream
import time
from luxai.robot.core.frames import JointCommandFrame
# Open a writer and send direct joint position/velocity commands
writer = robot.motor.stream.open_joints_command_writer()
cmd = JointCommandFrame()
cmd.set_joint("HeadYaw", position=30, velocity=40)
writer.write(cmd)
time.sleep(2)
# Return to home
cmd2 = JointCommandFrame()
cmd2.set_joint("HeadYaw", position=0, velocity=20)
writer.write(cmd2)
Next steps
Continue with the Kinematics tutorial, or see the full robot.motor namespace in the Python API Reference.