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

How to import an OpenDRIVE map using UTM coordinate system #153

Closed GraySnail closed 7 months ago

GraySnail commented 7 months ago

I use the RSS-lib in my own simulator, and during the integration process, I modified it based on the RSS-sensor from Carla.

During the final debugging process, I found that ad-map-access does not support the UTM coordinate system, and my map happens to be in UTM coordinates, with a large map scope. And my maps use extended lon/lat offset use userData label. Due to the large map scope and coordinate values like (x:10330.6, y:-41831.2, z:0), an error occurred when creating the ENU coordinates:

withinValidInputRange(::ad::map::point::ENUCoordinate)>> -41831.17771743114 out of valid input range [-16384.0, 16384.0]

By reviewing the ad map access doc and related issues, I've come to understand that in the ENU coordinate system, larger coordinate values lead to larger errors. Therefore, author have implemented range restrictions in the code.

How should I proceed with using the rss-lib? Is there a solution specific to the UTM coordinate system? Or do I need to explore alternative approaches and consider abandoning the use of ad-map-access?

berndgassmann commented 7 months ago

Hi, the question is: is your map really that large, that it exceeds the extends of 32km? Maybe you just have to set the coordinate system reference point into the center of your map. Because in general the transformations used in importing the opendrive should work. The problem though with ENU coordinate systems is: if your coordinate system origin is selected too far away the projections are becoming worse and errorneous. Which log output do you see on loading your map. Is is using the geo reference point from the opendrive file? https://github.com/carla-simulator/map/blob/master/ad_map_access/src/opendrive/AdMapFactory.cpp#L74

Alternatively you might be able to compile the ad-map-access yourself (if not already doing so) and just extend the coordinate range checks to meet your requirements here: https://github.com/carla-simulator/map/blob/master/ad_map_access/generated/include/ad/map/point/ENUCoordinateValidInputRange.hpp#L55 https://github.com/carla-simulator/map/blob/master/ad_map_access/generated/src/ad/map/point/ENUCoordinate.cpp#L35 But you might see that the latest version of the ad-map-access library has already extended the coordinate values to 1e8 in the meantime, because others also had problems with opendrive maps which were generated with having a bad coordinate system origin for the projection. Maybe just rebuild using the latest release and the problem might be gone. Bernd.

GraySnail commented 7 months ago

Thank you so much. I will follow your suggestion to update the reference points of the map and rebuild the project using the latest ad-map-access.