Signature
← Back to Overview

MAXIM

Body Awareness

Proprioception, Pain, and Motor Learning

Close your eyes and touch your nose. You can do it because proprioception tells you where your arm is without looking. You don't smash your arm into the table because pain taught you to be careful. You've become smoother at the movement through practice. Maxim implements all three.

Proprioception: Knowing Where You Are

🧬 Biological Inspiration

Muscle spindles detect stretch. Golgi tendon organs sense tension. Joint receptors track angles. Together, they create a real-time map of body position that doesn't require vision.

Maxim's MovementTracker continuously monitors the robot's kinematic state:

  • Angular velocity - Combined yaw + pitch rate (deg/sec)
  • Translation velocity - Combined x + y + z movement (mm/sec)
  • Angular acceleration - Rate of velocity change (deg/sec²)
  • Direction reversals - Detecting thrashing patterns
  • Position history - Sliding window for trend analysis

This isn't just logging. The data flows into pain detection, motor learning, and decision-making systems. The robot feels how it's moving.

Pain: Learning from Discomfort

Why Robots Need Pain

Pain isn't cruelty, it's information. Biological pain systems evolved because organisms that didn't feel damage didn't survive long. Robots without pain detection can destroy themselves, their environment, or hurt people. Maxim's pain system is a safety feature, not a bug.

The PainDetector identifies five types of aversive experiences:

⚡ EXCESSIVE_VELOCITY

Moving too fast. Threshold: 100 deg/sec. High speeds risk overshooting targets and mechanical stress.

↔️ DIRECTION_THRASHING

Rapid back-and-forth reversals. Usually indicates confusion, oscillation, or control instability.

📈 EXCESSIVE_ACCELERATION

Sudden speed changes. Jerky motion indicates poor control and stresses actuators.

😫 SUSTAINED_STRAIN

Holding positions near mechanical limits for too long. Like holding a heavy weight at arm's length.

❌ MOVEMENT_FAILURE

Commanded movement that didn't happen. Indicates obstruction, motor stall, or calibration error.

Each pain signal includes:

Data structure PainSignal: - pain_type: EXCESSIVE_VELOCITY - intensity: 0.73 (scale 0-1) - angular_velocity: 127.4 deg/sec - translation_velocity: 0.0 mm/sec - direction_reversals: 0 - timestamp: 2024-01-15T14:23:17Z - context: {"joint": "head_yaw", "goal": "track_face"}

Pain → Learning

Pain signals don't just trigger immediate responses. They feed into the Nucleus Accumbens through the PainCircuitBridge, creating lasting aversive associations:

Movement Command
       │
       ▼
┌──────────────────┐
│ MovementTracker  │
│ (position data)  │
└────────┬─────────┘
         │
         ▼
┌──────────────────┐
│  PainDetector    │
│ (pattern match)  │
└────────┬─────────┘
         │ PainSignal
         ▼
┌──────────────────┐
│ PainCircuitBridge│
│ (format for NAc) │
└────────┬─────────┘
         │
         ▼
┌──────────────────┐
│ Nucleus Accumbens│
│ (causal learning)│
└──────────────────┘
         │
         ▼
Future: Predict pain BEFORE action

After experiencing pain from a specific action pattern, the NAc learns to predict it. Next time a similar action is proposed, the robot can refuse or modify the plan before experiencing pain again.

Motor Learning: The FocusLearner

🧬 Biological Inspiration

The cerebellum adapts motor commands through error-driven learning. Reach for a cup, miss by 2cm, and your next reach is slightly adjusted. Over trials, movements become smooth and accurate without conscious effort.

Maxim's FocusLearner implements this for gaze control. The problem: camera latency, mechanical dynamics, and tracking delays mean the robot often overshoots or undershoots when following a target.

The solution: Rescorla-Wagner learning to adapt movement gain:

ΔV = α(λ - V)
  • α = learning rate (0.2 default)
  • λ = optimal gain inferred from this trial
  • V = current gain estimate

The process:

  1. Command movement to target with current gain
  2. Observe actual vs expected position (tracking error)
  3. Compute optimal gain from overshoot ratio
  4. Update gain incrementally toward optimal
Example Trial 1: Gain=1.0, Commanded=30°, Overshot to 38° → optimal=0.79 Update: V = 1.0 + 0.2*(0.79 - 1.0) = 0.96 Trial 2: Gain=0.96, Commanded=25°, Overshot to 28° → optimal=0.89 Update: V = 0.96 + 0.2*(0.89 - 0.96) = 0.95 ...after many trials... Trial N: Gain=0.82, Commanded=20°, Actual=20.2° → nearly perfect Gain stable, movements smooth

Key properties:

  • Bounded: Gains constrained to [0.4, 1.0] preventing instability
  • Asymptotic: Smooth convergence, no oscillation
  • Persistent: Learned gains saved across sessions
  • Adaptive: Naturally handles changing conditions

Workspace Bounds Learning

Similarly, the WorkspaceBoundsLearner discovers the robot's reachable space through exploration. Rather than hard-coding limits, the system learns where it can and cannot move, adapting to mounting position, obstructions, and mechanical wear.

Integration: The Embodied Loop

All proprioceptive systems connect to the decision-making loop:

  • Movement planning uses learned gains and bounds
  • Action proposals are checked against pain predictions
  • Execution monitoring detects pain in real-time
  • Memory formation records painful episodes for future avoidance
  • Energy tracking considers motor effort as a cost

The result: a robot that moves smoothly, avoids harmful patterns, and improves with experience. Not because we programmed every case, but because we gave it the machinery to learn.