Implement emergency safety handling - #15
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
📝 WalkthroughWalkthroughThis PR implements the emergency safety feature for OpenMower firmware: hardware debouncing of three physical emergency inputs (stop, lift, tilt), latching behavior that persists until physical conditions clear, ROS 2 subscription support enabling software-triggered latch/release commands, and LED status indication. The implementation includes comprehensive interactive testing and documentation. ChangesEmergency Safety Features Implementation
Sequence DiagramsequenceDiagram
participant Firmware as Firmware Core
participant Emergency as emergency module
participant GPIO as Physical Inputs
participant ROS as ROS 2 I/O
participant LED as LED Status
Firmware->>Emergency: init() at setup
loop Every firmware loop iteration
Firmware->>Emergency: update()
Emergency->>GPIO: read() stop/lift/tilt inputs
Emergency->>Emergency: debounce & check timers
Emergency->>Emergency: manage latch state
end
ROS->>Emergency: getState()
Emergency-->>ROS: return EmergencyStatus
ROS->>ROS: publish to emergency/status topic
ROS->>Emergency: handleCommand(latch_requested)
Emergency->>Emergency: apply command with confirmation window
Firmware->>LED: set LED_STATUS_EMERGENCY flag
LED->>LED: override to red blinking if active
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
emergency/commandlatch/release topic requiring 3 matching commands within 1 secondPIN_ESC_SHUTDOWNLOW without dynamic shutdown logicVerification
/home/jkaflik/.platformio/penv/bin/pio runpython3 -m py_compile test/hil/emergency_interactive.pyCloses #5
Summary by CodeRabbit
New Features
Documentation