Dynamic obstacles

Hi,
I want to ask how to get the speed of dynamic obstacles at various moments (there is a get_obstacles() in base_class, but it is not very clear for me how to use), because I want to reward those who make “avoidance” or change lanes, do you have any good suggestions?

Hi you_bear_er_lai,

as I understood you just want to get the speed of dynamic obstacles, right? I think followings step may help you:

  • use obstacle_in_lanelet = get_obstacles() in base_class to obtain the subset of obstacles;
  • for each obstacle you obtained from last step, e.g.
    for obs in obstacle_in_lanelet:
    if obs.obstacle_role == Obstacle.obstacle_role.DYNAMIC:
    # find out whether it is a dynamic obstacle
  • then you can get prediction list of a dynamic obstacle, please see commonroad_io API, https://commonroad-io.readthedocs.io/en/latest/api/scenario/#dynamicobstacle-class

Hope it can help :slight_smile: