OpenSim vs. Matlab -> different simulation results

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Endale Schilling
Posts: 2
Joined: Thu Sep 29, 2022 12:09 pm

OpenSim vs. Matlab -> different simulation results

Post by Endale Schilling » Mon Jan 30, 2023 12:53 am

Dear OpenSim Community,

I have modeled a double inverse pendulum with ankle and hip joint and designed a PD controller for it similar to the Cpp ControllerExample_Solution.cpp for the TugOfWar model in Matlab. It all works so far, but I'm facing an issue - when I compare the angle of my hip joint from motionData (of the IntegrateOpenSimPlant-function) to the data measured in Matlab (I saved angle and angular velocity at each time step in an array), I'm getting different plots. This is strange, as the data and plot of OP and Matlab match up perfectly for the ankle joint. I've included the model and plot in the attached images. Additionally, I noticed that the initial angle for the hip in motionData was 0 degrees, even though I set it to 15 degrees. This is visible in the Matlab plot.
Can anyone provide me with a hint as to why this is happening? Could it be related to my sampling time (1E-3 s)?

I would be extremely appreciative if someone could offer any advice.
Thank you,
Endale
Attachments
doubleInvPendulum.JPG
doubleInvPendulum.JPG (92.2 KiB) Viewed 258 times
differentPlots.JPG
differentPlots.JPG (95.35 KiB) Viewed 258 times

Tags:

User avatar
Nicholas Bianco
Posts: 1050
Joined: Thu Oct 04, 2012 8:09 pm

Re: OpenSim vs. Matlab -> different simulation results

Post by Nicholas Bianco » Mon Feb 06, 2023 12:47 pm

Hi Endale,

I'm a little confused by the following:
when I compare the angle of my hip joint from motionData (of the IntegrateOpenSimPlant-function) to the data measured in Matlab (I saved angle and angular velocity at each time step in an array)
Are you running two different simulations in Matlab/OpenSim that you can't get to line up, or are you recording results from the same simulation that are not consistent? Is "motionData" just the output of IntegrateOpenSimPlant? How are you "measuring" the data in Matlab (i.e., are you calculating angles from the model directly)?

Best,
Nick

POST REPLY