我Point在头文件中定义了一个结构类,如下所示 -
namespace global_planner {
class GlobalPlanner : public nav_core::BaseGlobalPlanner {
struct Point {
__uint32_t x, y;
bool operator==(const Point &p1 ) {
return ((p1.x == x) && (p1.y == y));
}
bool operator<(const Point &p1 ) const {
return ((p1.x < x) || (p1.x == x && p1.y < y) ) ;
}
};
public:
///
private:
////
};
};
Run Code Online (Sandbox Code Playgroud)
在我的源文件(名为global_planner.cpp)中,我有一个名为的函数,generate_straight_path定义如下 -
bool GlobalPlanner::generate_straight_path(const Point &p1, const Point &p2){
if(costmap_ros_->getCost(p1.x, p1.y) == costmap_2d::LETHAL_OBSTACLE) …Run Code Online (Sandbox Code Playgroud)