huawei-noah / SMARTS

Scalable Multi-Agent RL Training School for Autonomous Driving
MIT License
951 stars 190 forks source link

To generate myself scenario #1139

Open zyk516 opened 2 years ago

zyk516 commented 2 years ago

High Level Description [To generate myself scenario]

Desired SMARTS version [e.g. 0.4.18]

Operating System [ubuntu 18.04]

Problems I generated 10 social agents using follow codes:

car_nums = 10
car_index_list = [i for i in range(car_nums)]
laner_actors = []
laner_missions = []
for car_index in car_index_list:
    laner_actors.append(t.SocialAgentActor(name=str(car_index), agent_locator="zoo.policies:keep-lane-agent-v0"))
    laner_missions.append(t.Mission(t.Route(begin=("445633932", car_index, 'random'), end=("445633932", 0, 'max'))))

missions = [
    t.Mission(t.Route(begin=("445633932", 2, 'random'), end=("445633932", 0, 'max')))
]
gen_scenario(
    t.Scenario(
        # traffic={'cars':traffic},
        ego_missions=missions,
        social_agent_missions={"all": (laner_actors, laner_missions)}

    ),
    output_dir=Path(__file__).parent,
)

But when I visualize this scenario with envision, I can only see one social agent.It seems that one social agent randomly chose from 10 social agents I generate will appear in one episode.I want to know how the 10 social agents appear at the same time.

Gamenot commented 2 years ago

@zyk516 Hello sorry for the late reply, I have looked at the problem. The way you are attempting to create the social vehicles should be correct. I was surprised by this issue, it looks like at some point we tried to share the mission generation code with the ego missions and it ended with the behavior you note.

I am putting up a solution for it.

Gamenot commented 2 years ago

Solution in review with PR #1151.

saulfield commented 1 year ago

Oh I just realized the PR was abandoned. I will reopen.