Page 1 of 1

Custom Joint Query

Posted: Wed Jul 24, 2019 9:22 pm
by vinaym815
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

Re: Custom Joint Query

Posted: Sun Jul 28, 2019 11:44 am
by jimmy
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.

Re: Custom Joint Query

Posted: Sun Jul 28, 2019 11:55 am
by jimmy
This previous post may also be useful; viewtopicPhpbb.php?f=91&t=9061&p=0&start=0&view=

Re: Custom Joint Query

Posted: Sun Jul 28, 2019 10:05 pm
by vinaym815
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?

Re: Custom Joint Query

Posted: Mon Jul 29, 2019 7:18 am
by jimmy
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.

Re: Custom Joint Query

Posted: Mon Jul 29, 2019 8:42 am
by tkuchida
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.

Re: Custom Joint Query

Posted: Tue Jul 30, 2019 1:05 am
by vinaym815
Thank You @James Dunne and @Thomas Uchida for your replies.