High-performance C++ multibody dynamics/physics library for simulating articulated biomechanical and mechanical systems like vehicles, robots, and the human skeleton.

Overview

Simbody Travis Appveyor Codecov

Simbody is a high-performance, open-source toolkit for science- and engineering-quality simulation of articulated mechanisms, including biomechanical structures such as human and animal skeletons, mechanical systems like robots, vehicles, and machines, and anything else that can be described as a set of rigid bodies interconnected by joints, influenced by forces and motions, and restricted by constraints. Simbody includes a multibody dynamics library for modeling motion in generalized/internal coordinates in O(n) time. This is sometimes called a Featherstone-style physics engine.

Simbody provides a C++ API that is used to build domain-specific applications; it is not a standalone application itself. For example, it is used by biomechanists in OpenSim, by roboticists in Gazebo, and for biomolecular research in MacroMoleculeBuilder (MMB). Here's an artful simulation of several RNA molecules containing thousands of bodies, performed with MMB by Samuel Flores:

Sam Flores' Simbody RNA simulation

Read more about Simbody at the Simbody homepage.

Simple example: a double pendulum

Here's some code to simulate and visualize a 2-link chain:

#include "Simbody.h"
using namespace SimTK;
int main() {
    // Define the system.
    MultibodySystem system;
    SimbodyMatterSubsystem matter(system);
    GeneralForceSubsystem forces(system);
    Force::Gravity gravity(forces, matter, -YAxis, 9.8);

    // Describe mass and visualization properties for a generic body.
    Body::Rigid bodyInfo(MassProperties(1.0, Vec3(0), UnitInertia(1)));
    bodyInfo.addDecoration(Transform(), DecorativeSphere(0.1));

    // Create the moving (mobilized) bodies of the pendulum.
    MobilizedBody::Pin pendulum1(matter.Ground(), Transform(Vec3(0)),
            bodyInfo, Transform(Vec3(0, 1, 0)));
    MobilizedBody::Pin pendulum2(pendulum1, Transform(Vec3(0)),
            bodyInfo, Transform(Vec3(0, 1, 0)));

    // Set up visualization.
    system.setUseUniformBackground(true);
    Visualizer viz(system);
    system.addEventReporter(new Visualizer::Reporter(viz, 0.01));

    // Initialize the system and state.
    State state = system.realizeTopology();
    pendulum2.setRate(state, 5.0);

    // Simulate for 20 seconds.
    RungeKuttaMersonIntegrator integ(system);
    TimeStepper ts(system, integ);
    ts.initialize(state);
    ts.stepTo(20.0);
}

Double-pendulum simulation in Simbody

See Simbody's User Guide for a step-by-step explanation of this example.

Features

  • Wide variety of joint, constraint, and force types; easily user-extended.
  • Forward, inverse, and mixed dynamics. Motion driven by forces or prescribed motion.
  • Contact (Hertz, Hunt and Crossley models).
  • Gradient descent, interior point, and global (CMA) optimizers.
  • A variety of numerical integrators with error control.
  • Visualizer, using OpenGL

You want to...


Dependencies

Simbody depends on the following:

  • cross-platform building: CMake 2.8.10 or later (3.1.3 or later for Visual Studio).
  • compiler: Visual Studio 2015, 2017, or 2019 (Windows only), gcc 4.9.0 or later (typically on Linux), Clang 3.4 or later, or Apple Clang (Xcode) 8 or later.
  • linear algebra: LAPACK 3.6.0 or later and BLAS
  • visualization (optional): FreeGLUT, Xi and Xmu
  • API documentation (optional): Doxygen 1.8.6 or later; we recommend at least 1.8.8.

Using Simbody

  • Creating your own Simbody-using project with CMake To get started with your own Simbody-using project, check out the cmake/SampleCMakeLists.txt file.

Installing

Simbody works on Windows, Mac, and Linux. For each operating system, you can use a package manager or build from source. In this file, we provide instructions for 6 different ways of installing Simbody:

  1. Windows: build from source using Microsoft Visual Studio.
  2. Linux or Mac (make): build from source using gcc or Clang with make.
  3. Mac (Homebrew): automated build/install with Homebrew.
  4. Ubuntu/Debian: install pre-built binaries with apt-get.
  5. FreeBSD: install pre-built binaries with pkg.
  6. Windows using MinGW: build from source using MinGW.
  7. Windows/Mac/Linux: install pre-built binaries with the Conda package manager.

If you use Linux, check Repology to see if your distribution provides a package for Simbody.

These are not the only ways to install Simbody, however. For example, on a Mac, you could use CMake and Xcode.

C++11 and gcc/Clang

Simbody 3.6 and later uses C++11 features (the -std=c++11 flag). Simbody 3.3 and earlier use only C++03 features, and Simbody 3.4 and 3.5 can use either C++03 or C++11; see the SIMBODY_STANDARD_11 CMake variable in these versions. Note that if you want to use the C++11 flag in your own project, Simbody must have been compiled with the C++11 flag as well.

Windows using Visual Studio

Get the dependencies

All needed library dependencies are provided with the Simbody installation on Windows, including linear algebra and visualization dependencies.

  1. Download and install Microsoft Visual Studio, version 2015, 2017, or 2019. The Community edition is free and sufficient.
  • 2015: By default, Visual Studio 2015 does not provide C++ support; when installing, be sure to select Custom, and check Programming Languages > Visual C++ > Common Tools for Visual C++ 2015. If you have already installed Visual Studio without C++ support, simply re-run the installer and select Modify.
  • 2017 and later: In the installer, select the Desktop development with C++ workload.
  • Any other C++ code you plan to use with Simbody should be compiled with the same compiler as used for Simbody.
  1. Download and install CMake, version 3.1.3 or higher.
  2. (optional) If you want to build API documentation, download and install Doxygen, version 1.8.8 or higher.

Download the Simbody source code

  • Method 1: Download the source code from https://github.com/simbody/simbody/releases. Look for the highest-numbered release, click on the .zip button, and unzip it on your computer. We'll assume you unzipped the source code into C:/Simbody-source.
  • Method 2: Clone the git repository.
    1. Get git. There are many options:

    2. Clone the github repository into C:/Simbody-source. Run the following in a Git Bash / Git Shell, or find a way to run the equivalent commands in a GUI client:

       $ git clone https://github.com/simbody/simbody.git C:/Simbody-source
       $ git checkout Simbody-3.7
      
    3. In the last line above, we assumed you want to build a released version. Feel free to change the version you want to build. If you want to build the latest development version ("bleeding edge") of Simbody off the master branch, you can omit the checkout line.

      To see the set of releases and checkout a specific version, you can use the following commands:

       $ git tag
       $ git checkout Simbody-X.Y.Z
      

Configure and generate project files

  1. Open CMake.
  2. In the field Where is the source code, specify C:/Simbody-source.
  3. In the field Where to build the binaries, specify something like C:/Simbody-build, just not inside your source directory. This is not where we will install Simbody; see below.
  4. Click the Configure button.
    1. When prompted to select a generator, in the dropdown for Optional platform for generator, choose x64 to build 64-bit binaries or leave blank to build 32-bit binaries. In older versions of CMake, select a generator ending with Win64 to build 64-bit binaries (e.g., Visual Studio 14 2015 Win64 or Visual Studio 15 2017 Win64), or select one without Win64 to build 32-bit binaries (e.g., Visual Studio 14 2015 or Visual Studio 15 2017).
    2. Click Finish.
  5. Where do you want to install Simbody on your computer? Set this by changing the CMAKE_INSTALL_PREFIX variable. We'll assume you set it to C:/Simbody. If you choose a different installation location, make sure to use yours where we use C:/Simbody below.
  6. Play around with the other build options:
    • BUILD_EXAMPLES to see what Simbody can do. On by default.
    • BUILD_TESTING to ensure your Simbody works correctly. On by default.
    • BUILD_VISUALIZER to be able to watch your system move about! If building remotely, you could turn this off. On by default.
    • BUILD_DYNAMIC_LIBRARIES builds the three libraries as dynamic libraries. On by default. Unless you know what you're doing, leave this one on.
    • BUILD_STATIC_LIBRARIES builds the three libraries as static libraries, whose names will end with _static. Off by default. You must activate either BUILD_DYNAMIC_LIBRARIES, BUILD_STATIC_LIBRARIES, or both.
    • BUILD_TESTS_AND_EXAMPLES_STATIC if static libraries, and tests or examples are being built, creates statically-linked tests/examples. Can take a while to build, and it is unlikely you'll use the statically-linked libraries.
    • BUILD_TESTS_AND_EXAMPLES_SHARED if tests or examples are being built, creates dynamically-linked tests/examples. Unless you know what you're doing, leave this one on.
  7. Click the Configure button again. Then, click Generate to make Visual Studio project files.

