Introduction
Granular materials—such as sand, soil, and gravel—are fundamental to industries ranging from construction and agriculture to planetary exploration. Despite their ubiquity, simulating these materials presents a significant computational challenge. High-fidelity methods like the Discrete Element Method (DEM) are often too slow for modern robotics workflows, particularly Reinforcement Learning (RL), which requires millions of samples to converge.
Existing simulators typically fall into two categories: highly accurate but slow CPU-based solvers, or fast but closed-source engines that struggle with complex robot geometries. GranularGym addresses this "missing middle" by providing a fast, approximate, and open-source simulator capable of modeling the bulk behavior of granular materials while interacting with complex, moving robotic components.
Technical Methodology
GranularGym models granular materials as a collection of rigidly interacting spherical particles. Its high performance is achieved through several GPU-parallelized algorithms and software engineering optimizations:
- Projected Jacobi Algorithm (PJA): Unlike standard serialized solvers, GranularGym employs a parallelized variant of the Projected Gauss-Seidel method, allowing the GPU to solve thousands of contact impulses simultaneously.
- Linked Spatial Hashmaps: To efficiently handle neighbor searches, the engine implements an atomic spatial hashmap in GPU memory, filtering potential collisions significantly faster than naive $O(n^2)$ approaches.
- Signed Distance Functions (SDFs): Complex robot geometries are represented as gridded SDFs. This allows for $O(1)$ collision checking between spherical particles and intricate meshes, such as excavator buckets.
- Warp Divergence Mitigation: A key optimization involves splitting collision detection and impulse computation into separate kernels. In standard "fused" loops, threads often remain idle if they aren't processing a collision. By separating these passes, GranularGym ensures maximum GPU hardware utilization.
Benchmarking Environments
The authors introduced several benchmark environments to evaluate physical plausibility and scaling:
- Bulldozing: A tracked vehicle moving material into a goal zone.
- Helical Gear Tower: A stress test featuring particles flowing through rotating, non-convex gears.
- Excavation: A 7-DOF Franka Emika Panda robot arm interacting with a large particle bed.
Performance and Results
GranularGym achieves remarkable speeds on consumer-grade hardware. On an NVIDIA RTX 3080 Ti, the engine simulates 50,000 particles at real-time speeds (at $\Delta t = 1 \times 10^{-3}s$). The simulator scales efficiently; adding rigid bodies results in linear performance hits, maintaining interactive rates even with hundreds of thousands of particles.
The speed of the simulator makes RL training feasible for granular tasks. A Twin Delayed DDPG (TD3) agent was successfully trained on the Bulldozing task in approximately 12 hours, a process that would typically require weeks in traditional high-fidelity simulators.
Discussion and Future Work
While GranularGym provides a powerful tool for robotics research, it currently has several limitations. The system uses one-way coupling, meaning particles do not exert reaction forces back onto the robot. Additionally, the use of rigid spheres simplifies complex phenomena like soil cohesion or the interlocking of non-spherical rocks. Future work aims to implement two-way coupling, explore differentiable physics for gradient-based optimization, and introduce heterogeneous particle properties to better reflect real-world terrain diversity.
Summary updated