Custom Joint

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
dani mendez
Posts: 24
Joined: Tue Aug 07, 2018 1:40 am

Custom Joint

Post by dani mendez » Tue Jul 23, 2019 10:25 am

Hello, I have defined 1 personalized articulation between the blue plate and the humerus, and between the yellow plate and the ulna bone. The problem is that when defining a new articulation between the yellow and blue plates, the following error message appears, and the model is not loaded.
ejemplo.png
ejemplo.png (158.57 KiB) Viewed 428 times
error.png
error.png (36.55 KiB) Viewed 428 times
Someone comes up with how can I solve the error?

The code used to create the new custom joint is as follows:

<CustomJoint name="placa_r_humerus_y_placa_r_ulna">
<!--Path to a Component that satisfies the Socket 'parent_frame' of type PhysicalFrame (description: The parent frame for the joint.).-->
<socket_parent_frame>placa_ulna_offset</socket_parent_frame>
<!--Path to a Component that satisfies the Socket 'child_frame' of type PhysicalFrame (description: The child frame for the joint.).-->
<socket_child_frame>placa_humerus_offset</socket_child_frame>
<!--List containing the generalized coordinates (q's) that parameterize this joint.-->
<coordinates>
<Coordinate name="placas">
<!--The value of this coordinate before any value has been set. Rotational coordinate value is in radians and Translational in meters.-->
<default_value>0</default_value>
<!--The minimum and maximum values that the coordinate can range between. Rotational coordinate range in radians and Translational in meters.-->
<range>-3.6 3.6</range>
<!--Flag indicating whether or not the values of the coordinates should be limited to the range, above.-->
<clamped>false</clamped>
<!--Flag indicating whether or not the values of the coordinates should be constrained to the current (e.g. default) value, above.-->
<locked>false</locked>
<!--Flag indicating whether or not the values of the coordinates should be prescribed according to the function above. It is ignored if the no prescribed function is specified.-->
<prescribed>false</prescribed>
</Coordinate>
</coordinates>
<!--Physical offset frames owned by the Joint that are typically used to satisfy the owning Joint's parent and child frame connections (sockets). PhysicalOffsetFrames are often used to describe the fixed transformation from a Body's origin to another location of interest on the Body (e.g., the joint center). When the joint is deleted, so are the PhysicalOffsetFrame components in this list.-->
<frames>
<PhysicalOffsetFrame name="placa_ulna_offset">
<!--The geometry used to display the axes of this Frame.-->
<FrameGeometry name="frame_geometry">
<!--Path to a Component that satisfies the Socket 'frame' of type Frame.-->
<socket_frame>..</socket_frame>
<!--Scale factors in X, Y, Z directions respectively.-->
<scale_factors>0.20000000000000001 0.20000000000000001 0.20000000000000001</scale_factors>
</FrameGeometry>
<!--Path to a Component that satisfies the Socket 'parent' of type C (description: The parent frame to this frame.).-->
<socket_parent>/bodyset/placa_ulna_r</socket_parent>
<!--Translational offset (in meters) of this frame's origin from the parent frame's origin, expressed in the parent frame.-->
<translation>0 0 0</translation>
<!--Orientation offset (in radians) of this frame in its parent frame, expressed as a frame-fixed x-y-z rotation sequence.-->
<orientation>0 0 0</orientation>
</PhysicalOffsetFrame>
<PhysicalOffsetFrame name="placa_humerus_offset">
<!--The geometry used to display the axes of this Frame.-->
<FrameGeometry name="frame_geometry">
<!--Path to a Component that satisfies the Socket 'frame' of type Frame.-->
<socket_frame>..</socket_frame>
<!--Scale factors in X, Y, Z directions respectively.-->
<scale_factors>0.20000000000000001 0.20000000000000001 0.20000000000000001</scale_factors>
</FrameGeometry>
<!--Path to a Component that satisfies the Socket 'parent' of type C (description: The parent frame to this frame.).-->
<socket_parent>/bodyset/placa__r</socket_parent>
<!--Translational offset (in meters) of this frame's origin from the parent frame's origin, expressed in the parent frame.-->
<translation>0 0 0</translation>
<!--Orientation offset (in radians) of this frame in its parent frame, expressed as a frame-fixed x-y-z rotation sequence.-->
<orientation>0 0 0</orientation>
</PhysicalOffsetFrame>
</frames>
<!--Defines how the child body moves with respect to the parent as a function of the generalized coordinates.-->
<SpatialTransform>
<!--3 Axes for rotations are listed first.-->
<TransformAxis name="rotation1">
<!--Rotation or translation axis for the transform.-->
<axis>0 1 0</axis>
<!--Transform function of the generalized coordinates used to represent the amount of displacement along a specified axis.-->
<Constant name="function">
<value>0</value>
</Constant>
</TransformAxis>
<TransformAxis name="rotation2">
<!--Names of the coordinates that serve as the independent variables of the transform function.-->
<coordinates>placas</coordinates>
<!--Rotation or translation axis for the transform.-->
<axis>1 0 0</axis>
<!--Transform function of the generalized coordinates used to represent the amount of displacement along a specified axis.-->
<LinearFunction name="function">
<coefficients> 1 0</coefficients>
</LinearFunction>
</TransformAxis>
<TransformAxis name="rotation3">
<!--Rotation or translation axis for the transform.-->
<axis>0 0 1</axis>
<!--Transform function of the generalized coordinates used to represent the amount of displacement along a specified axis.-->
<Constant name="function">
<value>0</value>
</Constant>
</TransformAxis>
<!--3 Axes for translations are listed next.-->
<TransformAxis name="translation1">
<!--Rotation or translation axis for the transform.-->
<axis>1 0 0</axis>
<!--Transform function of the generalized coordinates used to represent the amount of displacement along a specified axis.-->
<Constant name="function">
<value>0</value>
</Constant>
</TransformAxis>
<TransformAxis name="translation2">
<!--Rotation or translation axis for the transform.-->
<axis>0 1 0</axis>
<!--Transform function of the generalized coordinates used to represent the amount of displacement along a specified axis.-->
<Constant name="function">
<value>0</value>
</Constant>
</TransformAxis>
<TransformAxis name="translation3">
<!--Rotation or translation axis for the transform.-->
<axis>0 0 1</axis>
<!--Transform function of the generalized coordinates used to represent the amount of displacement along a specified axis.-->
<Constant name="function">
<value>0</value>
</Constant>
</TransformAxis>
</SpatialTransform>
</CustomJoint>

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Custom Joint

Post by Dimitar Stanev » Tue Jul 23, 2019 10:36 pm

I think the problem is that you cannot create closed kinematic chains with only joints. You can add a joint between humerus and blue body and a joint between the ulna and the yellow body, but you have to define a constraint for connecting the blue and yellow body. Depending on the degrees of freedom you can choose between the following constraints:

OpenSim constraints https://simtk.org/api_docs/opensim/api_ ... raint.html

There are other types of constraints, which however, are not exposed in OpenSim yet, therefore you will have to write the wrapper and create a plugin:

Simbody constraints https://simbody.github.io/simbody-3.6-d ... raint.html

wrapper example: https://gist.github.com/mitkof6/61f9ebb ... 3ad233faba

plugin: https://simtk-confluence.stanford.edu:8 ... ng+Plugins

User avatar
dani mendez
Posts: 24
Joined: Tue Aug 07, 2018 1:40 am

Re: Custom Joint

Post by dani mendez » Thu Jul 25, 2019 10:21 am

Thank you very much for the reply. I'm trying with some restrictions, although I have another question.
I have tried to define a constraintball but when loading the model it does not recognize the restriction.
The code that I have used is the following:

<ConstraintSet name="constraintset">
<objects>
<ConstraintBall>
<!--List of components that this component owns and serializes.-->
<components />
<!--Flag indicating whether the constraint is enforced or not.Enforced means that the constraint is active in subsequent dynamics realizations. NOTE: Prior to OpenSim 4.0, this behavior was controlled by the 'isDisabled' property, where 'true' meant the constraint was not being enforced. Thus, if 'isDisabled' is'true', then 'isEnforced' is false.-->
<isEnforced>true</isEnforced>
<!--Path to a Component that satisfies the Socket 'body_1' of type PhysicalFrame (description: The first body participating in this constraint.).-->
<socket_body_1>/bodyset/placa_ulna_r</socket_body_1>
<!--Path to a Component that satisfies the Socket 'body_2' of type PhysicalFrame (description: The second body participating in this constraint.).-->
<socket_body_2>/bodyset/ulna_r</socket_body_2>
<!--Location of the point in first body specified in body1 reference frame.-->
<location_body_1>0 0 0</location_body_1>
<!--Location of the point in second body specified in body2 reference frame.-->
<location_body_2>0 0 0</location_body_2>
</ConstraintBall>
</objects>
<groups />
</ConstraintSet>

Anyone see where the fault is?

Thank you

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Custom Joint

Post by Dimitar Stanev » Fri Jul 26, 2019 10:00 pm

I have the impression that this constraint is from Simbody. Try using the PointConstraint from OpenSim.

POST REPLY