Skip to content

Commit

Permalink
Fixed ad_map_opendrive_reader (#29)
Browse files Browse the repository at this point in the history
- updated carla Town01/03 map files
- added carla Town04 to test_files
- added initialization of cmake variable to be on the safe side
  • Loading branch information
berndgassmann committed Oct 1, 2020
1 parent 8f4c4eb commit 5d0e7c4
Show file tree
Hide file tree
Showing 23 changed files with 78,122 additions and 22,573 deletions.
2 changes: 1 addition & 1 deletion ad_map_access/impl/src/landmark/LandmarkOperation.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ----------------- BEGIN LICENSE BLOCK ---------------------------------
//
// Copyright (C) 2018-2019 Intel Corporation
// Copyright (C) 2018-2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
//
Expand Down
6 changes: 5 additions & 1 deletion ad_map_access/impl/src/lane/LaneOperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ point::ParaPoint uniqueParaPoint(point::GeoPoint const &geoPoint)
auto mapMatchingResult
= mapMatching.getMapMatchedPositions(geoPoint, physics::Distance(0.1), physics::Probability(0.5));

if (mapMatchingResult.size() != 1)
if (mapMatchingResult.size() == 0u)
{
throw std::runtime_error("uniqueLaneId: position doesn't match any lane within 0.1 meters");
}
if (mapMatchingResult.size() != 1u)
{
throw std::runtime_error("uniqueLaneId: position matches multiple lanes");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ struct IntersectionPrioRightTown01WestToSouthTest : IntersectionTown01WestToSout
return IntersectionPriorityToRightWestToSouthTest::expectedIncomingLanesWithLowerPriority();
}
}

virtual lane::LaneIdSet expectedCrossingLanes() const override
{
// since there are four internal lanes within the intersection from north to south (510149, 510249, 510349, 510449)
// the precalculated from the base class don't work here
// we have to reduce to the lower half of the lanes
return createUnorderedLaneIdSet({lane::LaneId(510349), lane::LaneId(510449)});
}
};

