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

How to convert grid map from Elevation Mapping to CostMap2D? #399

Open
Aishkrish18 opened this issue Sep 20, 2023 · 3 comments
Open

How to convert grid map from Elevation Mapping to CostMap2D? #399

Aishkrish18 opened this issue Sep 20, 2023 · 3 comments
Labels

Comments

@Aishkrish18
Copy link

Aishkrish18 commented Sep 20, 2023

Hello,
I am new to this repository and I see that we can convert any kind of grid map to occupancy grids/costmap2D . I also see these convertors in many of the issues on how to do it. But I dont understand how exactly do I execute this? Do i write my own separate launch files to do this?

@deweykai
Copy link

You can use the grid_map_visualization node to convert a grid map topic into several others including an occupancy grid. Most of the grid_map demos do this in their launch file.

Also, you can include grid_map_ros/GridMapRosConvertor.hpp to convert a grid_map to other ros representations including a costmap2d.

@Aishkrish18
Copy link
Author

Thank you for your reply. Honestly, I am quite versatile with python and ros and not with c ++ and im quite unsure how to use this node from the repo, could you please explain a bit elaborately so that I can try it out? I am currently working on my thesis and it would be really helpful for me to implement this.

Thanks!

@deweykai
Copy link

Looking at it again, the toCostmap function is only available in the ros2 branch. You can use the grid_map_visualization node to output a occupancy grid like shown here (launch) for traversability. Then use a costmap_2d_node with a static layer listening to the occupancy grid topic.

Or if you want to directly output a costmap2d. I think you can use Costmap2DConverter. Pseudo code:

// variables
grid_map::GridMap map;
costmap_2d::Costmap2D outputMap;
grid_map::Costmap2DConverter<grid_map::GridMap> converter;

// initialize
converter.initializeFromGridMap(grid, costmap);

// create costmap
converter.setCostmap2DFromGridMap(grid, "layer name", costmap);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants