feat(minco_ws): 横向膨胀拆成「车体半径 + 额外裕度」两个参数
原实现里 rebuildInflationOffsets 直接拿 double_cylinder_radius 当横向膨胀半径,
导致「车体几何尺寸」与「安全裕度」是同一个数——想加余量就必须假装车变大了,
也就无法在不改变车体语义的前提下单独调裕度。
新增 grid_map.obstacles_inflation_xy(默认 0.0),膨胀半径改为:
inflate_radius = double_cylinder_radius + obstacles_inflation_xy
**默认 0.0 ⇒ 总膨胀仍为 0.62,行为与改动前完全一致**,无回归。
若要语义更清楚,可写 double_cylinder_radius: 0.53 + obstacles_inflation_xy: 0.09。
该参数**不被 launch 覆盖**(launch 只覆盖 double_cylinder_radius/collision_radius),
只需改 yaml 一处,避免了此前'三处必须同改否则失效'的坑。
yaml 注释同时补上两个图层的区别:
grid_map/occupancy —— 障碍原样
grid_map/occupancy_inflate —— 车**中心**的禁区,必然比障碍粗一圈(粗多少 = 膨胀半径)
This commit is contained in:
@@ -60,6 +60,10 @@ struct MappingParameters {
|
||||
Eigen::Vector3d local_update_range_;
|
||||
double resolution_, resolution_inv_;
|
||||
double obstacles_inflation_z_up, obstacles_inflation_z_down;
|
||||
// 横向**额外**膨胀 [m],叠加在 double_cylinder_radius 之上:
|
||||
// 膨胀半径 = double_cylinder_radius(车体几何半径) + obstacles_inflation_xy(安全裕度)
|
||||
// 拆开后:车体尺寸只表达物理大小,安全裕度可单独调。
|
||||
double obstacles_inflation_xy;
|
||||
double double_cylinder_radius_, double_cylinder_offset_;
|
||||
bool map_sliding_en_;
|
||||
double map_sliding_thresh_;
|
||||
|
||||
@@ -32,6 +32,7 @@ void GridMap::initMap(rclcpp::Node *node)
|
||||
load_parameter(node_, "grid_map.obstacles_inflation_z_up", mp_.obstacles_inflation_z_up, -1.0);
|
||||
load_parameter(node_, "grid_map.obstacles_inflation_z_down", mp_.obstacles_inflation_z_down, -1.0);
|
||||
load_parameter(node_, "grid_map.double_cylinder_radius", mp_.double_cylinder_radius_, -1.0);
|
||||
load_parameter(node_, "grid_map.obstacles_inflation_xy", mp_.obstacles_inflation_xy, 0.0);
|
||||
load_parameter(node_, "grid_map.double_cylinder_offset", mp_.double_cylinder_offset_, 0.0);
|
||||
load_parameter(node_, "grid_map.map_sliding_en", mp_.map_sliding_en_, true);
|
||||
load_parameter(node_, "grid_map.map_sliding_thresh", mp_.map_sliding_thresh_, mp_.resolution_);
|
||||
@@ -207,8 +208,12 @@ void GridMap::updateMapBoundaryFromIndex()
|
||||
|
||||
void GridMap::rebuildInflationOffsets()
|
||||
{
|
||||
const double double_radius = std::max(0.0, mp_.double_cylinder_radius_);
|
||||
const int inf_step_xy = ceil(double_radius / mp_.resolution_);
|
||||
// 膨胀半径 = 车体几何半径 + 额外安全裕度。
|
||||
// 拆开后:车体尺寸只描述物理大小,改裕度不必跟着改"车有多大"。
|
||||
const double robot_radius = std::max(0.0, mp_.double_cylinder_radius_);
|
||||
const double extra_radius = std::max(0.0, mp_.obstacles_inflation_xy);
|
||||
const double inflate_radius = robot_radius + extra_radius;
|
||||
const int inf_step_xy = ceil(inflate_radius / mp_.resolution_);
|
||||
const int inf_step_z_up = ceil(mp_.obstacles_inflation_z_up / mp_.resolution_);
|
||||
const int inf_step_z_down = ceil(mp_.obstacles_inflation_z_down / mp_.resolution_);
|
||||
|
||||
@@ -217,7 +222,7 @@ void GridMap::rebuildInflationOffsets()
|
||||
for (int y = -inf_step_xy; y <= inf_step_xy; ++y)
|
||||
{
|
||||
Eigen::Vector2d offset_xy(x * mp_.resolution_, y * mp_.resolution_);
|
||||
if (offset_xy.norm() >= double_radius)
|
||||
if (offset_xy.norm() >= inflate_radius)
|
||||
continue;
|
||||
|
||||
for (int z = -inf_step_z_down; z <= inf_step_z_up; ++z)
|
||||
|
||||
@@ -37,11 +37,18 @@ scan_planner_node:
|
||||
# 代码里 footprint 是胶囊:front = pos + offset·heading,rear = pos - offset·heading,
|
||||
# 总长 = 2·offset + 2·radius。车体是圆,故 offset 必须为 0,退化为单圆柱;
|
||||
# 若沿用 0.20,footprint 会变成 1.46 m × 1.06 m,远处的窄道会被误判过不去。
|
||||
# 物理半径 0.53 m + 9 cm 裕度 ⇒ 0.62。
|
||||
# 0.53(零裕度)实测会规划出"贴脸"路径,跟踪误差直接撞上;
|
||||
# 0.62 保证 9 cm 物理余量,1.35 m 通道仍可行(需 1.24 m)。
|
||||
# 【两个图层,别混淆】
|
||||
# grid_map/occupancy —— 障碍**原样**,用来判断"障碍在哪、多大"
|
||||
# grid_map/occupancy_inflate —— 障碍外扩 R 后的区域,表示"车**中心**不能进入的范围",
|
||||
# 所以它必然比障碍粗一圈(粗多少 = R),这不是 bug。
|
||||
#
|
||||
# 唯一膨胀数 R(障碍外扩 R,扩完车被当点):
|
||||
# R = 车体物理半径 0.53 + 安全裕度 0.09 = 0.62
|
||||
# 0.53 时零裕度,实测跟踪误差即擦碰;0.62 需 1.24 m 通道,此前实测最稳。
|
||||
grid_map.double_cylinder_radius: 0.62
|
||||
grid_map.double_cylinder_offset: 0.0
|
||||
# 横向额外裕度,叠加在 R 上(总和才是实际膨胀)。当前 0 ⇒ 总膨胀 = 0.62。
|
||||
grid_map.obstacles_inflation_xy: 0.0
|
||||
# ⚠️ 参数名有误导:body_height 不是「车体物理高度」,语义是:
|
||||
# z_traj = waypoint.z(该点地面高度) + body_height
|
||||
# 全仓唯一消费者:reference_path_utils.h:119。抬完的 z 就是轨迹 z,
|
||||
|
||||
Reference in New Issue
Block a user