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

Create service to get cost of a cell in the costmap #4302

Conversation

tonynajjar
Copy link
Contributor


Basic Info

Info Please fill out this column
Ticket(s) this addresses (add tickets here #1)
Primary OS tested on (Ubuntu, MacOS, Windows)
Robotic platform tested on (Steve's Robot, gazebo simulation of Tally, hardware turtlebot)
Does this PR contain AI generated software? (No; Yes and it is marked inline in the code)

Description of contribution in a few bullet points

Draft PR created for https://github.com/open-navigation/navigation2/issues/4271

  • Added getCost service

Description of documentation updates required from your changes


Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in navigation.ros.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

{
RCLCPP_INFO(
get_logger(), "Received request to get cost at point (%f, %f)", request->x, request->y);
auto cost = static_cast<float>(layered_costmap_->getCostmap()->getCost(
Copy link
Member

Choose a reason for hiding this comment

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

I think some bounds checking needs to happen that the request is within the costmap's size

float32 x
float32 y
---
uint8 cost
Copy link
Member

Choose a reason for hiding this comment

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

You cast the output to a float in the cpp code but its a uint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, I just copied it from here why is it cast there?

Copy link
Member

Choose a reason for hiding this comment

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

Because footprint cost is a float.

@SteveMacenski
Copy link
Member

I'm not entirely sure this is a good thing to expose to users. I understand you want it to debug the current problem, but this will be crazy inefficient if misused in applications. I think perhaps this should just be a debugging tool for the current work unless you feel strongly about it otherwise

@tonynajjar
Copy link
Contributor Author

tonynajjar commented May 6, 2024

I don't feel strongly about it but can you elaborate on

but this will be crazy inefficient if misused in applications

I was hoping this could also be the base for an rviz plugin with which you just click a point on the costmap and it gives you the cost

@SteveMacenski
Copy link
Member

I suppose if there's an rviz thing for it in nav2's config, that's fine with me

@doisyg
Copy link
Contributor

doisyg commented May 7, 2024

I suppose if there's an rviz thing for it in nav2's config, that's fine with me

That would be very nice to debug, and to be able to get the true value of the cost of a costmap cell, not the truncated occupancy grid msg value

@SteveMacenski
Copy link
Member

SteveMacenski commented May 7, 2024

It would have to be the truncated occupancy grid value, because that’s what rviz displays if we did it only within rviz

@BriceRenaudeau
Copy link
Contributor

Is it possible to add a bool in the .srv to get costmap cost at pose or footprint cost at pose?

@SteveMacenski
Copy link
Member

Is it possible to add a bool in the .srv to get costmap cost at pose or footprint cost at pose?

The request would also require the theta then too

@SteveMacenski
Copy link
Member

Any update here @tonynajjar?

@tonynajjar
Copy link
Contributor Author

Yeah I was wondering what to do with it. I don't need it anymore personally but if enough people want it I guess we can keep it in the backlog as a low-prio thing to implement?

@SteveMacenski
Copy link
Member

SteveMacenski commented Jun 10, 2024

I guess you could close this PR, open a ticket as low priority / good first issue with a description: service to get cell/footprint cost + rviz panel for selecting and using it. You could link this branch as a starting point

This would make a nice grad student / hobbyist project

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.

None yet

4 participants