Skip to content

Feature: Layer which checks if a robot can fit through a space #74

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

Merged
merged 3 commits into from
Jan 20, 2025

Conversation

JustusBraun
Copy link
Contributor

I have created a new layer for the mesh map which calculates the obstacle free space above each vertex and calculates the cost based on the height of the robot. This is useful to check if the robot can fit through doors or can pass under overhangs in the world. For example if the robot is small enough it could drive under tables.

Let me know if you have any feedback :)

The freespace layer computes the free space above the meshes vertices
and marks vertices as lethal if the robot would not fit through e.g. a
doorway.

Add exporting of cmake targets to mesh_map for depending projects to
use.

LVR2_DEFINITIONS had to be added to the mesh_map target to reflect LVR2 library configuration.
Copy link
Member

@Cakem1x Cakem1x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, nice addition! Sounds very useful.
Two findings:

  • layer name
  • adapt cost function (maybe, just an idea)

Both are not critical, I'd be okay with merging as-is as well.

Comment on lines 70 to 71
// The freespace_ map contains the actual free space above the vertices.
// If the robot fits through a gap the cost is 0 and if not its 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I think it's great that the cost is decoupled from the available space!

Do you think it could be useful to add a ramp-down value range to the cost function?

I.e. don't jump from 1 to 0, but have a linear part in there. I.e the cost is

  • 1, if available space is below config_.required_freespace
  • additional_free_space_ratio in (0,1), if available space is above config_.required_freespace but below config_.more_than_enough_freespace. With additional_free_space_ratio being close to 1 when available space is close to config_.required_freespace. And close to 0 when available space is close to config_.more_than_enough_freespace.
  • 0, if available space is above config_.more_than_enough_freespace

Here, I drew a picture :D
freespace_layer_cost

This would allow modelling that the robot should prefer paths with more space, when possible. Up until the available space is large enough that it does not care anymore.
Preferring paths with more space could be motivated by e.g. exteroceptive sensors like lidars that might not like a limited FoV, or by having uncertainty about the map quality (robot might not fit after all).

Using a sigmoid function instead would smooth the discontinuous parts of the cost functions. That might be useful for some planners if they estimate derivations on the map cost. But I don't know if this is a thing...

}

// Finally calculate the freespace layer
freespace_ = lvr2::calcNormalClearance(*map_ptr_->mesh(), vertex_normals);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the term clearance, like in lvr. I think the layer name freespace is not optimal. To me, it invokes the image of a gridmap where there are obstacles (cannot traverse) and freespace (can traverse).
Your layer, however, looks at a specific kind of freespace in the above sense: Parts of the env with enough clearance so the robot can fit.

I think a more specific layer name would be great.

My ideas were:

  • headspace
  • headroom

But seeing the lvr2 function name here, I think clearance would also be nice.
Might actually be the best choice, so it's consistent between lvr2 and the mesh map. Also, I think clearance is a more common word than the stuff that came to my mind.

@JustusBraun
Copy link
Contributor Author

I would be fine with changing the name, do you have any suggestions?

Maybe something like OverheadClearanceLayer?

How would you change the cost function? My thought was either the robot fits or it doesn't ^^

@Cakem1x
Copy link
Member

Cakem1x commented Jan 17, 2025

I would be fine with changing the name, do you have any suggestions?

Maybe something like OverheadClearanceLayer?

How would you change the cost function? My thought was either the robot fits or it doesn't ^^

check out the comments in the code below the main review comment

@JustusBraun
Copy link
Contributor Author

Oh sorry, i missed the comments.

clearance sounds good to me :)

I think it makes sense to implement the proposed change to the cost function. However as far as i know the planners do not consider the costs other than checking if the cost is above a certain limit.

It would argue to have a robot_height and a extra_margin or height_inflation parameter instead of two fixed heights, to prevent issues when the height is reconfigured at runtime.

@Cakem1x
Copy link
Member

Cakem1x commented Jan 17, 2025

Oh sorry, i missed the comments.

No worries

clearance sounds good to me :)

great :)

I think it makes sense to implement the proposed change to the cost function. However as far as i know the planners do not consider the costs other than checking if the cost is above a certain limit.

It would argue to have a robot_height and a extra_margin or height_inflation parameter instead of two fixed heights, to prevent issues when the height is reconfigured at runtime.

Awesome, your idea on parameters is great! 🥇

@JustusBraun
Copy link
Contributor Author

I have implemented the changes and the clearance layer looks like this :)
clearance_example

@Cakem1x Cakem1x merged commit d0471a2 into naturerobots:humble Jan 20, 2025
1 check passed
@Cakem1x
Copy link
Member

Cakem1x commented Jan 20, 2025

Thanks for your contribution!

@JustusBraun JustusBraun deleted the pr/free-space-layer branch January 20, 2025 14:07
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

Successfully merging this pull request may close these issues.

2 participants