Attribute error for obstacle appearing at t > 0

I have a bunch of scenarios where obstacles only appear half way into the scenario, i.e. whose initial_state timestamp is > 0. In these cases, I’m getting the following error when trying to evaluate criticality:

File ~/dev/atks/deeptest/venv3.9/lib/python3.9/site-packages/commonroad_crime/utility/general.py:101, in check_in_same_lanelet(lanelet_network, vehicle_1, vehicle_2, time_step)
     91 def check_in_same_lanelet(
     92     lanelet_network: LaneletNetwork,
     93     vehicle_1: DynamicObstacle,
     94     vehicle_2: Union[DynamicObstacle, StaticObstacle],
     95     time_step: int,
     96 ):
     97     lanelets_1 = lanelet_network.find_lanelet_by_shape(
     98         vehicle_1.occupancy_at_time(time_step).shape
     99     )
    100     lanelets_2 = lanelet_network.find_lanelet_by_shape(
--> 101         vehicle_2.occupancy_at_time(time_step).shape
    102     )
    103     return len(set(lanelets_1).intersection(lanelets_2)) > 0

AttributeError: 'NoneType' object has no attribute 'shape'

Could somebody please help me with this?

Dear Ferdinand,

Thank you once again for your question. Indeed, the issue you’ve raised could occur, and we realize that we had not implemented attribute error handling previously. Your keen observation is greatly appreciated.

We have now addressed this oversight, and the updates have been merged into the latest develop branch. Should you have any further questions or require additional assistance, please do not hesitate to reach out to us.

Warm regards,
Yuanfei

1 Like

Wow, that was quick, thanks a lot! :pray:

1 Like