From c2dfd8dd46266f0b3c87cc11462fe20f244903b9 Mon Sep 17 00:00:00 2001 From: S1ink Date: Sat, 29 Nov 2025 21:14:04 -0600 Subject: [PATCH] additional goal checks, add skeleton for map accumulator --- include/modules/impl/path_planner_impl.hpp | 19 ++++++++++++ src/core/threads/path_planning_worker.cpp | 36 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/include/modules/impl/path_planner_impl.hpp b/include/modules/impl/path_planner_impl.hpp index aa83b23..32cb785 100644 --- a/include/modules/impl/path_planner_impl.hpp +++ b/include/modules/impl/path_planner_impl.hpp @@ -160,6 +160,24 @@ bool PathPlanner::solvePath( } } + // check for unreachable destination or move goal to closest traversible point + this->kdtree.radiusSearch(goal_pt, this->search_radius, tmp_indices, tmp_dists); + bool all_invalid = true; + for(pcl::index_t i : tmp_indices) + { + if(meta_cloud.points[i].trav_weight() < 1.f) + { + goal_pt = loc_cloud.points[i]; + all_invalid = false; + break; + } + } + if(all_invalid) + { + DEBUG_COUT("Error - goal is unreachable!"); + return false; + } + this->nodes.clear(); this->nodes.reserve(loc_cloud.points.size()); @@ -186,6 +204,7 @@ bool PathPlanner::solvePath( } else { + DEBUG_COUT("Error - could not initialize starting location!"); return false; } diff --git a/src/core/threads/path_planning_worker.cpp b/src/core/threads/path_planning_worker.cpp index 67a433f..1f1329a 100644 --- a/src/core/threads/path_planning_worker.cpp +++ b/src/core/threads/path_planning_worker.cpp @@ -55,6 +55,7 @@ #include #include +// #include using namespace util::geom::cvt::ops; @@ -65,6 +66,41 @@ using PathMsg = nav_msgs::msg::Path; using PointCloudMsg = sensor_msgs::msg::PointCloud2; +// namespace csm::perception +// { + +// template +// class PlannningMap : +// public MapOctree +// { +// static_assert(pcl::traits::has_xyz::value); +// static_assert(util::traits::has_trav_weight::value); + +// private: +// using PointT = Point_T; +// using MetaT = Meta_T; +// using PointCloudT = pcl::PointCloud; +// using MetaCloudT = pcl::PointCloud; + +// using Vec3f = Eigen::Vector3f; + +// public: +// PlanningMap(double voxel_res); +// ~PlanningMap() = default; + +// public: +// void update( +// const PointCloudT& points, +// const MetaCloudT& points_meta, +// const Vec3f& bound_min, +// const Vec3f& bound_max); + +// protected: +// }; + +// }; // namespace csm::perception + + namespace csm { namespace perception