# Galatea Domain — Features and Capabilities

Named after Galatea (Γαλάτεια), the ivory statue sculpted by the legendary
Cypriot sculptor Pygmalion in Ovid's Metamorphoses — a creation so perfect and
beloved that Aphrodite answered Pygmalion's prayer and brought it to life —
Galatea is the comprehensive robotics software stack for humanoid robots
operating in fashion retail and entertainment environments. Just as the
mythological Galatea crossed the boundary between inanimate form and living
presence, the Galatea domain gives physical robots the software intelligence to
perceive, move, interact, and perform.

Galatea covers the full robotics software stack from bare-metal firmware and
motor drivers through computational kinematics, balance control, computer
vision, AI behavioral intelligence, ISO 13482-compliant safety systems, garment
and fashion management, choreographed multi-robot show production, and fleet
management — everything needed to deploy humanoid robots in commercial fashion
retail and entertainment contexts.

The domain is organized as 20 module directories under `libs/galatea/`, building
to 36 packages. It has no `apps/` or `services/` projects: all functionality is
exported as libraries that integrations, SDKs, and future services consume.

---

## At a Glance

The table below summarizes the domain's 12 functional areas and which libraries
provide them. Each row represents a cohesive concern; the sections that follow
go into depth on each one.

| Layer        | Libraries                                                    | What It Provides                                                         |
| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------------------ |
| Hardware     | `firmware`, `hardware-abstraction`                           | Motor drivers, sensor interfaces, tactile skin, RFID, thermal management |
| Motion       | `kinematics`, `locomotion`, `whole-body-control`             | FK/IK, dynamics, walking, balance, whole-body coordination               |
| Expression   | `pose-engine`                                                | Named poses, pose interpolation, breathing simulation, micro-movements   |
| Perception   | `perception`                                                 | Person detection, garment recognition, SLAM, depth processing            |
| Intelligence | `ai`                                                         | VLA models, behavioral engine, natural motion, customer engagement       |
| Safety       | `safety`                                                     | ISO 13482 compliance, force limiting, E-stop, safe state transitions     |
| Fashion      | `garment-management`                                         | RFID garment tracking, outfit changes, cloth manipulation                |
| Performance  | `choreography`                                               | Multi-robot choreography, music synchronization, show scripting          |
| Operations   | `fleet`, `firmware`, `simulation`                            | Fleet monitoring, OTA updates, physics simulation, digital twin          |
| Inclusion    | `inclusivity`                                                | Diverse body profiles, accessibility config, cultural adaptation, i18n   |
| Analytics    | `analytics`                                                  | Engagement metrics, show analytics, A/B testing, revenue attribution     |
| Foundation   | `core`, `database`, `communication`, `event-handlers`, `sdk` | Types, schemas, persistence, messaging, SDK                              |

**Key Specifications**

The table below provides a quick reference for specific technical capabilities.
Detailed explanations appear in the numbered sections below.

| Capability      | Detail                                                                                           |
| --------------- | ------------------------------------------------------------------------------------------------ |
| Kinematics      | Forward kinematics; hierarchical whole-body IK; Denavit-Hartenberg chains; redundancy resolution |
| Dynamics        | Recursive Newton-Euler; gravity compensation; torque calculation                                 |
| Balance control | ZMP-based; center of pressure tracking; push recovery strategies                                 |
| AI policy       | VLA (Vision-Language-Action) models; large behavior models; RL infrastructure                    |
| Safety standard | ISO 13482 (personal care robot safety standard)                                                  |
| Fashion         | RFID garment identification; cloth manipulation; quick-change system                             |
| Communication   | Publish-subscribe messaging; low-latency command channel; robot-to-robot                         |

---

## 1. Core Robotics Framework (`@galatea/core`)

The foundational layer providing shared types, constants, utilities, and error
definitions used by every other Galatea library. All robot configurations,
coordinate frames, joint representations, and error codes originate here.

- **Coordinate frame types** — Standardized 3D coordinate frame definitions
  (base frame, body frame, end-effector frame, world frame) for consistent
  spatial reasoning across all robot components. Frame transformations use
  homogeneous matrices to represent both rotation and translation in a single
  operation.
- **Joint angle representations** — Unified joint angle data structures
  supporting revolute joints (rotate around an axis, like an elbow), prismatic
  joints (translate along an axis, like a linear actuator), and continuous
  joints (revolute without angle limits, like a wheel). Position, velocity, and
  effort fields are standardized across all joint types.
- **Robot configuration schemas** — Zod-validated schemas defining robot
  morphology (which joints exist and how they connect), joint limits (minimum
  and maximum angles), and operational parameters (maximum speeds, payload
  capacities). Configurations are validated at load time to prevent runtime
  failures from misconfiguration.
- **Error code taxonomy** — Comprehensive error code taxonomy covering
  kinematics failures (singularity, workspace violation, convergence failure),
  hardware faults (motor overtemperature, encoder fault, communication timeout),
  safety violations (force limit exceeded, prohibited zone entered), and
  communication errors.
- **Configuration management** — Centralized configuration system with schema
  validation, factory defaults, runtime override support, and configuration
  versioning.
- **Physical constants and safety thresholds** — Robot-specific physical
  constants (link lengths, mass properties, inertia tensors) and safety
  thresholds (maximum joint torques, maximum end-effector contact forces,
  thermal limits) exported as validated constants.
- **Math utilities** — Rotation matrix utilities, quaternion operations,
  Denavit-Hartenberg (DH) parameter calculations, and homogeneous transformation
  matrix composition.

---

## 2. Kinematics and Dynamics (`@galatea/kinematics`)

Computational kinematics transforms between joint space (a set of joint angles)
and task space (the position and orientation of the end effector in 3D space).
This transformation is fundamental to all motion planning and control.

