Zero-gravity environment in OpenSim

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Hide Kimpara
Posts: 135
Joined: Mon Sep 19, 2016 5:12 am

Zero-gravity environment in OpenSim

Post by Hide Kimpara » Mon Jun 01, 2020 8:53 am

Hello,

I tried to make a zero-gravity environment with OpenSim 4.1. Previously, I set Vec3(0) into osimModel.setGravity(), however, I always received some errors from SimBody. So that, I gave a small gravity such as 0.01 m/s^2 in Y-axis with OpenSim 4.1. However, I received sometimes an error as following:
RuntimeError: std::exception in 'SimTK::State & OpenSim::Model::initSystem()': SimTK Exception thrown at Force_Gravity.cpp:225:
Error detected by Simbody method Force::Gravity::Gravity(downDirection,magnitude): A non-finite 'down' direction was received; did you specify a zero-length Vec3? The direction must be non-zero.
(Required condition 'defDirection.isFinite()' was not met.)
Is it possible to express zero-gravity environment in OpenSim 4.1? Or is there any ideas to mimic that with small gravity acceleration values? In some cases, 0.01 works for me. However, 0.01 still did not work with other cases. I could not expect what conditions make the issue of non-zero direction vector. If someone knows this issue, could you share your previous experience or solutions?

Thank you,
Hide

Tags:

User avatar
Ayman Habib
Posts: 2239
Joined: Fri Apr 01, 2005 12:24 pm

Re: Zero-gravity environment in OpenSim

Post by Ayman Habib » Mon Jun 01, 2020 9:35 am

Hello Hide,

Gravity has a a direction and magnitude, according to the code snippet here
https://github.com/opensim-org/opensim- ... l.cpp#L585
from this code, it looks like you can create a zero gravity environment by specifying exactly 0 0 0 in the gravity property of the model

Code: Select all

<gravity>0 0 0</gravity>
rather than trying to use a small number that gets renormalized anyway downstream.

Please let us know how it goes,
-Ayman

User avatar
Hide Kimpara
Posts: 135
Joined: Mon Sep 19, 2016 5:12 am

Re: Zero-gravity environment in OpenSim

Post by Hide Kimpara » Sat Jun 06, 2020 8:37 am

Hello Ayman,

Thank you for your suggestion. It works for me!!

Hide

POST REPLY