Help with Granular Simulation on Windows using PyChrono

129 views
Skip to first unread message

Nnamdi Chikere

unread,
Jul 24, 2025, 1:51:10 AMJul 24
to ProjectChrono
Hello.
I am working on a simulation where a robot moves on different terrains, and I want to simulate the robot moving on sand and rocks. I have been able to implement the soil terrain using the SCM parameters in PyChrono. Is it possible to implement granular media, such as rocks, in PyChrono? I attempted to install the DEME package, but encountered several errors. I am working with PyChrono 9.0 and Python 3.9.
Thank you.

Dan Negrut

unread,
Jul 24, 2025, 2:10:25 AMJul 24
to Nnamdi Chikere, ProjectChrono

If you describe what you need to do with your robot, we might be able to steer you in the right direction.
How big are the rocks you mentioned?

What sort of end-goal do you have? Design of robot, control of robot, RL, optimal design, etc.

 

Dan

---------------------------------------------

Bernard A. and Frances M. Weideman Professor

NVIDIA CUDA Fellow

Department of Mechanical Engineering

Department of Computer Science

University of Wisconsin - Madison

4150ME, 1513 University Avenue

Madison, WI 53706-1572

608 772 0914

http://sbel.wisc.edu/

http://projectchrono.org/

---------------------------------------------

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/projectchrono/d38be8a1-f6e0-4661-83ba-d51b500ccea5n%40googlegroups.com.

Nnamdi Chikere

unread,
Jul 24, 2025, 11:31:04 AMJul 24
to Dan Negrut, ProjectChrono
Hello Professor,

Thank you so much for your reply.

For the first stage, I am trying to optimize the parameters for control of the robot’s locomotion on complex environments including sand and rocks using CPGs. The end goal is to later use RL to implement adaptive control with changing terrains.

For the rock sizes, I was looking to implement three rock sizes ranging between 2cm and 6cm filled in a box on which the robot will operate.

I am also trying to implement a flexible limb that will be attached to the motors and deform when in contact with some force or the ground, is it possible to implement this to a specified link? 

I am working with Python and windows, and would appreciate some help as regards this

Best regards,
Nnamdi

Dan Negrut

unread,
Jul 24, 2025, 3:53:14 PMJul 24
to Nnamdi Chikere, ProjectChrono

Please see my comments in this font below.

 

Thank you,

Dan

---------------------------------------------

Bernard A. and Frances M. Weideman Professor

NVIDIA CUDA Fellow

Department of Mechanical Engineering

Department of Computer Science

University of Wisconsin - Madison

4150ME, 1513 University Avenue

Madison, WI 53706-1572

608 772 0914

http://sbel.wisc.edu/

http://projectchrono.org/

---------------------------------------------

 

From: Nnamdi Chikere <nchi...@nd.edu>
Sent: Thursday, July 24, 2025 10:31 AM
To: Dan Negrut <neg...@wisc.edu>
Cc: ProjectChrono <projec...@googlegroups.com>
Subject: Re: [chrono] Help with Granular Simulation on Windows using PyChrono

 

Hello Professor,

 

Thank you so much for your reply.

 

For the first stage, I am trying to optimize the parameters for control of the robot’s locomotion on complex environments including sand and rocks using CPGs. The end goal is to later use RL to implement adaptive control with changing terrains.

We are starting to work in this area as well, from a slightly different perspective. Harry, a great student in the lab, will share his findings in about a week, to steer you in the right direction. Are you working with a quadruped or something similar?

 

For the rock sizes, I was looking to implement three rock sizes ranging between 2cm and 6cm filled in a box on which the robot will operate.

Is it like (a) the entire terrain is made up of rocks 2cm to 6 cm; or (b) you have some deformable terrain that once in a while has some rocks 2 cm to 6 cm scattered around? This is important, since (a) will likely take more time to run than (b).

 

I am also trying to implement a flexible limb that will be attached to the motors and deform when in contact with some force or the ground, is it possible to implement this to a specified link? 

In principle, this should be doable but we haven’t tried it yet. The needed modeling elements are in Chrono, it’s just a matter of putting a model like this together and seeing how it does. Easier said than done, but we might be able to provide some feedback when you cross that bridge.

 

I am working with Python and windows, and would appreciate some help as regards this

In about one week we’ll share a way to install a newer version of PyChrono, a beta version, that has support for what’s called in Chrono “the CRM terrain” model. Might be helpful for you. Needs an NVIDIA GPU to run.

Nnamdi Chikere

unread,
Jul 28, 2025, 5:40:48 PMJul 28
to ProjectChrono
Thank you so much for your response.

We are starting to work in this area as well, from a slightly different perspective. Harry, a great student in the lab, will share his findings in about a week, to steer you in the right direction. Are you working with a quadruped or something similar?

I am working on a small-sized bioinspired quadruped robot, and I look forward to the findings from your student.

Is it like (a) the entire terrain is made up of rocks 2cm to 6 cm, or (b) you have some deformable terrain that once in a while has some rocks 2 cm to 6 cm scattered around? This is important, since (a) will likely take more time to run than (b).

I am interested in having the entire terrain composed of movable rocks, which the limbs can interact with, such as each terrain box filled with rocks of a specific size (2cm to 6cm). I am also open to suggestions on whether this setup might be computationally intensive and any alternatives, such as option B. The image below is what I have in mind (generated in MuJoCo, but is fixed to the ground)
Screenshot 2025-07-28 172945.png

In principle, this should be doable but we haven’t tried it yet. The needed modeling elements are in Chrono, it’s just a matter of putting a model like this together and seeing how it does. Easier said than done, but we might be able to provide some feedback when you cross that bridge.

Thank you. I will provide more details on my proposed implementation soon.

In about one week we’ll share a way to install a newer version of PyChrono, a beta version, that has support for what’s called in Chrono “the CRM terrain” model. Might be helpful for you. Needs an NVIDIA GPU to run.

Looking forward to the new version. I have been facing some SDL2 package errors with my current version. I gave more details in a different thread.

Harry ZHANG

unread,
Jul 30, 2025, 12:17:42 PMJul 30
to ProjectChrono
Hello Nnamdi,

My name's Harry and Dan asked me to follow up on this thread.

About couple weeks ago, we start exploring using PyChrono as our physics engine to train RL policies for quadruped locomotion task. Our projects's goal is to investigate simulation terrain's effect on locomotion policy performance. In PyChrono there are different fidelity levels for terrain model (from low to high): rigid terrain (rtf<<1) --> SCM deformable terrain (rtf~=1)-->CRM granular terrain(rtf~=5), where rtf means real time fator. RL library we are using is "RSL-RL". 

Please check this link for prelim results we got: https://drive.google.com/drive/folders/1Yhx1goYDsv0FZdk4OfyH9_yRazkRSwMQ?usp=sharing. The locomotion policy trained for 0.5 m/s longitudinal speed walking. The policy trained with rigid terrain (about 6 hours) and we put it on scm deformable terrain for testing purpose, in both rigid and deformable terrain the evaluation looks decent. 

For us, there are two major things in our todo list: 1) implement some parallelzation methods during training. current 6 hour training time is trained with one single simulation agent interact with RSL-RL algorithm, we try to see if it's possible to do faster by training with multiple simulation agents. 2) Include quadrupeds with CRM terrain in both policy training and evaluation. See the attched picture, we have a simulation script includes quadrupeds on CRM terrain, but we need to merge this into RL pipeline. 

Let me know if you have any questions, I am available for meeting if you want me explain more about the pipeline and details.

Best,
Harry

Harry ZHANG

unread,
Jul 30, 2025, 1:50:56 PMJul 30
to ProjectChrono
Picture attachment for last message:
Screenshot from 2025-07-30 10-45-41.png
Best,
Harry

Nnamdi Chikere

unread,
Jul 30, 2025, 8:50:49 PMJul 30
to ProjectChrono
Hello Harry,

Your simulation results looks great and are similar to what I hope to implement in my setup. I am interested in discussing more about this and would love to set up a meeting as soon as possible. Can you please let me know what day/time you are available?

Best regards,
Nnamdi

Harry ZHANG

