Simulation
DeskBot provides a headless simulation driver that composes face rendering, body pose, and a servo overlay without requiring physical hardware.
See also the Simulation reference for the auto-generated API documentation.
When to use simulation
- Development: iterate on face/body behavior without a Raspberry Pi.
- CI: run visual regression checks in headless environments.
- Debugging: inspect the composite frame buffer at any point.
Running
The simulation uses mock hardware backends for the display, servos, and sensors. The face animator renders to an in-memory pixel buffer, and the servo overlay draws a stick-figure body representation directly into that buffer.
Architecture
SimulationDriver
SimulationDriver (robot.simulation.driver) owns the render loop:
- Advance the
FaceAnimatorby one frame. - Read the current body
Posefrom theBodyLanguageEngine. - Composite the face frame with the
ServoOverlay. - Push the composite to the
MockDisplay.
ServoOverlay
ServoOverlay (robot.simulation.overlay) draws a simple stick-figure body
(head + neck + two arms) into the face framebuffer, positioned according to the
current servo angles. The overlay uses the same pixel grid as the face, so
both render into a single display buffer.
API reference
robot.simulation
Simulation mode.
The :class:SimulationDriver runs the same :class:FaceAnimator and
:class:BodyLanguageEngine used in hardware mode, but renders the
face to a virtual display and draws a stick-figure visualisation of
the four servos on top.
The virtual display is a :class:MockDisplay (in-memory RGB888
buffer). The servo overlay is drawn directly into the face framebuffer
by :class:ServoOverlay so the simulation output is a single image
per frame.