Build and install

  1. Open C:/Simbody-build/Simbody.sln in Visual Studio.

  2. Select your desired Solution configuration from the drop-down at the top.

    • Debug: debugger symbols; no optimizations (more than 10x slower). Library and visualizer names end with _d.
    • RelWithDebInfo: debugger symbols; optimized. This is the configuration we recommend.
    • Release: no debugger symbols; optimized. Generated libraries and executables are smaller but not faster than RelWithDebInfo.
    • MinSizeRel: minimum size; optimized. May be slower than RelWithDebInfo or Release.

    You at least want optimized libraries (all configurations but Debug are optimized), but you can have Debug libraries coexist with them. To do this, go through the full installation process twice, once for each configuration.

  3. Build the project ALL_BUILD by right-clicking it and selecting Build.

  4. Run the tests by right-clicking RUN_TESTS and selecting Build. Make sure all tests pass. You can use RUN_TESTS_PARALLEL for a faster test run if you have multiple cores.

  5. (Optional) Build the project doxygen to get API documentation generated from your Simbody source. You will get some warnings if your doxygen version is earlier than Doxygen 1.8.8; upgrade if you can.

  6. Install Simbody by right-clicking INSTALL and selecting Build.

Play around with examples

Within your build in Visual Studio (not the installation):

  1. Make sure your configuration is set to a release configuration (e.g., RelWithDebInfo).
  2. Right click on one of the targets whose name begins with Example - and select Select as Startup Project.
  3. Type Ctrl-F5 to start the program.

Set environment variables and test the installation

