Home
Species

Hxyxy Debug Session Log - 2025-09-02

September 2, 2025

Hxyxy OpenFrameworks Interface - Debug Session Log

Date: September 2, 2025
Session Duration: ~3 hours
Status: Critical fixes applied, major visualization issue identified

Issues Encountered

1. Servo Direction Mismatch

Problem: TipX servo moving opposite direction to BaseX despite identical commands

  • Symptom: When BaseX moves right (+X), TipX moves left (-X) for same positive value
  • Root Cause: Physical servo mounting orientation difference
  • Impact: Made coordinated tentacle movement impossible

Solution Applied:

// In Arduino updateServos() function:
// OLD: servoTipX.write((int)tipX);
// NEW: servoTipX.write((int)(180 - tipX));

2. Range Validation Bug - System Lockup

Problem: Setting any servo to 180° in OF GUI caused complete system freeze

  • Symptom: Arduino stopped responding to all commands when servo reached max range
  • Root Cause: Mismatched validation ranges
    • OF GUI: allows 0-180°
    • Arduino validation: restricted to 5-175°
  • Impact: Made full servo range unusable

Solution Applied:

// Arduino range validation updated:
// OLD: return (angle >= 5.0 && angle <= 175.0);
// NEW: return (angle >= 0.0 && angle <= 180.0);

// Also updated constrain calls:
// OLD: baseX = constrain(bx, 5, 175);
// NEW: baseX = constrain(bx, 0, 180);

3. Missing Mouse Interaction

Problem: Servo position grids were display-only, required slider manipulation Solution Applied:

  • Added mousePressed(), mouseDragged(), and isInsideGrid() methods
  • Coordinate mapping with proper Y-axis inversion: baseY.set(ofClamp(190 - gridY, 0, 180));
  • Direct click/drag control of servo positions on visual grids

4. OpenFrameworks Path Issues

Problem: Project couldn’t find OF libraries due to non-standard location

  • Root Cause: Project expected OF at ../../../libs/ but actual location was /Applications/of_v20250818_osx_release/
  • Solution Applied: Moved project to OF standard location for development, copy back to git for backup

Critical Discovery: Tentacle Visualization Fundamental Flaw

The Problem

Current “Tentacle Profile” visualization assumes discrete rigid segments with linear interpolation between points. This is completely wrong for the actual hardware.

Reality vs. Visualization

Actual Hardware:

  • Continuous flexible silicone structure
  • Cable-driven deformation creating smooth organic curves
  • Base servos create primary curvature affecting entire length
  • Tip servos add secondary bending to upper portion
  • Complex physics involving spine elasticity, knuckle spacing, cable routing

Current Visualization:

  • 8 rigid segments connected by straight lines
  • Linear interpolation: ofLerp(baseX - 90, tipX - 90, tipInfluence)
  • Fake “joints” that don’t exist in hardware
  • No understanding of continuous deformation

Impact Assessment

Critical: The visualization is not just inaccurate - it actively misleads about system behavior. This undermines:

  • Manual tuning intuition
  • Algorithm development understanding
  • Spatial control strategies

Proposed Solution: Empirical Curve Fitting

Instead of guessing physics, measure actual tentacle curves at various servo positions:

  1. Photograph tentacle at 20-30 servo position combinations
  2. Digitize actual curve coordinates from photos
  3. Build lookup table with spline interpolation between measured curves
  4. Replace fake linear segments with real hardware-based curves

Files Modified

  • HIxyxy_Tuning_OF.ino - servo direction fix, range validation
  • ofApp.h - added mouse interaction method declarations
  • ofApp.cpp - implemented mouse grid interaction

Testing Status

  • ✅ Servo direction fix verified
  • ✅ Full range (0-180°) validated
  • ✅ Mouse grid interaction working
  • ❌ Tentacle visualization still fundamentally wrong (requires future work)

Next Steps

  1. Immediate: Copy fixed files back to git repository for backup
  2. Short-term: Remove misleading tentacle visualization or add warning label
  3. Medium-term: Implement empirical curve fitting with photographed data
  4. Long-term: Develop physics-based modeling accounting for actual hardware parameters

Lessons Learned

  • Range validation mismatches cause silent failures that are hard to debug
  • Visual feedback systems can be worse than no feedback if they’re fundamentally wrong
  • Hardware-software integration requires matching physical reality, not theoretical models
  • Empirical measurement often more valuable than physics assumptions for complex systems

Session Notes: Late night debugging session. Good progress on critical fixes, but tentacle visualization problem is bigger than initially thought. Need systematic approach to spatial modeling based on actual hardware behavior, not guessed physics.

Classification

debugging openframeworks servo-control visualization