Adding ligaments using C++
Posted: Thu Aug 23, 2018 10:38 am
Hello
I am kind off new to OpenSim API development and currently I am writing a code on developing a model with ligament. I have tried to modify the code for mainFatigue.cpp and would like to add ligaments into the model (tugofwar). The problem I am facing right now is that when I am trying to input the ligament (set1) as a pointer to the function MyModel.addForce(set1), it is not being reflected to my osim model after running the code. Is there any other way to define ligaments in the model? I get this that set1 has to be a pointer of OpenSim::Force type. How do I assign a pointer of ligament class into force class? Here is a part of the code.
GeometryPath a1;
a1.appendNewPathPoint("P1", ground, Vec3(0.0, halfLength, 0.35));
a1.appendNewPathPoint("P2", *block,Vec3(0.0, halfLength, halfLength));
Ligament *original;
original->setRestingLength (RestingLength);
original->setName("Original");
original->setsetMaxIsometricForce(p_force);
original->setForceLengthCurve(ForceLengthCurve);
original->set_GeometryPath(a1); // I have also tried using getGeometryPath to access appendNewPathPoint but it isn't working
MyModel.addForce(original);
MyModel.print("tugOfWar_Ligament_model.osim");
Kindly help me in this regard.
Thank you
Regards
Arnab
I am kind off new to OpenSim API development and currently I am writing a code on developing a model with ligament. I have tried to modify the code for mainFatigue.cpp and would like to add ligaments into the model (tugofwar). The problem I am facing right now is that when I am trying to input the ligament (set1) as a pointer to the function MyModel.addForce(set1), it is not being reflected to my osim model after running the code. Is there any other way to define ligaments in the model? I get this that set1 has to be a pointer of OpenSim::Force type. How do I assign a pointer of ligament class into force class? Here is a part of the code.
GeometryPath a1;
a1.appendNewPathPoint("P1", ground, Vec3(0.0, halfLength, 0.35));
a1.appendNewPathPoint("P2", *block,Vec3(0.0, halfLength, halfLength));
Ligament *original;
original->setRestingLength (RestingLength);
original->setName("Original");
original->setsetMaxIsometricForce(p_force);
original->setForceLengthCurve(ForceLengthCurve);
original->set_GeometryPath(a1); // I have also tried using getGeometryPath to access appendNewPathPoint but it isn't working
MyModel.addForce(original);
MyModel.print("tugOfWar_Ligament_model.osim");
Kindly help me in this regard.
Thank you
Regards
Arnab