If you are only building Simbody to use it with OpenSim, you can skip this section.

  1. Allow executables to find Simbody libraries (.dll's) by adding the Simbody bin/ directory to your PATH environment variable.
    1. In the Start menu (Windows 7 or 10) or screen (Windows 8), search environment.
    2. Select Edit the system environment variables.
    3. Click Environment Variables....
    4. Under System variables, click Path, then click Edit.
    5. Add C:/Simbody/bin; to the front of the text field. Don't forget the semicolon!
  2. Allow Simbody and other projects (e.g., OpenSim) to find Simbody. In the same Environment Variables window:
    1. Under User variables for..., click New....
    2. For Variable name, type SIMBODY_HOME.
    3. For Variable value, type C:/Simbody.
  3. Changes only take effect in newly-opened windows. Close any Windows Explorer or Command Prompt windows.
  4. Test your installation by navigating to C:/Simbody/examples/bin and running SimbodyInstallTest.exe or SimbodyInstallTestNoViz.exe.

Note: Example binaries are not installed for Debug configurations. They are present in the build environment, however, so you can run them from there. They will run very slowly!

Layout of installation

How is your Simbody installation organized?

  • bin/ the visualizer and shared libraries (.dll's, used at runtime).
  • doc/ a few manuals, as well as API docs (SimbodyAPI.html).
  • examples/
    • src/ the source code for the examples.
    • bin/ the examples, compiled into executables; run them! (Not installed for Debug builds.)
  • include/ the header (.h) files; necessary for projects that use Simbody.
  • lib/ "import" libraries, used during linking.
  • cmake/ CMake files that are useful for projects that use Simbody.

Linux or Mac using make

These instructions are for building Simbody from source on either a Mac or on Ubuntu.

Check the compiler version

Simbody uses recent C++ features, that require a modern compiler. Before installing Simbody, check your compiler version with commands like that:

  • g++ --version
  • clang++ --version

In case your compiler is not supported, you can upgrade your compiler.

Upgrading GCC to 4.9 on Ubuntu 14.04

Here are some instructions to upgrade GCC on a Ubuntu 14.04 distribution.

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install gcc-4.9 g++-4.9

If one wants to set gcc-4.9 and g++-4.9 as the default compilers, run the following command

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9

Remember that when having several compilers, CMake flags CMAKE_C_COMPILER and CMAKE_CXX_COMPILER can be used to select the ones desired. For example, Simbody can be configured with the following flags:

$ cmake -DCMAKE_C_COMPILER=gcc-4.9 -DCMAKE_CXX_COMPILER=g++-4.9

Get dependencies

On a Mac, the Xcode developer package gives LAPACK and BLAS to you via the Accelerate framework. Mac's come with the visualization dependencies.

On Ubuntu, we need to get the dependencies ourselves. Open a terminal and run the following commands.

  1. Get the necessary dependencies: $ sudo apt-get install cmake liblapack-dev.
  2. If you want to use the CMake GUI, install cmake-qt-gui.
  3. For visualization (optional): $ sudo apt-get install freeglut3-dev libxi-dev libxmu-dev.
  4. For API documentation (optional): $ sudo apt-get install doxygen.

LAPACK version 3.6.0 and higher may be required for some applications (OpenSim). LAPACK can be downloaded from http://www.netlib.org/lapack/, and compiled using the following method. It is sufficient to set LD_LIBRARY_PATH to your LAPACK install prefix and build Simbody using the -DBUILD_USING_OTHER_LAPACK:PATH=/path/to/liblapack.so option in cmake.

cmake ../lapack-3.6.0 -DCMAKE_INSTALL_PREFIX=/path/to/new/lapack/ -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=ON
make
make install

Get the Simbody source code

There are two ways to get the source code.

  • Method 1: Download the source code from https://github.com/simbody/simbody/releases. Look for the highest-numbered release, click on the .zip button, and unzip it on your computer. We'll assume you unzipped the source code into ~/simbody-source.
  • Method 2: Clone the git repository.
    1. Get git.

      • Mac: You might have it already, especially if you have Xcode, which is free in the App Store. If not, one method is to install Homebrew and run brew install git in a terminal.
      • Ubuntu: run sudo apt-get install git in a terminal.
    2. Clone the github repository into ~/simbody-source.

       $ git clone https://github.com/simbody/simbody.git ~/simbody-source
       $ git checkout Simbody-3.7
      
    3. In the last line above, we assumed you want to build a released version. Feel free to change the version you want to build. If you want to build the latest development version ("bleeding edge") of Simbody off the master branch, you can omit the checkout line.

      To see the set of releases and checkout a specific version, you can use the following commands:

       $ git tag
       $ git checkout Simbody-X.Y.Z
      

Configure and generate Makefiles

  1. Create a directory in which we'll build Simbody. We'll assume you choose ~/simbody-build. Don't choose a location inside ~/simbody-source.

     $ mkdir ~/simbody-build
     $ cd ~/simbody-build
    
  2. Configure your Simbody build with CMake. We'll use the cmake command but you could also use the interactive tools ccmake or cmake-gui. You have a few configuration options to play with here.

    • If you don't want to fuss with any options, run:

        $ cmake ~/simbody-source
      
    • Where do you want to install Simbody? By default, it is installed to /usr/local/. That's a great default option, especially if you think you'll only use one version of Simbody at a time. You can change this via the CMAKE_INSTALL_PREFIX variable. Let's choose ~/simbody:

        $ cmake ~/simbody-source -DCMAKE_INSTALL_PREFIX=~/simbody
      
    • Do you want the libraries to be optimized for speed, or to contain debugger symbols? You can change this via the CMAKE_BUILD_TYPE variable. There are 4 options:

      • Debug: debugger symbols; no optimizations (more than 10x slower). Library and visualizer names end with _d.
      • RelWithDebInfo: debugger symbols; optimized. This is the configuration we recommend.
      • Release: no debugger symbols; optimized. Generated libraries and executables are smaller but not faster than RelWithDebInfo.
      • MinSizeRel: minimum size; optimized. May be slower than RelWithDebInfo or Release.

      You at least want optimized libraries (all configurations but Debug are optimized), but you can have Debug libraries coexist with them. To do this, go through the full installation process twice, once for each configuration. It is typical to use a different build directory for each build type (e.g., ~/simbody-build-debug and ~/simbody-build-release).

    • There are a few other variables you might want to play with:

      • BUILD_EXAMPLES to see what Simbody can do. On by default.
      • BUILD_TESTING to ensure your Simbody works correctly. On by default.
      • BUILD_VISUALIZER to be able to watch your system move about! If building on a cluster, you could turn this off. On by default.
      • BUILD_DYNAMIC_LIBRARIES builds the three libraries as dynamic libraries. On by default.
      • BUILD_STATIC_LIBRARIES builds the three libraries as static libraries, whose names will end with _static.
      • BUILD_TESTS_AND_EXAMPLES_STATIC if tests or examples are being built, creates statically-linked tests/examples. Can take a while to build, and it is unlikely you'll use the statically-linked libraries.
      • BUILD_TESTS_AND_EXAMPLES_SHARED if tests or examples are being built, creates dynamically-linked tests/examples. Unless you know what you're doing, leave this one on.

      You can combine all these options. Here's another example:

        $ cmake ~/simbody-source -DCMAKE_INSTALL_PREFIX=~/simbody -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_VISUALIZER=off
      

Build and install

  1. Build the API documentation. This is optional, and you can only do this if you have Doxygen. You will get warnings if your doxygen installation is a version older than Doxygen 1.8.8.

     $ make doxygen
    
  2. Compile. Use the -jn flag to build using n processor cores. For example:

     $ make -j8
    
  3. Run the tests.

     $ ctest -j8
    
  4. Install. If you chose CMAKE_INSTALL_PREFIX to be a location which requires sudo access to write to (like /usr/local/, prepend this command with a sudo .

     $ make -j8 install
    

Just so you know, you can also uninstall (delete all files that CMake placed into CMAKE_INSTALL_PREFIX) if you're in ~/simbody-build.

$ make uninstall

Play around with examples

From your build directory, you can run Simbody's example programs. For instance, try:

    $ ./ExamplePendulum

Set environment variables and test the installation

If you are only building Simbody to use it with OpenSim, you can skip this section.

  1. Allow executables to find Simbody libraries (.dylib's or so's) by adding the Simbody lib directory to your linker path. On Mac, most users can skip this step.

    • If your CMAKE_INSTALL_PREFIX is /usr/local/, run:

        $ sudo ldconfig
      
    • If your CMAKE_INSTALL_PREFIX is neither /usr/ nor /usr/local/ (e.g., ~/simbody'):

      • Mac:

          $ echo 'export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:~/simbody/lib' >> ~/.bash_profile
        
      • Ubuntu:

          $ echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/simbody/lib/x86_64-linux-gnu' >> ~/.bashrc
        

      These commands add a line to a configuration file that is loaded every time you open a new terminal. If using Ubuntu, you may need to replace x86_64-linux-gnu with the appropriate directory on your computer.

  2. Allow Simbody and other projects (e.g., OpenSim) to find Simbody. Make sure to replace ~/simbody with your CMAKE_INSTALL_PREFIX.

    • Mac:

        $ echo 'export SIMBODY_HOME=~/simbody' >> ~/.bash_profile
      
    • Ubuntu:

        $ echo 'export SIMBODY_HOME=~/simbody' >> ~/.bashrc
      
  3. Open a new terminal.

  4. Test your installation:

     $ cd ~/simbody/share/doc/simbody/examples/bin
     $ ./SimbodyInstallTest # or ./SimbodyInstallTestNoViz
    

Layout of installation

The installation creates the following directories in CMAKE_INSTALL_PREFIX. The directory [x86_64-linux-gnu] only exists if you did NOT install to /usr/local/ and varies by platform. Even in that case, the name of your directory may be different.

  • include/simbody/ the header (.h) files; necessary for projects that use Simbody.
  • lib/[x86_64-linux-gnu]/ shared libraries (.dylib's or .so's).
    • cmake/simbody/ CMake files that are useful for projects that use Simbody.
    • pkgconfig/ pkg-config files useful for projects that use Simbody.
    • simbody/examples/ the examples, compiled into executables; run them! (Not installed for Debug builds.)
  • libexec/simbody/ the simbody-visualizer executable.
  • share/doc/simbody/ a few manuals, as well as API docs (SimbodyAPI.html).
    • examples/src source code for the examples.
    • examples/bin symbolic link to the runnable examples.

Mac and Homebrew

If using a Mac and Homebrew, the dependencies are taken care of for you.

Install

  1. Install Homebrew.

  2. Open a terminal.

  3. Add the Open Source Robotics Foundation's list of repositories to Homebrew:

    $ brew tap osrf/simulation
    
  4. Install the latest release of Simbody.

    $ brew install simbody
    

    To install from the master branch instead, append --HEAD to the command above.

Where is Simbody installed?

Simbody is now installed to /usr/local/Cellar/simbody/<version>/, where <version> is either the version number (e.g., 3.6.1), or HEAD if you specified --HEAD above.

Some directories are symlinked (symbolically linked) to /usr/local/, which is where your system typically expects to find executables, shared libraries (.dylib's), headers (.h's), etc. The following directories from the Simbody installation are symlinked:

  • include/simbody -> /usr/local/include/simbody
  • lib -> /usr/local/lib
  • share/doc/simbody -> /usr/local/share/doc/simbody

Layout of installation

What's in the /usr/local/Cellar/simbody/<version>/ directory?

  • include/simbody/ the header (.h) files; necessary for projects that use Simbody.
  • lib/ shared libraries (.dylib's), used at runtime.
    • cmake/simbody/ CMake files that are useful for projects that use Simbody.
    • pkgconfig/ pkg-config files useful for projects that use Simbody.
    • simbody/examples/ the examples, compiled into executables; run them! (Not installed for Debug builds.)
  • libexec/simbody/ the simbody-visualizer executable.
  • share/doc/simbody/ a few manuals, as well as API docs (SimbodyAPI.html).
    • examples/src source code for the examples.
    • examples/bin symbolic link to executable examples.

Ubuntu and apt-get

Starting with Ubuntu 15.04, Simbody is available in the Ubuntu (and Debian) repositories. You can see a list of all simbody packages for all Ubuntu versions at the Ubuntu Packages website. The latest version of Simbody is usually not available in the Ubuntu repositories; the process for getting a new version of Simbody into the Ubuntu repositories could take up to a year.

Install

  1. Open a terminal and run the following command:

     $ sudo apt-get install libsimbody-dev simbody-doc
    

Layout of installation

Simbody is installed into the usr/ directory. The directory [x86_64-linux-gnu] varies by platform.

  • usr/include/simbody/ the header (.h) files; necessary for projects that use Simbody.
  • usr/lib/[x86_64-linux-gnu] shared libraries (.so's).
    • cmake/simbody/ CMake files that are useful for projects that use Simbody.
    • pkgconfig/ pkg-config files useful for projects that use Simbody.
  • usr/libexec/simbody/ the simbody-visualizer executable.
  • usr/share/doc/simbody/ a few manuals, as well as API docs (SimbodyAPI.html).
    • examples/src source code for the examples.
    • examples/bin symbolic link to executable examples.

FreeBSD and pkg

Simbody is available via the FreeBSD package repository.

Install

  1. Open a terminal and run the following command:

     $ sudo pkg install simbody
    

Windows using MinGW

Warning: The MinGW generation and build is experimental!

This build is still experimental, because of :

  • the various MinGW versions available (Thread model, exception mechanism)
  • the compiled libraries Simbody depends on (Blas, Lapack and optionnaly glut).

Below are three sections that gives a list of supported versions, command line instructions, and reasons why is it not so obvious to use MinGW.

Supported MinGW versions

If you do not want to go into details, you need a MinGW version with :

  • a Posix thread model and Dwarf exception mechanism on a 32 bit computer
  • a Posix thread model and SJLJ exception mechanism on a 64 bit computer

Other versions are supported with additional configurations.

The table below lists the various versions of MinGW versions tested:

OS Thread Exception Comment URL
1 64 Bits Posix SJLJ All features supported, all binary included (Recommended version) MinGW64 GCC 5.2.0
2 64 Bits Posix SEH Needs to be linked against user's Blas and Lapack MinGW64 GCC 5.2.0
3 32 Bits Posix Dwarf No visualization, all binary included MinGW64 GCC 5.2.0
4 32 Bits Posix SJLJ No visualization, needs to be linked against user's Blas and Lapack MinGW64 GCC 5.2.0

We recommend to use the first configuration where all features are supported and does not need additional libraries to compile and run. The URL allows to download directly this version. The second version needs to be linked against user's Blas and Lapack (A CLI example is given below). Blas and Lapack sources can be downloaded from netlib. For the 3rd and 4th versions that run that target a 32 bit behaviour, visualization is not possible for the time being. (It is due to a compile and link problem with glut). Moreover for the 4th one, one needs to provide Blas and Lapack libraries.

Please note that only Posix version of MinGW are supported.

If your version is not supported, CMake will detect it while configuring and stops.

Instructions

Below are some examples of command line instructions for various cases. It is assumed you are running commands from a build directory, that can access Simbody source with a command cd ..\simbody.

It is recommended to specify with the installation directory with flag CMAKE_INSTALL_PREFIX (e.g. -DCMAKE_INSTALL_PREFIX="C:\Program Files\Simbody"). If not used, the installation directory will be C:\Program Files (x86)\Simbody on a 64 bit computer. This might be confusing since it is the 32 bit installation location.

Example of instructions where one uses Blas and Lapack libraries provided (to be used in a Windows terminal, where MinGW is in the PATH):

rem CMake configuration
cmake ..\simbody -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\Program Files\Simbody"
rem Compilation
mingw32-make
rem Test
mingw32-make test
rem Installation
mingw32-make install

Example of instructions where one uses Blas and Lapack libraries provided (to be used in a Windows terminal, where MinGW is NOT in the PATH):

rem Variable and path definition
set CMAKE="C:\Program Files\CMake\bin\cmake.exe"
set MinGWDir=C:\Program Files\mingw-w64\i686-5.2.0-posix-sjlj-rt_v4-rev0\mingw32
set PATH=%MinGWDir%\bin;%MinGWDir%\i686-w64-mingw32\lib
rem CMake configuration
%CMAKE% ..\simbody -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ^
 -DCMAKE_INSTALL_PREFIX="C:\Program Files\Simbody" ^
 -DCMAKE_C_COMPILER:PATH="%MinGWDir%\bin\gcc.exe" ^
 -DCMAKE_CXX_COMPILER:PATH="%MinGWDir%\bin\g++.exe" ^
 -DCMAKE_MAKE_PROGRAM:PATH="%MinGWDir%\bin\mingw32-make.exe"
rem Compilation
mingw32-make
rem Test
mingw32-make test
rem Installation
mingw32-make install

Example of instructions where one uses Blas and Lapack libraries provided (to be used in a MSYS terminal with MinGW in the PATH):

# CMake configuration
cmake ../simbody -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\Program Files\Simbody"
# Compilation
make
# Test
make test
# Installation
make install

Example of instructions where one provides our own Blas and Lapack libraries (to be used in a MSYS terminal with MinGW in the PATH):

# CMake configuration
cmake ../simbody -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="C:\Program Files\Simbody" \
-DCMAKE_C_COMPILER:PATH="C:\Program Files\mingw-w64\i686-5.2.0-posix-sjlj-rt_v4-rev0\mingw32\bin\gcc.exe" \
-DCMAKE_CXX_COMPILER:PATH="C:\Program Files\mingw-w64\i686-5.2.0-posix-sjlj-rt_v4-rev0\mingw32\bin\g++.exe" \
-DBUILD_USING_OTHER_LAPACK:PATH="C:\Program Files\lapack-3.5.0\bin\liblapack.dll;C:\Program Files\lapack-3.5.0\bin\libblas.dll"
make
# Test
make test
# Installation
make install

MinGW details

This paragraph explains the reason why one can not use any MinGW version.

MinGW is available with two thread models :

  • Win32 thread model
  • Posix thread model

One has to use the Posix thread model, since all thread functionalities (e.g. std:mutex) are not implemented.

To ease building on Windows, Simbody provides compiled libraries for Blas and Lapack :

  • On Windows 32 Bits, these were compiled with a Dwarf exception mechanism,
  • On Windows 64 Bits, these were compiled with a SJLJ exception mechanism.

If one chooses a MinGW compilation, we need to respect this exception mechanism. A program can not rely on both mechanisms. This means that if we want to use the compiled libraries, our MinGW installation should have the same exception mechanism. Otherwise, we need to provide our own Blas and Lapack libraries.

To see which exception mechanism is used, user can look at dlls located in the bin directory of MinGW. The name of mechanism is present in the file libgcc_XXXX.dll, where XXXX can be dw, seh or sjlj. For some MinGW versions, this information is also available by looking at the result of gcc --version.

CMake will check the version of your MinGW, and if the exception mechanism is different, then the configuration stops because of this difference. If one provides Blas and Lapack libraries with the CMake variable BUILD_USING_OTHER_LAPACK, compilation with MinGW is always possible.

Windows, Mac, and Linux Using Conda

Conda is a cross platform package manager that can be used to install Simbody on Windows, Mac, or Linux. To install Simbody using Conda you must first install Miniconda or Anaconda. Either of these will provide the conda command which can be invoked at the command line to install Simbody from the Conda Forge channel as follows:

$ conda install -c conda-forge simbody

This command will install Simbody (both the libraries and headers) into the Miniconda or Anaconda installation directory as per the standard layout for each of the operating systems described above. The Conda Forge Simbody recipe can be found in Conda Forge's feedstock repository.

Acknowledgments

We are grateful for past and continuing support for Simbody's development in Stanford's Bioengineering department through the following grants:

  • NIH U54 GM072970 (Simulation of Biological Structures)
  • NIH U54 EB020405 (Mobilize Center)
  • NIH R24 HD065690 (Simulation in Rehabilitation Research)
  • OSRF subcontract 12-006 to DARPA HR0011-12-C-0111 (Robotics Challenge)

Prof. Scott Delp is the Principal Investigator on these grants and Simbody is used extensively in Scott's Neuromuscular Biomechanics Lab as the basis for the OpenSim biomechanical simulation software application for medical research.

Issues
  • Task space class with UR10 & Atlas examples, plus example reorganization

    Task space class with UR10 & Atlas examples, plus example reorganization

    This PR continues PR #210 but with the source moved into the simbody/simbody repo from chrisdembia/simbody. (via short-lived PR #237). This is so Chris and I can work on it together and with osrf.

    cc/ @chrisdembia @hsu @scpeters

    opened by sherm1 78
  • [WIP] Operational space ex

    [WIP] Operational space ex

    The start of an example of operational space control in Simbody. @hsu @scpeters @tkuchida @sohapouya could chime in too. I've added those 4 people and @sherm1 as collaborators on my fork; feel free to directly add commits to this branch.

    Right now, there's a reaching task with gravity compensation in its nullspace. I have coded it up inefficiently and in one method. However, I have spent time trying to do the same calculations efficiently; look at all the commented-out code.

    Possible things to do:

    • [x] Add methods/operators to Simbody to calculate things like the task space mass matrix, or the dynamically consistent jacobian inverse.
    • ~~[ ] Add a Force::OperationalSpace to Simbody that has an interface to build up an op-space controller for those who don't want to have to type out the calculations themselves.~~
    • [x] Add documentation in the example, referring people to resources about operational space control.
    • ~~[ ] Use an internal model to compute the controls.~~
    • ~~[ ] Add noise to model sensing of the state of the "actual" model.~~
    • ~~[ ] Model the actuation: model torque sensing and control.~~
    • [x] Display goemetry at the target point.
    • [x] Mouse or keyboard input to move around the target point.
    • [x] use Simbody.h instead of SimTKsimbody.h
    • [x] InertialForces should depend on Velocity stage.
    • [ ] Optimize.
    • [ ] Write test cases (using an RRR robot?).
    • [ ] Why does the simulation freeze when the target goes out of reach of the humanoid?

    I'm hoping this PR can be a place for discussing exactly what we want this example to be, what new methods we want in Simbody, and what we are doing for the September deadline.

    This code is somewhat derived from stuff Gerald Brantner did for ME 485 last Spring.

    opened by chrisdembia 69
  • CMAES Optimizer: initial inclusion, threading, MPI, resuming an optimization

    CMAES Optimizer: initial inclusion, threading, MPI, resuming an optimization

    Sherm just got news that cmaes will be released under the Apache 2.0 license, so we will be able to include it directly in Simbody. I am willing to take the brunt of the work doing the integration, but will want help from @sherm1 and, if interested, @carmichaelong and @msdemers.

    First question:

    Since CMAES is a derivative-free optimizer, when someone creates an OptimizerSystem and they try to define a derivative function, what do we do?

    Things to keep in mind:

    • [x] How to handle constraint tolerance?
    • [x] Satisfying license requirements?
    • ~~[ ] Do all OptimizerRep subclasses need to override clone()? There's a definition in OptimizerRep.~~
    • [x] cmaes outputs to the console; should we allow this?
    • [x] Does hitting the maximum number of iterations count as finding a solution?
    • [ ] Check for memory leaks.
    • [x] Create simple CMAES example file.
    • [ ] Create example with an optimization, optimizing something about a model's behavior, using visualization to show the improvement with iterations of the optimization.
    • [ ] Allow restarts.
    • ~~[ ] Use cmaes' boundary transformation?~~
    • [ ] Allow a single parameter, but lambda >= 2 (change this line)
    • [ ] MPI: should the master run objective function evaluations? Make this an option. If master cannot run obj func, then having only one process will cause the solver to hang; prevent option=off with nproc = 1.
    • [ ] Make sure CMAES is well behaved with MPI when only using 1 proc.
    • [ ] Test that a diagnostics level of 2 causes the allcmaes.dat file to be written.
    • [ ] Make sure I only use "popsize" and "stepsize", never "lambda" or "sigma".
    • [ ] In readme, clarify how to find the MPI library with cmake.
    • [ ] SIMBODY_ENABLE_MPI - > SIMBODY_MPI.
    • [ ] Better MPI test: maybe actually run an executable using the mpi executable.
    • [ ] In SimbodyConfig.cmake, provide if mpi was used and which library was used. (use components?)
    • [ ] Diagnostics should print numbers using scientific notation.
    • [ ] Show how to use restarts in CMAESOptimization.cpp
    • [ ] processing cmaes errors (c-cmaes calls exit()?).
    • [ ] Allow turning off parallel.
    • [ ] Add MPI test to travis.
    • [ ] Document more clearly that to use MPI (0) obtain MPI, (1) compile with SIMBODY_MPI, (2) opt.setAdvancedStrOption("parallel", "mpi");, (3) execute as mpiexec -np 3 ....
    • [ ] Remove use of auto_ptr.
    • [ ] Clarify MPI diagnostics.
    • [ ] Don't include "mpi.h" in CMAESOptimizer.h?
    • [ ] Throw error if init_stepsize is not set.
    • [ ] Exception handling with MPI.
    enhancement 
    opened by chrisdembia 46
  • Fix most warnings generated from -Wmost, for SimTKcommon.

    Fix most warnings generated from -Wmost, for SimTKcommon.

    Addresses #181.

    See travis output for the remaining warnings. So far, I only addressed warnings from SimTKcommon. SimTKcommon still has two warnings, but I don't know what to do with them.

    opened by chrisdembia 46
  • Standardize install paths and cmake finder

    Standardize install paths and cmake finder

    I've made some changes which should approach Simbody to the standard guidelines described by Debian policy and AFAIK they should be quite cross-platforms improvements, although testing in Windows/MacOsX would be nice. Detailed list:

    1. Use GNUInstallDirs, which should provide canonical paths aware of the platform.
    2. Change all the hardcoded paths to use the ones provided by GNUInstallDircs (CMAKE_INSTALL_DOCDIR, CMAKE_INSTALL_LIBDIR, etc).
    3. Adapt and change name to cmake finder, generate it from a .in file to be aware of CMAKE_INSTALL_LIBDIR.

    I will move the debian/ directory out of the source, but I have leaved here during the pull request so the great @thomas-moulard can review the debian metadata changes and maybe provide some feedback.

    opened by j-rivero 44
  • deconstructPathRelativeToSWD

    deconstructPathRelativeToSWD

    Addresses fixes to deconstructPathname (addresses issue #264). Introduces a new function deconstructPathRelativeToSWD that finds the absolute path to a given path name relative to a specified working directory (swd).

    opened by carmichaelong 43
  • ADOLC negator

    ADOLC negator

    [email protected], [email protected] This PR contains the changes in negator.h necessary to build Simbody with ADOLC. This PR also contains various tests in TestADOLCCommon.cpp verifying that negator<adouble> works properly. Note that this PR is based other PRs (ADOLC Ntraits #603 and ADOLC common #600) that are still in review. Changes in other files should thus disappear when those PRs are merged. Please let me know whether I should wait for the other PRs to be merged before going forward.

    One remark: as already discussed with @chrisdembia,

    negator(const adouble& t) {
                v = -N((typename NTraits<N>::Precision)NTraits<adouble>::value(t));
            }
    

    might be problematic but I could not get rid of the value() without getting errors. I have tried different options:

    • Using the following statement gives me an error (cannot convert from 'const adouble' to 'double') negator(const adouble& t) {v = -N((typename NTraits<N>::Precision)t);}

    • Using the following statement gives me an error (cannot convert from 'const adouble' to 'SimTK::conjugate) negator(const adouble& t) {v = -N(t);}

    • Using the following statement gives me a warning (conversion from 'double' to 'const std::complex::_Ty) negator(const adouble& t) {v = -N(NTraits<adouble>::value(t));}

    • Using the following statement is error and warning free negator(const adouble& t) {v = -N((typename NTraits<N>::Precision)NTraits<adouble>::value(t));}

    Here was the conclusion of @chrisdembia:

    Perhaps we can go with the last option until we run into issues with it. I like it because it is safe, as value() will give an exception if taping.


    This change is Reviewable

    opened by antoinefalisse 41
  • Added the possibility to compile simbody with MinGW for Windows

    Added the possibility to compile simbody with MinGW for Windows

    These commits enable compilation with various versions of MinGW for Windows.

    Since, simbody is shipped with Blas and Lapack libraries compiled with specific versions of MinGW, some checks had to be added to verify compatibility.

    If it is possible to compile simbody, configuration and compilation run smoothly. Otherwise, user is asked to provide its own version of Blas and Lapack, or to change to its version of MinGW.

    Versions tested:

    • MinGW 32 with gcc 4.7.2 and dwarf exception mechanism
    • MinGW 64 with gcc 4.9.2 and SJLJ exception mechanism
    • MinGW 64 with gcc 5.2.0 and SEH exception mechanism with Blas and Lapack compiled manually

    Please note, that one can clean the code with the the two Python scripts:

    The Python script that has been used to remove trailing spaces from CMakeLists.txt files found recursively is:

    import os
    PATH = r'simbody'
    for path, dirs, files in os.walk(PATH):
        for f in files:
            file_name, file_extension = os.path.splitext(f)
            if file_name == 'CMakeLists' and file_extension =='.txt':
                print(f)
                path_name = os.path.join(path, f)
                with open(path_name, 'r') as fh:
                    new = [line.rstrip() for line in fh]
                with open(path_name, 'w') as fh:
                    fh.writelines((line+'\n' for line in new))
    

    The Python script that has been used to remove trailing spaces from files *.c *.h *.cpp *.hpp found recursively is:

    import os
    PATH = r'simbody'
    extensions = ('.c','.h','.cpp','.hpp')
    
    for path, dirs, files in os.walk(PATH):
        for f in files:
            file_name, file_extension = os.path.splitext(f)
            if file_extension in extensions:
                print(f)
                path_name = os.path.join(path, f)
                with open(path_name, 'r') as fh:
                    new = [line.rstrip() for line in fh]
                with open(path_name, 'w') as fh:
                    fh.writelines((line+'\n' for line in new))
    
    opened by Gjacquenot 36
  • PR CMake

    PR CMake

    In this PR, we modified the CMake files needed to build SimTKcommon with adolc

    @chrisdembia

    Note: @chrisdembia, there is still one of your TODO in adolcTarget/CMakeLists. Perhaps you were still intending to do something. We can look into that when reviewing the PR.


    This change is Reviewable

    opened by antoinefalisse 35
  • Plan for a new simbody release (3.4)?

    Plan for a new simbody release (3.4)?

    Dear Simbody team:

    Is there any plan to release a new version of simbody? I was looking to ask debian for an official submission but it would be great to release an official version with all the latest changes we did to the build system and examples.

    Thanks.

    P.D: my best wishes for this new year and thanks for all the collaboration you have done during the 2013 :)

    opened by j-rivero 35
  • Simbody 3.5 release todo list

    Simbody 3.5 release todo list

    • [x] update changelog (and convert it to markdown)
    • [x] write CONTRIBUTING.md
    • [x] in README.md, replace "3.4" with "3.5" (PR #291)
    • [x] check that README.md is up to date
    • [x] read through tutorial, fix links and text as needed
    • [x] update version number for advanced user's manual
    • [x] check theory manual
    • [x] post doxygen on simtk.org
    • [x] get José's blessing on the debian subdirectory
    • [x] make 3.5 branch
    • [x] make 3.5 release (tag)
    • [x] delete 3.3 branch
    • [x] update master branch to 3.6
    • [x] announce release on forum
    build 
    opened by sherm1 34
  • Exponential Springs in OpenSim

    Exponential Springs in OpenSim

    @sherm1 @aymanhab

    This week I began work to bring the ExponentialSpringForce contact model into OpenSim. I discovered that all force producing objects in OpenSim inherit from OpenSim::Force, which in turn has some generic code (written by @peastman and Ajay) that interacts with SimTK::Force. The issue is that the SimTK::ExponentialSpringForce class does not inherit from SimTK::Force but rather from SimTK::ForceSubsystem. SimTK::ExponentialSpringForce, for example, does not implement a calcForce() method.

    It seems to me that the easiest path to incorporating ExponentialSpringForce into OpenSim is to rework ExponentialSpringForce so that it inherits from SimTK::Force and adds itself to the GeneralForceSubsystem. I'm thinking (hoping) that this will rework will not be such a big job, that it will mostly just require changing some of the Impl details.

    I will proceed with this rework. If either of you have any input about this, I am all ears. For instance, there may be a reason, given the features of ExponentialSpringForce, that will make inheriting from SimTK::Force a difficult path to walk down.

    In the past 2 weeks, it is unlikely that someone has started using SimTK::ExponentialSpringForce. If someone has, then there may be some adjustments required when ExponentialSpringForce becomes a SimTK::Force. I hoping the adjustments will be minor and a good case in point for hiding the Impl details.

    -Clay

    opened by fcanderson 1
  • official conan recipe for simbody

    official conan recipe for simbody

    Description

    • Do you know about Conan?
    • Conan is modern dependency manager for C++. And will be great if your library will be available via package manager for other developers.
    • Here you can find example, how you can create package for the library.
    • If you look at the list of repositories available on CCI, you can find most of the downstream dependencies of simbody is already available and CCI is at quite a mature state in terms of supporting the recipes to support a conan recipe for Simbody If you have any questions, just ask on the CCI github

    Use case

    • For me personally I'm trying to make conan recipes for gazebo and ignition-gazebo and it will be advantageous to have as many physics engine for both the simulation engines as they can support different physics engines, simbody being one of them

    • But as think the usage of conan is becoming common and simbody will have also wider community adoption wit h an official conan recipe

    opened by ggulgulia 2
  • Suggestion: simple algorithm for proper interpolation of quaternions.

    Suggestion: simple algorithm for proper interpolation of quaternions.

    @sherm1

    I hope you are doing well personally and are not too busy professionally. I'm writing, not to report a bug, but to see if it makes sense to incorporate a relatively simple algorithm into Simbody related to quaternions.

    I continue working to use Blender, an open-source animation suite (www.blender.org), as a means of visualizing Simbody simulations. A large part of that work has been to develop Python bindings for Simbody. Most recently, I've written some C++ classes that translate simulation results into animation keyframes. The keyframe classes have turned out nicely, but I'm not sure they would be of interest to the typical Simbody user and so may not be a good candidate for inclusion into Simbody proper.

    Anyway, when it came to interpolating quaternions, I came across a very nice, simple algorithm that is almost essential for interpolating quaternions properly. The algorithm is a 2-liner and can be implemented as a static method. In a nutshell, an issue arises because when a Rotation is converted to a Quaternions in Simbody, the Quaternion is returned in canonical form, as should be the case. However, sometimes a quaternion needs to be expressed in non-canonical form to yield correct interpolations. How does one decide? The algorithm I came across and implemented ensures that a quaternion is in the correct form. This issue seemed like it might be encountered often enough that it might make sense to incorporate the algorithm into Simbody. Of course, it's possible something like it is already in Simbody, and I overlooked it.

    I wrote some detailed Doxygen comments for the method, which follow below. If you think this algorithm potentially has a place in Simbody, I am happy to branch and submit a pull request. Unlike happned with ExponentialSpringForce, I wanted to start a discussion before hitting you with something unexpected.

    Doxygen comments and static method below here ----------------------------------------------

    /** Given two successive quaternions, Q₁ and Q₂, in a sequence of
    rotations (as might occur when keyframing rotations for a computer
    animation), ensure that Q2 is in the form (canonical or non-canonical)
    that yields interpolations on the the short arc from Q₁ to Q₂. In
    particular, determine if the rotation angle between Q₁ and Q₂ is less
    than or equal to 180° (π radians). If not, make it so by negating Q₂.
    
    #### Background
    For every quaternion, Q = w + xi + yj + zk = ~(w, x, y, z), that generates
    a rotation by an angle α to some point on the unit sphere, there is
    another quaternion, namely -Q, that generates a rotation to that same point
    but by rotating by an angle 360°-α the other way around the unit sphere.
    If |α| ≤ 180°, Q produces the "short-arc" rotation; the short-arc rotation
    is obtained when Q is expressed in canonical form (i.e., when 0 ≤ w ≤ 1).
    If |α| > 180°, Q produces the "long-arc" rotation; the long-arc rotation
    is obtained when Q is expressed in non-canonical form (w < 0). Switching
    between the canonical (short-arc) and non-canonical (long-arc) forms is
    done simply by negating Q.
    
    The rotation angle α is given by α = 2*cos⁻¹(w). As described above,
    non-negative values of w result in values of α in the range [0° to 180°].
    For example,
    
            α = 2*cos⁻¹( 1.000) =   0.0°
            α = 2*cos⁻¹( 0.900) =  51.7°
            α = 2*cos⁻¹( 0.100) = 168.5°
            α = 2*cos⁻¹( 0.001) = 179.9°
            α = 2*cos⁻¹( 0.000) = 180.0°
    
    Negative values of w result in values of α in the range (180° to 360°]:
    
            α = 2*cos⁻¹(-0.001) = 180.1° = 360° - 179.9°
            α = 2*cos⁻¹(-0.100) = 191.5° = 360° - 168.5°
            α = 2*cos⁻¹(-0.900) = 308.3° = 360° -  51.7°
            α = 2*cos⁻¹(-1.000) = 360.0° = 360° -   0.0°
    
    Note that negation of a quaternion results in rotation the other way
    around the unit sphere because both w and the rotation axis are negated.
    
    #### Algorithm Explanation
    When interpolating from Q₁ to Q₂, as is commonly done in computer
    animation, it is critical to take the short arc from Q₁ to Q₂.
    Paradoxically, taking the short arc from Q₁ to Q₂ can sometimes require
    expressing Q₂ in non-canonical (long-arc) form. As an explanation, a
    concrete example is likely most effective.
    
    Say Q₁ produces a rotation around the unit sphere by α₁ = 176° and Q₂
    produces a rotation that is just a little bit farther, say α₂ = 184°.
    The desired interpolation from Q₁ to Q₂ should produce angles on the
    short arc between α₁ and α₂ (e.g., 176°, 178°, 180°, 182°, 184°).
    Expressing Q₂ in canonical (short-arc) form, however, would have
    α₂ = -176° (assuming the same rotation axis) and interpolation would
    instead yield angles on the long arc between α₁ and α₂
    (e.g., 176°, 88°, 0°, -88°, -176°). The fact that Q₂, in canonical form,
    represents the short arc rotation around the unit sphere (i.e. a rotation
    of -176° instead of 184°) is not helpful in this situation. In order to
    get the short arc from Q₁ to Q₂, Q₂ must be expressed in non-canonical
    (long-arc) form with α₂ = 184°, not α₂ = -176°.
    
    Algorithmically, a simple dot product of Q₁ and Q₂ (i.e., ~Q₁ * Q₂)
    reveals if Q₂ needs to be expressed in its alternate form to produce
    interpolations along the short arc from Q₁ to Q₂. If the dot product
    is non-negative, |α₂ - α₁| ≤ 180, and Q₂ should be kept in its
    current form. If the dot product is negative, |α₂ - α₁| > 180, and
    Q₂ must be expressed in its alternate form, which is done simply by
    negating Q₂!
    
    This algorithm is presented and discussed by Prof. Ladislav Kavan of the
    University of Utah in a 2014 class lecture for Physics Based Animation:
    
            "PBA 2014: 3D Rotations and Quaternions"
            https://www.youtube.com/watch?v=IQEysbB0F0Y
    
    In particular, see the material from 1:00:00 to about 1:14:00. */
    
    static void ensureQ2YieldsShortArcFromQ1(const Vec4& q1, Vec4& q2) {
        Real q1q2 = ~q1*q2;  // dot product
        if(q1q2<0.0) q2 = -q2;
    }
    

    Doxygen comments and static method above here --------------------------------------------------

    Although I went looking for a concise write-up / explanation of this algorithm, I never found one. I found 30 pages on the topic, but not 3 or 4 paragraphs. So I wrote the above comments pretty much from scratch.

    Best, Clay

    ps - In Simbody, I suppose the method should take proper Quaternions as arguments instead of Vec4's. That way they are normalized, etc.

    opened by fcanderson 4
  • Provide move semantics for PIMPLHandle objects

    Provide move semantics for PIMPLHandle objects

    I work with some code that uses non-PTR handle objects whose implementations are expensive to copy-assign. Please consider pulling this patch that allows PIMPLHandles to take advantage of C++11 move semantics which can help to avoid expensive copies in some cases.


    This change is Reviewable

    opened by MadCatX 0
  • MATLAB error

    MATLAB error

    I'd like to design an exoskeleton for arm26.osim in MATLAB and define a pin joint between to links of created robots but MATLAB makes the following error:

    Java exception occurred: java.lang.RuntimeException: SimTK Exception thrown at Integrator.cpp:431: Integrator initialization failed apparently because: SimTK Exception thrown at SimbodyMatterSubsystemRep.cpp:4361: Error detected by Simbody method SimbodyMatterSubsystem::projectQ(): Failed to achieve required accuracy 0.0001. Norm on entry was 0.0252783; norm on exit 0.0251779. You might need a better starting configuration, or if there are prescribed or locked q's you might have to free some of them.

    how can I solve this error?

    opened by sh-hsz 0
Releases(Simbody-3.7)
  • Simbody-3.7(Dec 8, 2019)

    This release of Simbody includes a smoothed compliant contact model and a few bug fixes.

    • The new SmoothSphereHalfSpaceForce provides a continuous and differentiable contact model, ideal for use with gradient-based optimization algorithms (PR #667).
    • Fixes a memory issue with CPodes (PR #642).
    • The new CMake variable INSTALL_DOCS controls whether docs are installed (PR #655).
    • Fixes a bug with calculating constraint acceleration errors (PR #670).
    • Fixes Pathname::getThisExecutablePath() for FreeBSD (PR #672).
    • Fixes simbody-visualizer on macOS 10.15 Catalina when using high-DPI screens. Now, simbody-visualizer is an app bundle (simbody-visualizer.app) on Mac (PR #676).
    Source code(tar.gz)
    Source code(zip)
  • Simbody-3.6.1(Jun 12, 2018)

    This patch release is 3.6 with minor changes:

    • Fixed a bug wherein a program may crash when using the visualizer if the visualizer window was closed manually.
    Source code(tar.gz)
    Source code(zip)
  • Simbody-3.6(Feb 21, 2018)

    This is the first release of Simbody that requires C++11, as much of the code base now takes advantage of C++11 features. The MinGW compiler is now supported, providing an alternative to Visual C++ on Windows. This release fixes a bug in MultibodyGraphMaker where massless bodies were handled incorrectly. The state's caching mechanism is now more fine-grained ("stage versions"), though this change should not affect users in this release.

    If upgrading from 3.5, you may need to make minor changes to downstream code:

    • SimTK::ClonePtr's equality comparison operator previously checked equality between the underlying objects, but now checks equality between pointers.
    • Support for long double has been removed.
    • Some methods in SimTK::ClonePtr and SimTK::ReferencePtr have been renamed.
    • SimTK::Xml was changed from a class to a namespace.

    Where possible, we have deprecated previous methods rather than removing them completely.

    There were numerous smaller improvements to Simbody since the previous release, in build and installation, documentation, performance, bug fixes, and small enhancements. For details, see CHANGELOG.md.

    For installation instructions, see README.md. For API documentation, see https://simbody.github.io/simbody-3.6-doxygen/api/. For information on contributing to the Simbody project, see CONTRIBUTING.md.

    If you have questions or problems, please post to the Simbody Forum.

    Source code(tar.gz)
    Source code(zip)
  • Simbody-3.5.4(Oct 1, 2016)

  • Simbody-3.5.3(Jun 15, 2015)

    This patch release is 3.5.2 with minor changes:

    • The source will now compile on Windows with Visual C++ 2015. It has also been tested with 2013 and should still work with 2010.

    There are also bug fixes for two relatively obscure problems:

    • SpatialInertia::shift() and calcCompositeBodyInertias() were not correct for non-zero center of mass offsets (issue #334).
    • VectorIterator was causing unnecessary copying during mesh handling (issue #349).
    Source code(tar.gz)
    Source code(zip)
  • Simbody-3.5.2(May 16, 2015)

    Same as 3.5.1 except on 64 bit Windows which now has a patched version of Lapack that addresses an obscure error handling problem that caused trouble for some OpenSim users. This release is intended to support OpenSim; there is no reason for Simbody users to upgrade from 3.5.1 although it is harmless to do so.

    The change here is a patch to Lapack 3.4.2 (64 bit) to fix the bug discussed in Issue #177 and PR #342. There were two functions where convergence failures incorrectly caused an abort (XERBLA in Lapack-speak) that bubbled up to trash an IpOpt optimization that should have recovered. See discussion on Lapack forum: http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=13&t=4586. The patched Lapack DLL is binary compatible with the previous one, same functions and ordinals.

    Source code(tar.gz)
    Source code(zip)
  • Simbody-3.5.1(Jan 1, 2015)

    (This patch release fixed an installation problem but is otherwise identical to 3.5.)

    Release 3.5 focused primarily on infrastructure for and prototyping of rigid contact and impact, and the development of examples showing how to perform task space control using Simbody. These two projects were supported by our DARPA research subcontract with Open Source Robotics Foundation, and were integrated with Gazebo. Further development for rigid contact is required for smooth integration into Simbody; this is planned for Simbody 4.0 and only the bravest among you should attempt to use rigid contact before then. The task space control examples TaskSpaceControl-UR10 and TaskSpaceControl-Atlas can be found in the Simbody examples directory.

    Chris Dembia integrated Nikolaus Hansen's Covariant Matrix Adaptation Evolution Strategy (CMA-ES) global optimizer into Simbody's existing Optimizer class framework, and implemented a multithreading capability for it. This is ready to use and we would like feedback. Thanks to Nikolaus Hansen for allowing us to include this in Simbody under the Apache 2.0 license.

    There were numerous smaller improvements to Simbody since the previous release, in build and installation, documentation, performance, bug fixes, and small enhancements. There are no known incompatibilities with previous release 3.4.1 and we highly recommend that you upgrade. For details, see CHANGELOG.md.

    For installation instructions, see README.md. For information on contributing to the Simbody project, see CONTRIBUTING.md.

    If you have questions or problems, please post to the Simbody Forum.

    Source code(tar.gz)
    Source code(zip)
  • Simbody-3.4.1(Mar 31, 2014)

    This release is functionally similar to 3.3 but has had extensive changes to build and install, mostly affecting Linux and OSX systems. The behavior should now conform better to standards on those platforms, thanks to the hard work of @scpeters and @j-rivero at Open Source Robotics Foundation and @chrisdembia at Stanford.

    There are a number of bug fixes but they will not be noticed by most users. The most numerically significant is that SimbodyMatterSubsystem::getTotalCentrifugalForces() now returns the correct result (see issue #112). There are several small new features and enhancements but they were targeted narrowly at specific use cases and are likely to affect only the people who were involved in their development.

    If you run into problems with the build changes, please post to the Simbody forum.

    Source code(tar.gz)
    Source code(zip)
  • Simbody-3.3.1(Jan 22, 2014)

    This is the first release built for use in Open Source Robotic Foundation's Gazebo robot simulator and is also the version of Simbody that ships with OpenSim 3.2. It incorporates many fixes and enhancements prompted by the integration effort with OSRF, and a new Debian builder for smooth incorporation into the Gazebo build.

    This is also a stable general purpose Simbody build.

    Version 3.3.1 is a minor patch to 3.3 to fix some problems compiling with Visual Studio 12 (2013) on Windows. Otherwise it is unchanged from 3.3.

    Source code(tar.gz)
    Source code(zip)
  • Simbody-3.1(Aug 16, 2013)

Owner
Simbody Project
High-accuracy C++ multibody dynamics/physics library for scientific & engineering simulation of biomechanical and mechanical systems.
Simbody Project
A fast and lightweight 2D game physics library.

NEW IN CHIPMUNK 7 Chipmunk 7 is complete and now includes the ARM NEON optimizations, the autogeometry code, and the mulithreaded solver. The latest p

Scott Lembcke 1.8k May 11, 2022
C++ library for multi-physics simulation

Project CHRONO Project Chrono represents a community effort aimed at producing a physics-based modelling and simulation infrastructure based on a plat

null 1.4k May 13, 2022
Box2D is a 2D physics engine for games

Build Status Box2D Box2D is a 2D physics engine for games. Contributing Please do not submit pull requests with new features or core library changes.

Erin Catto 5.7k May 17, 2022
2D physics engine for games

LiquidFun Version 1.1.0 Welcome to LiquidFun! LiquidFun is a 2D physics engine for games. Go to our landing page to browse our documentation and see s

Google 4.4k May 7, 2022
Real-time multi-physics simulation with an emphasis on medical simulation.

Introduction SOFA is an open source framework primarily targeted at real-time simulation, with an emphasis on medical simulation. It is mainly intende

SOFA Framework 605 May 10, 2022
Natively multithreaded physics for threejs with PhysX.

Three-Physx Natively multithreaded physics for threejs with PhysX and an easy interface. Credit to Milkshake inc, physx-js, three-ammo, three-to-canno

XR Foundation 12 Feb 17, 2022
A modern C++11 quantum computing library

Quantum++ Version 2.6 - 9 January 2021 Build status: Chat (questions/issues) About Quantum++ is a modern C++11 general purpose quantum computing libra

softwareQ Inc. 361 May 3, 2022
A C++ library for kinematics and dynamics of articulated rigid body systems.

gear Geometric Engine for Articulated Rigid-body simulation GEAR is a C++ library for kinematics and dynamics of articulated rigid body systems. It us

null 58 Jan 27, 2022
✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

null 6.2k May 13, 2022
Improved version of real-time physics engine that couples FEM-based deformables and rigid body dynamics

Enhanced version of coupled FEM and constrained rigid body simulation Description This little playground aimed to test our Conjugate Gradients based M

Andrey Voroshilov 25 Apr 11, 2022
Multi-Joint dynamics with Contact. A general purpose physics simulator.

Multi-Joint dynamics with Contact. A general purpose physics simulator.

DeepMind 3.5k May 18, 2022
An Alice-like 35% 3d printed mechanical keyboard using ItsyBitsy dev boards

QALBLE An ergo 35% 3d printed wireless mechanical keyboard, born from the thought of "Imagine QAZ but split like an Alice ?? " The BLE is a misnomer s

null 11 Apr 14, 2022
Public Code Repository of the iRotate Active SLAM for Omnidirectional robots at the Max Planck Institute for Intelligent Systems, Tübingen

iRotate: Active Visual SLAM for Omnidirectional Robots This repository contains the code of iRotate, an active V-SLAM method submitted to RA-L + IROS2

Elia Bonetto 31 Apr 1, 2022
Efficient Differentiable Simulation of Articulated Bodies (ICML2021)

Efficient Differentiable Simulation of Articulated Bodies Yi-Ling Qiao, Junbang Liang, Vladlen Koltun, Ming C. Lin [Paper] [Video] [Slides] [Code] Set

YilingQiao 69 May 6, 2022
An eventing framework for building high performance and high scalability systems in C.

NOTE: THIS PROJECT HAS BEEN DEPRECATED AND IS NO LONGER ACTIVELY MAINTAINED As of 2019-03-08, this project will no longer be maintained and will be ar

Facebook Archive 1.7k May 14, 2022
An eventing framework for building high performance and high scalability systems in C.

NOTE: THIS PROJECT HAS BEEN DEPRECATED AND IS NO LONGER ACTIVELY MAINTAINED As of 2019-03-08, this project will no longer be maintained and will be ar

Meta Archive 1.7k Apr 26, 2022
This code accompanies the paper "Human-Level Performance in No-Press Diplomacy via Equilibrium Search".

Diplomacy SearchBot This code accompanies the paper "Human-Level Performance in No-Press Diplomacy via Equilibrium Search". A very brief orientation:

Facebook Research 28 Apr 29, 2022
This is a single-header, multithreaded C++ library for simulating the effect of hydraulic erosion on height maps.

TinyErode This is a single-header, multithreaded C++ library for simulating the effect of hydraulic erosion on height maps. The algorithm is based on

Taylor 39 Apr 1, 2022
Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Bullet Physics SDK This is the official C++ source code repository of the Bullet Physics SDK: real-time collision detection and multi-physics simulati

Bullet Physics SDK 9.3k May 10, 2022
Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Bullet Physics SDK 9.3k May 11, 2022
Linear predictive coding (LPC) is an algorithm used to approximate audio signals like human speech

lpc.lv2 LPC analysis + synthesis plugin for LV2 About Linear predictive coding (LPC) is an algorithm used to approximate audio signals like human spee

null 3 May 2, 2022
Firmware, mechanical and electrical design files for the Inline Filament Diameter Estimator, Lowcost (InFiDEL).

Inline Filament Diameter Estimator, Lowcost (InFiDEL) Originally created by Thomas Sanladerer A cheap, yet precise filament diameter sensor, intended

Daniel Smullen 84 Apr 27, 2022
A fully-functional open source and open hardware mechanical USB computer keyboard with only three keys!

threeboard threeboard is a fully-functional open source and open hardware mechanical USB computer keyboard with only three keys. It supports multiple

Conor Taylor 98 Feb 12, 2022
A C header file & shader for simulating colourblindness and checking contrast.

Colourblind A C header file & shader for simulating colourblindness and checking contrast. Make sure that your graphic design is suitable for the ~8%

Andrew Reece 19 May 1, 2022
OpenGL Demo: Simulating Ocean Waves with FFT

OceanFFT Realistic ocean wave simulation, primarily based on J. Tessendorf's paper, using OpenGL compute shaders. Checkout the demo video here. In the

Achal Pandey 59 May 8, 2022
sipeed opensource mechanical keyboard make with BL706

sipeed_keyboard sipeed opensource mechanical keyboard make with BL706 矽π 开源双模机械键盘 目录结构 ./ ├── LICENSE ├── README.md ├── firmware // 存放键盘固件 ├── hardwar

Sipeed 52 Apr 18, 2022
A large mechanical 7-segment clock using cheap stepper motors.

mechanical-7-segment-clock A large mechanical 7-segment clock using cheap stepper motors. Each digit requires its own controller board. The seconds di

null 42 Mar 17, 2022
Packages for simulating the Tethys-class Long-Range AUV (LRAUV) from the Monterey Bay Aquarium Research Institute (MBARI).

LRAUV Simulation This repository contains packages for simulating the Tethys-class Long-Range AUV (LRAUV) from the Monterey Bay Aquarium Research Inst

Open Robotics 15 May 12, 2022
A Multi-Scale Model for Simulating Liquid-Fabric Interactions

libWetCloth libWetCloth is an open source project for the physical simulation of liquid and wet cloth or yarns. It has been compiled and tested on Mac

Raymond Yun Fei 371 May 6, 2022