ZJU-FAST-Lab / ego-planner-swarm

An efficient single/multi-agent trajectory planner for multicopters.
GNU General Public License v3.0
1.13k stars 222 forks source link

boundIndex的参数和物理含义? #62

Closed fishZeng closed 1 year ago

fishZeng commented 1 year ago

在grid_map.h文件中,定义了地图范围和xyz方向的voxel数量 Eigen::Vector3d map_min_boundary_, map_max_boundary_; // map range in position Eigen::Vector3i map_voxel_num_; // map range in index toAddress可以输入一个三维坐标来确定index inline int GridMap::toAddress(const Eigen::Vector3i& id) { return id(0) * mp_.map_voxel_num_(1) * mp_.map_voxel_num_(2) + id(1) * mp_.map_voxel_num_(2) + id(2); } 之后的boundIndex参数应该是各个方向的voxel数量,然后与map_voxel_num进行比较。但是在isUnknow函数当中传入的是一个三维坐标,并用boundIndex对传入的坐标进行了修改,这一段的逻辑应该如何理解? inline void GridMap::boundIndex(Eigen::Vector3i& id){ Eigen::Vector3i id1; ` id1(0) = max(min(id(0), mp.map_voxelnum(0) - 1), 0); id1(1) = max(min(id(1), mp_.map_voxelnum(1) - 1), 0); id1(2) = max(min(id(2), mp_.map_voxelnum(2) - 1), 0); id = id1; } inline bool GridMap::isUnknown(const Eigen::Vector3i& id) { Eigen::Vector3i id1 = id; boundIndex(id1); return md_.occupancybuffer[toAddress(id1)] < mp_.clamp_minlog - 1e-3; }`