Is visualization.draw_dispatch_cr obsolete?

I am trying to follow the basic Getting Started tutorial in the doc website of commonroad-io (link)

And the following line seems obsolete

from commonroad.visualization.draw_dispatch_cr import draw_object

because the error is saying

ModuleNotFoundError: No module named 'commonroad.visualization.draw_dispatch_cr'

I looked at the Gitlab repo, indeed there is no longer a file named ‘draw_dispatch_cr’ in it. I assume that the example given in the doc is outdated? Please help, thanks!

By the way, I looked at other tutorials (this one, for example), and by replacing draw_dispatch_cr with its latest equivalent of MPRenderer, it works correctly to display the scenario now, at least. I think the documentation is not updated. That is my conclusion. Below is the modified code:

import os
import matplotlib.pyplot as plt

from commonroad.common.file_reader import CommonRoadFileReader
# from commonroad.visualization.draw_dispatch_cr import draw_object
from commonroad.visualization.mp_renderer import MPRenderer

file_path = os.path.join(os.getcwd(), 'scenarios/USA_Lanker-1_1_T-1.xml')

scenario, planning_problem_set = CommonRoadFileReader(file_path).open()

# plt.figure(figsize=(25, 10))
# draw_object(scenario)
# draw_object(planning_problem_set)
# plt.gca().set_aspect('equal')
# plt.show()

# plot the planning problem and the scenario for the fifth time step
plt.figure(figsize=(25, 10))
rnd = MPRenderer()
scenario.draw(rnd, draw_params={'time_begin': 5})
planning_problem_set.draw(rnd)
rnd.render()
plt.show()
1 Like

You are right, the code in the documentation is outdated.
We will update it as soon as possible.

The tutorials on the commonroad-io tool website should be correct.

1 Like

Thank you for confirming, Sebastian!