Skip to content

❤️ (VCS/VTC) Explicit State Machine: Add self.state in the Pump #21

@OppaAI

Description

@OppaAI

⚠️ Issue: Lack of Lifecycle State Awareness (Operational Blindness)

The Pump and VTC currently operate in a "binary" fashion—they are either alive or dead. There is no mechanism to communicate intermediate phases like "Hardware Discovery" or "Sensor Failure," leading to unstable behavior during startup or communication dropouts with the Jetson.

🎯 Location:

robot/vtc/pump.py (Primary state controller)
robot/vtc/vtc.py (State consumer)

🦠 Symptoms:

  • The Regulator starts calculating vitals before the Pump has successfully connected to jtop.
  • If the jtop service restarts or hangs, the VTC continues to display "Zombie Data" (the last cached value) without warning the user.
  • No clear signal for when it is safe to begin high-frequency harvesting.

🩺 Diagnosis:

  • The node lacks a Finite State Machine (FSM). In complex ROS 2 systems, nodes must transition through defined states to ensure data integrity. Without a DEGRADED state, the system cannot distinguish between "Everything is fine" and "I'm showing you data from 10 seconds ago because the sensor died."

💡 Proposal:

Implement an Explicit Lifecycle FSM
Introduce a self.state variable in the Pump that dictates the node's behavior and informs the rest of the VitalTerminalCore.

  • INIT: The default state. Only initial_probe() runs here. No timers are active.
  • RUNNING: Set only after the YAML is validated and the first "Neutral Seed" is planted.
  • DEGRADED: Triggered if jtop.ok() returns False or if the data_lock is held for too long. UI should reflect this (e.g., yellow warning).
  • STOPPED: Set during the destroy_node() sequence to ensure clean thread termination.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions