projectchrono / gym-chrono

Custom OpenAI Gym environments based on PyChrono
32 stars 8 forks source link

URDF and Parsers module building #13

Open pgupta2050 opened 6 months ago

pgupta2050 commented 6 months ago

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.

1 Building URDF:

This is not related to my question directly, but needs fixing on this branch I believe.

  1. The lines (https://github.com/zzhou292/chrono/blob/e35a82779325d30d45b7f7941334d72b1968b972/src/chrono_parsers/ChParserURDF.cpp#L42) needs to be cleaned.
  2. The buildURDF.sh file in this branch is not the same as official branch. That causes cmake config failure for urdf packages. So I used the one from the official branch (https://github.com/projectchrono/chrono/blob/main/contrib/build-scripts/urdf/buildURDF.sh) to use tinyxml2 and urdfdom fork from Radu's repo. This builds ok, allows the above Chrono modules to build.

2 Optix Engine Load issue:

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

Huzaifg commented 6 months ago

@pgupta2050 Thanks for pointing this out

@zzhou292 can you make these changes on your fork of the feature/robot branch?

zzhou292 commented 6 months ago

I am trying to do some fixing after the release.

The release made several big api changes which the fork needs to adapt.

Stay tuned!