-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
⚠️ Issue: Unguarded Statistical Aggregation (Empty Sequence / Type Errors)
The VTC and Regulator modules rely on max() to find the "worst-case" values in the Pump's deques. Without proper filtering and defaults, these calls trigger fatal exceptions when encountering None values or empty deques during initialization or sensor dropouts.
🎯 Location:
robot/vtc -> display_tick()
Any logic performing peak-detection on glob_bin
🦠 Symptoms:
ValueError: max() arg is an empty sequenceduring the first few milliseconds of startup.TypeError: '>' not supported between instances of 'NoneType' and 'float'when a sensor fails to return a value.- Total node failure (crash) instead of graceful degradation.
🩺 Diagnosis:
- Python's built-in
max()is not "null-aware." In a high-frequency telemetry system like the VCS,Nonerepresents a "missing sample," not a zero. Passing a sequence containingNoneor an empty list tomax()results in an unhandled exception that halts the entire thread.
💡 Proposal:
The "Resilient Peak" Wrapper
Implement a standardized, generator-based filtering pattern for all peak-detection logic. This ensures that the system always returns a safe numerical default even if the "glob" is corrupted or empty.
- None-Filtering: Use a generator expression to strip
Nonevalues before aggregation. - Safe Defaults: Always utilize the default keyword argument in
max()to provide a neutral fallback (e.g.,0.0). - Type Consistency: Ensure the output is cast to a
floatto maintain compatibility with theVitalPulsemessage definition.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Projects
Status
Todo