Axion is a high-performance, differentiable physics simulator designed for robotics research, machine learning, and applications requiring accurate gradients through complex dynamics. Built on top of NVIDIA Warp, it leverages GPU acceleration and automatic differentiation to enable gradient-based optimization for physics-driven systems.
Differentiable simulators are crucial tools for bridging physics-based modeling with gradient-based optimization techniques common in machine learning and robotics. Axion provides a powerful and flexible simulation environment that addresses key challenges in the field:
- โก GPU Acceleration: Built on NVIDIA Warp for parallel execution on modern GPUs, maximizing computational throughput
- ๐ง Flexible Configuration: Hydra-based configuration system for easy experimentation and parameter tuning
- ๐ Comprehensive Logging: HDF5-based logging system for detailed simulation data capture and analysis
- ๐ฎ Simulation Visualization: Rendering with configurable frame rates
- Rigid Body Dynamics: Robust simulation of articulated and unarticulated rigid body systems
- Contact & Collision: Advanced contact constraint handling with configurable stiffness and damping
- Friction Modeling: Coulomb friction implementation with customizable coefficients
- Joint Constraints: Support for various joint types in articulated systems
- Adaptive Time Stepping: Dynamic integration methods for optimal performance and stability
- Python 3.12 or higher
- CUDA-capable GPU (recommended)
- NVIDIA Warp (automatically installed as dependency)
# Clone the repository
git clone https://github.com/aleskucera/axion.git
cd axion
# Install third-party dependencies
git submodule update --init --recursive
# Install with pip
pip install -e .
# Or install with uv (if you have it)
uv pip install -e .Axion depends on the following key packages:
warp-lang: NVIDIA's differentiable graphics and physics librarytorch: PyTorch for machine learning integrationhydra-core: Configuration managementh5py: HDF5 data loggingusd-core: Universal Scene Description supporttrimesh: 3D mesh processing
Axion comes with several pre-built examples that demonstrate its capabilities:
# Simple ball bouncing example
python -m axion.examples.ball_bounce
# Collision primitives demonstration
python -m axion.examples.collision_primitives
# Helhest robot simulation
python -m axion.examples.helhest
# Simplified Helhest example
python -m axion.examples.helhest_simpleAxion uses Hydra for flexible configuration management. Configuration files are organized in a modular structure:
conf/
โโโ config.yaml # Main configuration
โโโ engine/ # Physics engine settings
โ โโโ base.yaml
โ โโโ helhest.yaml
โโโ simulation/ # Simulation parameters
โ โโโ base.yaml
โ โโโ helhest.yaml
โโโ rendering/ # Visualization settings
โ โโโ 30_fps.yaml
โ โโโ headless.yaml
โโโ execution/ # Execution modes
โ โโโ cuda_graph.yaml
โ โโโ no_graph.yaml
โโโ profiling/ # Performance profiling
โโโ disabled.yaml
โโโ timing.yaml
โโโ hdf5_logging.yaml
You can override configuration parameters from the command line:
# Run with different frame rate
python -m axion.examples.ball_bounce rendering=headless
# Change engine parameters
python -m axion.examples.helhest engine=helhest simulation=helhest
# Enable profiling
python -m axion.examples.ball_bounce profiling=timingaxion/
โโโ core/ # Core simulation engine
โ โโโ engine.py # Main physics engine
โ โโโ engine_config.py
โ โโโ engine_data.py
โ โโโ abstract_simulator.py
โโโ constraints/ # Physics constraints
โ โโโ contact_constraint.py
โ โโโ friction_constraint.py
โ โโโ joint_constraint.py
โ โโโ dynamics_constraint.py
โโโ optim/ # Optimization algorithms
โ โโโ cr.py # Conjugate residual solver
โ โโโ preconditioner.py
โ โโโ matrix_operator.py
โโโ logging/ # Data logging utilities
โ โโโ hdf5_logger.py
โ โโโ hdf5_reader.py
โโโ types/ # Data structures
โ โโโ contact_interaction.py
โ โโโ joint_interaction.py
โ โโโ generalized_mass.py
โโโ examples/ # Example simulations
-
Engine Core: The
AxionEngineclass handles the main simulation loop, integrating Newton's method for solving nonlinear systems arising from implicit time integration. -
Constraint System: Modular constraint handlers for different physics phenomena:
- Contact constraints with configurable stiffness/damping
- Friction constraints using Coulomb model
- Joint constraints for articulated bodies
- Dynamics constraints for Newton-Euler equations
-
Optimization Layer: Efficient linear solvers and preconditioners for handling large-scale systems:
- Conjugate Residual (CR) solver
- Matrix-free operators for memory efficiency
- Jacobi preconditioning
-
Logging Infrastructure: Comprehensive data capture for analysis and debugging:
- HDF5-based storage for efficient data management
- Real-time performance metrics
- Configurable logging levels and outputs
Axion includes benchmarking tools for performance analysis:
# Run constraint kernel benchmarks
python tests/contact_kernel_benchmark.py
python tests/dynamics_kernel_benchmark.py
python tests/friction_kernel_benchmark.py
python tests/joint_kernel_benchmark.py
# Combined kernel benchmark
python tests/combined_kernel_benchmark.py- CUDA Graph Execution: Optimized GPU kernel execution
- Sparse Matrix Operations: Efficient handling of large systems
- Parallel Constraint Resolution: GPU-accelerated constraint solving
- Adaptive Timestep Control: Dynamic adjustment for stability and speed
# Run all tests
pytest tests/
# Run specific test
pytest tests/test_ncp.py -v# Build with mkdocs
mkdocs build
# Serve locally
mkdocs serveWe welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Author: Aleลก Kuฤera
Email: [email protected]
Institution: Czech Technical University in Prague