maliput / maliput_malidrive

Open-source ready OpenDrive backend for Maliput
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

XODR: Lane's length comparable to linear tolerance. #120

Open francocipollone opened 3 years ago

francocipollone commented 3 years ago

When loading a xodr such as:

Click to see XODR ```xml
```
[TRACE] Building lane id 609_0_-3
terminate called after throwing an instance of 'maliput::common::assertion_error'
  what():  open_range_validator.cc:OpenRangeValidator:33: Open range lower bound <5.500000> is greater than <2.839985>
Aborted (core dumped)

LANE-3

Road's length: 13.944560355298691 Lane -3's length is: 2.83998

The issue appears when building with a linear tolerance that is larger than the lane but less than the road. For example: Linear tolerance = 11.0

Error comes from building lane stage.

https://github.com/ToyotaResearchInstitute/maliput_malidrive/blob/0e0b9059d0c3d625b317efbe384d44a4f551b276/maliput_malidrive/src/maliput_malidrive/base/lane.cc#L47-L61

Here we are creating an OpenRangeValidator instance using an epsilon of linear_tolerance / 2. and of course it throws because of the verification the OpenRangeValidator's constructor does:

  MALIDRIVE_VALIDATE((min_ + epsilon_) <= max_, maliput::common::assertion_error,
                     std::string("Open range lower bound <") + std::to_string((min_ + epsilon_)) +
                         "> is greater than <" + std::to_string(max_) + ">");
francocipollone commented 3 years ago

The issue appears when building with a linear tolerance that is larger than the lane but less than the road. For example: Linear tolerance = 11.0

It isn't expected to use linear tolerances as high as 11.0. So if the XODR forces you to use this value of linear tolerance in order to build the RoadNetwork probably there must be another issue in the XODR, like a jump in some elevation description that is preferable to be fixed in order to improve the XODR description and of course, lower down the tolerance

Probably to improve awareness we could log a warning message when a Lane is smaller than the linear tolerance as it is happening in this case. And that condition isn't necessarily leading to an error. (The case described in this issue is even rarer given that road's length > linear tolerance > lane's length because of the curvature of the road)