-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix bug mentioned in #3958 #3972
Conversation
I think this is a clever and fine solution to the problem, just some questions to answer |
add space for code style
We specially name nodes like our suggestion is: these child-LifecycleNode should have some basic specialist like:
such mechanism could be like:
Perhaps such mechanism could be used for any program in ROS2 ? |
At present, the unit test of CI takes nav2_ costmap_2d is considered as an independent LifecycleNode for launch and shutdown tests, which goes against the premise of our proposed modification proposal
For this, we have three suggestions to address different development needs that may exist in the future. 1. modify the unit-testIf it can be guaranteed that in current nav2 program usage and subsequent development, It's only in need to modify the 2: create a new class
|
If there is anymore work that requires our assistance, we'd like to have a try within our capabilities O(∩_∩)O |
What might you be interested in doing? I can always certainly find projects :-) Taking a stab at #3303 would be very helpful - Alexey made some changes to rclcpp::Rate to make it better supportable of different clocks https://github.com/AlexeyMerzlyakov/rclcpp/blob/rolling/rclcpp/include/rclcpp/rate.hpp#L141 |
WOW! That's cool ! Thanks a lot ~ |
add childLifecycleNode mode to costmap_2d_ros
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3972 +/- ##
==========================================
+ Coverage 90.20% 90.27% +0.06%
==========================================
Files 417 417
Lines 18605 18608 +3
==========================================
+ Hits 16783 16798 +15
+ Misses 1822 1810 -12 ☔ View full report in Codecov by Sentry. |
if only considering current nav2, we're very sure that such uncovered checks could be removed. However, perhaps it may be still worried that any future changes may make these checks work again. anyway, whether remove or retain them, I am very willing to make modifications based on your futher suggestions (●'◡'●) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in concept, but we can play some games and make it cleaner
change get_parameter into `=false`
comment modification
missing line
The failure of CI test may show that some unit tests may need to change their constructor choice ? |
* @brief as a child-LifecycleNode : | ||
* sometimes costmap may be launched by another LifecycleNode and work as a child-thread | ||
* child-LifecycleNodes should wait for their parents to handle the shutdown, which includes this module | ||
* Thus, it's neccessary to set NodeOption is_lifecycle_follower_ as true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Thus, it's neccessary to set NodeOption is_lifecycle_follower_ as true | |
* Thus, it's neccessary to set NodeOption is_lifecycle_follower_ as true |
Delete.
Sorry, just some changes to be clear in technical language, Delete that last line and that should be good |
great of thanks for your patience ~ |
delete last line
@GoesM I retriggered CI a few times, |
delete last line
change test fit to NodeOptions
Great! Thanks for the iteration! |
* bug fixed * add space * Update planner_server.cpp * add space for code style * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add ChildLifecycleNode mode in costmap_2d_ros * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower * fit to NodeOption: is_lifecycle_follower * fit reorder Werror * fix wrong use of is_lifecycle_follower * remove blank line * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * Add files via upload * NodeOption: is_lifecycle_follower_ * NodeOption:is_lifecycle_follower_ * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * change default * add NodeOption for costmap_2d_ros * add node options for costmap2dros as an independent node * code style reformat * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * changes * comment changes * change get_parameter into =false * comment modification * missing line * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * delete last line * change lifecycle_test fit to NodeOption --------- Co-authored-by: GoesM <GoesM@buaa.edu.cn> Co-authored-by: Steve Macenski <stevenmacenski@gmail.com>
* bug fixed * add space * Update planner_server.cpp * add space for code style * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add ChildLifecycleNode mode in costmap_2d_ros * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower * fit to NodeOption: is_lifecycle_follower * fit reorder Werror * fix wrong use of is_lifecycle_follower * remove blank line * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * Add files via upload * NodeOption: is_lifecycle_follower_ * NodeOption:is_lifecycle_follower_ * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * change default * add NodeOption for costmap_2d_ros * add node options for costmap2dros as an independent node * code style reformat * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * changes * comment changes * change get_parameter into =false * comment modification * missing line * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * delete last line * change lifecycle_test fit to NodeOption --------- Co-authored-by: GoesM <GoesM@buaa.edu.cn> Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> Signed-off-by: gg <josho.wallace@gmail.com>
* bug fixed * add space * Update planner_server.cpp * add space for code style * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add ChildLifecycleNode mode in costmap_2d_ros * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower * fit to NodeOption: is_lifecycle_follower * fit reorder Werror * fix wrong use of is_lifecycle_follower * remove blank line * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * Add files via upload * NodeOption: is_lifecycle_follower_ * NodeOption:is_lifecycle_follower_ * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * change default * add NodeOption for costmap_2d_ros * add node options for costmap2dros as an independent node * code style reformat * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> * changes * comment changes * change get_parameter into =false * comment modification * missing line * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * delete last line * change lifecycle_test fit to NodeOption --------- Co-authored-by: GoesM <GoesM@buaa.edu.cn> Co-authored-by: Steve Macenski <stevenmacenski@gmail.com> Signed-off-by: enricosutera <enricosutera@outlook.com>
* bug fixed * add space * Update planner_server.cpp * add space for code style * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add ChildLifecycleNode mode in costmap_2d_ros * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower * fit to NodeOption: is_lifecycle_follower * fit reorder Werror * fix wrong use of is_lifecycle_follower * remove blank line * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * Add files via upload * NodeOption: is_lifecycle_follower_ * NodeOption:is_lifecycle_follower_ * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * change default * add NodeOption for costmap_2d_ros * add node options for costmap2dros as an independent node * code style reformat * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * changes * comment changes * change get_parameter into =false * comment modification * missing line * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * delete last line * change lifecycle_test fit to NodeOption --------- Co-authored-by: GoesM <GoesM@buaa.edu.cn> Co-authored-by: Steve Macenski <stevenmacenski@gmail.com>
* bug fixed * add space * Update planner_server.cpp * add space for code style * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode to costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add childLifecycleNode mode in costmap_2d_ros * add ChildLifecycleNode mode in costmap_2d_ros * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * fit to NodeOption: is_lifecycle_follower * fit to NodeOption: is_lifecycle_follower * fit reorder Werror * fix wrong use of is_lifecycle_follower * remove blank line * NodeOption: is_lifecycle_follower_ * NodeOption: is_lifecycle_follower_ * Add files via upload * NodeOption: is_lifecycle_follower_ * NodeOption:is_lifecycle_follower_ * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * NodeOption:is_lifecycle_follower * change default * add NodeOption for costmap_2d_ros * add node options for costmap2dros as an independent node * code style reformat * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * fit to NodeOption of Costmap2DROS * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * changes * comment changes * change get_parameter into =false * comment modification * missing line * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * Update nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp * delete last line * change lifecycle_test fit to NodeOption --------- Co-authored-by: GoesM <GoesM@buaa.edu.cn> Co-authored-by: Steve Macenski <stevenmacenski@gmail.com>
Basic Info
Description of contribution in a few bullet points
Description of documentation updates required from your changes
bug description
costmap is set as a Nav2::util LifecycleNode : ../nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp#L 73
all LifecycleNode would react to Ctrl+C ../nav2_util/src/lifecycle_node.cpp#L 90
all LifecycleNode would react to rcl_preshutdown randomly, and similar issue has been discussed before : ../ros2/rclcpp/issues/2096
this explanation should have been clear enough: ../nav2_planner/src/planner_server.cpp #L 214-L225
the bug happening in ISSUE: #3958 is caused by this.
because during shutdown_period,
costmap_ros_
may react rcl_preshutdown earlier, so that planner/controller may try to access thecostmap_ros_
though it has been a nullptr.our provided solution
it seems that
costmap
is only used as a child-thread of planner/controller, ../nav2_planner/src/planner_server.cpp#L 89so can we make it do nothing when reacting to Ctrl+C ?
doing so, its lifecycle would be completely bond to planner/controller's lifecycle, and also going to death in order.
because the
costmp_ros_
is just a thread created by planner/controller,whether program shutdown correctly or not, or even dead unexpectably, the child-thread could be closed all the time since parent-LifecycleNode sub-process dead.
Thus there's no need to worry whether it would be still alive after whole program exit finally.
in addition
if our solution being adopted, many checks could be removed :
double check in planner_server->on_deactivate()
double check in planner_server->on_cleanup()
double check in controller_server->on_deactivate()
double check in controller_server->on_cleanup()
these double checks are also designed to face to bugs in situation that
costmap_ros_
may be closed earlier than planner/controller. After our code modification, these checks are useless anymore.what's more, our solution performs perfectly during our local tests, much more than our past solutions mentioned in #3958
Future work that may be required in bullet points
For Maintainers: