Farama-Foundation / HighwayEnv

A minimalist environment for decision-making in autonomous driving

Home Page:https://highway-env.farama.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating a New Environment

vinay06vinay opened this issue · comments

Hello,

I have a query about creating a new custom environment and registering it. The current documentation is not clear

  1. Firstly, the "register(
    id='your-env-v0',
    entry_point='highway_env.envs:YourEnv',
    )" should be inside highway_env/init.py file as other environments

  2. Secondly, I am not able to understand how to make my custom-created environment (created inside envs) in my local workspace be registered with Gymansium and use it. Does only pull requests work to make our custom environments work? Cant we make an environment locally and test ? I tried
    "import highway_env
    highway_env.register_highway_envs()"

but I think its not considering my local repo instead use the highway_env library installed

Could you please assist or update documentation on creating an environment locally

A dirty fix that worked for me was to append the local repo to the python search path within the file highway_env/envs/__init__.py like that:

import sys
sys.path.append('path/to/the/folder/containing/your/env')
from your_env_file import *

Yes, you should do add it to highway_env/init.py and then do

import highway_env
highway_env.register_highway_envs()

And for highway_env to be importable, it needs to be in your path, so if it's not already:

import sys
sys.path.append('path/to/the/folder/containing/highway_env')

I'll update the docs, they are outdated.

EDIT: the docs were actually up to date, so you can just follow that.