unread,
Aug 4, 2025, 3:57:30 PMAug 4
to ProjectChrono
Hello Nnamdi,

I hope you are doing well. 

I want to share this repo (https://github.com/uwsbel/sbel-reproducibility/tree/master/2025/multi-terrain-RL) with you, which does the RL training for the demo videos I shared earlier. The specific robot type or task might differ, but I think the structure or idea would be similar.

I realize I previously offered to meet, but after giving it more thought—and in light of similar requests from others—We’ve decided it's better to share a prepared code repo instead. This way, you can try it on your own and post any questions here, so others can also benefit from the discussion.

Best,
Harry

Nnamdi Chikere

unread,
Aug 6, 2025, 3:35:04 PMAug 6
to ProjectChrono
Hello Harry,

I tried to replicate the RL example in the GitHub link you shared, but I have been trying to fix the following error. It seems the pychrono.parsers module is missing.

Traceback (most recent call last):
  File "C:\Users\chike\Box\TurtleRobotExperiments\Sea_Turtle_Robot_AI_Powered_Simulations_Project\NnamdiFiles\mujocotest1\chrono\multi-terrain-RL\rl_examples\rslrl\eval.py", line 8, in <module>
    from chrono_env import ChronoQuadrupedEnv as RigidTerrainEnv
  File "C:\Users\chike\Box\TurtleRobotExperiments\Sea_Turtle_Robot_AI_Powered_Simulations_Project\NnamdiFiles\mujocotest1\chrono\multi-terrain-RL\rl_examples\rslrl\chrono_env.py", line 13, in <module>      
    import simulation.Robots as Robots
  File "C:\Users\chike\Box\TurtleRobotExperiments\Sea_Turtle_Robot_AI_Powered_Simulations_Project\NnamdiFiles\mujocotest1\chrono\multi-terrain-RL\simulation\Robots.py", line 7, in <module>
    import pychrono.parsers as parsers
ModuleNotFoundError: No module named 'pychrono.parsers'

Could you please provide some help with this? I followed
conda create -n chrono "python<3.13" -c conda-forge conda activate chrono conda install bochengzou::pychrono -c bochengzou -c nvidia -c dlr-sc -c conda-forge
Install RL Library

Inside the conda environment, supposingly named as chrono:

pip install rsl-rl-lib==2.2.4
Verify Installation

Inside the conda environment:

cd <path_to_current_folder>/multi-terrain-RL python rl_examples/rslrl/eval.py --ckpt 2999

Best regards,
Nnamdi

Bocheng Zou

unread,
Aug 6, 2025, 6:31:14 PMAug 6
to projec...@googlegroups.com

Hi Nnamdi,

Thank you for bringing the issue to our attention. We just noticed that there is something wrong in our Windows's conda building pipeline that causes pychrono.parsers module to be missing. I'm expected to fix that later today (within 12 hours) and let you know.

Best

Bocheng Zou

Bocheng Zou

unread,
Aug 6, 2025, 9:28:44 PMAug 6
to projec...@googlegroups.com

Hi Nnamdi,

I'd like to provide a quick update regarding my previous email. Due to some issues with Chrono's build system, we may not be able to release the package containing the parser fix for Windows within the previously promised 12-hour timeframe.

I'll do my best to get it released as soon as the build system is back up and running.

Best regards,

Bocheng Zou

Nnamdi Chikere

unread,
Aug 6, 2025, 10:14:27 PMAug 6
to Bocheng Zou, projec...@googlegroups.com
Thank you for the update. I look forward to hearing from you whenever it is fixed.

Best regards,
Nnamdi

Bocheng Zou

unread,
Aug 7, 2025, 10:36:12 AMAug 7
to Nnamdi Chikere, projec...@googlegroups.com

Hi Nnamdi,

Thank you for your patience. We have published a new release that fixes the issue on Windows. You can obtain the release by creating a NEW environment using the command listed in https://github.com/uwsbel/sbel-reproducibility/tree/master/2025/multi-terrain-RL 

To run granular simulation, replace "env_type = "rigid"" with "env_type = "granular"" in eval.py . 

Let me know if you still encounter the issue. 

Best,

Bocheng Zou

Nnamdi Chikere

unread,
Aug 7, 2025, 4:03:50 PMAug 7
to ProjectChrono
Hi Chrono team,

I followed the updated steps and successfully ran eval.py on my PC. It ran successfully on the rigid terrain. 
But it fails when I attempt to run on granular terrain. I got the following error. I suspect it might be due to a CUDA mismatch. What CUDA version do you recommend I install to run the FSI for the PyChrono Windows granular simulation?
                                                                       
Loaded configurations from ./data/rl_models/rslrl/cfgs.pkl                                
Using device: cpu
Create an FSI system using a custom SPH FSI interface
Error initializing terrain: parallel_for failed: cudaErrorUnsupportedPtxVersion: the provided PTX was compiled with an unsupported toolchain.
Resetting environment tensor(0)
Create an FSI system using a custom SPH FSI interface
Error initializing terrain: parallel_for failed: cudaErrorUnsupportedPtxVersion: the provided PTX was compiled with an unsupported toolchain.
Created environment with 1 parallel environments
Actor MLP: Sequential(
  (0): Linear(in_features=45, out_features=512, bias=True)
  (1): ELU(alpha=1.0)
  (2): Linear(in_features=512, out_features=256, bias=True)
  (3): ELU(alpha=1.0)
  (4): Linear(in_features=256, out_features=128, bias=True)
  (5): ELU(alpha=1.0)
  (6): Linear(in_features=128, out_features=12, bias=True)
)
Critic MLP: Sequential(
  (0): Linear(in_features=45, out_features=512, bias=True)
  (1): ELU(alpha=1.0)
  (2): Linear(in_features=512, out_features=256, bias=True)
  (3): ELU(alpha=1.0)
  (4): Linear(in_features=256, out_features=128, bias=True)
  (5): ELU(alpha=1.0)
  (6): Linear(in_features=128, out_features=1, bias=True)
)
Loaded model from ./data/rl_models/rslrl\model_2999.pt
Policy loaded successfully
Resetting environment tensor(0)
Create an FSI system using a custom SPH FSI interface
Error initializing terrain: parallel_for failed: cudaErrorUnsupportedPtxVersion: the provided PTX was compiled with an unsupported toolchain.
Environment reset. Observation shape: torch.Size([1, 45])

Starting evaluation for 1000 steps...
==================================================
ERROR: FSI system not initialized!


Traceback (most recent call last):
  File "C:\Users\chike\Box\TurtleRobotExperiments\Sea_Turtle_Robot_AI_Powered_Simulations_Project\NnamdiFiles\mujocotest1\chrono\multi-terrain-RL\rl_examples\rslrl\eval.py", line 156, in <module>
    main()
  File "C:\Users\chike\Box\TurtleRobotExperiments\Sea_Turtle_Robot_AI_Powered_Simulations_Project\NnamdiFiles\mujocotest1\chrono\multi-terrain-RL\rl_examples\rslrl\eval.py", line 94, in main
    obs, rewards, dones, extras = env.step(actions)
                                  ^^^^^^^^^^^^^^^^^
  File "C:\Users\chike\Box\TurtleRobotExperiments\Sea_Turtle_Robot_AI_Powered_Simulations_Project\NnamdiFiles\mujocotest1\chrono\multi-terrain-RL\rl_examples\rslrl\chrono_crmenv.py", line 275, in step
    self.terrains[i].Advance(step_size)
  File "C:\Users\chike\anaconda3\envs\chrono_rl\Lib\site-packages\pychrono\vehicle.py", line 5562, in Advance
    return _vehicle.CRMTerrain_Advance(self, step)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: FSI system not initialized!

Best regards,
Nnamdi

Bocheng Zou

unread,
Aug 7, 2025, 4:32:24 PMAug 7
to projec...@googlegroups.com

Hi Nnamdi,

We recommend a CUDA driver that can support at least CUDA 12.8. That means the CUDA version shown on the upper right of your nvidia-smi's output should be 12.8 or higher.

Best,

Bocheng Zou

Reply all
Reply to author
Forward
0 new messages