Skip to main content

An environment for simulated highway driving tasks.

Project description

Python PyPI build pre-commit Code style: black


An episode of one of the environments available in HighwayEnv.

A collection of environments for autonomous driving and tactical decision-making tasks. Originally developed by Edouard Leurent and currently maintained by Jin Huang.

The documentation website is at highway-env.farama.org, and we have a public discord server (which we also use to coordinate development work) that you can join here: https://discord.gg/bnJ6kubTg6

Installation

To install HighwayEnv, use:

pip install highway-env

or with uv:

uv add highway-env          # adds to project dependencies and installs (preferred)
uv pip install highway-env  # or install without adding to a project (pip install)

We support Linux and macOS primarily, with Windows support maintained on a best-effort basis.

Environments

HighwayEnv includes 10 driving scenario families: highway, intersection, exit, lane-keeping, merge, parking, racetrack, roundabout, two-way, and u-turn, with several environments also offering fast, continuous-control, connected-lane, multi-agent, generic, large, or oval variants. The full list with descriptions and configuration options is available in the documentation.

Previews
highway highway
merge merge
roundabout roundabout
parking parking
intersection intersection
racetrack racetrack
lane-keeping lane-keeping
two-way two-way
exit exit
u-turn u-turn

Usage

import gymnasium as gym
import highway_env

gym.register_envs(highway_env)

# Initialise the environment
env = gym.make("highway-v0", config={"lanes_count": 3}, render_mode="human")

# Reset the environment to generate the first observation
obs, info = env.reset()
for _ in range(1000):
    # this is where you would insert your policy
    action = env.action_space.sample()

    # step (transition) through the environment with the action
    # receiving the next observation, reward and if the episode has terminated or truncated
    obs, reward, terminated, truncated, info = env.step(action)

    # If the episode has ended then we can reset to start a new episode
    if terminated or truncated:
        obs, info = env.reset()

env.close()

See the documentation for more examples including how to train agents with Stable Baselines3 and Google Colab notebooks. For examples of trained agents (DQN, DDPG, Value Iteration, MCTS), see the Agent Examples page.

Documentation

Read the documentation online.

Development Roadmap

Here is the roadmap for future development work.

Citating

If you use HighwayEnv in your work, please consider citing it with:

@misc{highway-env,
  author = {Leurent, Edouard},
  title = {An Environment for Autonomous Driving Decision-Making},
  year = {2018},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/Farama-Foundation/HighwayEnv}},
}

Publications

A list of publications using HighwayEnv can be found in the documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

highway_env-1.12.0.tar.gz (92.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

highway_env-1.12.0-py3-none-any.whl (110.0 kB view details)

Uploaded Python 3

File details

Details for the file highway_env-1.12.0.tar.gz.

File metadata

  • Download URL: highway_env-1.12.0.tar.gz
  • Upload date:
  • Size: 92.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for highway_env-1.12.0.tar.gz
Algorithm Hash digest
SHA256 accdf3239209a1a43be5c52ba95149ee7cf4567b8747947153d87d22e65bc6ce
MD5 ce5b4296fe947d8c5d566363ee7b6ee6
BLAKE2b-256 30bf4ef0c1e1fc9f1e05d4472926d34e6682a45cb1d04118b76716aa37af9d02

See more details on using hashes here.

File details

Details for the file highway_env-1.12.0-py3-none-any.whl.

File metadata

  • Download URL: highway_env-1.12.0-py3-none-any.whl
  • Upload date:
  • Size: 110.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for highway_env-1.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3c091526c2f86e40f38277b08b2c3bb07425151afc05960c96b342a7a99d40b
MD5 2b7b4a4f8c06e2fc720b0dff98b1342d
BLAKE2b-256 9606f2bb3bf26ff54aacade7ff9ee2ead85ef057f1d40ecb08ffb9df4debd14c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page