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

missmatching sizes of grid_map using rviz plugin (ROS) #391

Open
csanrod opened this issue Apr 13, 2023 · 1 comment
Open

missmatching sizes of grid_map using rviz plugin (ROS) #391

csanrod opened this issue Apr 13, 2023 · 1 comment

Comments

@csanrod
Copy link

csanrod commented Apr 13, 2023

Hello!

I'm developing an app using ROS Noetic, in Ubuntu 20.04 LTS, using C++. Here I provide the code where I initialize everything:

GridMap map({"elevation"});
map.setFrameId("map");    
map.setGeometry(Length(10, 10), 1);

Then I create and publish the message here:

int i = 0;
for (GridMapIterator it(map); !it.isPastEnd(); ++it) {
  Position position;
  map.getPosition(*it, position);
  map.at("elevation", *it) = data.data[i];
  i++;
}

ros::Time time = ros::Time::now();
map.setTimestamp(time.toNSec());
grid_map_msgs::GridMap message;
GridMapRosConverter::toMessage(map, message);
publisher.publish(message);

The thing is 'data' is an array of 100 elements (10x10), but when I display it in rviz, I get a 9x9 representation. I tried to change the size to 11x11, but the representation gets buggy because it has more than 100 elements, but the matrix showed in rviz is 10x10. Here are some results:

In this case, the representation of the data is correct, but it shows a 9x9 matrix instead of a 10x10 in rviz, meanwhile the data is still a 10x10 array:
image

Here I paint an 11x11 map in rviz (which shows a 10x10), but data displayed is inconsistent because I'm giving 100 elements to the 11x11 map:
image

Why is this happening?

@weidinger-c
Copy link

weidinger-c commented May 8, 2023

Each corner point on the black lines represent a cell center, the planes that you see are the interpolation between four corner points.
So this is no bug and works as intended, as there are 10 "corner points" for the 10x10 grid example.

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