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
288 stars 69 forks source link

How can I spawn vehicles on the opposite lane? #584

Open nivolog opened 2 years ago

nivolog commented 2 years ago

Hello there, I'm trying to create custom scenario with custom scene made in Roadrunner. The scene is displayed below. image

And main problem is - no matter how I change parameters or lane configs - vehicles always drive on the same lane, as shown on the picture.

image

The road configuration is: road 0 starts at top left side and road 1 starts right about the turn at the bottom. So what i did recently is changed lane configs for left and right lane, so road ids are [0,1] and [1,0] for left_lane and right_lane respectively. That help me to spawn vehicles on different ends of the road(s). However, no matter how i chnge lane_corridor_id, or source and sink position, vehicles refused to spawn correctly. The code I used for lane confiigs is displayed below. I was trying to comment something and change numbers here, however, as I said, it didn't lead to any progress. Hope You can help me understand, what's going on!

`left_lane = LaneCorridorConfig(params=param_server, source_pos=[1, 48], sink_pos=[1, 2], road_ids=[0,1], lane_corridor_id=1, behavior_model=BehaviorIDMClassic(param_server), min_vel=5., max_vel=5., ds_min=8., ds_max=10., s_min=15., s_max=35.) right_lane = LaneCorridorConfig(params=param_server,

source_pos=[30,-3],

                                    #sink_pos=[1, -3],
                                    road_ids=[1,0],
                                    lane_corridor_id=-1,
                                    behavior_model=BehaviorIDMClassic(param_server),
                                    controlled_ids=True,
                                    max_vel=5.,
                                    ds_min=8.,
                                    ds_max=10.,
                                    s_min=15.,
                                    s_max=35.)   `
nivolog commented 2 years ago

The geometry of the scene is simple. Suppose that beggining of this U-turn is bottom-left corner. Therefore main anchor points are: (0,0) for the center of the begining of the road, about (100,25) for the middle of the U-turn, and (0,50) for the end of the road.

nivolog commented 2 years ago

UPD: I've conducted some experiments and found out that the problem occures only on curved roads, like I posted before, with U-turn. On simple straight roads it is possible for me to generate opposite traffic even on 4 lanes. But with exactly the same lane configs on exactly the same scene except it is a bit longer and has U-turn this scenario refused to work. Example of successfull launch is on the picture below: image