S_min/s_max in Tutorial 02

Hello Team,

I have some issues with planning the motion of the ego vehicle. When I try to run commonRoad_io Tutorial 2 Exercise 4, an error occurs:

constr.append(x[0, k + 1] <= s_max[k])
IndexError: list index out of range

It seems the problem originates in the following lines

for o in dyn_obstacles:
    if o.initial_state.position[0] < x_0[0]:
        [...]
        prediction = o.prediction.trajectory.state_list    
        for p in prediction:
            s_min.append(p.position[0] + o.obstacle_shape.length/2. + 2.5)
    else:
        [...]
        prediction = o.prediction.trajectory.state_list
        for p in prediction:
            s_max.append(p.position[0] - o.obstacle_shape.length/2. - 2.5)

where prediction is evaluated for both following and leading vehicle. However, it seems like the line

prediction = o.prediction.trajectory.state_list

does not generate output of the same length in both cases, as suggested by evaluating the sizes of s_min and s_max:

npy.shape(s_min)
(40,)
npy.shape(s_max)
(39,)

Is there a reason why the prediction of the leading vehicle is missing one time step? I hope I didnt miss anything important, thanks in advance for your answer!

Did you use the tutorials from the commonroad-io repository (https://gitlab.lrz.de/tum-cps/commonroad_io/-/tree/master/commonroad/tutorials)?
If not, please try these tutorials.

Best,
Sebastian

Yes, I downloaded optimization_solution.ipynb , but when I run it, the same IndexError is thrown after input section 8. Lengths of s_min and s_max are still 40 and 39 respectively.
Plotted values from input section 7 (s_min: blue, s_max_red):
plot_s_min_s_max

I had the same results on a different machine. Has anyone else had this issue/ is it reproducible?

Can you try to run the scenario jupyter notebook again?

1 Like

No, I created the .xml file according to the website, which seems to have been a mistake.
Running the scenario jupyter notebook from the repository and recreating the .xml file from it made it work - thank you very much for your help!