OpenSim Moco  0.2.0
Getting started

Obtaining Moco

Download Moco for Windows or Mac from https://simtk.org/projects/opensim-moco. The Moco distribution contains a MATLAB/Java package, a Python package, a C++ library, and a command-line tool. Currently, Moco does not have a graphical user interface.

The distribution is a ZIP file that you can place anywhere on your computer; for example, C:/Users/<username>/opensim-moco-<version> on Windows or /Users/<username>/opensim-moco-<version> on Mac. We refer to this location

Note
On Windows, set your Windows PATH environment variable to include <OpenSim-Moco-Install>/bin before any other OpenSim/OpenSense paths.

Decide which of Moco's interfaces you want to use and follow the relevant instructions below.

Building Moco from source

If you want to edit Moco's C++ code or use Moco on a platform for which we do not distribute binaries (e.g., Linux), then you must build Moco from source. Developing your own cost module does not require building Moco from source.

For instructions, visit the source code repository at https://github.com/opensim-org/opensim-moco and consult the README.md file.

Using Moco in MATLAB

Start Matlab, change your current directory to <OpenSim-Moco-Install>/Resources/Code/Matlab and run configureMoco.m.

Restart Matlab and test that Matlab is properly configured to use Moco by running:

>> org.opensim.modeling.opensimMoco.GetMocoVersionAndDate();

Make sure the output is consistent with the version of Moco you intend to use.

The Moco distribution contains Matlab examples in the folder Resources/Code/Matlab. Start with exampleSlidingMass.m.

Using Moco in Python

To use the Python package that comes with the Moco distribution, you must use the same Python distribution with which Moco was built. For Windows, this is the Python 3 distribution from python.org. For Mac, this is the Python 3 package from Homebrew.

The Moco distribution contains Python examples in the folder Resources/Code/Python. Start with exampleSlidingMass.py.

If you would prefer to use Python 2 instead of Python 3, let us know.

In the future, we hope to make the Python package easier to install by distributing it through the Conda package manager.

Using Moco with XML files and the command line

Moco provides a command-line tool, bin/opensim-moco, through which you can solve studies saved as XML files, using the .omoco file extension.

The command-line interface allows generating a template XML .omoco file and for visualizing a solution.

Unfortunately, Moco does not yet provide any examples of XML files for use with the command-line interface. However, the MATLAB/Python examples can generate XML files that you can then use through the command-line interface.

Using Moco in C++

This section is under development.