TEST_F(IntersectionPrioRightTown01WestToSouthTest, basic_checks)
Expand Down
12 changes: 6 additions & 6 deletions ad_map_access/impl/tests/intersection/IntersectionTown01Test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ struct IntersectionTown01WestToSouthTest : virtual SyntheticIntersectionTestBase
{
virtual point::GeoPoint getGeoFromSouth() const override
{
return point::createGeoPoint(point::Longitude(8.00490650359), point::Latitude(49.0000165612), point::Altitude(0));
return point::createGeoPoint(point::Longitude(0.0032321), point::Latitude(0.0000165612), point::Altitude(0));
}

virtual point::GeoPoint getGeoToSouth() const override
{
return point::createGeoPoint(point::Longitude(8.0048934219), point::Latitude(48.9999830507), point::Altitude(0));
return point::createGeoPoint(point::Longitude(0.0032321), point::Latitude(-0.0000169493), point::Altitude(0));
}

virtual point::GeoPoint getGeoFromWest() const override
{
return point::createGeoPoint(point::Longitude(8.00462843722), point::Latitude(48.9997976038), point::Altitude(0));
return point::createGeoPoint(point::Longitude(0.0030455), point::Latitude(-0.0002023962), point::Altitude(0));
}

virtual point::GeoPoint getGeoToWest() const override
{
return point::createGeoPoint(point::Longitude(8.0045717552), point::Latitude(48.9997433894), point::Altitude(0));
return point::createGeoPoint(point::Longitude(0.003000), point::Latitude(-0.0002566106), point::Altitude(0));
}

virtual point::GeoPoint getGeoFromNorth() const override
{
return point::createGeoPoint(point::Longitude(8.00424859652), point::Latitude(48.9999829343), point::Altitude(0));
return point::createGeoPoint(point::Longitude(0.0028), point::Latitude(-0.0000170657), point::Altitude(0));
}

virtual point::GeoPoint getGeoToNorth() const override
{
return point::createGeoPoint(point::Longitude(8.00423629191), point::Latitude(49.0000237813), point::Altitude(0));
return point::createGeoPoint(point::Longitude(0.0028), point::Latitude(0.0000237813), point::Altitude(0));
}

virtual point::GeoPoint getGeoFromEast() const override
Expand Down
2 changes: 1 addition & 1 deletion ad_map_access/impl/tests/lane/LaneOperationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ TEST_F(LaneOperationTest, getLane)
TEST_F(LaneOperationTest, getPointsOfInterest)
{
ASSERT_TRUE(access::init("test_files/Town01.txt"));
auto pos = point::createGeoPoint(point::Longitude(8.0026912), point::Latitude(48.9970472), point::Altitude(3.1));
auto pos = point::createGeoPoint(point::Longitude(0.00193915337), point::Latitude(-0.00295), point::Altitude(0.));
std::vector<config::PointOfInterest> poI;
poI = access::getPointsOfInterest(pos, physics::Distance(1.0));
ASSERT_EQ(poI.size(), 0u);
Expand Down
52 changes: 51 additions & 1 deletion ad_map_access/impl/tests/opendrive/OpenDriveAccessTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@ struct OpenDriveAccessTests : ::testing::Test
void checkEdgePoints(lane::LaneId laneId, point::ECEFEdge const &edge)
{
EXPECT_GE(edge.size(), 2u) << static_cast<uint64_t>(laneId);
if (edge.size() == 2u)
{
return;
}
for (auto pointIter = edge.begin(); pointIter != edge.end(); pointIter++)
{
auto nextPointIter = pointIter + 1;
if (nextPointIter != edge.end())
{
auto deltaPoints = *pointIter - *nextPointIter;
auto pointDistance = vectorLength(deltaPoints);
EXPECT_NE(pointDistance, physics::Distance(0.)) << static_cast<uint64_t>(laneId);
EXPECT_NE(pointDistance, physics::Distance(0.)) << static_cast<uint64_t>(laneId) << " num: " << edge.size();
}
}
}
Expand Down Expand Up @@ -229,6 +233,52 @@ TEST_F(OpenDriveAccessTests, lane_contact_points_town01)
}
}

TEST_F(OpenDriveAccessTests, lane_points_town03)
{
ASSERT_TRUE(access::init("test_files/Town03.txt"));

for (auto laneId : lane::getLanes())
{
auto lane = lane::getLane(laneId);
checkEdgePoints(lane.id, lane.edgeLeft.ecefEdge);
checkEdgePoints(lane.id, lane.edgeRight.ecefEdge);
}
}

TEST_F(OpenDriveAccessTests, lane_contact_points_town03)
{
ASSERT_TRUE(access::init("test_files/Town03.txt"));

for (auto laneId : lane::getLanes())
{
auto lane = lane::getLane(laneId);
checkEdgeContacts(lane);
}
}

TEST_F(OpenDriveAccessTests, lane_points_town04)
{
ASSERT_TRUE(access::init("test_files/Town04.txt"));

for (auto laneId : lane::getLanes())
{
auto lane = lane::getLane(laneId);
checkEdgePoints(lane.id, lane.edgeLeft.ecefEdge);
checkEdgePoints(lane.id, lane.edgeRight.ecefEdge);
}
}

TEST_F(OpenDriveAccessTests, lane_contact_points_town04)
{
ASSERT_TRUE(access::init("test_files/Town04.txt"));

for (auto laneId : lane::getLanes())
{
auto lane = lane::getLane(laneId);
checkEdgeContacts(lane);
}
}

