Pytest for the lastest version issues

I am installing the latest version of commonroad-rl on a Ubuntu 18.04 machine, but after running

pytest commonroad_rl/tests --scope unit module -m "not slow"

I got

21 failed, 262 passed, 5 deselected, 478 warnings in 309.82s (0:05:09)

The failed cases are mostly costed by

  1. The make function:
    def make(self, **kwargs) → Env:
    “”“Instantiates an instance of the environment with appropriate kwargs”""
    if self.entry_point is None:
    raise error.Error(
    f"Attempting to make deprecated env {self.id}. "
    “(HINT: is there a newer registered version of this env?)”
    )
  _kwargs = self.kwargs.copy()

E AttributeError: ‘NoneType’ object has no attribute ‘copy’

  1. The find lanelet function
    def find_lanelet_by_id(self, lanelet_id: int) → Lanelet:
   assert is_natural_number(lanelet_id), '<LaneletNetwork/find_lanelet_by_id>: provided id is not valid! id = {}'.format(lanelet_id)

E AssertionError: <LaneletNetwork/find_lanelet_by_id>: provided id is not valid! id = []

Have you met these issues?

I solve the issue by downgrading gym-0.22 to gym-0.21, but new issues come.

self = <commonroad_rl.gym_commonroad.utils.navigator.Navigator object at 0x7f9dd22320d0>, route = None

def __init__(self, route: Route):
    # version 2020 # version 06.2021 variables shared
  self.scenario = route.scenario

E AttributeError: ‘NoneType’ object has no attribute ‘scenario’

commonroad_rl/gym_commonroad/utils/navigator.py:41: AttributeError

I think it could be package version inconsistency. I guess we need to know what package version the project is working with. You just write a “gym” in the environment.yml, but gym just got updated on Feb 19, 2022. I can no longer solve this issue by settling the package version. Could you take a look at it?

Hi Galen,

I tested it and for some scenarios in the tests, the current route planner does not find a route. This is caused by an update in the route planner to not generate invalid/bad-quality routes. I pushed a commit to remove such scenarios in our test cases.

Best,
Xiao

Hi Xiao,

I see, thanks for your help!

Galen

Hi @xwang, I cloned the repository and followed the instructions given at https://gitlab.lrz.de/tum-cps/commonroad-rl. I am still getting the same error as @Galen233. Can you please help me.

Hi Joy,

Could you give more details about for which scenario did the error happen? The error of not finding lanelet ids is caused by a bug in shapely. We cached the polygon of lanelets to accelerate the function of finding lanelets. However, the cached polygons are None in some case after polygon.buffer function in shapely. We abandoned the use of this function in our internal version of commonroad-io, will be released recently. My suggestion is to focus on highway scenarios where the lanelets are more structured and switch to urban scenarios after the next release of commonroad-io.

Best,
Xiao

Dear Joy,

A new commonroad-io version has been released. This should solve the error you got.

Best,
Xiao

Hi @xwang, I tried with new version. This time gym version has been changed to 0.21.0 in environment.yml. However, I am still getting 3 failures. I am getting AssertionError: <LaneletNetwork/find_lanelet_by_id>: provided id is not valid! id = [] for def find_lanelet_by_id(self, lanelet_id: int) -> Lanelet:

Thanking you,
Joy

Dear Joy,

Are you using commonroad-io 2022.1?

Best,
Xiao

Hi @xwang, I was using commonroad-io==2021.4 as given in the environment.yml previously. I will change that and try again. Also it will be helpful if tutorials for CommonroadRL get updated. There are some issues with the visualization in the Tutorial2.

I changed to commonroad-io=2022.1. Now all of the 283 tests are passed.