Nuscenes data conversion: Unable to run 3D simulation
Opened this issue · 4 comments
Hi, when I was running the dataset conversion for nuscenes, I found that I could render in 2D normally, but I couldn’t render in 3D.
System: Windows 11
Python environment: 3.9.18
Log:
>>> python -m scenarionet.sim -d D:\GithubCodes\dataset\ --render 3D
>>> d:\githubcodes\scenarionet\scenarionet\sim.py:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources # for suppress warning
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
File "C:\Users\10149\miniconda3\envs\scenarionet\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\10149\miniconda3\envs\scenarionet\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "d:\githubcodes\scenarionet\scenarionet\sim.py", line 52, in <module>
env.reset(seed=index if args.scenario_index is None else args.scenario_index)
File "d:\githubcodes\metadrive\metadrive\envs\base_env.py", line 499, in reset
return self._get_reset_return()
File "d:\githubcodes\metadrive\metadrive\envs\base_env.py", line 504, in _get_reset_return
scene_manager_after_step_infos = self.engine.after_step()
File "d:\githubcodes\metadrive\metadrive\engine\base_engine.py", line 396, in after_step
self.interface.after_step()
File "d:\githubcodes\metadrive\metadrive\engine\interface.py", line 51, in after_step
self._render_contact_result(track_v.contact_results)
File "d:\githubcodes\metadrive\metadrive\engine\interface.py", line 167, in _render_contact_result
color = COLLISION_INFO_COLOR[COLOR[text]][1]
KeyError: None
I output the variables in the _render_contact_results()
function according to the log, and found that the variable text
is None.
I solved this problem by modified the _render_contact_results()
function in \metadrive\metadrive\engine\interface.py
:
def _render_contact_result(self, contacts):
contacts = sorted(
list(contacts), key=lambda c: COLLISION_INFO_COLOR[COLOR[c]][0])
text = contacts[0] if len(contacts) != 0 else None
try:
color = COLLISION_INFO_COLOR[COLOR[text]][1]
except Exception as e:
text = 'red'
color = COLLISION_INFO_COLOR['red'][1]
if time.time() - self.engine._episode_start_time < 10:
text = "Press H to see help message"
self._render_banner(text, color)
Hi,
Thank you for the feedback.
Could you provide your MetaDrive version? This should be fixed on the latest main
branch already.
Hello, I installed it from the GitHub repository. The most recent commit ID displayed locally is: 653431be036c818e38856f0148789aea13c4f5fc, 4 Oct 2023 23:52, Add pull asset hint (#510)
Thanks. Could you try the latest MetaDrive main branch? It should be fixed now.