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

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.

Owner
Simbody Project
High-accuracy C++ multibody dynamics/physics library for scientific & engineering simulation of biomechanical and mechanical systems.
Simbody Project
Comments
  • 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

  • [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.

  • 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.
  • 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.

  • 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.

  • 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).

  • 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

  • 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))
    
  • 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

  • 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 :)

  • 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
  • TestBigMatrix fails on mips64el and ppc64el architectures

    TestBigMatrix fails on mips64el and ppc64el architectures

    Simbody 3.7 fails TestBigMatrix when built on Debian on mips64el and ppc64el architectures:

    test 12
            Start  12: TestBigMatrix
    
    12: Test command: obj-mips64el-linux-gnuabi64/TestBigMatrix
    12: Working Directory: obj-mips64el-linux-gnuabi64/SimTKcommon/tests
    12: Test timeout computed to be: 1500
    12: f(v)=~[1,2,3]
    12: exception: SimTK Exception thrown at TestBigMatrix.cpp:100:
    12:   Internal bug detected: Test condition failed.
    12:   (Assertion '(X*vs == -(X*-vs))' failed).
    12:   Please file an Issue at https://github.com/simbody/simbody/issues.
    12:   Include the above information and anything else needed to reproduce the problem.
      9/108 Test  #12: TestBigMatrix ..................................***Failed    0.02 sec
    f(v)=~[1,2,3]
    exception: SimTK Exception thrown at TestBigMatrix.cpp:100:
      Internal bug detected: Test condition failed.
      (Assertion '(X*vs == -(X*-vs))' failed).
      Please file an Issue at https://github.com/simbody/simbody/issues.
      Include the above information and anything else needed to reproduce the problem.
    
    

    Full build logs: mips64el and ppc64el. Log files are ~100 MB in size.

  • The OBJ file parser should ignore all kinds of whitespace for face (`f`) commands

    The OBJ file parser should ignore all kinds of whitespace for face (`f`) commands

    Minor bug, but it popped up when a user supplied custom-computed mesh data to OpenSim Creator (see: https://github.com/ComputationalBiomechanicsLab/opensim-creator/issues/473)

    The bug is that SimTK's OBJ parser will fail to parse OBJ files that use tabs as delimiters in the face (f) command.

    A quick search on the internet indicates that OBJ fields do not have a strictly specified field delimiter. Examples and files I have found on the internet indicate that fields may be separated with:

    • A single space
    • A newline character (with \ as a control character)
    • A single tab
    • A single "other" whitespace character (vertical tabs)
    • (maybe) Multiple instances of the above

    E.g. Blender's OBJ parser handles all of the above by just treating all control characters the same way:

    • (call point): https://github.com/blender/blender/blob/a16dd407b3d3f830c40646fcda5ea5b89b3ad4ee/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc#L499
    • (implementation): https://github.com/blender/blender/blob/a16dd407b3d3f830c40646fcda5ea5b89b3ad4ee/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc#L390

    SimTK's OBJ loader currently handles this fairly liberal specification for vertex commands (v), but not face commands (f) in OBJ files. This is because the vertex parser uses std::istream::operator>> to read each vertex element:

    • https://github.com/simbody/simbody/blob/d685ed2/SimTKcommon/Geometry/src/PolygonalMesh.cpp#L174

    Where C++ specifies that the operator:

    Extracts a floating-point value potentially skipping preceding whitespace. (see: https://en.cppreference.com/w/cpp/io/manip/skipws)

    But the face commands (f) use std::istream::ignore with a space character (' '):

    • https://github.com/simbody/simbody/blob/d685ed2/SimTKcommon/Geometry/src/PolygonalMesh.cpp#L191

    Where C++ specifies that ignore skips that character multiple times until it doesn't see it (in this bug, until it sees \t and stops).

    The solution to this is to change that code section to skip as much whitespace as possible, rather than specifically the space character.

  • Usage of SimTK::Vec for custom types.

    Usage of SimTK::Vec for custom types.

    I have some type (let's say SomeClass) and would like to use it as an element of SimTK::Vec. So I try to do the following:

    SimTK::Vec<2, SomeClass> vec;
    

    but it doesn't work since SimTK::CNT<SomeClass> is not defined and all the typedefs from SimTK::NTraits are missing.

    Then I tried to do the following:

    template <>
    class SimTK::CNT<SomeClass> : public SimTK::NTraits<SomeClass> {};
    

    or

    template <>
    class SimTK::CNT<SomeClass> : public SimTK::NTraits<SimTK::NTraits<SomeClass>> {};
    

    but it still doesn't compile.

    I get errors saying that a bunch of typedefs is missing. E.g.:

    error C2039: 'TNeg': is not a member of 'SimTK::CNT<SomeClass>'
    

    Does anybody have any suggestion what should I do to define SimTK::Vec<2, SomeClass> with all the neccesary typedefs from SimTK::NTraits?

    Thank you in advance!

  • Removed NDEBUG-dependent SimTK::StateImpl members

    Removed NDEBUG-dependent SimTK::StateImpl members

    Although the members that are affected by this diff (m_qVersion, m_discreteVarVersions, etc.) are unused in release builds, it is dangerous to conditionally expose them.

    The reason why is because of ABI breakages. StateImpl.h is a header that can, in principle, be included by downstream code (I know it's internal/, but that won't stop it from being transitively included by, e.g. OpenSim) there is a chance that different compilation units will compile different downstream code based on what their NDEBUG is set to (might be different from simbody's build).

    Example: In Linux, I was getting a segfault on a cache variable read from a not-debug part of StateImpl, probably because my downstream code--compiled in Debug mode--compiled assembly code that computes an incorrect offset into the StateImpl struct, because it inlined a function via OpenSim.

    That segfault disappears if I apply this patch, and I can then build opensim-creator in Debug mode against Release-mode binaries in Linux. The utility of this is that I'm using debug mode /w libasan to kick out harder-to-detect faults.

    I have read in other PRs, issues, etc. on both simbody and opensim-core that downstream projects must be compiled with the same optimization+debug levels. This should not be the case. It is perfectly normal to use a downstream debug binary with an upstream release library (think about graphics bindings, OS APIs, game engines, etc.).

    The only exception is maybe MSVC, which has some kind of iterator debug level macro in its standard library, which causes is to cry quite a bit if you mix up flags. I have only seen this in MSVC--specifically for iterators--and both OSX and Linux are usually ok with mixing debug levels.

    This patch makes StateImpl slightly bigger but, assuming empty containers cause no allocations, the overhead should be small compared to the rest of the datastructure. If there is genuinely a performance concern then I would recommend heap-allocating a DebugData struct behind a unique_ptr to put a cap (pointer size) on the overhead.


    This change is Reviewable

  • Compile error C2678 when building ALL_BUILD in Visual Studio

    Compile error C2678 when building ALL_BUILD in Visual Studio

    I encounter some problems when building the ALL_BUILD project in Visual Studio with following specifications:

    • Visual Studio 2022 17.2.5 (same problem on VS 2019)
    • MSVC v143 - VS 2022 C++-x64/x86-Buildtools
    • Building "RelWithDebugInfo" and x64 configuration

    I get some compiler error C2678 (build_log.txt), complaining about some conversion problems.

  • Elastic Foundation Force Computation Error

    Elastic Foundation Force Computation Error

    I have run into two distinct but related problems when running a forward dynamics simulation using Simbody’s Elastic Foundation Force to model contact between a falling brick (with a contact mesh) and a contact half space:

    1. Faces which should not be flagged as “in contact” are producing force
    2. The angle of the face is not accounted for in the force computation

    This simulation is unidirectional with the y-translation as the only unlocked degree of freedom. The properties of the brick are as follows:

    • 0.2 m x 0.2 m x 0.2 m
    • Mass = 500 kg
    • Rotated 30 degrees around the x-axis
    • COM = 2.2 m above the ground
    • Simple triangular mesh applied with two triangular meshes per face, totaling 12 triangles
    • Markers positioned at the centroid of each triangle (where the spring is placed)

    The half space was rotated by -π/2 radians and is coincident with the ground. The model file is provided in the folder. The motion file from the forward dynamics simulation is provided in the folder. A point kinematics analysis is performed on the markers and the net force of contact between the brick and the half space is reported. The analysis file is provided in the folder.

    The net force reported is the sum of all of the force contributions from each triangular mesh in contact with the half space. It appears that the faces with positive (Right 1 & 2 and Top 1 & 2) or no (Front 1 & 2 and Back 1 & 2 ) vertical surface normal components are contributing to the net force although they should not be in contact with the half space even when the brick appears to “pass through” the floor completely.

    I have generated a Python code (provided in the folder) to replicate Simbody’s ElasticFoundationForceImpl::processContact() function, which uses the position and velocity output files (provided in the folder) as well as a user-defined Excel file (provided in the folder) detailing the stiffness, dissipation coefficient, and area of each spring as well as the vector normal to the face of each triangular mesh and the initial height of the spring in the ground frame. When running the code, select all of the position files (12) followed by all of the velocity files (12). The python code closely matches the force table output from Simbody (provided in the folder), validating the python computation. By selecting a time point in which the block appears completely below the half space (e.g. t = 0.71241100 s), we can compute the force contribution from each spring individually. Two problems become apparent:

    • For this time point, all faces have a nonzero force contribution, but only “Bottom 1,” “Bottom 2,” “Left 1,” and “Left 2” should contribute as these faces have a negative vertical surface normal component
    • It appears that the force registered from each face is not componentized according to the 30-degree offset and instead is reported as the resultant force (normal to the contact half space).

    A proposed solution is to modify the code (provided in the folder) by creating a list (compression_state) formed by the dot product of the unit vectors normal to each mesh with the unit vector normal to the contact half space. The force on each spring is only computed if the compression_state < 0; if compression_state = 0, the contact surfaces are orthogonal (i.e. Front 1 & 2 and Back 1 & 2 ) and if compression_state>0, the block face should not come into contact with the half space (i.e. Right 1 & 2 and Top 1 & 2). This portion of the solution accounts for excluding the force contributions from the appropriate faces. To address the componentization of the force, f (defined in line 175 of the source code) should be multiplied by compression_state instead of forceDir as it is in line 176 in the source code. Since forceDir is a function of displacement and this is a unidirectional test case, the only nonzero forceDir component is in the y-direction, but since the block falls at an angle of 30 degrees rotated around the x-axis, the displacement of the springs on the bottom and left faces would occur in both the y- and z-directions. Thus, multiplying by compression_state should account for the componentization. Bug_Report.zip

A fast and lightweight 2D game physics library.
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

Dec 30, 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

Jan 6, 2023
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.

Jan 7, 2023
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

Jan 5, 2023
Real-time multi-physics simulation with an emphasis on medical simulation.
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

Dec 22, 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

Jun 6, 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

Dec 31, 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

Dec 8, 2022
✔️The smallest header-only GUI library(4 KLOC) for all platforms
✔️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

Jan 8, 2023
Improved version of real-time physics engine that couples FEM-based deformables and rigid body dynamics
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

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

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

Dec 31, 2022
An Alice-like 35% 3d printed mechanical keyboard using ItsyBitsy dev boards
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

Dec 17, 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

Dec 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

Dec 14, 2022
Public Code Repository of the iRotate Active SLAM for Omnidirectional robots at the Max Planck Institute for Intelligent Systems, Tübingen
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

Nov 25, 2022
Efficient Differentiable Simulation of Articulated Bodies (ICML2021)
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

Dec 15, 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 This is the official C++ source code repository of the Bullet Physics SDK: real-time collision detection and multi-physics simulati

Jan 7, 2023
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: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Jan 7, 2023
This code accompanies the paper "Human-Level Performance in No-Press Diplomacy via Equilibrium Search".
This code accompanies the paper

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

Dec 20, 2022
This is a single-header, multithreaded C++ library for simulating the effect of hydraulic erosion on height maps.
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

Aug 4, 2022