Numerical experiments for analyzing time integrators and discretizations for the simulation and optimal control of rigid-flexible robotic systems.
This repository contains the numerical experiments on time integration and optimal control of rigid-flexible multibody systems reported in [1]. In the experiments, various common ODE integrators for nonstiff and stiff systems are compared to a Lie-group variational integrator in terms of numerical properties and computational efficiency. The implementation is based on the MATLAB toolbox ELARA, which must be installed and available on the MATLAB path.
- Free motion of a planar four-link pendulum
- Nonlinear oscillations of a geometrically exact cantilever beam (modeled as a Kirchhoff beam); this is the same case also treated in [2, 3]
- Robot manipulator with a highly flexible end link under closed-loop PD control
The first two simulation cases are each analyzed both with and without dissipation.
- Rest-to-rest motion of a planar robot manipulator (after [4])
- TCP trajectory tracking of a three-DOF robot manipulator
- TCP trajectory tracking of a tendon-driven continuum manipulator
-
Clone the repository together with its submodules:
git clone --recurse-submodules https://github.com/mherrmann21/LGVI-Multibody-Experiments.git
For an existing clone, initialize the submodules with:
git submodule update --init --recursive
-
Make sure the ELARA MEX files have been built correctly (run
elara.buildand check withelara.setup). -
Run
startup_sim_studies.mto add the required functions to the MATLAB path and check for dependencies. -
Run the simulation studies in the
studiesfolder:sim_study_integrators_run_sims: time-integration studysim_study_OCP_disc_run_sims: optimal-control discretization study
The scripts save the simulation results under
results/runs. -
Run the evaluation scripts to generate the output plots. In each script's settings, select the system and dissipation case and update the timestamped result-folder names to those created in step 4.
The tests folder contains two interactive validation scripts for the four-link pendulum and cantilever-beam cases from the integrator study.
In addition, validation_sim_cantilever_beam.m compares the simulation results with literature data from [3].
- MATLAB R2025b
- ELARA Toolbox, V0.1 (installed and available on the MATLAB path)
- CasADi V3.7.2 (only for the optimal control experiments; must be installed and available on the MATLAB path)
- Coin-HSL linear solvers for IPOPT (version 2024.05.15)
Later versions of the required software may work, but have not been tested and may lead to different results.
The code is tested on Windows 11.
-
This repository includes the RADAU integrator implemented by Denis Bichsel. It is originally available here.
-
The MATLAB version of the scientific color maps Crameri is included as a submodule.
-
The PHCosseratRods repository (corresponding to [3]) is included as a submodule for validation and comparison of the cantilever-beam simulation case.
See the Coin-HSL download page and the CasADi installation instructions.
- Create an account on the HSL licensing website (academic license) and download binaries for Windows
- Add the
binsubfolder to thePATHenvironment variable
Now, the solvers should be available in CasADi/IPOPT:
opts = struct;
opts.ipopt.linear_solver = "ma97";
nlpSolver = nlpsol("solver", "ipopt", nlpProblem, opts);For additional details on the implementation, see the ELARA documentation, and for background on the systems and integrators, see [1].
Repository-authored code is licensed under the MIT License; see LICENSE.
Third-party components in third-party/ are redistributed under their respective upstream terms, notices, and citation requirements.
[1] M. Herrmann: Geometric Modeling and Optimal Control of Rigid-Flexible Robot Manipulators. PhD Thesis, Technical University of Munich, 2026 (in preparation).
[2] M. Herrmann and P. Kotyczka. “Relative-kinematic formulation of geometrically exact beam dynamics based on Lie group variational integrators”. In: Computer Methods in Applied Mechanics and Engineering 432 (2024), p. 117367. doi:10.1016/j.cma.2024.117367
[3] P. L. Kinon, S. R. Eugster, and P. Betsch. “Mixed formulation and structure-preserving discretization of Cosserat rod dynamics in a port-Hamiltonian framework”. In: Computer Methods in Applied Mechanics and Engineering 458 (2026), p. 118966. doi:10.1016/j.cma.2026.118966
[4] S. Ober-Blöbaum, O. Junge, and J. E. Marsden. “Discrete mechanics and optimal control: An analysis”. In: ESAIM: Control, Optimisation and Calculus of Variations 17.2 (2011), pp. 322–352. doi:10.1051/cocv/2010012