gym-carla icon indicating copy to clipboard operation
gym-carla copied to clipboard

Run without rendering in pygame window

Open anahrendra opened this issue 4 years ago • 6 comments

Can I run the simulator without rendering the display, just as what we can do in MuJoCo Gym. Because I need to run the code in a server computer with no display. Thanks in advance!

anahrendra avatar Sep 22 '20 05:09 anahrendra

@aswinnahrendra Did you find a way for this? I usually use os.environ["SDL_VIDEODRIVER"] = "dummy" at the beginning of my codes to turn off the pygame window, but for this environment, when I do it, in the code I face some errors. It seems it is not a solution for this environment. The error is

File "/home/isaac/codes/autonomous_driving/gym-carla/gym_carla/envs/carla_env.py", line 849, in _get_obs
    pygame.surfarray.blit_array(camera_surface, camera_display)
  File "/home/isaac/miniconda3/envs/rlpyt/lib/python3.7/site-packages/pygame/surfarray.py", line 81, in blit_array
    return numpysf.blit_array (surface, array)
  File "/home/isaac/miniconda3/envs/rlpyt/lib/python3.7/site-packages/pygame/_numpysurfarray.py", line 82, in blit_array
    return array_to_surface(surface, array)
ValueError: unsupported datatype for array

kargarisaac avatar Oct 08 '20 18:10 kargarisaac

@aswinnahrendra Did you find a way for this? I usually use os.environ["SDL_VIDEODRIVER"] = "dummy" at the beginning of my codes to turn off the pygame window, but for this environment, when I do it, in the code I face some errors. It seems it is not a solution for this environment. The error is

File "/home/isaac/codes/autonomous_driving/gym-carla/gym_carla/envs/carla_env.py", line 849, in _get_obs
    pygame.surfarray.blit_array(camera_surface, camera_display)
  File "/home/isaac/miniconda3/envs/rlpyt/lib/python3.7/site-packages/pygame/surfarray.py", line 81, in blit_array
    return numpysf.blit_array (surface, array)
  File "/home/isaac/miniconda3/envs/rlpyt/lib/python3.7/site-packages/pygame/_numpysurfarray.py", line 82, in blit_array
    return array_to_surface(surface, array)
ValueError: unsupported datatype for array

Yes, I meet the same error. Did you solve this error in the headless server?

OrionZou avatar Mar 10 '21 10:03 OrionZou

I updated pygame to version 2.0.1 and ran test.py, the error do not appear. It is amazing.

OrionZou avatar Mar 10 '21 14:03 OrionZou

I updated pygame to version 2.0.1 and ran test.py, the error do not appear. It is amazing.

I removed pygame dependency and used this library instead:

https://pypi.org/project/carla-birdeye-view/

kargarisaac avatar Mar 10 '21 15:03 kargarisaac

I updated pygame to version 2.0.1 and ran test.py, the error do not appear. It is amazing.

I removed pygame dependency and used this library instead:

https://pypi.org/project/carla-birdeye-view/

Thanks for your sharing, It is a good solution.

OrionZou avatar Mar 11 '21 02:03 OrionZou

I updated pygame to version 2.0.1 and ran test.py, the error do not appear. It is amazing.

Thanks for your advice. After upgrading pygame can the model training be done normally? Do new problems occur due to pygame version mismatch?

Zhephy avatar Nov 17 '23 18:11 Zhephy