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!
"
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