Comments (9)
@stonier FYI
from grid_map.
First issue, I'm guessing its due to the data layout from the top left corner (graphics style). I haven't done a costmap <-> cost_map (aka grid_map) conversion yet, but will shortly so I'll probably experience the same thing.
Second issue, just conventions I think. Pinning the grid_map in the centre or bottom left corner is neither right, nor wrong, just different ways of doing it. So long as all is clearly defined, I'm ok with that. They have included a useful diagram referencing the bits and pieces of the grid_map layout here.
from grid_map.
Regarding the second issue, I think it's fine, if grid map uses it's own convention. Though when converting to occupancy grids, the output should align with the convention (mainly) used within ROS.
from grid_map.
I didn't seem to have any problems loading an image into a cost_map (aka grid_map) and then to occupancy grid map - setting the frame id to "map" and cost map position to zero resulted in an occupancy grid oriented in the expected x-direction in rviz. It is using the same code. Picture here.
Is your conversion from an occupancy grid into a grid_map doing things correctly?
from grid_map.
I'm not changing any position or frame id, but use the source. Please post the pose/origin after your conversion from image (sensor_msgs::Image
?) to cost_map/grid_map as well as the resulting occupancy grid message.
Here is my implementation of the conversion nav_msgs::OccupancyGrid
-> grid_map::GridMap
:
bool ElevatorController::occupancyGridToGridMap(const nav_msgs::OccupancyGrid& occupancy_grid_msg,
grid_map::GridMap& grid_map)
{
grid_map_msgs::GridMap grid_map_msg;
grid_map_msg.info.header = occupancy_grid_msg.header;
grid_map_msg.info.resolution = occupancy_grid_msg.info.resolution;
grid_map_msg.info.length_x = occupancy_grid_msg.info.width * occupancy_grid_msg.info.resolution;
grid_map_msg.info.length_y = occupancy_grid_msg.info.height * occupancy_grid_msg.info.resolution;
grid_map_msg.info.pose = occupancy_grid_msg.info.origin;
grid_map_msg.layers.resize(1);
grid_map_msg.layers[0] = "occupancy_probabilities";
grid_map_msg.basic_layers.resize(0);
grid_map_msg.data.resize(1);
grid_map_msg.data[0].layout.dim.resize(2);
grid_map_msg.data[0].layout.dim[0].label = "column_index";
grid_map_msg.data[0].layout.dim[0].size = occupancy_grid_msg.info.height;
grid_map_msg.data[0].layout.dim[0].stride = occupancy_grid_msg.info.height * occupancy_grid_msg.info.width;
grid_map_msg.data[0].layout.dim[1].label = "row_index";
grid_map_msg.data[0].layout.dim[1].size = occupancy_grid_msg.info.width;
grid_map_msg.data[0].layout.dim[1].stride = occupancy_grid_msg.info.width;
grid_map_msg.data[0].layout.data_offset = 0;
grid_map_msg.data[0].data.resize(occupancy_grid_msg.data.size());
for (int cell = 0; cell < occupancy_grid_msg.data.size(); ++cell)
{
grid_map_msg.data[0].data[cell] = occupancy_grid_msg.data[cell];
}
grid_map_msg.outer_start_index = 0;
grid_map_msg.inner_start_index = 0;
if (grid_map::GridMapRosConverter::fromMessage(grid_map_msg, grid_map))
{
#ifdef DEBUG
pub_gridmap_.publish(grid_map_msg);
nav_msgs::OccupancyGrid occ_grid_msg;
grid_map::GridMapRosConverter::toOccupancyGrid(grid_map, grid_map.getLayers()[0], 0, 100, occ_grid_msg);
pub_costmap_.publish(occ_grid_msg);
}
#endif
return true;
}
else
{
ROS_WARN_STREAM_THROTTLE(1.0, "Couldn't convert grid map message into grid map.");
return false;
}
};
``
from grid_map.
@bit-pirate You can not just copy the origin from the OccupancyGrid to the GridMap, you have to convert it first. In the OccupancyGrid msg the origin represents the real-world pose of the cell (0, 0), while GridMap's position is w.r.t. the map center, as you can see at the layout that @stonier mentioned.
See here: http://docs.ros.org/api/nav_msgs/html/msg/MapMetaData.html
from grid_map.
Thanks a lot, @bit-pirate, @stonier, and @czalidis. I just added the conversion from occupancy map to grid map in the branch feature/occupancy_to_grid_map
. Could you please test this for your use case? If all works out, I will merged this branch into master. If you have any unexpected behavior, please document it with a unit test which you can create in GridMapTest.cpp
.
from grid_map.
This issue should is resolved with #36.
from grid_map.
Was fighting my own installation on Friday and finally got around testing your changes just now.
Works well for me. 👍 Thanks for this addition!
from grid_map.
Related Issues (20)
- How to convert grid map from Elevation Mapping to CostMap2D? HOT 3
- Invoking "make -j16 -l16" failed when building the grid map HOT 1
- 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
- How do I access and test the costmap2Dconvertor ?
- Visualize multiple grid maps in rviz
- 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 1
- 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 ?
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.