Error in VisualizerProtocol opensim API in matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Sadanand Modak
Posts: 1
Joined: Sat Jan 01, 2022 11:24 pm

Error in VisualizerProtocol opensim API in matlab

Post by Sadanand Modak » Wed Jan 19, 2022 1:45 am

Hi everyone,

I am on a windows machine and am using the opensim 4.2 api in matlab R2021b.
I have been really trying very hard to resolve one error that I am facing, but haven't been able to yet. When I run such a basic code (see below) in Matlab:

Code: Select all

import org.opensim.modeling.*;
model = Model();
model.setName('leg');
model.setUseVisualizer(true);
state = model.initSystem();
viz = model.updVisualizer().updSimbodyVisualizer();
viz.setGroundHeight(-1.0);  % this is causing error!
due to the last statement, the following error pops up:
"
Java exception occurred:
java.lang.RuntimeException: SimTK Exception thrown at VisualizerProtocol.cpp:848:
Error detected by Simbody method VisualizerProtocol: An attempt to write() 1 bytes to pipe 20 failed with errno=22 (Invalid argument).
(Required condition 'status!=-1' was not met.)

at org.opensim.modeling.opensimSimbodyJNI.SimTKVisualizer_setGroundHeight(Native Method)
at org.opensim.modeling.SimTKVisualizer.setGroundHeight(SimTKVisualizer.java:99)
"
Note that the simTKvisualizer object viz is getting created successfully in the second last statement.

Please help in this regard. I would be very grateful if someone knows how to solve this error.

Thanks.
Sadanand

Tags:

POST REPLY