TEST_F(OpenDriveAccessTests, map_matching_town01)
{
ASSERT_TRUE(access::init("test_files/Town01.txt"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ TEST_F(LaneIntervalOperationTest, GetEdgeAndBorder)
TEST_F(LaneIntervalOperationTest, GetProjectedENUEdgeOnTown01)
{
ASSERT_TRUE(access::init("test_files/Town01.txt"));
access::setENUReferencePoint(createGeoPoint(Longitude(8.0), Latitude(49.0), Altitude(0.)));

ENUPoint point_edu1 = createENUPoint(4.453, -4.560, 0);
ASSERT_NEAR((double)lane::calcWidth(point_edu1), 3.9943, 0.0001);
Expand Down
25 changes: 15 additions & 10 deletions ad_map_access/impl/tests/route/RoutePredictionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct RoutePredictionTestTown03 : public RoutePredictionTest
{
std::string getTestMap() override
{
return "test_files/Town03.adm.txt";
return "test_files/Town03.txt";
}
};

Expand All @@ -93,7 +93,7 @@ TEST_F(RoutePredictionTestTown01, route_prediction_positive)
auto routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(10.));
EXPECT_EQ(routePredictions.size(), 1u);

routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(500.));
routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(450.));
EXPECT_EQ(routePredictions.size(), 6u);
}

Expand All @@ -103,7 +103,7 @@ TEST_F(RoutePredictionTestTown01, route_prediction_dont_care)
auto routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(10.));
EXPECT_EQ(routePredictions.size(), 1u);

routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(500.));
routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(450.));
EXPECT_EQ(routePredictions.size(), 6u);
}

Expand All @@ -112,7 +112,7 @@ TEST_F(RoutePredictionTestTown03, route_prediction_positive)
auto routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(10.));
EXPECT_EQ(routePredictions.size(), 1u);

routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(500.));
routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(478.));
EXPECT_EQ(routePredictions.size(), 18u);
}

Expand All @@ -122,7 +122,7 @@ TEST_F(RoutePredictionTestTown03, route_prediction_dont_care)
auto routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(10.));
EXPECT_EQ(routePredictions.size(), 1u);

routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(500.));
routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(478.));
EXPECT_EQ(routePredictions.size(), 18u);
}

Expand All @@ -132,7 +132,7 @@ TEST_F(RoutePredictionTestTown03, route_prediction_constructor)
auto routePredictions = route::planning::predictRoutesOnDuration(predictionStart, physics::Duration(1.));
ASSERT_EQ(routePredictions.size(), 1u);

routePredictions = route::planning::predictRoutes(predictionStart, physics::Distance(500.), physics::Duration(500.));
routePredictions = route::planning::predictRoutes(predictionStart, physics::Distance(478.), physics::Duration(478.));
ASSERT_EQ(routePredictions.size(), 18u);
}

Expand All @@ -150,7 +150,7 @@ struct RoutePredictionTestIntersection : public RoutePredictionTestTown01
{
point::GeoPoint getPredictionStartGeo() override
{
return point::createGeoPoint(point::Longitude(8.0012071), point::Latitude(48.9971953), point::Altitude(0.));
return point::createGeoPoint(point::Longitude(0.00079520), point::Latitude(-0.00284188), point::Altitude(0.));
}
};

Expand Down Expand Up @@ -189,12 +189,17 @@ struct RoutePredictionTestRoundabout : public RoutePredictionTestTown03
{
point::GeoPoint getPredictionStartGeo() override
{
return point::createGeoPoint(point::Longitude(8.0004625), point::Latitude(49.0000714), point::Altitude(0.));
return point::createGeoPoint(point::Longitude(0.00033117), point::Latitude(0.00007233), point::Altitude(0.));
}
};

TEST_F(RoutePredictionTestRoundabout, route_prediction)
{
auto routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(50.));
EXPECT_EQ(routePredictions.size(), 5u);
auto routePredictions = route::planning::predictRoutesOnDistance(predictionStart, physics::Distance(130.));
// starting at the east entry we get:
// - to north
// - to south
// - circling just before out to east
// the route towards the west is not present in the new map!
EXPECT_EQ(routePredictions.size(), 3u);
}
2 changes: 1 addition & 1 deletion ad_map_access/impl/tests/test_files/Town01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ openDriveDefaultIntersectionType=TrafficLight
openDriveDefaultTrafficLightType=LEFT_STRAIGHT_RED_YELLOW_GREEN

[POI]
poi=T1 48.997026667 8.0026912 0.1
poi=T1 -0.00298986768 0.00193915337 0.
Loading

0 comments on commit 5d0e7c4

Please sign in to comment.