feat(lane_route): heuristic-only standability relax for the lattice field (R2.9)
- lattice_field_standability_relax_m (default 0): shrinks the inflated footprint half sizes for the lattice heuristic field only; graph reference, C-space and verification stay strict. - Plugin loads it, prints it on the fallback boot line; README and eval override key. - Measured 10/11: with extra field clearance 0 any relax reopens the sim post gaps (dumps 1, 2, 4 time out); with extra clearance 0.1 a relax of 0.035 keeps them and gains one kit query.
This commit is contained in:
@@ -1493,6 +1493,14 @@ TEST(Lattice, InvalidParametersAreRejected)
|
||||
config.lattice_field_cell_factor = -1;
|
||||
EXPECT_FALSE(config.validate().empty());
|
||||
config = latticeConfig();
|
||||
config.lattice_field_standability_relax_m = -0.001;
|
||||
EXPECT_FALSE(config.validate().empty());
|
||||
config.lattice_field_standability_relax_m = std::numeric_limits<double>::infinity();
|
||||
EXPECT_FALSE(config.validate().empty());
|
||||
config.lattice_field_standability_relax_m = -0.001;
|
||||
config.lattice_enabled = false;
|
||||
EXPECT_TRUE(config.validate().empty());
|
||||
config = latticeConfig();
|
||||
config.lattice_field_max_cells = 0;
|
||||
EXPECT_FALSE(config.validate().empty());
|
||||
config = latticeConfig();
|
||||
@@ -2160,6 +2168,8 @@ TEST(Standability, PostsRejectEverySampledHeadingAndReferenceDetours)
|
||||
EXPECT_EQ(tests, 1u);
|
||||
EXPECT_FALSE(standability.fits(cy * map.width + cx));
|
||||
EXPECT_EQ(tests, 1u); // Memoised even for a rejected cell.
|
||||
detail::Standability relaxed_posts(grid, config, &memory, nullptr, nullptr, nullptr, nullptr, 0.035);
|
||||
EXPECT_FALSE(relaxed_posts.fits(cy * map.width + cx));
|
||||
const Point2 start{1.025, 2.525}, goal{4.025, 2.525};
|
||||
double reference = 0.0;
|
||||
ASSERT_TRUE(detail::shortestStandableReference(grid, start, goal, 90.0, 100.0, &reference, standability));
|
||||
@@ -2175,6 +2185,77 @@ TEST(Standability, PostsRejectEverySampledHeadingAndReferenceDetours)
|
||||
ASSERT_EQ(field.factor, 1);
|
||||
EXPECT_EQ(field.settled[static_cast<std::size_t>(cy) * map.width + cx], 0);
|
||||
EXPECT_GT(info.lattice_standability_rejected, 0u);
|
||||
config.lattice_field_standability_relax_m = 0.035;
|
||||
PlanInfo relaxed_info;
|
||||
detail::LatticeContext relaxed_context{request, grid, config, 90.0, deadline, relaxed_info, memory};
|
||||
detail::LatticeField relaxed_field(&memory);
|
||||
ASSERT_TRUE(detail::buildLatticeField(relaxed_context, &relaxed_field, deadline));
|
||||
EXPECT_EQ(relaxed_field.settled[static_cast<std::size_t>(cy) * map.width + cx], 0);
|
||||
}
|
||||
|
||||
TEST(Standability, FieldRelaxationReopensAnOffCentrePose)
|
||||
{
|
||||
LatticeTestGrid map(100, 100);
|
||||
for (int x = 20; x <= 80; ++x)
|
||||
{
|
||||
map.cost[static_cast<std::size_t>(45) * map.width + x] = kLethalCost;
|
||||
map.cost[static_cast<std::size_t>(54) * map.width + x] = kLethalCost;
|
||||
}
|
||||
exactTestClearance(&map);
|
||||
PlannerConfig config = latticeConfig();
|
||||
config.half_x_m = 0.5; config.half_y_m = 0.15; config.footprint_min_gap_m = 0.03;
|
||||
config.lattice_field_cell_factor = 1;
|
||||
config.lattice_field_clearance_weight_m = 0.0;
|
||||
GridRef grid = map.view();
|
||||
const std::size_t cell = static_cast<std::size_t>(50) * map.width + 50;
|
||||
detail::Standability strict(grid, config, std::pmr::get_default_resource(), nullptr, nullptr, nullptr, nullptr);
|
||||
detail::Standability relaxed(grid, config, std::pmr::get_default_resource(), nullptr, nullptr, nullptr, nullptr, 0.035);
|
||||
EXPECT_FALSE(strict.fits(cell));
|
||||
EXPECT_TRUE(relaxed.fits(cell));
|
||||
// The centre is 5 mm short of the 30 mm gap; moving within the same cell clears both walls.
|
||||
EXPECT_TRUE(footprintCollides(grid, 2.525, 2.525, 0.0, 0.53, 0.18));
|
||||
EXPECT_FALSE(footprintCollides(grid, 2.525, 2.510, 0.0, 0.53, 0.18));
|
||||
|
||||
const RouteRequest request = latticeRequest(pose(1.525, 2.525, 0.0), pose(3.525, 2.525, 0.0));
|
||||
const auto deadline = detail::Clock::now() + std::chrono::seconds(10);
|
||||
detail::LatticeMemory memory(16 * 1024 * 1024);
|
||||
PlanInfo strict_info;
|
||||
detail::LatticeContext strict_context{request, grid, config, 90.0, deadline, strict_info, memory};
|
||||
detail::LatticeField strict_field(&memory);
|
||||
ASSERT_TRUE(detail::buildLatticeField(strict_context, &strict_field, deadline));
|
||||
ASSERT_EQ(strict_field.factor, 1);
|
||||
EXPECT_EQ(strict_field.settled[cell], 0);
|
||||
config.lattice_field_standability_relax_m = 0.035;
|
||||
PlanInfo relaxed_info;
|
||||
detail::LatticeContext relaxed_context{request, grid, config, 90.0, deadline, relaxed_info, memory};
|
||||
detail::LatticeField relaxed_field(&memory);
|
||||
ASSERT_TRUE(detail::buildLatticeField(relaxed_context, &relaxed_field, deadline));
|
||||
ASSERT_EQ(relaxed_field.factor, 1);
|
||||
EXPECT_NE(relaxed_field.settled[cell], 0);
|
||||
}
|
||||
|
||||
TEST(Standability, GraphReferenceIgnoresFieldRelaxation)
|
||||
{
|
||||
LatticeTestGrid map(100, 100);
|
||||
const int cx = 50, cy = 50;
|
||||
for (const auto& offset : std::vector<std::pair<int, int>>{{-5, 0}, {5, 0}, {0, -5}, {0, 5}})
|
||||
map.cost[static_cast<std::size_t>(cy + offset.second) * map.width + cx + offset.first] = kLethalCost;
|
||||
exactTestClearance(&map);
|
||||
PlannerConfig strict_config = latticeConfig();
|
||||
strict_config.half_x_m = 0.5; strict_config.half_y_m = 0.15; strict_config.footprint_min_gap_m = 0.03;
|
||||
PlannerConfig field_config = strict_config;
|
||||
field_config.lattice_field_standability_relax_m = 0.035;
|
||||
GridRef grid = map.view();
|
||||
detail::Standability strict(grid, strict_config, std::pmr::get_default_resource(), nullptr, nullptr, nullptr, nullptr);
|
||||
detail::Standability graph_with_field_relax(grid, field_config, std::pmr::get_default_resource(), nullptr, nullptr, nullptr, nullptr);
|
||||
EXPECT_FALSE(strict.fits(cy * map.width + cx));
|
||||
EXPECT_FALSE(graph_with_field_relax.fits(cy * map.width + cx));
|
||||
const Point2 start{1.025, 2.525}, goal{4.025, 2.525};
|
||||
double first = 0.0, second = 0.0;
|
||||
ASSERT_TRUE(detail::shortestStandableReference(grid, start, goal, 90.0, 100.0, &first, strict));
|
||||
ASSERT_TRUE(detail::shortestStandableReference(grid, start, goal, 90.0, 100.0, &second, graph_with_field_relax));
|
||||
EXPECT_DOUBLE_EQ(first, second);
|
||||
EXPECT_GT(first, 3.2);
|
||||
}
|
||||
|
||||
TEST(Standability, NarrowCorridorFitsLengthwise)
|
||||
|
||||
Reference in New Issue
Block a user