Giter Site home page Giter Site logo

mitkof6 / opensimrt Goto Github PK

View Code? Open in Web Editor NEW
59.0 5.0 17.0 160.51 MB

Real-time musculoskeletal kinematics and dynamics analysis using marker- and IMU-based solutions

License: GNU General Public License v3.0

CMake 2.12% C++ 88.37% C 0.47% Python 8.89% Shell 0.16%

opensimrt's Introduction

CI

OpenSimRT

Real-Time Musculoskeletal Kinematics and Dynamics Analysis Using Marker- and IMU-Based Solutions in Rehabilitation

Demo video

This project aims to explore the possibility of estimating a multitude of kinematic and dynamic quantities using subject-specific musculoskeletal models in real-time. The framework was designed to operate with marker-based and inertial measurement units enabling extensions far beyond dedicated motion capture laboratories. An overview of how different modules can be linked-to calculate the joint reaction loads is presented below:

pipeline

The basic operations presented in the above figure were re-implemented in a manner that enables us to call them iteratively so that information can be processed frame-by-frame. Emphasis was given that each algorithm is implemented in a simple manner. Tests were performed to ensure that online and offline results agree. We have used this pipeline to provide real-time biofeedback during gait retraining to reduce the loading of the knee:

visualization_front_end

gait_retraining

Relative projects:

Organization

The project is organized into sub-modules. Each sub-module contains the code, tests, and applications. Experimental algorithms (need further improvement) are placed into the experimental folder within a module. In the test files, we perform unit tests of each sub-component. There you can find more information on how to use the different tools developed. For example, if you are interested in performing inverse kinematics with IMU, you can check /OpenSimRT/IMU/tests/TestLowerLimbIKFromFile.cpp. The organization is as follows:

  • OpenSimRT/Common: a module containing common utilities such as circular buffer, dynamic library loader, exceptions, serialization, real-time filters, visualization, sensor synchronization manager, and other useful functions.
  • OpenSimRT/IMU: a data synchronization interface NGIMU sensors, unit tests, and applications that demonstrate how to stream data and perform inverse kinematics.
  • OpenSim/RealTime: contains the developed algorithms for performing real-time calculations. That includes inverse kinematics, inverse dynamics, muscle optimization, joint reaction analysis, and ground reaction forces prediction. You can find the tests folder very useful to understand how one can use individual modules. In the applications you will find an example that links multiple modules together.
  • OpenSim/Vicon': an interface with Vicon data streamer.

The data folder contains OpenSim models (upper and lower limb) and files used to test the developed algorithm. It also contains a setup.ini file with the settings of the algorithms during testing. Each model (e.g., gait1992) is organized into sub-folders with specific name conventions to automate migration to different models. For example, experimental data are placed into the experimental_data folder. Results from offline OpenSim analyses are placed into scale, inverse_kinematics, inverse_dynamics, residual_reduction_algorithm, static_optimziation, computed_muscle_control. The real_time folder contains results from the tests of different sub-modules. The scripts sub-folder contains automatic Python scripts that compare real-time and offline results and generate files into the corresponding folders. Finally, real_time/moment_arm contains Python auto-generated C++ code for calculating the moment arm matrix (pre-computed symbolic representation) that is linked on runtime depending on the model being used.

Dependencies

This project depends on several libraries:

For more information on how to build and set up these dependencies, please look at the continuous integration script (.github/workflows/) and the dependencies folder. To run the tests and examples that use files as inputs instead of streams, you will only need opensim-core.

Acknowledgments

This work was supported by the EC Horizon 2020 project OACTIVE: Advanced personalized, multi-scale computer models preventing osteoarthritis, Grant Agreement No. 777159 (OActive). This project was developed in the Visualization and Virtual Reality Group, University of Patras, Greece.

If you find this useful you can acknowledge it as follows:

