projectchrono / gym-chrono Goto Github PK
View Code? Open in Web Editor NEWCustom OpenAI Gym environments based on PyChrono
Custom OpenAI Gym environments based on PyChrono
Hi,
I am trying to use gym-chrono in Linux cra-Lambda-Vector 5.15.0-100-generic #110~20.04.1-Ubuntu SMP Tue Feb 13 14:25:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
, using the feature/robot_model (https://github.com/zzhou292/chrono/tree/feature/robot_model) branch of chrono. I am able to build Chrono with moudules: Chrono::Sensor, Chrono::Irrlicht, Chrono::SynChrono, Chrono::Vehicle, Chrono::Python, Chrono::OPENMP and Chrono::Parsers.
This is not related to my question directly, but needs fixing on this branch I believe.
When I try to run gym-chrono/gym_chrono/train/off_road_gator_train.py, it cannot init the Optix Engine. I get the folllowing error:
cra@cra-Lambda-Vector:~/chrono-ws/gym-chrono/gym_chrono/train$ python3 off_road_gator_train.py
Logging to gator_logs/
Failed to create a ChOptixEngine, with error:
OPTIX_ERROR_LIBRARY_NOT_FOUND: Library not found at /home/cra/chrono-ws/chrono/src/chrono_sensor/optix/ChOptixEngine.cpp:79
Failed to create a ChOptixEngine, with error:
OPTIX_ERROR_LIBRARY_NOT_FOUND: Library not found at /home/cra/chrono-ws/chrono/src/chrono_sensor/optix/ChOptixEngine.cpp:79
Failed to create a ChOptixEngine, with error:
OPTIX_ERROR_LIBRARY_NOT_FOUND: Library not found at /home/cra/chrono-ws/chrono/src/chrono_sensor/optix/ChOptixEngine.cpp:79
Failed to create a ChOptixEngine, with error:
OPTIX_ERROR_LIBRARY_NOT_FOUND: Library not found at /home/cra/chrono-ws/chrono/src/chrono_sensor/optix/ChOptixEngine.cpp:79
Failed to create a ChOptixEngine, with error:
OPTIX_ERROR_LIBRARY_NOT_FOUND: Library not found at /home/cra/chrono-ws/chrono/src/chrono_sensor/optix/ChOptixEngine.cpp:79
Failed to create a ChOptixEngine, with error:
OPTIX_ERROR_LIBRARY_NOT_FOUND: Library not found at /home/cra/chrono-ws/chrono/src/chrono_sensor/optix/ChOptixEngine.cpp:79
Traceback (most recent call last):
File "off_road_gator_train.py", line 106, in <module>
env = make_vec_env(env_id=make_env(0), n_envs=num_cpu,
File "/home/cra/.local/lib/python3.8/site-packages/stable_baselines3/common/env_util.py", line 125, in make_vec_env
vec_env = vec_env_cls([make_env(i + start_index) for i in range(n_envs)], **vec_env_kwargs)
File "/home/cra/.local/lib/python3.8/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py", line 119, in __init__
observation_space, action_space = self.remotes[0].recv()
File "/usr/lib/python3.8/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
File "/usr/lib/python3.8/multiprocessing/connection.py", line 414, in _recv_bytes
buf = self._recv(4)
File "/usr/lib/python3.8/multiprocessing/connection.py", line 379, in _recv
chunk = read(handle, remaining)
ConnectionResetError: [Errno 104] Connection reset by peer
The sensor demos in chrono_build/bin
do not run either.
cra@cra-Lambda-Vector:~/chrono-ws/chrono_build/bin$ ./demo_SEN_Gator
Copyright (c) 2017 projectchrono.org
Chrono version: 8.0.0
Irrlicht Engine version 1.8.4
Linux 5.15.0-100-generic #110~20.04.1-Ubuntu SMP Tue Feb 13 14:25:03 UTC 2024 x86_64
Using plain X visual
This driver is not available in Linux. Try OpenGL or Software renderer.
Cannot use default video driver - fall back to OpenGL
Irrlicht Engine version 1.8.4
Linux 5.15.0-100-generic #110~20.04.1-Ubuntu SMP Tue Feb 13 14:25:03 UTC 2024 x86_64
Using renderer: OpenGL 3.1
llvmpipe (LLVM 12.0.0, 256 bits): Mesa/X.org
OpenGL driver version is 1.2 or better.
GLSL version: 1.4
Loaded texture: /home/cra/chrono-ws/chrono_build/data/skybox/sky_lf.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/skybox/sky_up.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/skybox/sky_dn.jpg
PNG warning: iCCP: known incorrect sRGB profile
Loaded texture: /home/cra/chrono-ws/chrono_build/data/logo_chronoengine_alpha.png
Loaded texture: /home/cra/chrono-ws/chrono_build/data/fonts/arial80.bmp
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Lidar_Generator_AlbedoTransparency.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Lidar_Generator_Normal.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Server_Mount_AlbedoTransparency.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Server_Mount_Normal.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Gator_Chassis_F_Bed_AlbedoTransparency.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Gator_Chassis_F_Bed_Normal.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Gator_Chairs_Dash_AlbedoTransparency.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Gator_Chairs_Dash_Normal.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Gator_Chassis_R_AlbedoTransparency.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Gator_Texture_Gator_Chassis_R_Normal.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Wheel_F_Gator_Wheels_AlbedoTransparency.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/gator/Textures/Wheel_F_Gator_Wheels_Normal.jpg
Loaded texture: /home/cra/chrono-ws/chrono_build/data/vehicle/terrain/textures/grass.jpg
Failed to create a ChOptixEngine, with error:
OPTIX_ERROR_LIBRARY_NOT_FOUND: Library not found at /home/cra/chrono-ws/chrono/src/chrono_sensor/optix/ChOptixEngine.cpp:79
cra@cra-Lambda-Vector:~/chrono-ws/chrono_build/bin$ ./demo_SEN_buildtest
Copyright (c) 2019 projectchrono.org
Chrono version: 8.0.0
sensor manager being made
Failed to create a ChOptixEngine, with error:
OPTIX_ERROR_LIBRARY_NOT_FOUND: Library not found at /home/cra/chrono-ws/chrono/src/chrono_sensor/optix/ChOptixEngine.cpp:79
Not sure what the issue is, since the Chrono modules build successfully. Attaching my cMake output here.
cmake_configuration_output.txt
Any input is appreciated!
================================================
EDIT:
The 2nd issue (Optix Engine Load issue) is fixed for me. I just had a mismatch in the nvidia driver library that it pulls in at runtime. I had to ensure that the Cuda version I compiled the Optix7.7 with, matches the Cuda version compatible with the nvidia-driver I have installed.
Prakhar
title.
Add dockerfile so users don't have to build chrono / gymchrono on their own (because they have to build from Jason's branch).
I love this idea of connect Project Chrono to Gym. However, I am having a difficult time compiling the PyChrono module. Could you create a pip package for the correct version of Chrono with its necessary modules? I am aware there is a conda release, but I don't think it was compiled with the correct Chrono modules. Maybe you can also create Gym-Chrono conda release as well?
Also creating a pip package might make this usable on Google's CoLab.
Hello,
I noticed that if I use vehicle models with the ChronoBaseEnv(), there is a memory leak in the vectorized environments. I have noticed this for the offroad_gator.py and an env I created using the hmmwv vehicle. The individual environments keep growing their memory usage. It seems as if some environment resources are not being released at env.reset()
. The other env models such as cobra_wpts.py
dont seem to leak memory, however. Is this a known issue? Does anyone have thoughts about debugging this? Maybe something to do with the gym.Env.close()
implemention?
I am using top
utility to monitor the memory usage and the /usr/bin/python3 -c from multiprocessing.forkserver ...
nodes are the ones that grow in memory usage until the system runs out of memory and crashes. An example of where I monitor this (in this case, just re-ran cobra_wpts_train.py to reproduce results) :
top - 11:17:39 up 18:46, 1 user, load average: 18.79, 16.91, 15.91
Tasks: 1366 total, 6 running, 1360 sleeping, 0 stopped, 0 zombie
%Cpu(s): 15.7 us, 0.0 sy, 0.0 ni, 84.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 515580.9 total, 488939.0 free, 15644.0 used, 10997.9 buff/cache
MiB Swap: 2048.0 total, 1606.5 free, 441.5 used. 496004.3 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
81225 cra 20 0 1645756 1.5g 15624 S 0.0 0.3 0:26.70 /home/cra/.vscode/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
66581 cra 20 0 21.1g 1.2g 402612 S 0.3 0.2 25:33.27 python3 cobra_wpts_train.py
69302 cra 20 0 1125.8g 718384 63300 S 0.0 0.1 7:03.47 /snap/code/155/usr/share/code/code /home/cra/.vscode/extensions/ms-python.vscode-pylance-2024.4.1/dist/server.bundle.js --cancellationReceive=file:bc412ecaf76652112fa93809a8f24e90483ce3ef52 --node-ipc --clientProcessId=68584
84540 cra 20 0 4117136 591932 321480 S 0.3 0.1 0:37.34 /usr/lib/firefox/firefox -new-window
68457 cra 20 0 1136.1g 550088 105772 S 0.0 0.1 12:15.34 /snap/code/155/usr/share/code/code --type=renderer --crashpad-handler-pid=68425 --enable-crash-reporter=c6aaa28c-db04-43a0-a4e3-9668ea18dfb3,no_channel --user-data-dir=/home/cra/.config/Code --standard-schemes=vscode-webview,vscode-file --secure-schemes=vscode-webview,vscode-file --co+
66660 cra 20 0 5590972 534512 234492 S 77.9 0.1 207:05.27 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66658 cra 20 0 5590212 533708 234344 S 89.4 0.1 209:01.33 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66671 cra 20 0 5590656 533524 233924 S 87.5 0.1 203:24.93 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66652 cra 20 0 5590448 533512 233764 S 91.7 0.1 219:50.28 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66683 cra 20 0 5591232 533460 234220 R 87.5 0.1 204:19.76 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66664 cra 20 0 5590984 533380 233356 S 68.6 0.1 205:28.67 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66657 cra 20 0 5590208 533320 233960 S 92.7 0.1 208:44.55 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66649 cra 20 0 5591316 533312 232844 R 95.0 0.1 223:04.27 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66670 cra 20 0 5591084 533012 232884 S 78.9 0.1 204:00.27 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66659 cra 20 0 5590056 532832 233632 S 77.6 0.1 208:21.62 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66663 cra 20 0 5589696 532388 233960 S 72.3 0.1 206:55.54 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66653 cra 20 0 5589676 532336 234452 S 93.7 0.1 220:54.75 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66666 cra 20 0 5590196 532204 232860 S 86.5 0.1 204:40.95 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66651 cra 20 0 5590044 532104 232916 S 91.1 0.1 219:27.75 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66655 cra 20 0 5589284 531272 233912 R 80.5 0.1 217:58.57 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66662 cra 20 0 5588768 531052 233708 S 90.8 0.1 206:56.47 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66668 cra 20 0 5589972 530908 231796 S 69.3 0.1 204:51.29 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66656 cra 20 0 5590052 530280 231084 S 93.1 0.1 212:47.25 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66667 cra 20 0 5588568 530136 233784 S 67.3 0.1 203:21.30 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66661 cra 20 0 5588812 529720 233124 R 86.8 0.1 206:36.71 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66654 cra 20 0 5588412 529376 233188 S 80.2 0.1 218:59.53 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66669 cra 20 0 5590308 528620 229164 S 79.5 0.1 204:37.67 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66665 cra 20 0 5588840 527992 230576 S 76.6 0.1 204:15.16 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
66650 cra 20 0 5585680 526760 233088 R 92.7 0.1 221:35.81 /usr/bin/python3 -c from multiprocessing.forkserver import main; main(52, 54, ['__main__'], **{'sys_path': ['/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono/gym_chrono/train', '/home/cra/chrono-ws/gym-chrono', '/home/cra/chrono-ws/chrono_build/bin', '+
3793 cra 20 0 4637840 379480 98272 S 1.7 0.1 8:24.79 /usr/bin/gnome-shell
My training and system info:
- OS: Linux-5.15.0-101-generic-x86_64-with-glibc2.29 # 111~20.04.1-Ubuntu SMP Mon Mar 11 15:44:43 UTC 2024
- Python: 3.8.10
- Stable-Baselines3: 2.2.1
- PyTorch: 2.2.1+cu121
- GPU Enabled: True
- Numpy: 1.24.0
- Cloudpickle: 3.0.0
- Gymnasium: 0.29.1
Thanks.
The data folder that the users are asked to download seems to be incomplete - does not include vehicle meshes. Also adding the Chrono data directory in the readme implies that the Chrono data directory is being used for all the simulation assets. That also needs to be updated
So people can understand what to do, and so that we can make this a pip package
the data folder is large, and so when setting up the container, the gymchrono.sh
script fails because gdown
reaches a quota limit. See #8 for more details. Should we store the data somewhere else?
Easy, should do this to make the importable in ART.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.