-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make mapUpdateLoop() indicator variables to be thread-safe #3308
Merged
SteveMacenski
merged 1 commit into
ros-navigation:main
from
AlexeyMerzlyakov:costmap_2d_ros_atomic_fix
Dec 6, 2022
Merged
Make mapUpdateLoop() indicator variables to be thread-safe #3308
SteveMacenski
merged 1 commit into
ros-navigation:main
from
AlexeyMerzlyakov:costmap_2d_ros_atomic_fix
Dec 6, 2022
Conversation
This file contains 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
@AlexeyMerzlyakov, please properly fill in PR template in the future. @SteveMacenski, use this instead.
|
SteveMacenski
approved these changes
Dec 6, 2022
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.
God I hate all the stuff going on in this file. I welcome the day I can delete all this and do a rewrite
jwallace42
pushed a commit
to jwallace42/navigation2
that referenced
this pull request
Dec 14, 2022
SteveMacenski
pushed a commit
that referenced
this pull request
Dec 21, 2022
SteveMacenski
added a commit
that referenced
this pull request
Dec 21, 2022
* remove exec_depend on behaviortree_cpp_v3 (#3279) * BT Service Node to throw if service was not available in time (#3256) * throw if service server wasn't available in time mimic the behavior of the bt action node constructor * throw if action unavailable in bt cancel action * use chrono literals namespace * fix linting errors * fix code style divergence * Remove duplicate of nav2_back_up_cancel_bt_node (#3332) * Remove unused velocity scaling config from example xml (#3330) Signed-off-by: Borong Yuan <[email protected]> Signed-off-by: Borong Yuan <[email protected]> * Make mapUpdateLoop() indicator variables to be thread-safe (#3308) * Ensure that plugin initialization to be called before updating routines (#3307) * Solve bug when CostmapInfoServer is reactivated (#3292) * Solve bug when CostmapInfoServer is reactivated * Implemented smoother selector bt node (#3283) * Implemented smoother selector bt node Signed-off-by: Owen Hooper <[email protected]> * updated copyright in modified file Signed-off-by: Owen Hooper <[email protected]> Signed-off-by: Owen Hooper <[email protected]> * Add allow_unknown parameter to theta star planner (#3286) * Add allow unknown parameter to theta star planner * Add allow unknown parameter to tests * missing comma * Change cost of unknown tiles * Uncrustify * bump to 1.1.3 for humble sync 3 Signed-off-by: Borong Yuan <[email protected]> Signed-off-by: Owen Hooper <[email protected]> Co-authored-by: Adam Aposhian <[email protected]> Co-authored-by: Erwin Lejeune <[email protected]> Co-authored-by: Sven Langner <[email protected]> Co-authored-by: Borong Yuan <[email protected]> Co-authored-by: Alexey Merzlyakov <[email protected]> Co-authored-by: MartiBolet <[email protected]> Co-authored-by: Owen Hooper <[email protected]> Co-authored-by: Pedro Alejandro González <[email protected]>
andrewlycas
pushed a commit
to StratomInc/navigation2
that referenced
this pull request
Feb 23, 2023
shrijitsingh99
pushed a commit
to moss-ag/navigation2
that referenced
this pull request
Mar 4, 2023
* remove exec_depend on behaviortree_cpp_v3 (ros-navigation#3279) * BT Service Node to throw if service was not available in time (ros-navigation#3256) * throw if service server wasn't available in time mimic the behavior of the bt action node constructor * throw if action unavailable in bt cancel action * use chrono literals namespace * fix linting errors * fix code style divergence * Remove duplicate of nav2_back_up_cancel_bt_node (ros-navigation#3332) * Remove unused velocity scaling config from example xml (ros-navigation#3330) Signed-off-by: Borong Yuan <[email protected]> Signed-off-by: Borong Yuan <[email protected]> * Make mapUpdateLoop() indicator variables to be thread-safe (ros-navigation#3308) * Ensure that plugin initialization to be called before updating routines (ros-navigation#3307) * Solve bug when CostmapInfoServer is reactivated (ros-navigation#3292) * Solve bug when CostmapInfoServer is reactivated * Implemented smoother selector bt node (ros-navigation#3283) * Implemented smoother selector bt node Signed-off-by: Owen Hooper <[email protected]> * updated copyright in modified file Signed-off-by: Owen Hooper <[email protected]> Signed-off-by: Owen Hooper <[email protected]> * Add allow_unknown parameter to theta star planner (ros-navigation#3286) * Add allow unknown parameter to theta star planner * Add allow unknown parameter to tests * missing comma * Change cost of unknown tiles * Uncrustify * bump to 1.1.3 for humble sync 3 Signed-off-by: Borong Yuan <[email protected]> Signed-off-by: Owen Hooper <[email protected]> Co-authored-by: Adam Aposhian <[email protected]> Co-authored-by: Erwin Lejeune <[email protected]> Co-authored-by: Sven Langner <[email protected]> Co-authored-by: Borong Yuan <[email protected]> Co-authored-by: Alexey Merzlyakov <[email protected]> Co-authored-by: MartiBolet <[email protected]> Co-authored-by: Owen Hooper <[email protected]> Co-authored-by: Pedro Alejandro González <[email protected]>
shrijitsingh99
pushed a commit
to moss-ag/navigation2
that referenced
this pull request
Mar 4, 2023
* remove exec_depend on behaviortree_cpp_v3 (ros-navigation#3279) * BT Service Node to throw if service was not available in time (ros-navigation#3256) * throw if service server wasn't available in time mimic the behavior of the bt action node constructor * throw if action unavailable in bt cancel action * use chrono literals namespace * fix linting errors * fix code style divergence * Remove duplicate of nav2_back_up_cancel_bt_node (ros-navigation#3332) * Remove unused velocity scaling config from example xml (ros-navigation#3330) Signed-off-by: Borong Yuan <[email protected]> Signed-off-by: Borong Yuan <[email protected]> * Make mapUpdateLoop() indicator variables to be thread-safe (ros-navigation#3308) * Ensure that plugin initialization to be called before updating routines (ros-navigation#3307) * Solve bug when CostmapInfoServer is reactivated (ros-navigation#3292) * Solve bug when CostmapInfoServer is reactivated * Implemented smoother selector bt node (ros-navigation#3283) * Implemented smoother selector bt node Signed-off-by: Owen Hooper <[email protected]> * updated copyright in modified file Signed-off-by: Owen Hooper <[email protected]> Signed-off-by: Owen Hooper <[email protected]> * Add allow_unknown parameter to theta star planner (ros-navigation#3286) * Add allow unknown parameter to theta star planner * Add allow unknown parameter to tests * missing comma * Change cost of unknown tiles * Uncrustify * bump to 1.1.3 for humble sync 3 Signed-off-by: Borong Yuan <[email protected]> Signed-off-by: Owen Hooper <[email protected]> Co-authored-by: Adam Aposhian <[email protected]> Co-authored-by: Erwin Lejeune <[email protected]> Co-authored-by: Sven Langner <[email protected]> Co-authored-by: Borong Yuan <[email protected]> Co-authored-by: Alexey Merzlyakov <[email protected]> Co-authored-by: MartiBolet <[email protected]> Co-authored-by: Owen Hooper <[email protected]> Co-authored-by: Pedro Alejandro González <[email protected]>
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.
This is a elaboration of https://github.com/ros-planning/navigation2/pull/3307/files#r1038041946 comment for #3307.
Costmap2DROS contains one
std::thread
parallel execution, which callsmapUpdateLoop()
routine.As stated in a C standard docs in a "5.1.2.4 Multi-threaded executions and data races"
So, all write-write and write-read parallel operations should be protected by mutex, or
std::atomic
in case if it is the variable.The
mapUpdateLoop()
thread contains the following boolean indicator variables appeared to be thread-unsafe:stop_updates_
: being read inCostmap2DROS::updateMap()
loop called from std::thread; and written in parallel in theCostmap2DROS::start()
routine called from main thread.initialized_
: being read inCostmap2DROS::start()
, which belongs to main thread; and written in parallel byCostmap2DROS::updateMap()
from std::thread.stopped_
: to be thread-unsafe since Ensure that plugin initialization to be called before updating routines #3307, according to the https://github.com/ros-planning/navigation2/pull/3307/files#r1038041946 commentBasic Info
colcon test --packages-select nav2_costmap_2d
Description of contribution in a few bullet points
mapUpdateLoop()
thread from unsafe usage.Future work that may be required in bullet points
std::thread
utilization in Nav2, and find all shared variables (bool, int, string, vectors, etc...) and make them to be thread-safe, if they not.For Maintainers: