Unable to render Lanelets in correct z-order

Hi, I am trying to render a scenario together with some shapes. I can give the shapes and obstacles in the scenario a z-order, but not the lanelets. However, I did find the following lines in the MPRenderer.py file:

class ZOrders:
    LANELET_POLY = 9.0
    # Some more constants here
    RIGHT_BOUND = 12.0
    LEFT_BOUND = 12.0
    # Some more constants down below..

I am also drawing a shape to show the vehicle FOV with the following ShapeParams:

  time_begin: 0
  time_end: 1
  antialiased: true
  opacity: 0.95
  facecolor: '#E5E5FF'
  edgecolor: '#E5E5FF'
  linewidth: 0.5
  zorder: 1
  draw_mesh: false

I would think that since the FOV shape has a lower z-order, it would be rendered first, and then the lanelet bounds (this is functioning for all other objects in the scenario, at least). However, this is not the case. Here is an example plot: (I turned down the opacity a bit to show the underlying lanelets)
image

Am I missing something in the functionality of these z-orders for lanelets? Or is there maybe a work-around for ordering the plotting? Thanks!

Using commonroad-io 2022.3

The ZOrders class is only used internally in the visualization and cannot be modified from the user code.
I think there exists no workaround (without modifying the commonroad-io code itself, i.e., the
ZOrders class).
We will consider this feature in a future release.

Thank you for the reply!

I understand that the Lanelet Z-Orders can not be modified, however my thought was that I could still influence the order of plotting by setting the Z-Orders of my other elements relative to the Z-Orders of the lanelets. But this is not working as expected. Should I interpret the Z-Order of the lanelets as in the commonroad-io code equivalent to how Z-Orders work for other objects, or are they handled separately?

They are handled separately.

1 Like