Skip to content

An environment for urban area autonomous driving and pedestrian collision avoidance.

License

Notifications You must be signed in to change notification settings

kengboon/RoadEnv

Repository files navigation

The repository contains code used for my Master's thesis (Teo, 2023, "Recurrent Soft Actor-Critic (RSAC) Algorithm for Pedestrian Collision Avoidance in Occlusion Scenarios," Universiti Sains Malaysia, School of Computer Sciences, supervised by Dr. Fadratul Hafinaz Hassan).

If you are using the software, please cite it using this metadata.


RoadEnv

An environment for urban area autonomous driving and decision-making - extended and modified from highway-env.

Scenarios

  • Roadside obstacles
  • Pedestrians cross the road

Objective

  • Pedestrian collision avoidance
  • Navigation

Observation

Get Started

  1. Install highway-env via pip for all dependencies.
    pip install highway-env==1.8.1
  2. Clone the repository.
    git clone https://github.com/kengboon/RoadEnv.git

Usage

# Register environment
from road_env import register_road_envs
register_road_envs()

# Make environment
import gymnasium as gym
env = gym.make('urban-road-v0', render_mode='rgb_array')

# Configure parameters (example)
env.configure({
    "random_seed": None,
    "duration": 60,
})

obs, info = env.reset()

# Graphic display
import matplotlib.pyplot as plt
plt.imshow(env.render())

# Execution
done = truncated = False
while not (done or truncated):
    action = ... # Your agent code here
    obs, reward, done, truncated, info = env.step(action)
    env.render() # Update graphic

See more examples.

Resources

Citation

View CITATION.cff.

@software{Teo_RoadEnv,
    author = {Teo, Keng Boon},
    license = {MIT},
    title = {{RoadEnv}},
    url = {https://github.com/kengboon/RoadEnv}
}

Buy me a ☕

Support me on Ko-fi