usage of ConditionalPathPoint

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Pengfei Liu
Posts: 15
Joined: Tue Sep 20, 2022 8:15 am

usage of ConditionalPathPoint

Post by Pengfei Liu » Thu Apr 25, 2024 1:56 am

does anyone knows how to use ConditionalPathPoint to build muscle?i 'm stucked at its property of connectSocket_coordinate().

Tags:

User avatar
Thomas Uchida
Posts: 1763
Joined: Wed May 16, 2012 11:40 am

Re: usage of ConditionalPathPoint

Post by Thomas Uchida » Thu Apr 25, 2024 4:33 pm

Based on the doxygen documentation (https://simtk.org/api_docs/opensim/api_ ... 13a8fa369b), the ConditionalPathPoint::connectSocket_coordinate() method would be called by passing in a reference to the coordinate, something like this:

Code: Select all

model = osim.Model('modelFilename.osim');
state = model.initSystem();
coord = model.getCoordinateSet().get(5);
// ...
myConditionalPathPoint.connectSocket_coordinate(coord);

User avatar
Pengfei Liu
Posts: 15
Joined: Tue Sep 20, 2022 8:15 am

Re: usage of ConditionalPathPoint

Post by Pengfei Liu » Fri Apr 26, 2024 12:08 am

am i corrcet in using ConditionalPathPoint::connectSocket_coordinate() method? and what should i do to add the conditionnal pathpoint to the pathpointset of the muscle?

//...
transformaxisZR = TransformAxis();
transformaxisZR.setName('transformaxisZR');
transformaxisZR.setAxis(Vec3(0.049400012358,0.0366,0.998108249695));
transformaxisZR.set_coordinates(0,'elbow_flextion');
transformaxisZR.set_function(LinearFunction(1,0));
spatialTrans = SpatialTransform();
spatialTrans.set_rotation1(transformaxisZR);
elbow = CustomJoint('elbow',humerus,Vec3(0.0061,-0.2904,-0.0123),Vec3(0,0,0),ulna,Vec3(0,0,0),Vec3(0,0,0),spatialTrans);
osimModel.addJoint(elbow);
elbowrot = elbow.updCoordinate(0);
elbowrot.setRange([0,2.268928027593]);
elbowrot.setDefaultValue(deg2rad(90));
coord = osimModel.getCoordinateSet().get(0);~~~~~~~~~~~~~~~~~~~~~~~% get a reference
//...
BIClong.addNewPathPoint('BIClong_point7', humerus, Vec3(0.0228,-0.1754,-0.0063));
BIClong.addNewPathPoint('BIClong_point8', radius, Vec3(-0.002,-0.0375,-0.002));
BIClong_point9 = ConditionalPathPoint();
BIClong_point9.setName('BIClong_point9');
BIClong_point9.connectSocket_coordinate(coord);~~~~~~~~~~~~~~~~~~~%pass the reference
BIClong_point9.setRangeMax(1.570796326795);
BIClong_point9.setRangeMin(-0.63879050623);

//...

User avatar
Thomas Uchida
Posts: 1763
Joined: Wed May 16, 2012 11:40 am

Re: usage of ConditionalPathPoint

Post by Thomas Uchida » Sat Apr 27, 2024 3:39 am

what should i do to add the conditionnal pathpoint to the pathpointset of the muscle?
I think it would be something like this:

Code: Select all

BIClong.updGeometryPath().updPathPointSet().cloneAndAppend(BIClong_point9);
I've used upd... methods here but the get... versions should work equally well in Matlab.

User avatar
Pengfei Liu
Posts: 15
Joined: Tue Sep 20, 2022 8:15 am

Re: usage of ConditionalPathPoint

Post by Pengfei Liu » Sun Apr 28, 2024 12:54 am

i used get...method before, and it had same error with upd...method.
and do you know how to solve this problem?
Error Create_Complex_muscle
Java exception occurred:
java.io.IOException: Failed to connect Socket 'coordinate' of type Coordinate(details: Connectee for Socket 'coordinate' of type Coordinate in ConditionalPathPoint at /forceset/BIClong/geometrypath/BIClong_point9 is unspecified. If this model was built programmatically, perhaps finalizeConnections() was not called before printing. Thrown at Component.h:3383 in finalizeConnection().).
In Object 'BIClong_point9' of type ConditionalPathPoint.
Thrown at Component.cpp:313 in finalizeConnections().
at org.opensim.modeling.opensimSimulationJNI.Model_initSystem(Native Method)
at org.opensim.modeling.Model.initSystem(Model.java:984)

POST REPLY