voxel: chi giu o >= 3 node thay; obstacle_z_min 0.15

This commit is contained in:
trung09122002
2026-09-25 15:57:22 +07:00
parent 185814f0ec
commit ccd6d5954a
7 changed files with 210 additions and 36 deletions

View File

@@ -569,7 +569,7 @@ StatusResponse LoadAppConfig(const std::string& dir, AppConfig* out) {
const StatusResponse r =
Reject(v, "slam.yaml voxel",
{"emit_size_m", "z_min", "z_max", "max_cells", "delta_max_ratio",
"obstacle_z_min", "obstacle_z_max"});
"obstacle_z_min", "obstacle_z_max", "min_node_hits"});
if (!r.ok()) return r;
out->voxel.emit_size_m = v.get<double>("emit_size_m", out->voxel.emit_size_m);
@@ -583,6 +583,13 @@ StatusResponse LoadAppConfig(const std::string& dir, AppConfig* out) {
v.get<double>("obstacle_z_min", out->voxel.obstacle_z_min);
out->voxel.obstacle_z_max =
v.get<double>("obstacle_z_max", out->voxel.obstacle_z_max);
const int hits = v.get<int>("min_node_hits",
static_cast<int>(out->voxel.min_node_hits));
if (hits < 1) {
return StatusResponse::Error(StatusCode::kInvalidArgument,
"slam.yaml voxel.min_node_hits phai >= 1");
}
out->voxel.min_node_hits = static_cast<size_t>(hits);
if (out->voxel.emit_size_m <= 0.0) {
return StatusResponse::Error(StatusCode::kInvalidArgument,

View File

@@ -61,6 +61,9 @@ struct VoxelConfig {
// tu mat san) bi danh dau la tuong. Xem slam.yaml khoi `voxel:`.
double obstacle_z_min = 0.10;
double obstacle_z_max = 0.55;
// Voxel phai duoc it nhat bay nhieu node khac nhau thay moi giu -- ap cho ca
// ban do 3D lan lop vat can 2D. 1 = giu moi voxel.
size_t min_node_hits = 1;
};
struct ThreadConfig {

View File

@@ -1104,6 +1104,7 @@ void Runtime::SlamLoop() {
vo.z_min = cfg_->voxel.z_min;
vo.z_max = cfg_->voxel.z_max;
vo.max_cells = cfg_->voxel.max_cells;
vo.min_node_hits = cfg_->voxel.min_node_hits;
VoxelGrid vg;
const auto t_vox = std::chrono::steady_clock::now();