Fix lane_filter_node bugs: None header handling, missing subscriber, and dead code removal #156
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.
Summary
This PR fixes several bugs in
lane_filter_node.pythat could cause runtime errors and prevent proper functionality of the lane filtering system.Bugs Fixed
1. Initial publishEstimate with None header
The node was calling
self.publishEstimate(self.last_update_header)during initialization whenself.last_update_headerwas stillNone. This would cause issues when trying to assign the header to aLanePosemessage.Fixed by: Removing the premature call on line 127
2. Missing episode_start subscriber
The docstring documented a
~episode_startsubscriber and the callback handlercbEpisodeStartwas implemented, but the actual subscriber was never created. This prevented the lane filter from being reset when episodes start.Fixed by: Adding the missing subscriber:
3. None header in prediction step
In
cbPredict(), the method was callingpublishEstimate(self.last_update_header)which could still beNoneon the very first segment callback, sincecbPredict()is called beforeself.last_update_headeris updated.Fixed by: Adding a guard check:
4. Dead code removal
The static method
_seg_msg_to_custom_type(19 lines) was defined but never used anywhere in the codebase.Fixed by: Removing the unused method
5. Unused import
The
numpymodule was imported but never referenced in the code.Fixed by: Removing the unused import
Impact
NoneheadersTesting
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.