michigan-traffic-lab / Mcity-AV-Challenge

10 stars 2 forks source link

velocity=subscription[veh_id][64], 2024-04-02 18:43:48 test_env_a | KeyError: 'CAV' #1

Closed Jihy closed 5 months ago

Jihy commented 5 months ago

When running the code, the process is stuck and the logs in container are as follows. 2024-04-02 18:43:48 test_env_a | Traceback (most recent call last): 2024-04-02 18:43:48 test_env_a | File "<frozen __main__>", line 3, in <module> 2024-04-02 18:43:48 test_env_a | File "<frozen mcity_av_challenge>", line 179, in <module> 2024-04-02 18:43:48 test_env_a | File "<frozen mcity_av_challenge>", line 170, in main 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/simulator.py", line 247, in run 2024-04-02 18:43:48 test_env_a | self.step() 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/simulator.py", line 211, in step 2024-04-02 18:43:48 test_env_a | self.step_pipeline(self, self.ctx) 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/pipeline.py", line 16, in __call__ 2024-04-02 18:43:48 test_env_a | output = element.executable(*args, **kwargs) 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/envs/base.py", line 77, in _step 2024-04-02 18:43:48 test_env_a | step_result = self.on_step(ctx) 2024-04-02 18:43:48 test_env_a | File "<frozen terasim_nde_ite.envs.safetest_nade>", line 77, in on_step 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/envs/template.py", line 34, in make_decisions 2024-04-02 18:43:48 test_env_a | control_command_and_info = {veh.id: veh.make_decision() for veh in self.vehicle_list} 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/envs/template.py", line 34, in <dictcomp> 2024-04-02 18:43:48 test_env_a | control_command_and_info = {veh.id: veh.make_decision() for veh in self.vehicle_list} 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/agent/agent.py", line 153, in make_decision 2024-04-02 18:43:48 test_env_a | obs_dict = self._fetch_observation() 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/agent/agent.py", line 121, in _fetch_observation 2024-04-02 18:43:48 test_env_a | obs_dict = {name: self.sensors[name].observation for name in self.sensors} 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/agent/agent.py", line 121, in <dictcomp> 2024-04-02 18:43:48 test_env_a | obs_dict = {name: self.sensors[name].observation for name in self.sensors} 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/agent/agent_sensor.py", line 55, in observation 2024-04-02 18:43:48 test_env_a | return self._simulator.state_manager.retrieve_variable(self._agent.id, self._name) 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/state_manager.py", line 93, in retrieve_variable 2024-04-02 18:43:48 test_env_a | self._sensor_buffer[veh_id][sensor_name] = StampedData(sensor.fetch(), current_time) 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/vehicle/sensors/local.py", line 51, in fetch 2024-04-02 18:43:48 test_env_a | Ego=LocalSensor.pre_process_subscription(veh_id=self._agent.id), 2024-04-02 18:43:48 test_env_a | File "/usr/local/lib/python3.10/dist-packages/terasim/vehicle/sensors/local.py", line 74, in pre_process_subscription 2024-04-02 18:43:48 test_env_a | velocity=subscription[veh_id][64], 2024-04-02 18:43:48 test_env_a | KeyError: 'CAV'

Exceptionally the terminal has no output after running for some time. And the output file has no valid record.

Jihy commented 5 months ago

It seems like if the car run out of the map, it would present this error.

zhuhj-tery commented 5 months ago

Certainly, when the autonomous vehicle (AV) run out of the map, the Mcity testing environment will come to a halt. Nonetheless, there is no cause for concern as the Mcity testing environment is designed to restart automatically in the event of an unexpected stop.

zhuhj-tery commented 5 months ago

In this case, we suggest you visualize the output trajectories to see how your algorithm performs. You can run

python3 /app/av_decision_making_module/visualization_tool.py

to generate the videos.

zhuhj-tery commented 5 months ago

The normal workflow will be: If the "test_env_a" Docker container encounters some unexpected problems and stop the test, it will automatically restart after waiting for 30 seconds. In the meantime, your AV decision-making module will also stop, and you will see the output like this:

Exiting...
The trajectory data have been stored in the folder: output/trajectory_data/mcity_av_challenge_results/raw_data/0_1

Then, you should visualize the trajectory using the command:

python3 /app/av_decision_making_module/visualization_tool.py --trajectory_path output/trajectory_data/mcity_av_challenge_results/raw_data/0_1

You will see a video named "0_1.mp4" inside the folder "output/trajectory_videos." You should be able to find any existing problems after watching the video.