Custom Joint Query

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Vinay Kumar
Posts: 34
Joined: Thu Nov 08, 2018 6:50 am

Custom Joint Query

Post by Vinay Kumar » Wed Jul 24, 2019 9:22 pm

I have created custom joint (1DOF) between ground and a point mass using the following workflow:
Coordinate-----(coordinate name)---->TransformAxis----->Spatial Transform ------>Custom Joint
|
|-----------(append_coordinate)------>Custom Joint

Is the Joint supposed to take the ownership of coordinates?
Are we supposed to use some other method than append_coordinate() ?

Kind regards
Vinay


Code
https://github.com/vinaym815/OpenSimExa ... c/main.cpp

Tags:

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Custom Joint Query

Post by jimmy d » Sun Jul 28, 2019 11:44 am

Perhaps try instantiating the SpatialTransform first since it holds a set of six coordinates, edit each coordinate in the SpatialTransform, then construct the CustomJoint using this constructor. There seems to be a good example of this in one of the CustomJoint tests here.

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Custom Joint Query

Post by jimmy d » Sun Jul 28, 2019 11:55 am

This previous post may also be useful; viewtopicPhpbb.php?f=91&t=9061&p=0&start=0&view=

User avatar
Vinay Kumar
Posts: 34
Joined: Thu Nov 08, 2018 6:50 am

Re: Custom Joint Query

Post by Vinay Kumar » Sun Jul 28, 2019 10:05 pm

jimmy wrote:
Sun Jul 28, 2019 11:44 am
Perhaps try instantiating the SpatialTransform first since it holds a set of six coordinates, edit each coordinate in the SpatialTransform, then construct the CustomJoint using this constructor. There seems to be a good example of this in one of the CustomJoint tests here.
Thank you for your reply. However, I still require some clarification.

If I create the custom joint as explained in the example here, the API creates a template coordinate named "knee_r" and assigns it to the knee joint. Now, if I desire to put some constraints on the "knee_r" coordinate, like a default value or a range, I am required to acquire it's handle from the joint definition using an upd command. However, I was hoping for a simpler solution which avoids the instantiation of the template "knee_r" joint. I found this this code to work as I desire but it requires the use of command append_coordinates, which I find worrying as I think the methods with "_" in their name are not supposed to be called by the user.

Also If I wish to use a single coordinate for two different joints, so that they mimic each other's motion, will this work i.e. Can different joints share the same coordinate? To rephrase it, Is the coordinate definition owned by that of the joint?

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Custom Joint Query

Post by jimmy d » Mon Jul 29, 2019 7:18 am

The contributing guide doesn't indicate that methods with underscores are supposed to be not called by the user (see below) so you should be fine to use .append_coordinates()
Naming conventions
Please follow the convention that property, input, and output names use the lower_case_with_underscores convention, while class names use UpperCamelCaseWithoutUnderscores. This ensures no conflicts with XML tag names and makes it easy to tell a property name from a class name
As far as I am aware, joints own the coordinates so coordinates can't be shared.

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

Re: Custom Joint Query

Post by Thomas Uchida » Mon Jul 29, 2019 8:42 am

If I wish to use a single coordinate for two different joints, so that they mimic each other's motion, will this work i.e. Can different joints share the same coordinate?
You could try using a CoordinateCouplerConstraint (https://simtk.org/api_docs/opensim/api_ ... raint.html) so that one Coordinate follows the other.

User avatar
Vinay Kumar
Posts: 34
Joined: Thu Nov 08, 2018 6:50 am

Re: Custom Joint Query

Post by Vinay Kumar » Tue Jul 30, 2019 1:05 am

Thank You @James Dunne and @Thomas Uchida for your replies.

POST REPLY