Comments (10)
We have a function in the cost_map
library (based on this one, but has char based grids instead of double) which does this...here. There's an active PR on that too looking to improve it a bit.
At any rate, it could very easily be templatised to handle grid_map
and cost_map
objects together I think.
from grid_map.
Thanks for the link @stonier! I made my own small converter by pulling out some code from navigation, converting from CostMap2D to nav_msgs/OccupancyGrid and then just using the conversion to GridMap. Not terribly efficient, but gets the job done: https://github.com/tu-darmstadt-ros-pkg/grid_map_navigation_planner/blob/master/grid_map_planner_nav_plugin/include/grid_map_planner_nav_plugin/grid_map_cost_map_2d_conversion.h#L71
from grid_map.
Oh, two step. Bit expensive, but it should work.
Good to have this issue here. I've been a bit delayed getting my cost map revamped (has to wait until I get back from interview travels), but this would be a good function to get into the core for both cost_map and grid_map.
from grid_map.
Thanks @skohlbr and @stonier for your input! I added a quick implementation of a Costmap2D to Grid Map in the feature/costmap_conversion branch.
- The class
Costmap2DConverter
provides two methods- First one has to initialize a new grid map with
initializeFromCostmap2d
to adapt to the geometry of the costmap. - Then, data from the costmap can be copied to a layer of the grid map with
addLayerFromCostmap2d
.
- First one has to initialize a new grid map with
- Direct conversion from Costmap2d to Grid Map, no intermediate steps.
- Templated on
MapType
, so can be used by Grid Map derivatives as well. - Unit tests here.
Please let me know if this works for you or if you have any suggestions. Thanks!
from grid_map.
Update: I used the cost translation table as suggested by @skohlbr and added him as an author, please let me know if this is not ok.
from grid_map.
Fine with me, but full disclosure: I extracted and modified that code from costmap_2d_publisher (the cost translation table is a static char* cost_translation_table_
there).
from grid_map.
@skohlbr Ok great, were you able to check if the new conversion feature in branch feature/costmap_conversion works for your use case?
from grid_map.
Not yet, but will do next week.
from grid_map.
We've been refining what we do with Costmap2DROS conversions into cost maps - details here. Basically the use case we were interested in supporting is the ability to catch a subwindow of the cost map around the ros pose. @skohlbr is this a use case you were looking for as well?
This required us to be a little more careful (i.e. catch a few bugs) to make sure we don't introduce errors by having the resulting cost map not exactly aligning with the underlying ros costmap - it is not as straight forward as just setting the cost map centre to the robot pose position.
Anyway, seems to be working now and we have a battery of tests catching the different permutations. @pfankhauser it looks like something I could easily template in the style you made in the PR so we could use it for both cost map and grid map converters, just with different policies applied (e.g. direct value cast, or normalising from 0 to 100.0 or similar).
from grid_map.
Solved by #78.
from grid_map.
Related Issues (20)
- loadFromBag crashes in ROS2 when bag contains multiple topics HOT 3
- Efficient way to update an existing grid map object
- Superflous CMake Calls to old ament
- MedianFillFilter.cpp -> function cleanedMask() 's morphological operational question
- unable to build grid_map on ros2 humble HOT 1
- How do I access and test the costmap2Dconvertor ?
- Visualize multiple grid maps in rviz HOT 1
- Publish a Float32MultiArray in a GridMap message HOT 1
- Request to add maintainers for ROS 2 or transfer of ownership of ROS 2 to ethz-asl HOT 2
- grid_map_filters package fails during build HOT 1
- rolling: CI can't clone and all jobs fail HOT 4
- Deprecation of OgreVector3.h - Fix by ROS 2 Jazzy HOT 2
- grid_map_pcl and grid_map_sdf warnings with COMP0144 HOT 2
- Github CI on rolling/iron missing tests which causes build farm failures HOT 2
- There is a problem in grid_map_pcl config HOT 2
- Is there a simple way like apt to install grid_map package for ROS2? HOT 1
- Less than 4 points in a cell HOT 1
- Does polygonIterator support multi polygon ?
- README gives the false impression that conversion from Pointcloud2 to grid_map layers are available. HOT 2
- CMP0144 FindFlann wrong case warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grid_map.