Skip to content
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

use unique_ptr for map_update_thread #2977

Merged

Conversation

gezp
Copy link
Contributor

@gezp gezp commented May 30, 2022

replace raw pointer with unique_ptr.

@mergify
Copy link
Contributor

mergify bot commented May 30, 2022

@gezp, please properly fill in PR template in the future. @SteveMacenski, use this instead.

  • Check that any new parameters added are updated in navigation.ros.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

std::bind(
&Costmap2DROS::mapUpdateLoop, this, map_update_frequency_));
map_update_thread_ = std::make_unique<std::thread>(
[this]() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not bind?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer that, if it works

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that lambda is better than bind, you could see more detail here moveit/moveit2#872. but if you still think we should use bind, i can change back to bind.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given its a 1 time setup, I don't think the overhead is a big deal

Signed-off-by: zhenpeng ge <[email protected]>
@SteveMacenski SteveMacenski merged commit bd31820 into ros-navigation:main Jun 1, 2022
redvinaa pushed a commit to EnjoyRobotics/navigation2 that referenced this pull request Jun 30, 2022
* use unique_ptr for map_update_thread

Signed-off-by: zhenpeng ge <[email protected]>

* update

Signed-off-by: zhenpeng ge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants