SteveMacenski / navigation2

ROS2 Navigation
Other
6 stars 3 forks source link

Add costmap downsampler - fixes SteveMacenski/navigation2#4 #23

Closed carlosluis closed 4 years ago

carlosluis commented 4 years ago

Basic Info

Info Please fill out this column
Ticket(s) this addresses #4
Primary OS tested on Ubuntu 20.04
Robotic platform tested on Turtlebot3 simulation

Description of contribution in a few bullet points

Example with Willow world

Ran a few tests in the willow world, here's how the map looks after being downsampled from a 0.1m resolution to 0.3m

downsampling

Comparison Resolution (m) Nodes expanded Avg runtime (ms)
0.1 67420 ~160
0.3 5460 ~20

Runtime impact: downsampling the map is only done once (the first time we create a path) and it takes around 5ms for a 566x108 cells map. It's computation time is vastly outweighted by the amount of less nodes expanded.

Description of documentation updates required from your changes


Future work that may be required

SteveMacenski commented 4 years ago

In you image, I still see small dots - are those from an underlaying full resolution map? Can you give us a screen shot of just the downsampled map? I'm surprised to see black and some smaller cells with small gradients. I also don't think LETHAL is blue (but I could be wrong), I don't see LETHAL's over the small black cells, are you sure that is correct? I would think all the black cells for static obstacles in the map should be overlapped in the downsampled costmap with lethal coloring. I think lethal is red not the light blue.

carlosluis commented 4 years ago

The image had the full resolution map beneath, you're right. Here's one with only the downsampled map

downsampled_only I just checked and the blue color correspond to an inscribed obstacle (cost = 253), while the magenta is lethal (cost = 254).

I verified that every black dot in the full resolution map actually corresponds to lethal cost, so I think the downsampling is correct.

SteveMacenski commented 4 years ago

Got it, thanks! Met me re-review

carlosluis commented 4 years ago

I was able to address most comments:

carlosluis commented 4 years ago

Moved the publisher to the downsampler. I think the code looks a bit cleaner now. Let me know what you think!

I've tested again that the publisher is correctly updating the costmap. I initialized with some dummy value (a 1x1 costmap), published that costmap, and then it gets correctly updated when calling downsample

SteveMacenski commented 4 years ago

Looks more basic now - that's a good sign. When it looks simple, that's the hallmark of a good design. I'm wondering if we should make the downsample factor an input to downsample(). It seems natural to tell it what to downsample by and would make our lives easier for testing if we could just flip a varable range over a loop to an object to see the results.

SteveMacenski commented 4 years ago

Alright, we're down to pedantic stuff, I think this is the last few changes and we're good to go

carlosluis commented 4 years ago

For some reason I pushed to my branch https://github.com/carlosluisg/navigation2/tree/costmap_downsampler but it is not showing in the PR. I addressed there the last few comments

EDIT: registered just now :) seemed like Github had a small hiccup

SteveMacenski commented 4 years ago

OK I think this can go in now. Anything else you want to change?

Only 2 things I see that are really small would be (optional):

carlosluis commented 4 years ago

Last commit should address the 2 comments you mentioned last.

If you agree with those changes, I have nothing else to add to this PR and it can be merged.

carlosluis commented 4 years ago

Reverted back to using continue

SteveMacenski commented 4 years ago

Awesome! All good, merging. This was a really great step forward to restarting this work, thanks for working with me on performance items. This planner will naturally be slower than a usual A* so I'm hyper sensitive about making sure to reduce any small overhead that could accumulate.