Exemple #1
0
    def test_interface(self):
        """
        Main test part
        """
        self.assertTrue(admap.init("test_files/TPK.adm.txt"))

        # map loaded
        lanes = admap.getLanes()
        self.assertEqual(len(lanes), 141)

        # map matching
        mapMatching = admap.AdMapMatching()
        geoPoint = admap.GeoPoint()
        geoPoint.longitude = admap.Longitude(8.4401803)
        geoPoint.latitude = admap.Latitude(49.0191987)
        geoPoint.altitude = admap.Altitude(0.)

        mapMatchingResults = mapMatching.getMapMatchedPositions(
            geoPoint, physics.Distance(0.01), physics.Probability(0.05))
        self.assertEqual(len(mapMatchingResults), 1)

        # route planning
        routingStart = mapMatchingResults[0].lanePoint.paraPoint
        routingEnd = admap.ParaPoint()
        routingEnd.laneId = routingStart.laneId
        routingEnd.parametricOffset = physics.ParametricValue(0.0)

        routeResult = admap.planRoute(admap.createRoutingPoint(routingStart),
                                      admap.createRoutingPoint(routingEnd))
        routeLength = admap.calcLength(routeResult.roadSegments[0])
        self.assertEqual(int(float(routeLength)), 4)

        admap.cleanup()
Exemple #2
0
    def _initialize_ego_vehicle(self):
        # laneId: offset 240151:0.55
        self._initialize_object(admap.Longitude(8.00125444865324766),
                                admap.Latitude(48.99758627528235877),
                                math.pi / 2, self.egoObject)

        self.egoSpeed = physics.Speed(5.)

        # laneId: offset  120149:0.16
        positionEndGeo = admap.createGeoPoint(
            admap.Longitude(8.00188527300496979),
            admap.Latitude(48.99821051747871792), admap.Altitude(0.))

        self.egoRoute = admap.planRoute(
            self.egoObject.mapMatchedBoundingBox.referencePointPositions[
                admap.ObjectReferencePoints.Center][0].lanePoint.paraPoint,
            positionEndGeo)
Exemple #3
0
    def _initialize_object(self, lon, lat, yawAngle, resultObject):
        positionGeo = admap.createGeoPoint(lon, lat, admap.Altitude(0.))

        # fill the result position
        resultObject.enuPosition.centerPoint = admap.toENU(positionGeo)
        resultObject.enuPosition.heading = admap.createENUHeading(yawAngle)
        resultObject.enuPosition.dimension.length = physics.Distance(4.5)
        resultObject.enuPosition.dimension.width = physics.Distance(2.)
        resultObject.enuPosition.dimension.height = physics.Distance(1.5)
        resultObject.enuPosition.enuReferencePoint = admap.getENUReferencePoint(
        )

        mapMatching = admap.AdMapMatching()
        resultObject.mapMatchedBoundingBox = mapMatching.getMapMatchedBoundingBox(
            resultObject.enuPosition, physics.Distance(0.1))

        self.assertGreaterEqual(
            len(resultObject.mapMatchedBoundingBox.referencePointPositions),
            admap.ObjectReferencePoints.Center)
        self.assertGreaterEqual(
            len(resultObject.mapMatchedBoundingBox.referencePointPositions[
                admap.ObjectReferencePoints.Center]), 0)