Face and Emotion
robot.face controls QTrobot's face display — playing emotion animations and moving the eyes. 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 emotions
# List all available emotion files on the robot
emotions = robot.face.list_emotions()
Logger.info(f"Available emotions ({len(emotions)}):")
for e in emotions:
Logger.info(f" {e}")
Show emotion
# Play an emotion and let it finish naturally
robot.face.show_emotion("QT/kiss")
# Play an emotion at a different speed
ret = robot.face.show_emotion("QT/surprise", speed=2.0)
Logger.info(f"Done. Return value: {ret}")
Cancel an emotion
import time
# Play a long emotion and cancel it after 2 seconds
h = robot.face.show_emotion_async("QT/breathing_exercise")
time.sleep(2)
h.cancel()
Look (eye gaze)
import time
# Move both eyes to the right
robot.face.look(l_eye=[30, 0], r_eye=[30, 0])
time.sleep(1)
# Move eyes up-left
robot.face.look(l_eye=[-20, -20], r_eye=[-20, -20])
time.sleep(1)
# Move eyes and auto-reset to center after 3 seconds
robot.face.look(l_eye=[0, 20], r_eye=[0, 20], duration=3.0)
Next steps
Continue with the Gesture tutorial, or see the full robot.face namespace in the Python API Reference.