Page 1 of 1

Using both pin joint and weld joint

Posted: Sun Apr 05, 2020 10:19 am
by lowellr
Hi there,

I am trying to add an external body to a model, and want to constrain it to the skeleton using a weld joint, then to other external bodies using a pin joint. However, I can't seem to be able to apply both, as the first declared joint for a given body supersedes the other. Is there a way I can set both a weld and pin joint for a body?

Thanks.

Re: Using both pin joint and weld joint

Posted: Sun Apr 05, 2020 11:01 am
by aymanh
Hi Lowell,

The multibody system has to be a tree as such every joint has exactly one parent. You can however use a WeldConstraint instead of a WeldJoint to do the same thing. You may be over-constraining your system though so keep this in mind.

Best regards,
-Ayman

Re: Using both pin joint and weld joint

Posted: Sun Apr 05, 2020 11:08 am
by lowellr
Thanks Ayman,

That makes sense, I have been trying to implement the WeldConstraint, however it is having a problem finding the socketframe of the bodies to attach to. In my osim model, there don't appear to be any socketframes explicitly defined, so could you let me know how to use elements from the BodySet in the weld constraint?

Thanks again.

Re: Using both pin joint and weld joint

Posted: Mon Apr 06, 2020 9:15 am
by aymanh
Hello,

If you save your model in version 4.0+ and open the model .osim file in a text editor then you'll see the frames or slots for them. Use Help->XML Browser in the application and choose WeldConstraint from the dropdown and you'll see the XML representation of a WeldConstraint including <socket_frame1> and <socket_frame2> allowing you to specify which two frames to be welded. A frame could be Ground, a Body or a frame defined as an offset from another frame.

Hope this helps,
-Ayman

Re: Using both pin joint and weld joint

Posted: Wed Apr 08, 2020 12:08 pm
by lowellr
Hi Ayman,

Thanks, I was able to see how a weld constraint should be configured with the XML editor, however I still can't seem to to properly describe a body within the <socketframe_1> or <socketframe_2> tags. Following the example from https://simtk-confluence.stanford.edu:8 ... Sim+Models, doesn't appear to work. Could this be because the model I'm using doesn't contain the <FrameGeometry> components? It is similar to the version of the Gait2393 model without scaling. Am I still able to use the Weld constraint in this case?

Thanks,
Lowell

Re: Using both pin joint and weld joint

Posted: Fri Apr 10, 2020 1:08 pm
by aymanh
Hi Lowell,

Here's an example from another example model file saved in 4.0+ file fromat:

Code: Select all

<socket_frame1>/bodyset/pelvis</socket_frame1>
Please let us know if that works for you, the specification between the tags above is for a body (pelvis) but any Path to a Frame can be used.

Hope this helps,
-Ayman

Re: Using both pin joint and weld joint

Posted: Sat Apr 11, 2020 6:10 pm
by lowellr
Hi Ayman,

Thanks for the example, I tried it on the unscaled gait2354_simbody.osim model from OpenSim 4.1, and still got the same error:

RuntimeError: std::exception in 'SimTK::State & OpenSim::Model::initSystem()': Failed to connect Socket 'frame1' of type PhysicalFrame (details: Component 'frame1' could not find '..' of type PhysicalFrame. Make sure a component exists at this path and that it is of the correct type.

This was with trying to use:

Code: Select all

 <socket_frame1> /bodyset/calcn_r </socket_frame1> 

I also tried it with the pelvis and got the same error.