autowarefoundation / autoware.universe

https://autowarefoundation.github.io/autoware.universe/
Apache License 2.0
936 stars 613 forks source link

Feature: Remove Autoware limitations about map boundaries #5959

Open ataparlar opened 8 months ago

ataparlar commented 8 months ago

Checklist

Description

Provide a Dynamic Lanelet2 map loader. (Problem detail below)

Autoware Projections

Autoware has a limitation for map boundaries. Map Projection Loader modules can work for MGRS, Local Cartesian UTM and Transverse Mercator projections. MGRS Projection works inside of the 100km x 100km MGRS grids. Local Cartesian UTM works inside of a UTM zone. Transverse Mercator does not have a limitation. Problems are detected via a lanelet2 map generated via Python script that uses CommonRoad API between Istanbul and Ankara in Turkey. The road lenght is approximately 600km. Screenshot from 2023-12-25 15-23-31

Problems with Available Projections

MGRS

The 100km x 100km MGRS grid visualization can be found below. The road overlays more than 1 MGRS grid and the nodes and line segments reaches out the other MGRS grids than the main one keep being inside in the main MGRS grid. So, the 600km road is stuck inside of the main MGRS grid. It seems like the line segments are bouncing from the edges of the main grid. The image related to that problem can be found below. Screenshot from 2023-12-25 15-20-39 Screenshot from 2023-12-07 13-14-14

LocalCartesianUTM

Same situation is valid for Local Cartesian UTM projection. Only difference is the map boundaries. Map boundaries here is not 100km x 100km MG Screenshot from 2023-12-25 15-35-35 RS grids, they are the UTM zone grids. So, this projection involves much area than MGRS projection but still it is insufficient for long routes. UTM projection visualization on the same road and the same error can be seen below. Screenshot from 2023-12-07 13-13-53

TransverseMercator

Transverse Mercator projection hasn't any boundary limitations. Additionally, we are able to load all the roads into the Autoware and visualize it in RViz2 with Planning Simulator or Logging Simulator. However, when we get away from the origin of the lanelet2 map, the line segments, TF markers, 2D Pose Estimate or 2D Goal Pose arrows start to corrupt because of the large numbers. This very looks like a floating point error. RViz2 screenshot can be seen in below GIF. Another issue with Transverse Mercator is corruptions in the map while getting away from the origin. In far places, the map loses its correctness due to the projection surface. 2023-12-25 15-59-32

Additionally, due to the large numbers of coordinates and 123 MB lanelet2(.osm) file makes the system very heavy. While this GIF is recording, nearly 20 GBs of RAM is used from the computer by Autoware Planning Simulator.

Purpose

Autoware needs to be compatible with long range drivable lanelet2 maps. While doing that, RAM usage must be kept low.

Possible approaches

Dynamic Lanelet2 Map Loading

Autoware can load point cloud maps dynamicly. This provides better physical component usage for PCs and accelerates the whole Autoware due to the light system. Same situation is valid for Lanelet2 Maps. Error determination tests are implemented with 600 km road overlays different projection zones. Observed that, only Transverse Mercator project is available to use all the map at once but it has floating point problem and loses correctness while getting away from the origin.

MGRS and LocalCartesianUTM works in a boundary and they preserves their sufficient accuracy in the boundary. So, for keep getting sufficient accuracy from the map and for keeping the map outsourcing lower, Lanalet2 Maps can loaded dynamicly as the car moves. As a matter of fact, 10 or 5 km MGRS grids can be used for dynamicly loading and this will provide more compatible position data generation with the real world.

Definition of done

VRichardJP commented 8 months ago

Looks very complicated. Just a random idea:

ataparlar commented 8 months ago

Dynamic Lanelet2 Map Loading

This concept is found necessary for using Autoware in large areas. The main idea is changing the loaded map area while the body is moving. To do that, MGRS grids can be used. Because MGRS grids enables to use the squares of 100km, 10km and 1km areas. We think that 1km MGRS grids will be ok to use. In that way, planning modules can work easily and all the pipeline would use lower amount time towards to larger areas. Here is a demonstration of the idea with a GIF below. dynamic-lanelet2-map-loader-legend

