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

set size_x_ and size_y_ in method initMaps #4014

Closed
Hao-Li-Bachelorarbeit opened this issue Dec 17, 2023 · 4 comments
Closed

set size_x_ and size_y_ in method initMaps #4014

Hao-Li-Bachelorarbeit opened this issue Dec 17, 2023 · 4 comments

Comments

@Hao-Li-Bachelorarbeit
Copy link
Contributor

Bug report

Required Info:

  • Operating System:
  • ROS2 Version:
  • Version or commit hash:
  • DDS implementation:

Steps to reproduce issue

in file costmap_2d.cpp

void Costmap2D::initMaps(unsigned int size_x, unsigned int size_y)
{
  std::unique_lock<mutex_t> lock(*access_);
  delete[] costmap_;
  costmap_ = new unsigned char[size_x * size_y];
}

Expected behavior

Actual behavior

Additional information


Feature request

Feature description

set size_x_ and size_y_ in this method. Since these two attributes are always used to describe costmap_, I think this information should be synchronized when initializing the map, and setting them separately causes code redundancy.

Implementation considerations

@SteveMacenski
Copy link
Member

All uses of it now either call it using the member sizes or set the new member sizes right before the call (e.g. resizeMap). You could do the same in your application of just setting those member sizes before you call initMaps. But, I have no objection to this, can you submit the PR?

@Hao-Li-Bachelorarbeit
Copy link
Contributor Author

Already submitted a PR

@SteveMacenski
Copy link
Member

I requested a quick change, otherwise LGTM

@Hao-Li-Bachelorarbeit
Copy link
Contributor Author

Done, please notice the PR

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

No branches or pull requests

2 participants