How to update the model in Matlab after changing the path point reference <body>?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Hilary Cheng
Posts: 12
Joined: Thu Oct 04, 2018 9:10 pm

How to update the model in Matlab after changing the path point reference <body>?

Post by Hilary Cheng » Wed Jan 16, 2019 3:36 am

Hi,

In Opensim platform, we can edit the attachment frame and the path points would change automatically.
(As shown in this link -> https://simtk-confluence.stanford.edu/d ... mentPoints)

I can successfully change the attachment frame in Matlab by code: osimModel.getMuscles().get(0).getGeometryPath().getCurrentPath(state).getitem(0).setBody(body_0)

Scripting with the 'getLocation' function only shows the original(not updated) path point.
osimModel.getMuscles().get(0).getGeometryPath().getCurrentPath(state).getitem(0).getLocation(state)

So how can I retrieve the updated path points in Matlab?

I have tried adding the following code for updating sake, but it still doesnt work
osimModel.equilibrateMuscles(state);

Thanks so much for helping!

Regards,
Hilary

Tags:

User avatar
Hilary Cheng
Posts: 12
Joined: Thu Oct 04, 2018 9:10 pm

Re: How to update the model in Matlab after changing the path point reference <body>?

Post by Hilary Cheng » Wed Jan 16, 2019 7:12 am

Problem solved.

The following code might help!
changeBodyPreserveLocation (const SimTK::State &s, const PhysicalFrame &body)

Thanks! =)

POST REPLY