-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add visualisations to debug NO_PATH_FOUND #21
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
base: noetic
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ HybridMotionTable NodeHybrid::motion_table; | |
float NodeHybrid::size_lookup = 25; | ||
LookupTable NodeHybrid::dist_heuristic_lookup_table; | ||
costmap_2d::Costmap2DROS* NodeHybrid::costmap_ros = nullptr; | ||
nav_msgs::OccupancyGrid NodeHybrid::footprint_collision_map; | ||
|
||
ObstacleHeuristicQueue NodeHybrid::obstacle_heuristic_queue; | ||
|
||
|
@@ -365,13 +366,27 @@ bool NodeHybrid::isNodeValid( | |
const bool & traverse_unknown, | ||
GridCollisionChecker * collision_checker) | ||
{ | ||
if (collision_checker->inCollision( | ||
this->pose.x, this->pose.y, this->pose.theta /*bin number*/, traverse_unknown)) | ||
{ | ||
unsigned int map_x = static_cast<unsigned int>(this->pose.x + 0.5f); | ||
unsigned int map_y = static_cast<unsigned int>(this->pose.y + 0.5f); | ||
bool coordinates_in_bounds = (map_x < NodeHybrid::footprint_collision_map.info.width && | ||
map_y < NodeHybrid::footprint_collision_map.info.height); | ||
|
||
unsigned int index = map_y * NodeHybrid::footprint_collision_map.info.width + map_x; | ||
bool index_valid = coordinates_in_bounds && (index < NodeHybrid::footprint_collision_map.data.size()); | ||
Comment on lines
+369
to
+375
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: can't we use the costmap method here? (worldToMap, and in bounds check) |
||
|
||
if (collision_checker->inCollision(this->pose.x, this->pose.y, this->pose.theta, traverse_unknown)) { | ||
if (index_valid) { | ||
NodeHybrid::footprint_collision_map.data[index] = 100; // Mark as occupied | ||
} | ||
Comment on lines
+378
to
+380
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. R: I think we should process this only if there is subscriber to the collision publisher |
||
return false; | ||
} | ||
|
||
_cell_cost = collision_checker->getCost(); | ||
|
||
if (index_valid && NodeHybrid::footprint_collision_map.data[index] != 0) { | ||
NodeHybrid::footprint_collision_map.data[index] = _cell_cost; // Mark as free | ||
} | ||
|
||
return true; | ||
} | ||
|
||
|
@@ -471,6 +486,26 @@ inline float distanceHeuristic2D( | |
return std::sqrt(dx * dx + dy * dy); | ||
} | ||
|
||
void NodeHybrid::initializeFootprintCollisionMap(const std::shared_ptr<costmap_2d::Costmap2DROS>& costmap_ros) | ||
{ | ||
const costmap_2d::Costmap2D* costmap = costmap_ros->getCostmap(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q/R: You are copying the whole global costmap here again? if yes, this might be very expensive in some cases (e.g. in large maps). |
||
NodeHybrid::costmap_ros = costmap_ros.get(); | ||
NodeHybrid::footprint_collision_map.header.stamp = ros::Time::now(); | ||
NodeHybrid::footprint_collision_map.header.frame_id = costmap_ros->getGlobalFrameID(); | ||
NodeHybrid::footprint_collision_map.info.resolution = costmap->getResolution(); | ||
NodeHybrid::footprint_collision_map.info.width = costmap->getSizeInCellsX(); | ||
NodeHybrid::footprint_collision_map.info.height = costmap->getSizeInCellsY(); | ||
NodeHybrid::footprint_collision_map.info.origin.position.x = costmap->getOriginX(); | ||
NodeHybrid::footprint_collision_map.info.origin.position.y = costmap->getOriginY(); | ||
NodeHybrid::footprint_collision_map.info.origin.position.z = 0.0; | ||
NodeHybrid::footprint_collision_map.info.origin.orientation.w = 1.0; | ||
|
||
NodeHybrid::footprint_collision_map.data.assign( | ||
NodeHybrid::footprint_collision_map.info.width * | ||
NodeHybrid::footprint_collision_map.info.height, | ||
-1); // Initialize with -1 (unknown) initially | ||
} | ||
|
||
void NodeHybrid::resetObstacleHeuristic( | ||
const std::shared_ptr<costmap_2d::Costmap2DROS> & costmap_ros_i, | ||
const unsigned int & start_x, const unsigned int & start_y, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: can we use const here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not required, I changed something here and then forgot to revert this.
But we can't change that to const because resetObstacleHeuristic doesnot accept that as parameter