Editing Planning Pipeline According to Map Loading

With dynamicly loaded Lanelet2 maps, a problem is occuring. In large areas, we are not able to give a goal point with this planning implementation. Because the lanelet of the goal point could not be known with dynamicly loaded small Lanelet2 maps.

This situation can be solved with the suggestion made by @VRichardJP, which is using a graph structure to calculate the route with a full Lanelet2 map. This can work I think but this means one or several new package with various new nodes needed to be written and tested. This will cost too much time and too much energy to implement in my opinion. Additionally, I cannot guess the computational cost and how would be the performance in this stage. Still this can be the solution. Thank you for your sharings @VRichardJP.

Another solution can be using a different global planner with implementing it in the Autoware planning pipeline. This solution makes similar approximations with @xmfcx 's thoughts in another discussion about planning performence in large areas from @StepTurtle. We planned to use a global planner for large areas before giving a goal point. In this way, we can know which roads will be used in the route. Additionally, we got a planned route as a linestring and we can use it with planning pipeline.

The main idea here is taking the global planned route and giving goal points in each 1.5 or 2 kilometers to planning pipeline (Goal point can change according to the grid size will be used in Dynamic Lanelet2 Map Loading). Planning works fine in small environments has overall 1 kilometer radius. In that point of view, if we use goal points in a limited length and dynamicly changes the goal points along the globally planned route, it should work. Here is a demonstration of the general plan below. road_divide

Due to the complexity of the issue, we would like to discuss this before implement anything. Any comment or ideas would be great. @xmfcx @mitsudome-r

ataparlar commented 8 months ago

@xmfcx @mitsudome-r We can use this issue for only Dynamic Lanelet2 Map Loading and open another issue for route planning if needed. Also those already exist for route planning for large areas:

ataparlar commented 7 months ago

Using an external planner is not planned right now. The main aim is using mission_planner for large areas too. mission_planner can plan a route even in very long routes as can be seen in this video.

The main goal right now, using mission_planner with Dynamic Lanelet2 Loading. We are aiming it to use in MGRS projection for reaching the lowest projection corruption. However, MGRS projection has a limitation in a 100km x 100km MGRS grid. Besides that being a limitation, it can be an opportunity to use it on our good.

In large areas (over 100km routes), we are aiming to use mission_planner to plan the route. Once it plans the route, we can hold the lanelet ids inside of the route. The only issue here is to keeping coordinates low for not getting floating point errors. We thought that MGRS limitations can help with this. Here is a demonstration of what is planned. mgrs_border

As can be seen in the demonstration, in large areas, we change MGRS grids. In that situation, we will see that the lanelet2 maps of different MGRS grids will overlay due to the MGRS boundaries. To avoid that situation, we are planning that to use MGRS strings to find which MGRS grid the moving vehicle is in. Additonally, with Dynamic Lanelet2 Loading, it is aimed that to load lanelet2 maps according to MGRS string of moving vehicle.

Additionally, for keeping the coordinates low, we can apply the same method to point cloud maps as NDT input. With an MGRS string specification for each lanelet2 map and each point cloud will be able to solve the localization and mapping problem.

We will test this with a point cloud taken from AWSIM and a lanelet2 map generated via CommonRoad API at the crossing of 2 MGRS grids.

@xmfcx @mitsudome-r

mitsudome-r commented 7 months ago

MGRS grid cannot handle goals that is outside 100km x 100km, but can't we use other projection type for longer distance? (e.g., using TransverseMercator projection)

There could be distortion in the long distance anyways, but the topology of lane connection doesn't depend on the projection error so mission_planner should be able to do the route calculation just fine.

stale[bot] commented 5 months ago

This pull request has been automatically marked as stale because it has not had recent activity.

ataparlar commented 5 months ago

This issue is related to the MGRS boundaries. We can use LocalCartesian UTM or Transverse Mercator projections in Autoware. In real-life conditions, there won't be a drive that is too long. So, MGRS boundaries are not a problem right now.

We have opened PRs for Dynamic Lanelet2 Map Loading part. They are waiting for reviews.

stale[bot] commented 3 months ago

This pull request has been automatically marked as stale because it has not had recent activity.