diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f8f433..d9a6a0a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,9 +18,9 @@ jobs: container: image: ubuntu:20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ros-tooling/setup-ros@v0.6 - - uses: ros-tooling/action-ros-ci@v0.2 + - uses: ros-tooling/action-ros-ci@v0.3 id: action_ros_ci_step with: package-name: ${{ env.PACKAGE_NAME }} diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index a689251..b95574e 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -37,7 +37,7 @@ jobs: - uses: ros-tooling/setup-ros@v0.6 env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }} - name: clang 8 install diff --git a/.github/workflows/scan_build.yml b/.github/workflows/scan_build.yml index a70d75c..fa72e70 100644 --- a/.github/workflows/scan_build.yml +++ b/.github/workflows/scan_build.yml @@ -26,7 +26,7 @@ jobs: - uses: ros-tooling/setup-ros@v0.6 env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }} - name: clang 8 install diff --git a/test/find_lane_sequences_test.cc b/test/find_lane_sequences_test.cc index 6da65fc..eb62d4e 100644 --- a/test/find_lane_sequences_test.cc +++ b/test/find_lane_sequences_test.cc @@ -40,6 +40,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -190,5 +193,54 @@ GTEST_TEST(FindLaneSequencesTest, MaxLengthOmitsStartAndEndLanes) { ASSERT_EQ(FindLaneSequences(start_lane, end_lane, total_length).size(), 1u); } +static constexpr char kMalidriveResourcesPath[] = DEF_MALIDRIVE_RESOURCES; + +// Loads TShapeRoad, and evaluates FindLaneSequences() for a large distance that will not +// filter out results, and shows the behavior when removing and leaving U-turns. +class TShapeRoadFindLaneSequencesTest : public ::testing::Test { + public: + //@{ Tolerances set to match the involved geometries and the parser resolution. + static constexpr double kLinearTolerance{1e-6}; + static constexpr double kAngularTolerance{1e-6}; + static constexpr double kScaleLength{1.0}; + static constexpr double kDistance{std::numeric_limits::max()}; + static constexpr bool kDontRemoveUTurns{false}; + static constexpr bool kRemoveUTurns{true}; + //@} + const std::string kTShapeRoadFilePath{std::string(kMalidriveResourcesPath) + + std::string("/resources/odr/TShapeRoad.xodr")}; + + const api::LaneId kStartLaneId{"1_0_1"}; + const api::LaneId kEndLaneId{"0_0_1"}; + const Lane* start_lane_; + const Lane* end_lane_; + + void SetUp() override { + std::map configuration; + configuration.emplace(malidrive::builder::params::kRoadGeometryId, "malidrive_rg"); + configuration.emplace(malidrive::builder::params::kOpendriveFile, kTShapeRoadFilePath); + configuration.emplace(malidrive::builder::params::kLinearTolerance, std::to_string(kLinearTolerance)); + configuration.emplace(malidrive::builder::params::kAngularTolerance, std::to_string(kAngularTolerance)); + configuration.emplace(malidrive::builder::params::kScaleLength, std::to_string(kScaleLength)); + configuration.emplace(malidrive::builder::params::kInertialToBackendFrameTranslation, "{0., 0., 0.}"); + road_network_ = malidrive::loader::Load(configuration); + start_lane_ = road_network_->road_geometry()->ById().GetLane(kStartLaneId); + end_lane_ = road_network_->road_geometry()->ById().GetLane(kEndLaneId); + } + + std::unique_ptr road_network_{}; +}; + +TEST_F(TShapeRoadFindLaneSequencesTest, NotRemovingUTurnYieldsTwoSequences) { + CheckSequences( + FindLaneSequences(start_lane_, end_lane_, kDistance, kDontRemoveUTurns), + {{"1_0_1", "6_0_-1", "2_0_1", "9_0_-1", "0_0_-1", "5_0_-1", "1_0_-1", "7_0_-1", "2_0_-1", "8_0_-1", "0_0_1"}, + {"1_0_1", "4_0_1", "0_0_1"}}); +} + +TEST_F(TShapeRoadFindLaneSequencesTest, RemovingUTurnYieldsOneSequence) { + CheckSequences(FindLaneSequences(start_lane_, end_lane_, kDistance, kRemoveUTurns), {{"1_0_1", "4_0_1", "0_0_1"}}); +} + } // namespace routing } // namespace maliput