OpenSim Moco is a toolkit for solving optimal control problems involving musculoskeletal systems using the direct collocation method. Moco solves the following broad categories of problems:
- Solve for the muscle activity that produces an observed motion.
- Solve for the muscle activity that approximately tracks an observed motion.
- Solve for a new motion that optimizes user-defined costs.
- Solve for muscle properties that yield a good match between simulated and measured muscle activity.
Moco depends on the following software:
- OpenSim: Platform for simulating musculoskeletal systems.
- Simbody: Multibody dynamics.
- CasADi: Algorithmic differentiation and interface to nonlinear solvers.
- Tropter: C++ library for solving general optimal control problems with
direct collocation. Currently, Tropter's source code is part of Moco.
- Eigen: C++ matrix library.
- ColPack: Used to efficiently compute derivatives.
- ADOL-C: Automatic differentiation.
- Ipopt: Nonlinear program solver.
Build the dependencies by building the CMake project in the dependencies
folder.
On Windows, you can run the build_on_windows.ps1
PowerShell script to
obtain Moco's dependencies and to build Moco. This script assumes you
have installed Microsoft Visual Studio 2019 (with C++ support) and CMake
3.2 or greater. You can alternatively use Microsoft Visual Studio 2015 or
Microsoft Visual Studio 2017.
Install the following:
gfortran
pkgconfig
autoreconf
aclocal
glibtoolize
wget
cmake
doxygen
(optional)
You can install these with Homebrew:
brew install cmake pkgconfig gcc autoconf libtool automake wget doxygen
Nagivate to the directory where you placed the opensim-moco source code.
ex: cd ~/opensim-moco
Run build_on_mac from the terminal.
ex ./build_on_mac.sh
sudo apt install git wget build-essential libtool autoconf cmake pkg-config gfortran liblapack-dev
Use the CMake project in the
dependencies
directory to install remaining dependencies.
-
Allow biomechanists to solve certain classes of optimal control problems with ease and without writing any code.
-
Solving for muscle activity from a known motion should be faster than using OpenSim Computed Muscle Control.
-
Users should be able to solve for mass properties that minimize residual forces.
-
Advanced users can construct optimal control problems programmatically in C++.
-
-
Advanced users can create plugins to create custom cost terms and constraints.
-
Allow biomechanists to customize an optimal control problem.
-
Choose an objective functional (sum of squared muscle activation, metabolic cost, joint loads, coordinate tracking, marker tracking).
-
Choose constraints (activation within range of electromyography).
-
-
The software and its source code are made freely available in a way that allows for commercial use (permissive licensing).
-
Users do not need to manually specify derivatives (gradient, Jacobian, Hessian) for their optimal control problems.
-
For advanced users, there should be utilities to easily debug issues with problem formulation (which variables are hitting their constraints?) and to improve performance (visualize sparsity pattern).
-
The software should fully exploit all cores available on a user's computer, but should provide the option to only use 1 thread (if the user is solving multiple problems in parallel).
-
Users can construct a Moco problem in MATLAB and Python.
-
The software is easy to build from source.
-
The software runs on Windows, macOS, and Linux (Ubuntu).