The entire control and intelligence layer of Spookey is managed within a ROS 2 workspace, which organizes all code into modular nodes under the robot_scripts package. Each node handles a distinct function—movement control, AI interpretation, or sensor processing—and communicates through ROS 2 topics and services for real-time coordination.

Inside src/robot_scripts, the current structure includes:

  • heartbeat.node – maintains system activity signals and ensures all essential processes remain online.

  • spukai.py – the core AI interface that connects SpukAI, the robot’s reasoning engine, to the control network.

  • spukai_command_bridge.py – interprets JSON-based commands from SpukAI and forwards them to motion and balance nodes.

  • balance.py – reads IMU feedback to maintain posture stability and correct tilt deviations during movement.

  • servo_mover.py – handles low-level servo motion control via the PCA9685 driver board, translating angle data into PWM pulses.

  • spukai_cli.py – provides a local command-line interface for testing and manual overrides during development.

These nodes are launched through dedicated ROS 2 launch files, which start multiple scripts simultaneously and define inter-node dependencies. The launch setup allows me to bring up SpukAI, motion control, and balance management as a single synchronized system.

SpukAI itself runs as a distributed AI setup: a Llama 3 model executes locally on my laptop, while the Raspberry Pi 5 (mounted on Spookey) connects to it via SSH tunneling. This allows real-time communication between the on-board ROS 2 network and the off-board LLM, giving Spookey conversational understanding and high-level reasoning without overloading the Pi’s compute resources.

The system is designed for continuous improvement. I regularly update the node logic, refine topic structures, and expand inter-process communication. My next implementation stage focuses on integrating HC-SR04 ultrasonic sensors in the ankles—creating an interface node that publishes distance data to subscribers for obstacle awareness and precise ground detection.

The programming architecture evolves daily, gaining new capabilities through iterative testing, better topic organization, and smoother coordination between SpukAI’s cognitive layer and Spookey’s physical movement.