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

map -> global costmap issues #1498

Closed
jaredjohansen opened this issue Jan 11, 2019 · 8 comments
Closed

map -> global costmap issues #1498

jaredjohansen opened this issue Jan 11, 2019 · 8 comments

Comments

@jaredjohansen
Copy link

I am running cartographer and getting a very nice map. I’m quite pleased with this package, the maps it produces, and a few other bells and whistles. Thanks!

I am running into two issues involving cartographer and my global costmap:

  1. In rviz, when I click on “global costmap”, it shows no obstacles. There are clearly obstacles in the static map, but they are not showing up in the costmap. Why not?
  2. If I have been running the robot for a really long time, I may get a few cells that register as lethal obstacles in the global costmap. (Hooray! Although I don’t know why they show up and why only a few cells are marked that way.) When they do show up, I often get the following error: “update area outside of original map area”. Why does this error occur?

A few other notes:

  • I am running ros kinetic.
  • I am creating a 2D map with cartographer.
  • I have one laserscan and one pointcloud as input to cartographer.

I have put the following files at this link:

  • Screenshots of rviz with the static map, laserscan and either the global costmap or local costmap
  • My launch file and config file
  • A 10-second ros bag
  • Output of rqt_graph
  • My move_base launch file and associated costmap yaml files

Last thing: when I use gmapping, my global costmap works fine. Since gmapping works fine, and since my global costmap is produced from /map (which is published by cartographer_occupancy_grid_node), I suspect there is something unique about the map that cartographer produces that is causing the global costmap to not work.

@ojura
Copy link
Contributor

ojura commented Jan 11, 2019

gmapping thresholds the occupancy grid values into three distinct values: occupied, free, and busy. Cartographer's occupancy grid node publishes a range of values for each cell depending on certainty. Perhaps the costmap planner expects the map format to be like gmapping's. Try hacking the code that the occupancy grid node uses to calculate the values in the map message here to perform thresholding.

@jaredjohansen
Copy link
Author

Thanks, @ojura! Playing with that line has taught me that my global costmap expects that value to be 100 before it will register as a lethal obstacle.

I can add in a tiny hack (with a custom threshold) so that obstacles show up on my global costmap a lot sooner:

int value =
         observed == 0
             ? -1
             : ::cartographer::common::RoundToInt((1. - color / 255.) * 100.);
if (value > 65) {
    value = 100;
}

It has one side effect. Because my input is a pointcloud, the lowest rings hit the ground plane and cartographer marks those as obstacles just as quickly. Is there a way to have cartographer ignore any pointcloud points below a certain z distance?

Thanks again!

@jaredjohansen
Copy link
Author

Found the answer. In my config file, I added these lines:

TRAJECTORY_BUILDER_2D.min_z = -0.1
TRAJECTORY_BUILDER_2D.max_z = 1.5

I'm satisfied with this workaround and am closing the issue. Thanks, @ojura for your help in identifying the place in the code for the workaround .

@ojura
Copy link
Contributor

ojura commented Feb 16, 2019

@jaredjohansen I would like to share another hack which I think results in better looking costmaps. Instead of the hack above, change DrawTexture in cartographer/io/submap_painter.cc:

uint8_t alpha_value = alpha.at(i);
if (intensity_value == 0 && alpha_value > 0) {
  alpha_value = 255;
}

This way, we make darker only the cells which are actually occupied, and not grayish-looking cells in the final map which are actually free, but just really uncertain so they ended up looking dark after blending.

@jaredjohansen
Copy link
Author

Thanks, @ojura, for another helpful way to do this.

With the original hack, I've been able to get my downstream nodes to work satisfactorily. When I revisit the costmaps, I will look into this approach.

@bfMendonca
Copy link

thanks, @ojura, this helped me a lot.

Changing the min and max z would be unsuitable for me, as i use an VLP16 on my robot.

If I get the "TRAJECTORY_BUILDER_2D.min_z" below a certain threshold, cartographer start's to get part of the ground as an obstacle.

With this modification I was able to let this configuration and still get a good costmap for navigation.

@DE92
Copy link

DE92 commented Apr 27, 2020

Hello, everyone,

@bfMendonca I have a similar problem with my VLP-16 recognizing the ground as an obstacle. Due to the construction my robot has a fluctuation around the pitch axis.

@ojura which parameter and where exactly do I have to make your described setting?

Is there a possibility to inform the cartographer about these variations or do I have to use 3D Trajectory?

Thank you

@frans38
Copy link

frans38 commented Sep 13, 2022

@jaredjohansen I would like to share another hack which I think results in better looking costmaps. Instead of the hack above, change DrawTexture in cartographer/io/submap_painter.cc:

uint8_t alpha_value = alpha.at(i);
if (intensity_value == 0 && alpha_value > 0) {
  alpha_value = 255;
}

This way, we make darker only the cells which are actually occupied, and not grayish-looking cells in the final map which are actually free, but just really uncertain so they ended up looking dark after blending.

hi, is this a node? how should i do with this file? running it with cartographer node?
because my cartographer file doesnot have this file.

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

5 participants