Skip to content

use unique_ptr for map_update_thread#2977

Merged
SteveMacenski merged 2 commits intoros-navigation:mainfrom
gezp:unique_ptr_for_map_update_thread
Jun 1, 2022
Merged

use unique_ptr for map_update_thread#2977
SteveMacenski merged 2 commits intoros-navigation:mainfrom
gezp:unique_ptr_for_map_update_thread

Conversation

@gezp
Copy link
Contributor

@gezp gezp commented May 30, 2022

replace raw pointer with unique_ptr.

Signed-off-by: zhenpeng ge <zhenpeng.ge@qq.com>
@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 <zhenpeng.ge@qq.com>
@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 <zhenpeng.ge@qq.com>

* update

Signed-off-by: zhenpeng ge <zhenpeng.ge@qq.com>
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