Custom visualization of lanelets

I have a quick question related to OpenDRIVE to Lanelet conversion. Could you please help me out with this?

For a single lane (either right or left), I am trying to plot a lanelet with color visualisation for every 1m distance based on lane width value.

for example:

  • If lanelet id 100 has a length of 103m.
  • For 50m the width value is 3.55m and the remaining 53m has the width value of 3.75m
  • I want to visualize this lanelet with ‘green’ color if the width value is 3.75m and ‘red’ if it is 3.55m
  • while I am trying with the available source code by providing these conditions, I am getting only one color for the whole lanelet

My question is will it be possible to give different colors based on width value for the same lanelet?

or would it be possible to divide the lanelet based on the width value and then color coding?

Please help me out with this problem. Thank you in advance!

Best regards

Donthineni

Dear Donthineni,

unfortunately, it is not possible to have different colors for a single lanelet based on the width.

However, your second approach would work and requires two steps:

  • separating the lanelet based on the width value (you would have to implement this by yourself)
  • drawing each lanelet individually and using different draw_params with specific lanelet colors for each width

Best,
Sebastian

Thank you for your response.

I will try to implement this approach by separating the lanelet based on the width value.

In the mean time, if it is possible could you please share your idea or piece of code on how to implement it? It would be so helpful for me.

Thank you in advance!

Best regards,
Donthineni.

my rough idea how I would start:

  1. compute width for each lanelet (np.linalg.norm between left and right polyline)
  2. find path length for first point where to cut lanelet
  3. use interpolate_position() in lanelet.py to find corresponding vertices
  4. create two new lanelets and remove old one
  5. repeat 1-4 for the rear (second) part of the lanelet
  6. continue with the next lanelet

Thank you for the help. I will try to work on this.