bark-simulator / bark

Open-Source Framework for Development, Simulation and Benchmarking of Behavior Planning Algorithms for Autonomous Driving
https://bark-simulator.github.io/
MIT License
287 stars 69 forks source link

how to get left and right boundaries of the current road #511

Closed tinmodeHuang closed 3 years ago

tinmodeHuang commented 3 years ago

the snippet in the method Observer()in graph_observer.py:

    # the distance between the ego agent and boundaries of the road
    distance = []
    num_lines = len(list(world.ego_agent.road_corridor.lane_corridors))
    distance.append(Distance(world.ego_agent.GetPolygonFromState(world.ego_agent.state), 
                    world.ego_agent.road_corridor.lane_corridors[num_lines-1].right_boundary))
    distance.append(-Distance(world.ego_agent.GetPolygonFromState(world.ego_agent.state), 
                    world.ego_agent.road_corridor.lane_corridors[0].left_boundary))
    distance.sort(key=abs)
    obs[-2] = self._normalize_value(distance[0], [0, 3*num_lines])

I want to know a little about the snippet:

  1. does world.ego_agent.road_corridor simply hold the road that ego agent is currently in or all roads in the map?
  2. does barkhave an interface to provide the number of lanes of the road ego agent is currently in?
patrickhart commented 3 years ago
  1. its the road_corridor specific to the ego agent
  2. road_corridor.lane_corridors are all lanes within a road.
patrickhart commented 3 years ago

I will close this issue for now due to inactivity. Feel free to re-open this issue if it still persists!