Official Code Repository for Trajectory Optimization for In-Hand Manipulation with Tactile Force Control.
Minimal, uv-managed Python project for in-hand rolling trajectory optimization (CasADi + IPOPT) with a MeshCat visualizer.
Haegu Lee1, Yitaek Kim1, Victor Melbye Staven1, Christoffer Sloth1
1University of Southern Denmark
This repo contains:
finger.py– planar finger + circular object model (CasADi)main.py– builds/solves the NLP and savesfinger_solution.npzanimate.py– MeshCat animation of the saved trajectoryREADME.md– this file
- Python 3.10 – 3.12
uv(dependency manager)- A CasADi build with IPOPT (standard wheels typically include it)
# 1) Create a virtual environment (managed by uv)
uv venv --python 3.12
# 2) Install dependencies from pyproject.toml (creates/updates lockfile)
uv lock
uv syncRun the top-level scripts directly (no console entry points, by design):
# Optimize and save results to finger_solution.npz
uv run python main.py
# Visualize the saved result in MeshCat
uv run python animate.pyThe result should look like this.
rolling_trajectory_optimization
├── animate.py
├── editorconfig
├── finger.py
├── finger_rolling.gif
├── finger_solution.npz
├── gitignore
├── main.py
├── pyproject.toml
├── README.md
└── uv.lockIf you find our codes useful in your work, please cite our paper:
@article{lee2025trajectory,
title={Trajectory Optimization for In-Hand Manipulation with Tactile Force Control},
author={Lee, Haegu and Kim, Yitaek and Staven, Victor Melbye and Sloth, Christoffer},
journal={arXiv preprint arXiv:2503.08222},
year={2025}
}
If you have any questions, feel free to contact me through email (haeg@mmmi.sdu.dk)!

