Skip to content

❤️ (VCS/VTC) Initialization of "Neutral" Data to prevent first-tick error #19

@OppaAI

Description

@OppaAI

⚠️ Issue: Cold-Start Data Inconsistency (Empty Deque Exception)

The Regulator and Display modules attempt to perform statistical operations (like max() or mean()) on the glob_bin. If these operations occur before the first Pump cycle completes, the system throws a ValueError: max() arg is an empty sequence.

🎯 Location:

robot/vtc/pump.py -> Pump.__init()__
robot/vtc -> display_tick

🦠 Symptoms:

  • Immediate crash on startup with ValueError.
  • "Flickering" UI where values appear as NaN or None for the first 500ms of operation.
  • Race conditions where the Regulator tries to normalize a sensor that hasn't been "discovered" yet.

🩺 Diagnosis:

The system follows a Lazy Initialization pattern where deques are created only when data arrives. In a multi-threaded environment, the consumer (Regulator) often outruns the producer (Pump) during the first 100ms of the lifecycle.

💡 Proposal:

The "Neutral Seed" Initialization
Modify the Pump initialization to perform a Hardware Discovery Probe. This ensures that the glob_bin is fully populated with "Safe Defaults" before any timer-based consumers are allowed to run.

  • Mandatory Seeding: Every deque marked active: true in the YAML must be initialized with at least one None or 0.0.
  • Discovery Probe: The Pump should attempt one synchronous harvest of all active conduits during the INIT state to replace neutral seeds with real hardware values.
  • Atomic Hand-off: The glob_bin must be fully "shaped" before the RUNNING state is declared.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions