intel / ad-rss-lib

Library implementing the Responsibility Sensitive Safety model (RSS) for Autonomous Vehicles
https://intel.github.io/ad-rss-lib/
GNU Lesser General Public License v2.1
336 stars 138 forks source link

Question: Init object by metric coordinates in map_integration #125

Closed max-zipfl closed 2 years ago

max-zipfl commented 2 years ago

Hello, I am trying to understand the python example of map_integration. There, the objects are initialized with geodetic coordinates (ENU). Is it possible to define objects with x and y? How would an example look like?

`

    # example from interface_test.py
    positionGeo = ad.map.point.createGeoPoint(lon, lat, ad.map.point.Altitude(0.)) # -> I want to exchange lon and lat by x and y
    # fill the result position
    resultObject.enuPosition.centerPoint = ad.map.point.toENU(positionGeo)
    resultObject.enuPosition.heading = ad.map.point.createENUHeading(yawAngle)
    resultObject.enuPosition.dimension.length = ad.physics.Distance(4.5)
    resultObject.enuPosition.dimension.width = ad.physics.Distance(2.)
    resultObject.enuPosition.dimension.height = ad.physics.Distance(1.5)
    resultObject.enuPosition.enuReferencePoint = ad.map.access.getENUReferencePoint()

`

If this is not possible, is there an option to read the projection string from an opendrive file using this library with python. I have already found the mapdata reference, but haven't found a useful way to retrieve it - without rebuilding the whole factorypipeline.

Thanks!

berndgassmann commented 2 years ago

Hi, ad.map.point provides different transformations between coordinate frames. There are different overloads of (to/fromGeo, to/fromENU, to/fromECEF). See map-doc. Indeed the geo coordinates are here even not the actual input format since it is transformed by toENU. So you can just skip the Geo coordinates and immediately enter

resultObject.enuPosition.centerPoint.x = ad.map.point.ENUCoordinate(your-x-value)
resultObject.enuPosition.centerPoint.y = ad.map.point.ENUCoordinate(your-y-value)
resultObject.enuPosition.centerPoint.z = ad.map.point.ENUCoordinate(your-z-value)

For some more details on the used coordinate systems look here.

If you load an open drive map file, the projection string is internally already considered when doing the coordinate system transformations.

Hope this helps. Bernd.

max-zipfl commented 2 years ago

sorry for the late reply - thank you for the detailed explanation, it helped a lot.

Best Max