How venkateswarann/duck-brain works
This repository combines an offline conversational robot companion with DCS, the web-based robot control system beneath it. The principal interaction runs from speech or text through the brain’s model and safety checks to MCP actions on the robot, with speech and expressions as outputs. Separate capabilities include vision and face tracking, memory and trace, the phone-playable bluffing game, and DCS monitoring/setup. Edges follow README statements or shown imports/calls; unsampled implementation details are omitted rather than inferred.
Main entry points: duck_brain/main.py Brain orchestration · app/main.py FastAPI services · server.py Game server · robot.py Robot MCP client
Components 26
Companion brain
- Brain orchestration
brain/duck_brain/main.py - Speech recognition
brain/duck_brain/hearing.py - Gemma client
brain/duck_brain/llm.py - Action safety
brain/duck_brain/safety.py - Robot MCP client
brain/duck_brain/robot.py - Conversation memory
brain/duck_brain/memory.py - Face tracking
brain/duck_brain/tracking.py - Decision trace
brain/duck_brain/trace.py
Robot control
- FastAPI services
backend/app/main.py - Node runtime
backend/app/runtime/base_node.py - Node lifecycle
backend/app/runtime/registry.py - Clamped head control
backend/app/nodes/head_control.py - Script runner
backend/app/nodes/script_node.py - Camera streaming
backend/app/routes/video.py - Video frame hub
backend/app/services/frame_hub.py
DCS interface
- DCS web pages
frontend/src/App.tsx
Head device
- Eyes service
devices/head_zero/eyes_server.py - Eye animation
devices/head_zero/eye_engine.py - Eye rendering
devices/head_zero/eye_renderer.py - Head hardware I/O
devices/head_zero/body_io.py
Phone game
- Game server
brain/duck_brain/game/server.py - Liar's Duck rules
brain/duck_brain/game/liars.py
Other components
- Duck user
- Browser operator
- Local Ollama
- Player phones
Connections 26
- Duck user → Brain orchestration: speaks or types
- Brain orchestration → Speech recognition: starts listening
brain/duck_brain/main.py - Brain orchestration → Gemma client: requests actions
brain/duck_brain/main.py - Gemma client → Local Ollama: generates locally
brain/duck_brain/llm.py - Brain orchestration → Action safety: checks actions
brain/duck_brain/main.py - Brain orchestration → Robot MCP client: dispatches MCP tools
brain/duck_brain/main.py - Brain orchestration → Conversation memory: uses memory
brain/duck_brain/main.py - Brain orchestration → Face tracking: runs tracking
brain/duck_brain/main.py - Brain orchestration → Decision trace: emits decisions
brain/duck_brain/main.py - Robot MCP client → FastAPI services: calls robot API
- FastAPI services → Node runtime: registers nodes
backend/app/main.py - FastAPI services → Node lifecycle: starts enabled nodes
backend/app/main.py - FastAPI services → Clamped head control: registers head node
backend/app/main.py - FastAPI services → Script runner: registers script nodes
backend/app/main.py - FastAPI services → Camera streaming: serves camera stream
backend/app/main.py - Camera streaming → Video frame hub: reads frames
backend/app/routes/video.py - Browser operator → DCS web pages: operates pages
- DCS web pages → FastAPI services: REST and WebSocket
- Player phones → Game server: plays turns
- Game server → Liar's Duck rules: uses game rules
brain/duck_brain/game/server.py - Game server → Robot MCP client: updates duck
brain/duck_brain/game/server.py - Eyes service → Eye animation: runs animation
- Eye animation → Eye rendering: renders frames
devices/head_zero/eye_engine.py - Eye rendering → Head hardware I/O: drives displays
- FastAPI services → Eyes service: proxies eye controls
- Clamped head control → Head hardware I/O: controls head hardware