Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spawning vehicles #731

Open
EhsanSabouni opened this issue Jun 4, 2024 · 1 comment
Open

Spawning vehicles #731

EhsanSabouni opened this issue Jun 4, 2024 · 1 comment

Comments

@EhsanSabouni
Copy link

Hi

I want to use ramp in MARL. But I do not know how to spawn car on side road (in ramp). Does anyone know how to spawn car in an arbitrary position?

I checked the website and found this but I am not sure how to find these values including navigation module, spawn_lane_index and so on.

    # A BaseNavigation instance. It should match the road network type.
    navigation_module=None,
    # A lane id specifies which lane to spawn this vehicle
    spawn_lane_index=None,
    # destination lane id. Required only when navigation module is not None.
    destination=None,
    # the longitudinal and lateral position on the spawn lane
    spawn_longitude=5.0,
    spawn_lateral=0.0,

Thanks

@QuanyiLi
Copy link
Member

QuanyiLi commented Jun 9, 2024

Hi @EhsanSabouni,

All lanes will have its corresponding ID, which can be retrieved by lane.id. And you can find all lanes from env.engine.current_map.road_network which also records the connectivity information for all lanes. Usually speaking, the lane id is generated following some rules. This line is for creating the merging lane:

self.add_respawn_roads(straight_road)

Checking the properties of 'straight_road' would tell you the lane ID in style (node1, node2, lane_index). If you are connecting multiple ramps, the ID of this merging lane only differs at the first digit which indicates the block order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants