[WIP] Add safety and fault handling for ROS 2 node#26
Draft
Copilot wants to merge 1 commit intopilla-hw-nodefrom
Draft
[WIP] Add safety and fault handling for ROS 2 node#26Copilot wants to merge 1 commit intopilla-hw-nodefrom
Copilot wants to merge 1 commit intopilla-hw-nodefrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.
Original prompt
placeholder
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: You are a robotics engineer who has experience developing full software stack of robots. What features should be there in the main ROS 2 node of the software that interacts with motor drivers and other sensor drivers to do basic locomotion
Assistant:
Analysis of the Pilla Hardware Interface Node
Looking at your
odrive_interface.py, you already have a solid foundation — publishers/subscribers for ODrive control, joint state feedback, arm/disarm services, diagnostics, and a trajectory forwarding pipeline. Here's what I'd recommend adding for robust basic locomotion, organized by priority:1. Safety & Fault Handling (Critical)
What you have: Basic arm/disarm, diagnostics reporting.
What's missing:
Triggerservice that immediately idles all axes, disengages, and latches until explicitly cleared. Distinct from disarming — e-stop should be instantaneous and non-negotiable.odrive_status_callbackonly readspos_estimate. ODrive controllers reportactive_errorsanddisarm_reason— you should monitor these on every status tick, automatically disarm a faulting axis, and publish the error in diagnostics.2. Joint Offset / Calibration System (Critical)
What you have: Gear ratios and directions — good.
What's missing:
go_to_zero_possends the joints to encoder zero, not mechanical zero.3. Smooth Motion Control (High Priority)
What you have: Position commands forwarded directly from trajectory messages.
What's missing:
input_vel = 0.0always. The trajectory message (JointTrajectory) provides velocities in eachJointTrajectoryPoint— you should forward these as velocity feedforward to ODrive for much smoother tracking.msg.points[0]. A proper trajectory may have multiple waypoints with time stamps. Implementing a timer-based interpolator that walks through the trajectory points at the correct times produces smooth, predictable motion instead of jerky jumps.4. IMU Integration (High Priority)
What you have: A separate
arduino_interface.pyexists but isn't integrated into the main node.What's missing:
arduino_interfaceorimu_tools), fuse it into your state estimation.robot_stateor feed IMU orientation into the CHAMP controller so it can do body attitude correction. Without this, the robot has no idea if it's tilting or falling.5. Proper State Machine (High Priority)
What you have: A boolean
pilla_armedflag and per-jointarmed_state.What's missing:
IDLE → CALIBRATING → ARMED → ENGAGED → E_STOPPED → FAULT. Transitions between states should have preconditions (e.g., you can't engage without arming first, you can't arm during a fault). This prevents entire classes of bugs where services are called in the wrong order.6. Predefined Pose / Go-To-Position Service (Medium Priority)
What you have:
default_positionsarray with 5 poses, but onlygo_to_zero_posservice.What's missing:
default_positions), just need the service endpoint...This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.