MorphIt is a novel algorithm for approximating robot morphology using spherical primitives that balances geometric accuracy with computational efficiency. Unlike existing approaches that rely on either labor-intensive manual specification or inflexible computational methods, MorphIt implements an automatic gradient-based optimization framework with tunable parameters that provides explicit control over the physical fidelity versus computational cost tradeoff.
- Automatic spherical approximation of any mesh with gradient-based optimization
- Flexible configuration for different task requirements
- Fast computation - up to 2 orders of magnitude faster than baseline methods
- Physical fidelity - better mesh approximation with fewer spheres
- Easy integration - generates URDF files compatible with popular robotics simulators
uv venv venv-morphit --python 3.10
source venv-morphit/bin/activate
uv pip install -r requirements.txt
Compile an efficient helper module used to check whether a point lies inside a mesh:
sudo apt-get install python3.10-dev
cd src
python setup.py build_ext --inplace
This should generate a file such as triangle_hash.cpython-310-x86_64-linux-gnu.so
Test the system to ensure everything is working:
cd src
python test_morphit.py
This runs some tests including imports, configuration, model creation, loss computation, and minimal training to verify the installation.
cd src
python main.py
from morphit import MorphIt
from config import get_config
# Create configuration
config = get_config("MorphIt-B") # Balanced configuration
config.model.mesh_path = "path/to/your/mesh.obj"
config.model.num_spheres = 15
# Create and train model
model = MorphIt(config)
tracker = model.train()
# Save results
model.save_results("output.json")
Process multiple mesh files:
cd src
python morphit_panda.py
Visualize sphere packing results:
cd src
python visualize_packing.py results/output/morphit_results.json
Create the sheres, populate the URDF file, then use a simulator like Drake to use your new robot mophology.
cd src
python morphit_panda.py
cd scripts
python create_panda_urdf.py
python run_spherical_panda_drake_example.py
morphit.py
- Main MorphIt class implementing the spherical approximation algorithmconfig.py
- Configuration management with predefined variants (V, S, B)losses.py
- Loss functions for optimization (coverage, overlap, boundary, surface, containment, SQEM)training.py
- Training loop and optimization logicdensity_control.py
- Adaptive sphere pruning and addition mechanisms
inside_mesh.py
- Efficient mesh containment checking using Cythonvisualization.py
- PyVista-based visualization functionsconvergence_tracker.py
- Training metrics tracking and analysislogger.py
- Evolution logging and rendering thread management
main.py
- Main example scripttest_morphit.py
- Comprehensive system testsmorphit_panda.py
- Batch processing for Franka Panda robotvisualize_packing.py
- Standalone visualization toolscripts/
- URDF generation and integration scripts for Drake, CuRobo
setup.py
- Cython compilation setuptriangle_hash.pyx
- Cython implementation for fast mesh queriestriangle_hash.cpp
- Generated C++ code
- MorphIt-V: Volume-focused, conservative approximations for collision avoidance
- MorphIt-S: Surface-focused, precise approximations for contact-rich manipulation
- MorphIt-B: Balanced approximation for general-purpose applications
- Collision detection and avoidance
- Contact-rich manipulation planning
- Navigation through cluttered spaces
- Whole-body contact planning
- Real-time motion generation
- Ubuntu 22.04.5 LTS (recommended)
- Python 3.10
- CUDA-capable GPU (recommended, for acceleration)
If you use MorphIt in your research, please cite our paper:
@misc{nechyporenko2025morphit,
title={MorphIt: Flexible Spherical Approximation of Robot Morphology for Representation-driven Adaptation},
author={Nataliya Nechyporenko and Yutong Zhang and Sean Campbell and Alessandro Roncone},
year={2025},
eprint={2507.14061},
archivePrefix={arXiv},
primaryClass={cs.RO},
url={https://arxiv.org/abs/2507.14061},
}
This project is licensed under the MIT License.