-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Smac/Hybrid-A* planner #2021
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
Smac/Hybrid-A* planner #2021
Changes from all commits
d9a96ab
7e700b4
75cfbcb
8949452
0796d15
bce9ef1
e59c016
a1f2cde
1f6ab64
f7197a8
a04546f
9c8e88c
b66914e
c71e3db
867503c
5810e86
d237963
bd82d92
cf9c3b3
cce3e9c
bc47d1f
385df8d
c648191
47730af
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 |
|---|---|---|
|
|
@@ -31,18 +31,21 @@ using namespace std::chrono_literals; | |
| namespace nav2_costmap_2d | ||
| { | ||
|
|
||
| FootprintCollisionChecker::FootprintCollisionChecker() | ||
| template<typename CostmapT> | ||
| FootprintCollisionChecker<CostmapT>::FootprintCollisionChecker() | ||
|
Contributor
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. now that these are templated - they should be in a header - not a CPP file - otherwise you can't use this class in a downstream package that wants to define a custom CostmapT
Member
Author
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. I don't understand what specific part should be in the header. The bottom of the cpp file has the declaration of the templates as well for all the valid |
||
| : costmap_(nullptr) | ||
| { | ||
| } | ||
|
|
||
| FootprintCollisionChecker::FootprintCollisionChecker( | ||
| std::shared_ptr<nav2_costmap_2d::Costmap2D> costmap) | ||
| template<typename CostmapT> | ||
| FootprintCollisionChecker<CostmapT>::FootprintCollisionChecker( | ||
| CostmapT costmap) | ||
| : costmap_(costmap) | ||
| { | ||
| } | ||
|
|
||
| double FootprintCollisionChecker::footprintCost(const Footprint footprint) | ||
| template<typename CostmapT> | ||
| double FootprintCollisionChecker<CostmapT>::footprintCost(const Footprint footprint) | ||
| { | ||
| // now we really have to lay down the footprint in the costmap_ grid | ||
| unsigned int x0, x1, y0, y1; | ||
|
|
@@ -80,7 +83,8 @@ double FootprintCollisionChecker::footprintCost(const Footprint footprint) | |
| return footprint_cost; | ||
| } | ||
|
|
||
| double FootprintCollisionChecker::lineCost(int x0, int x1, int y0, int y1) const | ||
| template<typename CostmapT> | ||
| double FootprintCollisionChecker<CostmapT>::lineCost(int x0, int x1, int y0, int y1) const | ||
| { | ||
| double line_cost = 0.0; | ||
| double point_cost = -1.0; | ||
|
|
@@ -96,23 +100,27 @@ double FootprintCollisionChecker::lineCost(int x0, int x1, int y0, int y1) const | |
| return line_cost; | ||
| } | ||
|
|
||
| bool FootprintCollisionChecker::worldToMap( | ||
| template<typename CostmapT> | ||
| bool FootprintCollisionChecker<CostmapT>::worldToMap( | ||
| double wx, double wy, unsigned int & mx, unsigned int & my) | ||
| { | ||
| return costmap_->worldToMap(wx, wy, mx, my); | ||
| } | ||
|
|
||
| double FootprintCollisionChecker::pointCost(int x, int y) const | ||
| template<typename CostmapT> | ||
| double FootprintCollisionChecker<CostmapT>::pointCost(int x, int y) const | ||
| { | ||
| return costmap_->getCost(x, y); | ||
| } | ||
|
|
||
| void FootprintCollisionChecker::setCostmap(std::shared_ptr<nav2_costmap_2d::Costmap2D> costmap) | ||
| template<typename CostmapT> | ||
| void FootprintCollisionChecker<CostmapT>::setCostmap(CostmapT costmap) | ||
| { | ||
| costmap_ = costmap; | ||
| } | ||
|
|
||
| double FootprintCollisionChecker::footprintCostAtPose( | ||
| template<typename CostmapT> | ||
| double FootprintCollisionChecker<CostmapT>::footprintCostAtPose( | ||
| double x, double y, double theta, const Footprint footprint) | ||
| { | ||
| double cos_th = cos(theta); | ||
|
|
@@ -128,4 +136,8 @@ double FootprintCollisionChecker::footprintCostAtPose( | |
| return footprintCost(oriented_footprint); | ||
| } | ||
|
|
||
| // declare our valid template parameters | ||
| template class FootprintCollisionChecker<std::shared_ptr<nav2_costmap_2d::Costmap2D>>; | ||
| template class FootprintCollisionChecker<nav2_costmap_2d::Costmap2D *>; | ||
|
|
||
| } // namespace nav2_costmap_2d | ||
Uh oh!
There was an error while loading. Please reload this page.