HighwayEnv icon indicating copy to clipboard operation
HighwayEnv copied to clipboard

custom environment

Open lihua12312 opened this issue 10 months ago • 3 comments

Hello! Can I control all the background vehicles myself, for example, by using a prediction model to output the trajectories of background vehicles, while the main vehicle uses IDM?

lihua12312 avatar Mar 29 '24 06:03 lihua12312

"Can environments that are not for reinforcement learning purposes be constructed?"

lihua12312 avatar Mar 29 '24 12:03 lihua12312

Hello! Can I control all the background vehicles myself, for example, by using a prediction model to output the trajectories of background vehicles, while the main vehicle uses IDM?

It's not natively supported, but you can edit an environment and set the class of other vehicles in the scene (created in env._make_vehicles()) as Vehicle, and then at any time you can control them by setting their vehicle.action['acceleration'] and vehicle.action['steering'], for vehicle in env.road.vehicles

"Can environments that are not for reinforcement learning purposes be constructed?"

Likewise, it's not really natively supported as this project is mostly intended for RL, but the code can be adapted. You can make a custom environment without any ego-vehicle (to be controlled), simply populate the scenes with other vehicles and call env.simulate()

eleurent avatar Apr 06 '24 11:04 eleurent

Thank you very much for your response!

lihua12312 avatar Apr 06 '24 14:04 lihua12312