@Article{s21051804,
AUTHOR = {Stanev, Dimitar and Filip, Konstantinos and Bitzas, Dimitrios and Zouras, Sokratis and Giarmatzis, Georgios and Tsaopoulos, Dimitrios and Moustakas, Konstantinos},
TITLE = {Real-Time Musculoskeletal Kinematics and Dynamics Analysis Using Marker- and IMU-Based Solutions in Rehabilitation},
JOURNAL = {Sensors},
VOLUME = {21},
YEAR = {2021},
NUMBER = {5},
ARTICLE-NUMBER = {1804},
URL = {https://www.mdpi.com/1424-8220/21/5/1804},
ISSN = {1424-8220},
ABSTRACT = {This study aims to explore the possibility of estimating a multitude of kinematic and dynamic quantities using subject-specific musculoskeletal models in real-time. The framework was designed to operate with marker-based and inertial measurement units enabling extensions far beyond dedicated motion capture laboratories. We present the technical details for calculating the kinematics, generalized forces, muscle forces, joint reaction loads, and predicting ground reaction wrenches during walking. Emphasis was given to reduce computational latency while maintaining accuracy as compared to the offline counterpart. Notably, we highlight the influence of adequate filtering and differentiation under noisy conditions and its importance for consequent dynamic calculations. Real-time estimates of the joint moments, muscle forces, and reaction loads closely resemble OpenSim’s offline analyses. Model-based estimation of ground reaction wrenches demonstrates that even a small error can negatively affect other estimated quantities. An application of the developed system is demonstrated in the context of rehabilitation and gait retraining. We expect that such a system will find numerous applications in laboratory settings and outdoor conditions with the advent of predicting or sensing environment interactions. Therefore, we hope that this open-source framework will be a significant milestone for solving this grand challenge.},
DOI = {10.3390/s21051804}
}

opensimrt's People

Contributors

filipcon avatar mitkof6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

opensimrt's Issues

build error:opensim library link error

[build] E:/OpenSim 4.2/sdk/include/OpenSim/Common/Component.h:2546: undefined reference to __imp__ZN7OpenSim9ExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_i' [build] CMakeFiles\Common.dir/objects.a(Visualization.cpp.obj): In function OpenSim::PhysicalOffsetFrame const* OpenSim::Component::findComponentOpenSim::PhysicalOffsetFrame(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) const':
[build] E:/OpenSim 4.2/sdk/include/OpenSim/Common/Component.h:2557: undefined reference to `__imp__ZN7OpenSim13ComponentPathC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
[build] collect2.exe: error: ld returned 1 exit status
[build] mingw32-make.exe[2]: *** [OpenSimRT\Common\CMakeFiles\Common.dir\build.make:164: libCommon.dll] Error 1
[build] mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:932: OpenSimRT/Common/CMakeFiles/Common.dir/all] Error 2
[build] mingw32-make.exe: *** [Makefile:165: all] Error 2
The above is the error I encountered in VScode software, I have completed the configuration part, in the generation of only loaded to 11%, then appeared similar to the "undefined reference to" problem! Looking forward to someone who can help me out, I'd appreciate it.

The reanspose/inverse of rotation matrix

Dear developer:

Thank you for your work and your sharing firstly! I have tried this program in order to calculate the inverse kinematics data instantly. However I have found that the result is not so resonable until I canceled the transpose of the rotation matrix in IMUcalibrator.cpp (Line 96 and Line 142) and IMUcalibrator.h (Line 110). Then I wonder if I just got the correct result by accident while the real calculation process is not right. So I want to ask why the rotation matrix should be transposed (which means inverse in the code, I think). Thank you so much for your attention!

BTW: the IMU data I uesd is exported from Xsens

Chiho Ng

Unable to compile TestAccelerationGRFMPredictionFromFIle.cpp

When building TestAccelerationGRFMPredictionFromFIle.cpp in visual studio code I am getting a cmake error which is as followsL:

[cmake] CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
[cmake] Please set them or make sure they are set and tested correctly in the CMake files:
[cmake] oscpack
[cmake] linked by target "IMU" in directory C:/Users/Chris/OneDrive/Desktop/OpenSimRT-master/OpenSimRT/IMU
[cmake] linked by target "TestLowerLimbIMUIKFromFile" in directory C:/Users/Chris/OneDrive/Desktop/OpenSimRT-master/OpenSimRT/IMU
[cmake] linked by target "TestUpperLimbIMUIKFromFile" in directory C:/Users/Chris/OneDrive/Desktop/OpenSimRT-master/OpenSimRT/IMU
[cmake] linked by target "OnlineLowerLimbIMUIK" in directory C:/Users/Chris/OneDrive/Desktop/OpenSimRT-master/OpenSimRT/IMU
[cmake] linked by target "OnlineUpperLimbIMUIK" in directory C:/Users/Chris/OneDrive/Desktop/OpenSimRT-master/OpenSimRT/IMU
[cmake]
[cmake] -- Generating done
[cmake] CMake Generate step failed. Build files cannot be regenerated correctly.

Not sure what to do from here

Some tests fail on Windows but not on Linux

The following tests fail on Windows but not on Linux:

TestSOFromFile
TestContactForceGRFMPredictionFromFile
TestAccelerationGRFMPredictionFromFile

Maybe it is a floating-point precision issue when results are compared with the files.

Simbody crashing during visualization

When trying to run ./TestLowerLimbIMUIKFromFile from a Docker instance under Windows 10 using Xming, sometimes the program just finishes silently.

It took quite some time to track this down and I believe it is an old bug from Simbody (see simbody/simbody#563), not this code, which is why I described it there (simbody/simbody#563 (comment)). I can replicate if I add the line signal(SIGPIPE, SIG_IGN); to the file or run ./TestLowerLimbIMUIKFromFile using debug.

But I am not sure where the bug is, or even if it is exactly the same one. Note that the crashing does not happen all the time and that ./TestUpperLimbIMUIKFromFile always works.

Please tell me if you need any more information about replicating this.

License

Any reason to use GPL license as opposed to OpenSim style license (MIT, BSD etc.)? This may be a problem if we decide to integrate bits and pieces into OpenSim.

Demo video link does not open correctly.

I've tried to open the demo file from the link button provided in README, but it does not seem to open correctly. The video link is valid however, as I tried to copy/paste it in a new tab. I've tested it in Mozilla Firefox and Brave browser.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.