Fix frame consistency, race conditions, missing safety checks, and lifecycle error handling#4
Draft
varadVaidya with Copilot wants to merge 2 commits into
Draft
Fix frame consistency, race conditions, missing safety checks, and lifecycle error handling#4varadVaidya with Copilot wants to merge 2 commits into
varadVaidya with Copilot wants to merge 2 commits into
Conversation
…ks, lifecycle error handling Co-authored-by: varadVaidya <43097003+varadVaidya@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review implementation of fixes from AGENT.md
Fix frame consistency, race conditions, missing safety checks, and lifecycle error handling
Mar 5, 2026
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.
Full codebase review of the peregrine_core ROS2 UAV control stack. Found and fixed bugs across 6 packages related to frame consistency (Issue #3), thread safety, missing safety guards, and incomplete lifecycle error handling.
Frame consistency
frame_idwas hardcoded as"gps"instead of using parameterizedbaseLinkFrame_, breaking multi-UAV deployments whereframe_prefixnamespaces all frames.Race conditions
odomFrame_written outsidemutex_inonEstimatedState()while read under lock inupdateGeofenceCache(). Moved lock acquisition before the write.active_set totruebeforecreateActionServers()inon_activate()— goal callbacks could seeactive_==truewith no servers. Reordered.Missing safety checks in uav_manager
onLandAccepted,onGoToAccepted,onExecuteAcceptedwere all missing the emergency/preemption guard thatonTakeoffAcceptedhad:Lifecycle
on_error()leaving publishers activeon_error()in estimation_manager, control_manager, and trajectory_manager cancelled timers but never deactivated lifecycle publishers — leaving orphaned active publishers. Added deactivation matching the existingon_deactivate()pattern.Cleanup safety (estimation_manager)
on_cleanup()called.reset()on timers/publishers without cancelling or deactivating first. Added null-guarded cancel + deactivate before reset.Repo hygiene
Added
.gitignore, removed 13 committed__pycache__/binaries.Notable design-level issues identified but not fixed
multi_uav_sitl.launch.pyROS_DOMAIN_ID(1,2,3…) vs stack default (0) — DDS won't connectsingle_uav.launch.pyframe_prefixparam (they derive from upstream messages)uav_manager💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.