### 2.1 Forward Kinematics

- **Forward kinematics (FK)** — Computes the end effector's position and
  orientation in the world frame from a given set of joint angles. Uses
  Denavit-Hartenberg parameter chain evaluation: a standardized method of
  describing kinematic chains by four parameters per joint (d, θ, a, α) that
  enables systematic FK computation. Essential for knowing where the robot's
  hand is given its current pose.
- **Workspace analysis** — Computes the reachable workspace boundary for any
  kinematic chain configuration: the set of all positions the end effector can
  reach with any valid joint configuration. Used to verify that planned motions
  are physically achievable before attempting them.

### 2.2 Inverse Kinematics

Inverse kinematics (IK) solves the harder inverse problem: given a desired task
target, what joint angles achieve it?

- **Hierarchical whole-body IK solver** — A single solver
  (`solveWholeBodyInverseKinematics`) resolves a prioritised set of tasks over
  the full 52+ DOF body. Each task is one of four types — `end_effector` (link
  position and/or orientation), `center_of_mass`, `gaze` (link forward axis), or
  `posture` (preferred joint angles). Tasks carry a numeric priority and
  optional weight and tolerance.
- **Damped least-squares with null-space projection** — Each priority level is
  solved by damped least squares (the damping term keeps joint-velocity steps
  bounded near singular configurations); lower-priority tasks are projected into
  the null space of higher-priority tasks so secondary objectives are satisfied
  only insofar as they do not disturb primary ones.
- **Constraint enforcement** — The solver clamps each iteration against joint
  limits, per-joint maximum velocity, and (optionally) hand-to-hand
  self-collision avoidance, and reports per-task convergence (`satisfied`,
  `degraded`, `errorNorm`) and the set of degraded task IDs.
- **Redundancy resolution** — Because the humanoid body has far more joints than
  any single end-effector task requires, the null-space mechanism above exploits
  that redundancy for secondary objectives (preferred posture, gaze) without
  affecting higher-priority targets.

### 2.3 Dynamics and Forces

Dynamics computes the forces and torques required to produce desired motions —
essential for power consumption estimation, motor sizing, and torque-based
control.

- **Recursive Newton-Euler dynamics** — Computes joint torques required to
  execute any desired trajectory using the recursive Newton-Euler algorithm.
  This efficient algorithm computes the dynamics of an n-DOF robot in O(n) time
  by propagating forces and velocities outward from the base and inward from the
  end effector.
- **Inertia tensor computation** — Calculates link inertia tensors (mass
  distribution tensors that determine how each link resists rotation) for
  dynamic motion planning.
- **Gravity compensation** — Computes the joint torques required to hold any
  pose against gravity without moving. Essential for compliant gravity
  compensation mode where the robot resists gravity without following a stiff
  trajectory.
- **Torque calculation** — Determines the torques needed at each joint to
  achieve desired accelerations, accounting for gravity, Coriolis forces
  (arising from the interaction of rotational and translational motion), and
  centrifugal forces.

### 2.4 Collision Geometry

- **Swept volume collision detection** — Detects potential collisions along
  planned trajectories by computing the volume swept by robot links during
  motion. Checks this swept volume against the environment model before
  execution.
- **Self-collision checking** — Prevents robot self-intersection during motion
  planning by checking proximity between all link pairs.
- **Safety margin computation** — Calculates minimum clearance distances between
  robot links and obstacles in the environment, ensuring the robot maintains
  safe standoff distances.
- **Collision-free path planning** — Plans trajectories that avoid obstacles
  while satisfying joint limits and trajectory smoothness constraints.

### 2.5 Supporting Computations

- **Jacobian computation** — Computes both geometric Jacobians (relating joint
  velocities to end-effector linear/angular velocities) and analytical Jacobians
  (using Euler angle representations) for velocity-level control and singularity
  analysis.
- **URDF/XACRO parser** — Parses standard robot description formats (Unified
  Robot Description Format and XACRO macro files) to construct kinematic chain
  models. Enables the same control code to work with different robot platforms
  described by their URDF files.
- **Singularity detection** — Identifies kinematic singularities —
  configurations where the robot loses the ability to move in certain directions
  — through condition number monitoring of the Jacobian matrix. Applies damping
  to prevent dangerous velocity amplification near singularities.

---

## 3. Hardware Abstraction (`@galatea/hardware-abstraction`)

A unified interface layer that abstracts the physical hardware details so the
same control software can run on different robot platforms.

### 3.1 Actuator and Joint Control

- **Standardized joint interface** — Unified command and feedback API across DC
  motors, servo motors, BLDC (brushless DC) motors, and series elastic
  actuators. Control software sends position, velocity, or torque commands
  through a common interface regardless of the underlying actuator technology.
- **Actuator profiles** — Characterization data for each actuator type including
  torque-speed curves, maximum continuous and peak torques, thermal limits, gear
  ratio, backlash, and encoder resolution.
- **Position, velocity, and torque control modes** — All three primary control
  modes supported on any actuator through the abstraction layer. Position mode
  for precise joint angle tracking; velocity mode for smooth motion at desired
  speeds; torque mode for compliant interaction with the environment.

### 3.2 Sensor Fusion

- **Multi-sensor fusion** — Fuses Inertial Measurement Units (IMUs), joint
  encoders, force/torque sensors, and vision data into a coherent robot state
  estimate.
