Page 1 of 1

printing model to xml file in cpp error

Posted: Tue Dec 19, 2017 8:48 am
by nbeji89
I am having trouble with the OpenSim::Object::print function in the opensim api for cpp.

I have a project for forward dynamic simulation of a lower extremity standing model in which i have modified the feet to add contact spheres using hunt crossley. When i try to export the modified model to an xml file by using the command osimModel.print("NewModel.osim") the code compiles but crashes while running.

When i look at the NewModel.osim file, it is incomplete which led me to believe that the aforementioned command was crashing it. In addition, when I commented out that line, the program compiled and ran without crashing. I've also tried commenting out the code for the modifications to the model and just tried to export the same model but it still crashes.

When I ran the same project on someone else's computer, the print function did not crash on there, so that leads me to believe that the code is correct, but there is an issue with my computer or build.

I tried performing a fresh install of OpenSim33-source but that did not resolve the issue.

Has anybody come across this issue or possibly no the reason behind it or a solution to the problem.

Thank You,
Naji Alibeji

Re: printing model to xml file in cpp error

Posted: Tue Dec 19, 2017 10:24 am
by tkuchida
I've also tried commenting out the code for the modifications to the model and just tried to export the same model but it still crashes.
To rule out an issue with the model, you could try printing one of the models that is packaged with OpenSim. You should also ensure that you have write access to the destination folder.

Re: printing model to xml file in cpp error

Posted: Tue Dec 19, 2017 12:09 pm
by nbeji89
Thank You for your reply.

Sorry I left out this detail, but I have tried this with a different model and project all together (not the ones packaged with opensim), and it did work. But the same model that It is giving me trouble with, worked on the other computer. So I do not believe it is an issue with the model file that I am using. However, I was moving around were I write the print command, and I've determined that if it is before a certain part of the code, the error does not occur.

This part that seems to be causing the error is osimModel.addForce(ueact_r) which is adding a force based on a custom actuator that we added to a body. The thing that is still puzzling me is that this did not cause any issues on the other computer.