RealTimeBiomechanics / rtosim

The real-time OpenSim extension (RTOSIM) is a set of libraries in C++ that wrap OpenSim APIs to enable the real-time computation of inverse kinematics and inverse dynamics.
Apache License 2.0
33 stars 14 forks source link

RTOSIM

RTOSIM is a set of efficient and extensible C++ libraries to connect OpenSim with different devices. RTOSIM can use data provided by motion capture systems to solve OpenSim inverse kinematics and inverse dynamics on a frame-by-frame basis. Multiple threads operate concurrently to remove idle times due to communications with input and output devices, and the data flow is automatically managed by RTOSIM in order to preserve data integrity and avoid race conditions.

Read more about RTOSIM at the RTOSIM project page

Dependencies

RTOSIM depends on the following

The latest version of RTOSIM works with OpenSim 4.3. The superbuild of OpenSim will install Simbody and other requirements automatically.
For earlier versions of OpenSim you can use earlier editions of RTOSIM.

Install

RTOSIM works on Windows, Mac, and Linux.

Build

  1. Get and compile Simbody. IMPORTANT: if you want to use multiple threads to solve the Inverse Kinematics it is necessary to first patch Simbody.
  2. Get and compile OpenSim
  3. Get and compile Concurrency
  4. Get and compile Filter
  5. If you want to enable the real-time stream from Vicon Nexus you need to download and install Vicon DataStream SDK
    • Add the environmental variable VICONDATASTREAM_INSTALL_DIR that points to the installation directory of the Vicon DataStream SDK (must contain the file Client.h), as example c:\Program Files (x86)\Vicon\DataStream SDK\Win32\CPP
  6. Build your project using CMake.
  7. Explore how to use RTOSIM APIs in your project using the provided examples

Patch Simbody

If you want to use multiple threads to solve the OpenSim inverse kinematics using IpOpt as optimisation algorithm (which is the default algorithm for constrained optimisations in OpenSim), you need to patch Simbody first. To do this, get the files IpLapackSolverInterface.cpp and IpLapackSolverInterface.hpp and use them to replace the corresponding files in your Simbody distribution in the directory SimTKmath/Optimizers/src/IpOpt. Then, compile and install Simbody.

Adapt the software for your gait laboratory

The representation of force plates moments in the version of Vicon Nexus used to test RTOSIM is not what you may expect. To have the correct representation of joint moments in the global reference system of the gait laboratory is necessary to perform a further transformation. This requires to know the position of the force plates. You can get this by opening Vicon Nexus, clicking on your force plate -> Show Advanced -> Position. Currently, these values are harcoded in RTOSIM for the Griffith University gait laboratory. However, what you have to do to adapt it to your lab is to modify the function DataFromNexus::getForcePlatePosition() const with your force plates position. IMPORTANT: the position of the force plates must be consistent with the rotation used in the function DataFromNexus::setAxisMapping(VDS::Client& client) const. You need to provide the position of the force plate already rotated.

Licensing

Please see the file called LICENSE.txt.

Copyright (c) 2010-2016 C. Pizzolato, M. Reggiani

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contacts

Claudio Pizzolato c.pizzolato@griffith.edu.au

Publications

If you are using rtosim or part of it please cite:

C. Pizzolato, M. Reggiani, L. Modenese & D. G. Lloyd (2016): Real-time inverse kinematics and inverse dynamics for lower limb applications using OpenSim, Computer Methods in Biomechanics and Biomedical Engineering, DOI: 10.1080/10255842.2016.1240789 To link to this article: http://dx.doi.org/10.1080/10255842.2016.1240789

Acknowledgments