- **Real-time state estimation** — Combines proprioceptive sensors (joint
  encoders, IMUs — measuring the robot's own state) and exteroceptive sensors
  (cameras, depth sensors — measuring the environment) for accurate full-state
  estimation at control loop rates.
- **Kalman and complementary filtering** — Noise reduction for raw sensor data
  streams. Kalman filters optimally combine noisy measurements from multiple
  sensors; complementary filters efficiently fuse high-frequency gyroscope data
  with lower-frequency accelerometer data for IMU attitude estimation.

### 3.3 Body Systems

- **Body morphing** — Parameterized body dimension configuration for different
  robot platforms. The same control software adapts to robots with different
  link lengths and segment proportions by adjusting kinematic parameters.
- **Facial expression system** — Controls actuators for eyes (gaze direction,
  pupil dilation), eyebrows, and mouth to produce recognizable emotional
  expressions for human-robot interaction.
- **Dexterous hand control** — Finger-level articulation for manipulation tasks
  (grasping garments, presenting objects) and gesture expression (pointing,
  waving).
- **Tactile skin sensing** — Processes capacitive tactile sensor array data
  distributed across the robot body for contact detection, contact force
  mapping, and texture discrimination.
- **RFID reader interface** — Reads RFID tags embedded in garments for automated
  outfit identification and inventory tracking without manual barcode scanning.

### 3.4 Thermal Management

- **Motor temperature monitoring** — Real-time thermal monitoring of all motor
  actuators. Thermal sensors embedded in motor housings report temperatures at
  the control loop rate.
- **Thermal throttling** — Automatic performance reduction when actuators
  approach thermal limits: reducing maximum torque and speed to prevent
  overheating while allowing the robot to continue operating at reduced
  capability rather than shutting down.
- **Electronics cooling management** — Monitors and controls electronics cooling
  subsystems (fans, liquid cooling loops where applicable) to maintain processor
  and power electronics within operating temperature ranges.

---

## 4. Firmware Management (`@galatea/firmware`)

Manages the embedded firmware running directly on robot microcontrollers and
hardware subsystems.

### 4.1 Motor Drivers

- **Motor driver interface** — Low-level motor control firmware handling PWM
  generation, current sensing, commutation sequences (for BLDC motors), and
  fault detection.
- **Current and velocity loops** — High-bandwidth inner control loops running at
  the microcontroller level. The current loop controls motor torque; the
  velocity loop controls motor speed. These run at 10–20 kHz, much faster than
  the higher-level kinematics loop.
- **Fault detection and protection** — Hardware-level protection against
  overcurrent, overvoltage, undervoltage, and overtemperature conditions with
  safe shutdown procedures.

### 4.2 Sensor Interfaces

- **Sensor driver library** — Drivers for all supported sensors: IMUs
  (ICM-42688, BMI088), joint encoders (AMT22 absolute, AS5048 magnetic),
  force/torque sensors (ATI, Rokubi), cameras (Intel RealSense, ZED, OAK-D), and
  tactile arrays.
- **Sensor calibration** — Calibration procedures and parameter storage for each
  sensor type, ensuring accurate measurements across operating conditions.
- **Sensor fusion firmware** — Microcontroller-level sensor fusion for combining
  IMU accelerometer and gyroscope data at full sensor bandwidth before
  transmission to the main processor.

### 4.3 Safety Controller

- **Hardware safety controller** — Dedicated safety microcontroller monitoring
  all safety-critical conditions independently of the main control processor.
  Hardware-level independence ensures safety functions work even if the main
  processor fails.
- **E-stop handling** — Processes emergency stop signals from both hardware
  buttons and software commands, executing safe state transitions within
  guaranteed time bounds.
- **Watchdog timers** — Hardware watchdog timers that trigger safe shutdown if
  the main processor stops responding within the heartbeat period.
- **Safe state definitions** — Defined safe states for different fault
  conditions (full E-stop, reduced speed mode, limp mode) with documented
  transition procedures.

### 4.4 Power Management

- **Battery state estimation** — State-of-charge and state-of-health estimation
  for lithium battery packs using coulomb counting and voltage-based models.
- **Power distribution management** — Manages power distribution to subsystems
  with priority-based load shedding when battery is low.
- **Charging interface** — Handles autonomous docking and charging initiation
  when battery state-of-charge falls below configured thresholds.

### 4.5 Communication Bus Drivers

- **EtherCAT driver** — Industrial real-time fieldbus driver for high-speed,
  synchronized communication between the main controller and motor driver
  subsystems. EtherCAT achieves sub-microsecond synchronization across
  distributed nodes.
- **CAN bus driver** — Controller Area Network driver for sensor data and
  lower-bandwidth subsystem communication.
- **Serial drivers** — UART and SPI drivers for direct sensor connections.

### 4.6 RTOS Runtime

- **Real-time operating system runtime** — Bare-metal RTOS runtime for
  time-critical control loops. Provides task scheduling, priority management,
  and inter-task communication primitives with deterministic timing.
- **Control loop scheduling** — Configurable multi-rate control loop scheduling:
  motor current loops at 20 kHz, velocity loops at 1 kHz, kinematics at 500 Hz,
  behavior at 50 Hz.

### 4.7 OTA Firmware Management

- **Firmware version tracking** — Tracks firmware versions across all hardware
  subsystems in the fleet.
- **OTA firmware updates** — Delivers firmware updates over the air with staged
  rollout (canary → regional → full fleet), rollback capability on failure, and
  update validation.
- **Firmware compatibility checking** — Verifies firmware-software compatibility
  before deployment to prevent mismatched version combinations that could cause
  unexpected behavior.
- **Boot sequence management** — Coordinates safe startup sequences across all
  subsystems with proper initialization ordering and fault handling during boot.

---

## 5. Bipedal Locomotion (`@galatea/locomotion`)

Walking on two legs in unstructured environments is one of robotics' hardest
problems. Galatea's locomotion system handles gait planning, real-time balance
control, and terrain adaptation.

### 5.1 Gait Planning

- **Walking gait generation** — Generates stable walking gaits at configurable
  speeds and step lengths. Produces joint trajectories over a complete gait
  cycle (stance phase + swing phase) that can be tracked by the whole-body
  controller.
- **Running gait generation** — Dynamic running patterns with aerial phases
  (both feet off the ground simultaneously). Requires predictive control because
  balance cannot be maintained at each instant.
- **Configurable walking styles** — Parameterizes walking style to express robot
  personality and match fashion context: energy-efficient industrial walk,
  elegant runway walk, casual natural walk, and confident presentation walk.
- **Terrain-adaptive gaits** — Adjusts gait parameters based on sensed floor
  type: carpet (higher friction, different energy recovery), ramp
  (incline/decline compensation), and uneven surfaces (increased foot
  clearance).

### 5.2 Balance and Stability

- **ZMP balance control** — Zero Moment Point-based stability control. The ZMP
  is the point on the ground where the net ground reaction force effectively
  acts. If the ZMP lies within the support polygon (the convex hull of all
  ground contact points), the robot is dynamically stable. The controller
  continuously adjusts motion to keep the ZMP inside the support polygon.
- **Center of pressure tracking** — Real-time monitoring of the Center of
  Pressure (CoP) measured by foot pressure sensors, used as an estimator of the
  actual ZMP.
- **Push recovery** — Recovers from external disturbances (a person bumping the
  robot, an unexpected payload) through a hierarchy of strategies: ankle
  strategy (ankle torque adjustment for small perturbations), hip strategy
  (whole-body reconfiguration for medium perturbations), and stepping strategy
  (taking a step to recover for large perturbations).
- **Dynamic balance** — Maintains stability during dynamic tasks: reaching
  beyond the static stability margin, turning at speed, and carrying objects
  that shift the center of mass.

### 5.3 Navigation

- **Footstep planning** — Plans optimal footstep sequences considering obstacle
  avoidance, gait continuity, and energy efficiency.
- **Stair navigation** — Ascends and descends stairs with foot placement
  adaptation to measured step dimensions and stair geometry.
- **Obstacle avoidance** — Dynamically avoids obstacles detected by the
  perception system during locomotion without stopping.
- **Path following** — Follows pre-planned global paths with smooth, dynamically
  consistent trajectory tracking.

### 5.4 Walking Styles

A purpose-built library of walking style parameterizations for fashion and
retail contexts:

- **Runway walk** — High-energy, deliberate, theatrical walk appropriate for
  fashion show presentation. Exaggerated stride, elevated step height, confident
  pace.
- **Natural walk** — Biomechanically natural walking style for approachable
  retail interaction.
- **Quiet locomotion** — Noise-minimized locomotion policy reducing mechanical
  noise for quiet retail environments where intrusive sound would be
  inappropriate.

---

## 6. Whole-Body Motion Control (`@galatea/whole-body-control`)

Whole-body motion control coordinates all joints simultaneously to achieve
complex tasks that require the entire body to work together — reaching far while
maintaining balance, gesturing while walking, or presenting a garment while
tracking a customer.

- **Task-space control** — Controls end effectors (hands, head, gaze) in
  Cartesian space while the underlying joint motion is automatically
  coordinated. Motion commands are specified in natural task-space terms (move
  hand to this position) rather than individual joint angles.
- **Impedance control** — Variable impedance control where the robot behaves
  like a spring-damper system with configurable stiffness and damping. Low
  impedance makes the robot compliant and safe for human contact; high impedance
  provides precise position control for structured manipulation.
- **Admittance control** — Force-to-motion control: external forces applied to
  the robot cause it to move in proportion to the force. Makes the robot feel
  yielding and safe when people touch it — critical for human-robot interaction
  in public retail spaces.
- **Postural control** — Maintains desired body posture during task execution
  using null-space optimization. The robot can reach forward with its arm while
  simultaneously maintaining an upright, aesthetically pleasing torso posture.
- **Center of mass control** — Tracks and regulates the whole-body Center of
  Mass position and velocity for stability during dynamic whole-body movements.
- **Angular momentum control** — Regulates angular momentum during dynamic
  motions — turning, reaching, and recovery — preventing the robot from spinning
  out of control during fast maneuvers.

### 6.1 Task-Space Controller Sub-System

- **Priority-based task composition** — Multiple simultaneous tasks (balance,
  reach, gaze) executed with a strict priority hierarchy: safety always
  overrides balance; balance always overrides reaching; reaching overrides gaze.
- **Null-space exploitation** — Uses kinematic redundancy to satisfy
  lower-priority tasks in the null space of higher-priority tasks, achieving all
  objectives simultaneously when possible.
- **Task switching** — Smooth transitions between task sets without
  discontinuous joint accelerations.

### 6.2 Impedance and Admittance Control

- **Variable stiffness profiles** — Predefined stiffness profiles for different
  interaction contexts: rigid for precision manipulation, compliant for human
  contact zones, stiff for load-bearing.
- **Contact force estimation** — Estimates contact forces from joint torque
  measurements when no dedicated force/torque sensors are present.

---

## 7. Pose Engine (`@galatea/pose-engine`)

The pose engine provides a rich library of named, semantically meaningful poses
and the tools to blend between them smoothly — enabling the robot to express
meaning through body language.

### 7.1 Pose Library

- **Named pose library** — Catalog of semantically named poses for fashion and
  retail contexts: attention (alert, ready to assist), welcome (open, inviting),
  present_garment (highlighting the outfit being worn), bow (formal greeting),
  wave (casual greeting), thinking (considering), and many more.
- **Biomechanically valid poses** — All library poses are validated against
  joint limits and self-collision constraints. Invalid poses cannot be added to
  the library.
- **Motion capture retargeting** — Imports pose data from motion capture
  recordings (BVH, FBX, C3D formats) and retargets them to the Galatea skeleton,
  allowing fashion professionals and choreographers to author poses using
  familiar tools.

### 7.2 Pose Interpolation and Transitions

- **Pose interpolation** — Smooth blending between two poses with configurable
  duration, easing curve (linear, ease-in, ease-out, cubic bezier), and
  interpolation path.
- **Pose sequencing** — Chains multiple poses with timing, easing, and hold
  durations into complete expressive motion sequences.
- **Transition planner** — Plans dynamically feasible transitions between poses,
  respecting joint limits and velocity constraints throughout the motion.
- **Context-aware pose selection** — Selects contextually appropriate poses
  based on the current task (presenting garments vs. greeting a customer vs.
  standing on the runway), interaction state, and sensed audience engagement
  level.

### 7.3 Natural Motion Generation

- **Breathing simulator** — Adds continuous subtle breathing motion (slow
  rhythmic torso expansion and chest rise) to any static pose, making the robot
  appear alive rather than frozen.
- **Micro-movement generator** — Adds subtle continuous micro-movements (weight
  shifts, small head adjustments, natural body sway) that make the robot feel
  natural and present rather than mechanically static between commanded motions.
- **Contrapposto solver** — Computes the classical contrapposto pose (one hip
  raised, opposite shoulder raised, natural S-curve through the spine) — the
  foundational aesthetic pose of Western figurative art and fashion. Enables the
  robot to stand in this naturally appealing stance rather than mechanical
  symmetry.
- **Pose optimizer** — Optimizes poses for visual aesthetics and physical
  stability simultaneously, finding the best achievable pose given both
  constraints.

---

## 8. Computer Vision and Perception (`@galatea/perception`)

Galatea's perception system enables robots to understand the people,
environment, and garments around them.

### 8.1 People and Audience Awareness

- **Person detection** — Detects people in the robot's camera field of view with
  2D bounding boxes and 3D position estimation using depth data.
- **Person tracking** — Tracks individual people over time as they move through
  the retail space, maintaining consistent IDs across occlusion events.
- **Audience awareness** — Detects audience presence, group size, and spatial
  distribution during fashion shows and retail demonstrations.
- **Engagement estimation** — Estimates audience engagement levels from gaze
  direction, body orientation toward the robot, proximity, and dwell time.

### 8.2 Garment and Fashion Perception

- **Garment recognition** — Classifies garment type (dress, jacket, trousers,
  etc.), color, pattern, and style from camera images.
- **Fit analysis** — Analyzes garment fit on the robot using visual measurement,
  detecting whether garments are correctly positioned and seated.
- **Fashion trend analysis** — AI-powered analysis of fashion trends and style
  compatibility from visual observations in the retail environment.

### 8.3 Environment and Navigation Perception

- **SLAM (Simultaneous Localization and Mapping)** — Builds a map of the retail
  environment while simultaneously localizing the robot within it. Enables the
  robot to navigate without pre-installed markers or GPS.
- **Obstacle detection** — Detects both static obstacles (display cases, walls,
  fixtures) and dynamic obstacles (people, shopping carts) for safe navigation.
- **Depth processing** — Processes Intel RealSense and ZED stereo depth camera
  data for 3D scene understanding, including floor plane detection and obstacle
  height estimation.
- **Visual servoing** — Image-based visual servo control that uses camera
  feedback to precisely position the end effector relative to a visual target —
  useful for garment presentation alignment and interaction targeting.
- **Attention prediction** — Predicts where the robot should direct its gaze and
  attention next based on scene understanding and social cues.

---

## 9. AI and Robot Intelligence (`@galatea/ai`)

### 9.1 Foundation Models for Robotics

Foundation models pre-trained on large robot datasets provide general robotic
capability that can be fine-tuned for specific tasks.

- **Vision-Language-Action (VLA) runtime** — Executes VLA models that map visual
  observations and natural language instructions directly to motor actions. VLA
  models enable robots to follow natural language commands ("pick up the blue
  jacket") without programming each action explicitly.
- **VLA fine-tuning pipeline** — Fine-tunes VLA models on Galatea-specific data
  (garment manipulation, fashion presentation, customer interaction) to improve
  task performance beyond the general pre-trained baseline.
- **Large Behavior Model (LBM)** — Foundation behavior model fine-tuning for
  complex, long-horizon tasks requiring multi-step reasoning: "Greet the
  customer, present the outfit, describe the key features, and offer to show an
  alternative."
- **LBM evaluation suite** — Systematic evaluation of behavior model performance
  across standardized task scenarios, enabling quantitative comparison of model
  versions.
- **Motor cortex policy** — Hierarchical control policies for coordinated
  multi-joint motion, implementing learned motor primitives (reach, grasp, wave,
  bow) that can be composed by higher-level behavior systems.

### 9.2 Behavioral Systems

- **Behavioral engine** — Finite state machine and behavior tree execution
  engine for structured robot behavior. Behavior trees enable hierarchical
  composition of behaviors with clear priority, fallback, and sequencing
  semantics.
- **Natural motion generation** — Generates natural-looking motions from
  high-level behavioral descriptions ("wave hello enthusiastically", "present
  this garment elegantly") without requiring explicit trajectory programming.
- **Emotion expression** — Generates emotional expressions through facial
  features, body posture, and movement timing to communicate robot states
  (welcoming, attentive, delighted, apologetic) that support natural human-robot
  interaction.
- **Customer engagement** — Multi-turn customer interaction system with dialog
  management, context tracking, and natural conversation capability for retail
  assistance scenarios.
- **LLM integration** — Large language model integration for conversational
  ability, knowledge-based responses (describing garment materials, care
  instructions, outfit styling advice), and natural language instruction
  following.

### 9.3 Learning and Training Infrastructure

- **Reinforcement learning infrastructure** — RL training for locomotion,
  manipulation, and interaction policies. Supports both on-robot learning and
  simulation-to-real transfer.
- **End-to-end neural control** — Neural network control policies mapping
  directly from sensor input to motor output, trained through RL or imitation
  learning.
- **Data collection** — Systematic robot experience data collection during
  deployment, capturing state-action-outcome tuples for offline policy
  improvement.
- **Distributed training infrastructure** — Large-scale distributed training for
  robot policies requiring significant compute.
- **Simulation farm management** — Manages fleets of simulation instances
  running in parallel for efficient RL policy training.

### 9.4 Remote Operation

- **Teleoperation** — Remote control with real-time video streaming and optional
  force feedback for the operator. Used for demonstration, data collection, and
  operational rescue.
- **VR teleoperation** — VR headset-based teleoperation with intuitive motion
  mapping from operator movements to robot movements. The operator's body
  motions directly drive the robot.
- **Sensor suit integration** — Captures human motion from operator sensor suits
  for natural teleoperation and motion capture data collection for imitation
  learning.

---

## 10. Safety and Compliance (`@galatea/safety`)

Safety is non-negotiable for robots operating near people in public spaces.
Galatea's safety systems are designed to meet ISO 13482, the international
standard for the safety requirements of personal care robots.

### 10.1 Standards Compliance

- **ISO 13482 compliance checking** — Automated compliance checking against the
  personal care robot safety standard (ISO 13482:2014). Systematically verifies
  that the robot's design and operational parameters satisfy each requirement.
- **Automated risk assessment** — Systematic hazard identification, risk
  estimation (severity × probability), and risk evaluation following ISO 12100
  risk assessment methodology.
- **Regulatory documentation toolkit** — Generates CE (European conformity)
  marking documentation, UL (Underwriters Laboratories) certification
  documentation, and market-specific compliance packages from the risk
  assessment results.

### 10.2 Real-Time Safety Systems

- **Force and torque limiting** — Real-time limits on contact forces and joint
  torques preventing injury during human-robot contact. Limits are configurable
  per body region (head: very low, arm: medium, tool: higher) following ISO/TS
  15066 contact force and pressure limits.
- **Emergency stop system** — Hardware and software E-stop with guaranteed safe
  state transition times. Physical E-stop buttons on the robot override all
  software states.
- **Functional safety monitoring** — Continuous safety monitoring with watchdog
  timers, heartbeat checking, and safety channel redundancy.
- **Safe state transitions** — Defined, tested safe states entered on any safety
  violation detection: immediate stop (all joints hold position), controlled
  stop (gentle deceleration to zero velocity), and power-off (gradual power
  removal in safe sequence).

### 10.3 Operational Safety

- **Speed and separation monitoring** — Monitors human proximity using depth
  cameras and reduces robot speed when people are within defined safety zones.
  Stops the robot if humans enter the minimum safety zone.
- **Safety zone enforcement** — Configurable safety zone geometry (spherical,
  cylindrical) around the robot with response policies (reduce speed, pause,
  stop) triggered at each zone boundary.
- **Fault detection and diagnosis** — Detects and diagnoses hardware and
  software faults before they become safety hazards. Distinguishes recoverable
  faults (temporary sensor noise) from non-recoverable faults requiring safe
  shutdown.

---

## 11. Garment and Fashion Management (`@galatea/garment-management`)

Purpose-built capabilities for fashion retail operation, representing Galatea's
domain-specific differentiation.

- **Outfit tracking** — Real-time tracking of which garments the robot is
  currently wearing or displaying, using RFID reads and visual confirmation.
- **RFID garment identification** — Reads garment RFID tags for automated outfit
  change logging. As the robot changes outfits, the system automatically records
  which garments were added or removed.
- **Quick-change system** — Coordinates rapid outfit transitions during fashion
  shows and retail demonstrations. Choreography scripts can include outfit
  change cues with precise timing.
- **Cloth manipulation** — Control algorithms for handling soft, deformable
  garments: picking up a jacket by the collar, smoothing a dress's hem,
  presenting a scarf. Cloth manipulation is one of robotics' hardest problems
  due to the infinite degrees of freedom of fabric.
- **Garment damage detection** — Detects potential garment damage during
  handling (excessive tension, contact with sharp edges, inappropriate grip
  force) and aborts operations to prevent damage.
- **Outfit inventory management** — Tracks the full garment inventory available
  to the robot: which garments are available, their location in the garment
  storage area, and their condition.

---

## 12. Choreography and Show Production (`@galatea/choreography`)

Multi-robot choreography for fashion shows and entertainment performances —
enabling coordinated, synchronized, aesthetically polished robot performances at
scale.

- **Choreography definition** — Defines complex multi-robot choreographies with
  per-robot motion sequences, timing, formations, and transition rules.
- **Music synchronization** — Synchronizes robot motions to music tracks with
  beat detection (identifying strong beats for accent movements), BPM analysis,
  and configurable motion-music alignment.
- **Show scripting** — Scripts complete show sequences with lighting cue
  triggers, music playback control, robot positions, and outfit change timing.
- **Multi-robot coordination** — Coordinates multiple robots performing
  simultaneously with collision avoidance and formation maintenance.
- **Formation management** — Defines and executes formation changes: from
  single-file runway walk to arc facing the audience to symmetric pairs. Manages
  the transition choreography between formations.
- **Rehearsal mode** — Executes shows at reduced speed (configurable fraction of
  real speed) for rehearsal and debugging without time pressure.
- **Show analytics** — Records show performance data (timing adherence, motion
  quality metrics, audience engagement signals) for quality review and
  choreography improvement.

---

## 13. Fleet Management (`@galatea/fleet`)

Manages the operational lifecycle of multiple deployed robots across retail
locations and show venues.

- **Fleet registry** — Registers and tracks all robots in the fleet with
  identity (serial number, name), capability profile (hardware version,
  supported tasks), and deployment history.
- **Remote monitoring** — Real-time telemetry from all fleet robots: joint
  states, battery level, temperature, current task, error log, and position.
- **Fleet health dashboard** — Aggregated fleet health metrics and alerts: how
  many robots are operational, how many need maintenance, how many are in error
  states.
- **Remote configuration** — Deploys configuration updates to individual robots
  or robot groups without physical access.
- **Maintenance scheduling** — Schedules and tracks preventive maintenance based
  on operating hours, actuator cycle counts, and condition-based maintenance
  triggers.
- **Software update management** — OTA software and firmware update deployment
  with staged rollout, validation tests, and rollback capability on failure.
- **Deployment assignment** — Assigns robots to retail locations, show venues,
  or specific roles within a venue.

---

## 14. Robot Communication (`@galatea/communication`)

Communication infrastructure for robot-to-cloud and robot-to-robot interaction.

- **Publish-subscribe messaging** — Topic-based message bus for robot telemetry
  and command distribution. Robots publish sensor data and state; the cloud
  subscribes to relevant topics and publishes commands.
- **Low-latency command channel** — Real-time command delivery optimized for
  teleoperation and safety stops where latency directly affects safety. Uses
  dedicated connection to guarantee delivery time.
- **Robot-to-robot coordination** — Direct inter-robot communication for
  multi-robot show coordination. Robots share position, task state, and timing
  signals directly rather than relying solely on cloud coordination.
- **Event streaming** — Streams robot events to cloud processing pipelines for
  analytics, logging, and model training data collection.

---

## 15. Database and Persistence (`@galatea/database`)

Five PostgreSQL-backed store packages. Each generates `CREATE TABLE`/`INDEX`
DDL, provides parameterised query-template builders, and exposes a store class
that runs against an injected database client.

- **`event-store`** — Append-only operational event log spanning the `safety`,
  `incident`, `operator_action`, `ota_update`, and `operational` domains, with
  integrity verification.
- **`telemetry-store`** — TimescaleDB hypertable store for joint-state, battery,
  and environmental telemetry, with `1m`/`1h` aggregates, retention policy, and
  sampling-profile configuration.
- **`garment-store`** — Garment catalog, RFID mappings, digital-product-passport
  cache, wear history, and fit data.
- **`pose-store`** — Named-pose library supporting vector similarity search and
  full-text search.
- **`show-store`** — Show definitions, their version history, and show execution
  records.

---

## 16. Event Handlers (`@galatea/event-handlers`)

Five sub-packages, each a stateful in-process handler engine with a frozen
event-type constant array and a replayable, filterable event history.

- **Robot lifecycle events** (`robot-events`) — Models seven robot subsystems
  with boot-priority dependency graphs; runs boot sequences and self-tests,
  classifies and isolates faults, selects recovery strategies, escalates, and
  persists shutdown state. Emits 20 robot event types.
- **Safety event handlers** (`safety-events`) — Handles E-stop triggers, manual
  resets, force-limit-approached warnings, collision detection, and
  stability-margin-low events (five safety event types).
- **Show event handlers** (`show-events`) — Registers show definitions, tracks
  robot readiness, starts shows, dispatches lighting / formation-change /
  outfit-reveal cues, handles in-show robot faults, and ends shows (eight show
  event types).
- **Garment event handlers** (`garment-events`) — Maintains a garment catalog
  and handles RFID/NFC tag reads, dressed/undressed lifecycle, and
  digital-product-passport scans (four garment event types).
- **Customer event handlers** (`customer-events`) — Handles customer approach,
  engage, and depart events; produces pose and head-turn commands and manages a
  voice-interaction session and interaction metrics.

---

## 17. Simulation and Digital Twin (`@galatea/simulation`)

Simulates robots before physical deployment and enables behavior testing without
hardware risk. Eight simulation modules are unified under a single library,
covering physics through show preview.

- **Physics simulation** — High-fidelity rigid body dynamics simulation for
  robot testing. Simulates joint dynamics, contact physics, and environmental
  interactions using an RTOS-accurate plant model for hardware-in-the-loop
  equivalence.
- **Cloth simulator** — Soft body physics simulation of clothing using finite
  element methods, enabling cloth manipulation algorithm testing without risking
  real garments or requiring physical robot time.
- **Digital twin synchronization** — Maintains a live virtual replica of each
  deployed robot with state synchronized from real-time telemetry. The digital
  twin visualizes the robot's current state without requiring a camera view,
  enabling remote operators to understand what a robot is doing at any moment.
- **Show preview** — Full choreography preview system that renders a complete
  multi-robot show in simulation with correct music synchronization and
  formation geometry before committing to physical rehearsal. Catches timing
  errors, collision risks, and formation problems at zero hardware cost.
- **RL training environment** — Reinforcement learning training environment with
  physics-accurate dynamics for training locomotion, manipulation, and
  interaction policies through simulated experience before deployment to real
  hardware.
- **Wear simulator** — Simulates garment wear patterns and fabric deformation
  under repeated outfit changes, enabling prediction of garment longevity and
  identification of manipulation sequences that cause premature garment damage.
- **Virtual showroom** — Interactive 3D virtual showroom rendering for
  visualizing robot–garment interactions before physical deployment, usable by
  fashion designers and retail buyers to evaluate how specific garments will
  appear on a humanoid robot.
- **Scenario tester** — Parameterized scenario runner for systematic testing of
  specific situations (customer approaches from the left while robot is
  presenting, two customers simultaneously request assistance) across a sweep of
  scenario variants.

---

## 18. Inclusivity and Accessibility (`@galatea/inclusivity`)

Ensures that robotic systems serve all people equitably, regardless of body
type, ability, or cultural background.

- **Diverse body profiles** — Body dimension profiles covering a wide range of
  human body types for garment fitting demonstrations and inclusive retail
  interaction.
- **Accessibility configurations** — Configures robot behavior for users with
  mobility differences (adjusting interaction height, slowing motion near
  wheelchair users), visual differences (providing audio description of what the
  robot is doing), or hearing differences (relying on visual communication
  rather than spoken language).
- **Cultural configuration** — Adjusts robot greetings, gestures, and
  interaction styles for different cultural contexts. A bow is appropriate in
  Japanese contexts; a handshake in Western contexts; a nod may be more
  appropriate in certain contexts than either.
- **Multilingual support** — Customer interaction in multiple languages,
  configured per deployment location.

---

## 19. Analytics and Business Intelligence (`@galatea/analytics`)

Measures the business impact of robot deployments and enables data-driven
optimization.

- **Engagement analytics** — Tracks customer engagement metrics per robot
  deployment: dwell time near the robot, interaction rate (proportion of nearby
  customers who interact), return visit rate, and positive vs. negative
  interaction sentiment.
- **Show performance analytics** — Measures audience reaction and engagement
  during choreographed performances: applause detection, attention tracking,
  social media mention volume, and post-show survey correlation.
- **A/B testing framework** — Compares robot behavior variants (different
  greeting styles, different show choreography, different garment presentation
  techniques) and measures conversion and engagement differences with
  statistical significance testing.
- **Revenue attribution** — Attributes sales lift to robot interactions and
  demonstrations using experimental design (control days without robots vs.
  robot deployment days).
- **Operational efficiency metrics** — Tracks robot uptime, task completion
  rate, error rate, maintenance costs, and total cost of deployment.

---

## 20. Developer SDK (`@galatea/sdk`)

Tools for building applications and extensions on the Galatea platform.

- **TypeScript SDK (`@galatea/sdk`)** — `GalateaClient` composes three
  sub-clients — `fleet`, `shows`, and `analytics` — over a pluggable
  `GalateaClientBackend`. The default `InMemoryGalateaClientBackend` wires the
  client to the fleet orchestrator, show designer, show scheduler, and the
  engagement / heatmap / revenue analytics engines, so applications can register
  robots, author and schedule shows, and query analytics through one typed
  surface.
- **Python client (`galatea-client-sdk`)** — Python counterpart of the
  TypeScript SDK (`fleet`, `shows`, `analytics` clients over an in-memory
  backend) plus an additional `MLOpsClient` for ML workflows.
- **Show SDK (`@galatea/sdk/show-sdk`)** — `ShowAuthoringSdk` provides a fluent
  `ShowAuthoringBuilder` for show drafts (path/pose/pivot tracks, formations,
  music-sync points, lighting cues, outfit-change triggers), a `validateDraft`
  step that checks track requirements, robot proximity, and the one-microsecond
  timing-synchronisation target, and `deployDraft` for validated deployment.
- **Analytics SDK (`@galatea/sdk/analytics-sdk`)** — Custom-event schemas,
  aggregate/ratio metric definitions, metric evaluation, and dashboard widget
  creation (KPI, time-series, leaderboard) for custom reporting.
- **Fleet event subscription** —
  `GalateaClient.fleet.subscribeRobotStateUpdates` polls the orchestrator event
  stream and pushes `FleetRobotStatusUpdate`s to a listener, so applications can
  react to robot status changes without managing the event cursor themselves.

---

## 21. Planned Features

The Phase 63 library surface is in place. The following capabilities are planned
as part of future Galatea development and are not yet implemented:

- **Advanced VLA fine-tuning** `(planned)` — Robot-specific fine-tuned VLA
  models with larger training datasets from deployed robot operation.
- **Cross-domain integration with Themis** `(planned)` — Autonomous-systems
  governance frameworks for robotic operation in public spaces, including safety
  governance, incident reporting, and regulatory compliance documentation.
- **Extended fashion show formats** `(planned)` — Interactive show formats where
  robots respond to audience input in real time, enabled by enhanced audience
  engagement sensing and LLM-based natural interaction.
- **Expanded retail environment coverage** `(planned)` — Pre-built simulation
  environments for additional retail formats.

---

## Planned Cross-Domain Integrations

Galatea currently has **no cross-domain code dependencies** — no `@galatea/*`
package imports another Oshun domain. The boundaries below represent future
integration points rather than current coupling.

The boundary exists intentionally: Galatea is a self-contained robotics
platform. The partner domains (Neith, Gaia, Nous, Themis) own their respective
primitives and will expose them through well-defined APIs. Galatea will consume
those APIs without becoming coupled to their internal implementations.

- **Neith digital-human and grooming (Phases 155, 162)** `(planned)` — Consume
  Neith hair/grooming primitives (curve hair, grooming brushes, simulation,
  shading, presets) and digital-human primitives (character creation, FACS
  facial rig, body rig/deformation, soft-tissue simulation, digital garments,
  performance capture, retargeting, consent/likeness/provenance) for
  fashion-show visualisation, robot digital twins, choreography preview, and
  inclusive body-profile modelling.
- **Gaia weather safety inputs (Phase 175)** `(planned)` — Consume Gaia
  outdoor-weather and cyclone products as safety inputs for Galatea fleets.
- **Nous world models and continual learning (Phases 176-177)** `(planned)` —
  Consume Nous robotic world models for sample-efficient real-robot fine-tuning,
  imagination safety shields, and sim-to-real adaptation, plus
  continual-learning and interpretability gates for fleet-wide skill retention.
