Using matlab it works correctly:
Code: Select all
model = Model("model.osim");
state = model.initSystem();
model.realizePosition(state);
force_position_vector = [0, 0, 0];
simbody_position_vector = Vec3.createFromMat(force_position_vector);
simbody_jacobian = Matrix();
smss = model.getMatterSubsystem();
smss.calcStationJacobian(state, 4, simbody_position_vector, simbody_jacobian);
jacob = simbody_jacobian.getAsMat; % correct output
Code: Select all
Model* model = new Model("model.osim");
State& state = model->initSystem();
model->realizePosition(state);
SimbodyMatterSubsystem smss = model->getMatterSubsystem();
Matrix JS;
smss.calcStationJacobian(state, MobilizedBodyIndex(4), Vec3(0), JS); // exception (Access violation reading location 0x0000000000000000.)
The model is loaded correctly, since model->printBasicInfo(); prints the correct number of joints (4) and bodies (4).
If I loop through the body set (model->getBodySet()) I can print the bodies names, but if I try to access their mobilizedbody another excpetion is thrown.
If I loop through the joint set, I can print the joints names but I can't access their child frames (joints.getChildFrame()) without raising another exception.
state.getNQ() and state.getNU() return the correct number.
model->getNumBodies(); returns the correct number of bodies
smss->getNumBodies(); returns 0, as if the model was not initialized correctly