dimikout3 / MarsExplorer

55 stars 6 forks source link

gym.error.Error: No registered env with id: exploConf-v01 #7

Closed eridon closed 1 year ago

eridon commented 1 year ago

Issue

I have followed the instructions as shown in the readme file, however I am encountering an error in relation to registering the environment. This error occurs once I use the following command:

$ python mars-explorer/tests/test.py

The error is as follows:

Traceback (most recent call last): File "/Users/person/Desktop/MarsExplorer-main/mars-explorer/tests/test.py", line 52, in <module> env = gym.make('mars_explorer:exploConf-v01', conf=conf) File "/Users/person/opt/anaconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 570, in make raise error.Error(f"No registered env with id: {id}") gym.error.Error: No registered env with id: exploConf-v01

From my understanding, This error suggests that the environment "exploConf-v01" has not been registered with gym. The ID of the environment needs to match the ID that was used to register the environment with gym. My guess is that this is occurring because I am downloading the repository to a local machine

How would I find out what ID was used to register the environment with gym? Is there another way to go about this error?

Edit - Solution Found

I think I managed to fix this error as the environment was registered as "exploConf-v1" with gym, not as "exploConf-v01" as stated in line 52 of test.py. I figured this out by printing all registered environments to the terminal.

eridon commented 1 year ago

Now I am getting a new error that states a missing drone image? The error is as follows:

File "/Users/eridon/Desktop/GeneralExplorationPolicy/mars-explorer/tests/test.py", line 55, in <module>
    env.render()
  File "/Users/eridon/opt/anaconda3/lib/python3.9/site-packages/gym/wrappers/order_enforcing.py", line 51, in render
    return self.env.render(*args, **kwargs)
  File "/Users/eridon/opt/anaconda3/lib/python3.9/site-packages/gym/wrappers/env_checker.py", line 53, in render
    return env_render_passive_checker(self.env, *args, **kwargs)
  File "/Users/eridon/opt/anaconda3/lib/python3.9/site-packages/gym/utils/passive_env_checker.py", line 316, in env_render_passive_checker
    result = env.render(*args, **kwargs)
  File "/Users/eridon/Desktop/GeneralExplorationPolicy/mars-explorer/mars_explorer/envs/explorerConf.py", line 104, in render
    self.viewer = Viewer(self, self.conf["viewer"])
  File "/Users/eridon/Desktop/GeneralExplorationPolicy/mars-explorer/mars_explorer/render/viewer.py", line 29, in __init__
    self.load_data()
  File "/Users/eridon/Desktop/GeneralExplorationPolicy/mars-explorer/mars_explorer/render/viewer.py", line 40, in load_data
    self.drone_img = pg.image.load(self.conf["drone.png"]).convert_alpha()
KeyError: 'drone.png'

Even when using the relative path, as shown below:

self.conf["/Users/eridon/Desktop/GeneralExplorationPolicy/mars-explorer/img/drone.png"]).convert_alpha()

I get the following error:

KeyError: '/Users/eridon/Desktop/GeneralExplorationPolicy/mars-explorer/img/drone.png'

How can I go about this problem?

Edit - Solution Found:

The error was being thrown as the program was unable to find the path of the image, I fixed this by providing the dictionary with the full file path on line 21- 24 in test.py. As shown below:

conf["viewer"]["drone_img"] = "/Users/eridon/Desktop/MarsExplorer-main/mars-explorer/tests/img/drone.png"
conf["viewer"]["obstacle_img"] = "/Users/eridon/Desktop/MarsExplorer-main/mars-explorer/tests/img/block.png"
conf["viewer"]["background_img"] = "/Users/eridon/Desktop/MarsExplorer-main/mars-explorer/tests/img/mars.jpg"
conf["viewer"]["light_mask"] = "/Users/eridon/Desktop/MarsExplorer-main/mars-explorer/tests/img/light_350_hard.png"
dimikout3 commented 1 year ago

Hi @eridon you must include the image "drone.png" in your working directory/path. Please check if the image is present in the directory '/Users/eridon/Desktop/GeneralExplorationPolicy/mars-explorer/img/drone.png', if not, copy it there. Let me know if you were successful.

eridon commented 1 year ago

I can confirm that the image is included but I still get this error

eridon commented 1 year ago

There also seems to be an issue with 'setup.sh' as when I run it, I get the following error:

Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound: 
  - expat==2.2.9=he1b5a44_2
  - libedit==3.1.20191231=h14c3975_1
  - readline==8.0=h7b6447c_0
  - mkl==2020.2=256
  - numpy==1.19.2=py38h54aff64_0
  - freetype==2.10.4=h5ab3b9f_0
  - ncurses==6.2=he6710b0_1
  - pthread-stubs==0.4=h14c3975_1001
  - pyqt==5.9.2=py38h05f1152_4
  - lz4-c==1.9.2=heb0550a_3
  - mkl-service==2.3.0=py38he904b0f_0
  - sqlite==3.33.0=h62c20be_0
  - mkl_fft==1.2.0=py38h23d657b_0
  - kiwisolver==1.3.0=py38hbf85e49_0
  - ninja==1.10.1=py38hfd86e86_0
  - glib==2.66.1=h92f7085_0
  - protobuf==3.13.0.1=py38h950e882_1
  - libuv==1.40.0=h7b6447c_0
  - icu==58.2=hf484d3e_1000
  - matplotlib-base==3.3.2=py38h4d1ce4f_1
  - tk==8.6.10=hbc83047_0
  - setuptools==50.3.0=py38hb0f4dca_1
  - xorg-libxau==1.0.9=h14c3975_0
  - dbus==1.13.16=hb2f20db_0
  - numpy-base==1.19.2=py38hfa32c7d_0
  - qt==5.9.7=h5867ecd_1
  - certifi==2020.11.8=py38h06a4308_0
  - fontconfig==2.13.1=he4413a7_1000
  - cudatoolkit==10.2.89=hfd86e86_1
  - libxml2==2.9.10=hb55368b_3
  - xorg-libxdmcp==1.1.3=h516909a_0
  - zlib==1.2.11=h7b6447c_3
  - libgcc-ng==9.1.0=hdf63c60_0
  - tornado==6.1=py38h25fe258_0
  - libpng==1.6.37=hbc83047_0
  - pip==20.2.4=py38h06a4308_0
  - pytorch==1.7.0=py3.8_cuda10.2.89_cudnn7.6.5_0
  - xz==5.2.5=h7b6447c_0
  - pillow==8.0.1=py38he98fc37_0
  - libprotobuf==3.13.0.1=h8b12597_0
  - openssl==1.1.1h=h7b6447c_0
  - sip==4.19.13=py38he6710b0_0
  - mkl_random==1.1.1=py38h0573a6f_0
  - python==3.8.5=h7579374_1
  - gst-plugins-base==1.14.0=hbbd80ab_1
  - libffi==3.3=he6710b0_2
  - jpeg==9b=h024ee3a_2
  - ld_impl_linux-64==2.33.1=h53a641e_7
  - gstreamer==1.14.0=hb31296c_0
  - torchvision==0.8.1=py38_cu102
  - intel-openmp==2020.2=254
  - libuuid==2.32.1=h14c3975_1000
  - pcre==8.44=he1b5a44_0
  - zstd==1.4.5=h9ceee32_0
  - lcms2==2.11=h396b838_0
  - libxcb==1.13=h14c3975_1002
  - libstdcxx-ng==9.1.0=hdf63c60_0
  - libtiff==4.1.0=h2733197_1

Could this be causing issues with running the program?

eridon commented 1 year ago

I can confirm that test.py now works correctly after the solutions I provided.