get contact force vector during C++ runtime

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

get contact force vector during C++ runtime

Post by Hide Kimpara » Mon Jun 03, 2019 11:49 pm

Dear Experts,

I have a question about getting method of contact force data through C++ OpenSim API.

I used something like:

Code: Select all

osimModel.realizeAcceleration(si);
auto vals = osimModel.getForceSet().get(ContactForceName).getRecordValues(si);
However, obtained values show always zero even the contact force happens. Alternatively, I monitor force data from forcestorage in current. But, I'm willing to get contact force from runtime variables.

What kind of methods is lacked in my process?

Thank you,
Hide

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: get contact force vector during C++ runtime

Post by Dimitar Stanev » Thu Jun 06, 2019 12:20 am

I think the calculation of forces requires realization to dynamics stage. Can you verify that the contact is working properly (e.g.,in the GUI)? You may also find the following example code from Simbody:

https://github.com/simbody/simbody/blob ... ground.cpp

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

Re: get contact force vector during C++ runtime

Post by Hide Kimpara » Thu Jun 06, 2019 3:35 am

Hi Dimitar!
Thank you for your response. Yes, I made a double check with both of GUI and ForceReporter outputs. I changed realization from acceleration to dynamics stage, but get force does not give me any outputs.
I remember you used generalized force data for task space control. How did you monitor force data during C++ run-time?
Thank you, Hide

POST REPLY