feat(lane_route_planner): trim endpoint spin fans, load zone_deviation_weight (R2.12)
- New output_endpoint_spins (default false): the published plan starts at the first driving pose and ends with one goal pose. The local planner turns in place by itself; the planner still verifies both spins are collision free. - Load and clamp zone_deviation_weight; print both keys in the boot line. - Tests for the trim helper (29 pass).
This commit is contained in:
@@ -305,6 +305,7 @@ TEST(AdapterConfig, LatticeYamlReachesPlannerConfig)
|
||||
const PlannerConfig expected;
|
||||
EXPECT_FALSE(defaults.planner.lattice_enabled);
|
||||
EXPECT_DOUBLE_EQ(defaults.planner.zone_transition_m, 1.0);
|
||||
EXPECT_FALSE(defaults.output_endpoint_spins);
|
||||
EXPECT_EQ(defaults.planner.lattice_heading_bins, expected.lattice_heading_bins);
|
||||
EXPECT_DOUBLE_EQ(defaults.planner.lattice_preferred_gap_m, expected.lattice_preferred_gap_m);
|
||||
EXPECT_DOUBLE_EQ(defaults.planner.lattice_preferred_time_fraction, expected.lattice_preferred_time_fraction);
|
||||
@@ -833,4 +834,32 @@ TEST(AdapterDump, FailureDumpIsReadableRunLengthText)
|
||||
EXPECT_TRUE(writeFailureDump(dir, "bad", live, std::vector<uint8_t>(5, 0), directions, route, config, result).empty());
|
||||
}
|
||||
|
||||
TEST(EndpointSpins, TrimKeepsFirstDrivingPoseAndArrivalPose)
|
||||
{
|
||||
// Start spin 0 -> 0.2 rad, drive 1 m along x, goal spin 0.2 -> 1.0 rad.
|
||||
const Path path{ {0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.1, 0.0}, {0.0, 0.0, 0.2, 0.0},
|
||||
{0.5, 0.0, 0.2, 0.0}, {1.0, 0.0, 0.2, 0.0},
|
||||
{1.0, 0.0, 0.6, 0.0}, {1.0, 0.0, 1.0, 0.0} };
|
||||
const Path trimmed = trimEndpointSpins(path);
|
||||
ASSERT_EQ(trimmed.size(), 3u);
|
||||
EXPECT_DOUBLE_EQ(trimmed.front().x, 0.0);
|
||||
EXPECT_DOUBLE_EQ(trimmed.front().yaw, 0.2);
|
||||
EXPECT_DOUBLE_EQ(trimmed[1].x, 0.5);
|
||||
EXPECT_DOUBLE_EQ(trimmed.back().x, 1.0);
|
||||
EXPECT_DOUBLE_EQ(trimmed.back().yaw, 0.2);
|
||||
for (std::size_t i = 1; i < trimmed.size(); ++i)
|
||||
EXPECT_GT(std::hypot(trimmed[i].x - trimmed[i - 1].x, trimmed[i].y - trimmed[i - 1].y), 0.1);
|
||||
}
|
||||
|
||||
TEST(EndpointSpins, PathsWithoutSpinsOrWithoutDrivingAreUnchanged)
|
||||
{
|
||||
const Path straight{ {0.0, 0.0, 0.0, 0.0}, {0.5, 0.0, 0.0, 0.0}, {1.0, 0.0, 0.0, 0.0} };
|
||||
EXPECT_EQ(trimEndpointSpins(straight).size(), straight.size());
|
||||
// A rotation-only plan has no driving pose to keep, so the controller still gets the full turn.
|
||||
const Path rotate{ {2.0, 1.0, 0.0, 0.0}, {2.0, 1.0, 0.5, 0.0}, {2.0, 1.0, 1.0, 0.0} };
|
||||
EXPECT_EQ(trimEndpointSpins(rotate).size(), rotate.size());
|
||||
const Path two{ {0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0} };
|
||||
EXPECT_EQ(trimEndpointSpins(two).size(), two.size());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user