carla-simulator / scenario_runner

Traffic scenario definition and execution engine
https://carla-scenariorunner.readthedocs.io/en/latest/
MIT License
500 stars 353 forks source link

Bug Report: Class CheckMaximumVelocity in Scenario Runner Gives False Values #1009

Open GabrielZZZ opened 11 months ago

GabrielZZZ commented 11 months ago

Thanks for contributing to CARLA!

If you are reporting an issue, please use the following outline:

CARLA version: 0.9.13 Platform/OS: Ubuntu

Problem you have experienced:

image

It can be found in the image that when the Actual speed value of the vehicle exceeds the Expected Value, the criterion CheckMaximumVelocity gives a SUCCESS result, which by definition should give FAILURE.

image

What you expected to happen:

The criterion criterion CheckMaximumVelocity gives a FAILURE result.

GabrielZZZ commented 11 months ago

To help reproduce, I run the OppositeVehicleRunningRedLight_3 scenario and just push the throttle to max value since the beginning of the simulation.

GabrielZZZ commented 2 months ago

An update:

I have tracked the entire process, and the issue with the final report was due to self.test_status not being updated globally: the status was correct each time velocity and self.expected_value_success were compared. However, in the final report, which represents the global state of the maximum speed value, the status value reflected only the latest updated value instead of the global value:

Screenshot 2024-04-25 at 13 20 09 Screenshot 2024-04-25 at 13 23 26

GabrielZZZ commented 2 months ago

The issue is resolved by updating the code in srunner/scenariomanager/scenarioatomics/atomic_criteria.py : if velocity > self.success_value: to if self.actual_value > self.success_value:, which update the maximum value globally criteria-correct-result