Page 1 of 1

Append coordinate to coordinate set of custom joint

Posted: Mon Oct 10, 2016 10:38 pm
by gavinl23
Hi,

I am interested in appending coordinates to a custom joint (knee) to include abduction/adduction and int/ext rotation. I know how to do this manually in the model xml file, however, would like to do it programatically using the API in Matlab. Currently, I am able to edit the existing coordinate (knee_angle_r), and create new coordinates by cloning the existing, but am unable to append or update the coordinate set with the new coordinates. Is there a simple way to achieve this? Also, do I need to add the coordinate to the model or to the custom joint?

Here is the snippet of code I am currently running

Code: Select all

% Get knee joint and current coordinate set
kneeJoint = CustomJoint.safeDownCast(current_model.getJointSet().get('knee_r'));
kneeCoordSet = kneeJoint.getCoordinateSet();
flexCoord = kneeCoordSet.get(0);

% Create clone of knee_angle_r for other DOFs
adductionCoord = flexCoord.clone();
intRotationCoord = flexCoord.clone();

% Update name and range for other DOF
adductionCoord.setName('knee_adduction_r'); adductionCoord.setRange(rotRangeAbd);
intRotationCoord.setName('knee_rotation_r'); intRotationCoord.setRange(rotRangeIntRot);

% Section here to append onto CoordinateSet
Any information you can provide is greatly appreciated.

Regards,

Gavin.

Re: Append coordinate to coordinate set of custom joint

Posted: Sun Oct 16, 2016 8:36 pm
by gavinl23
Hi,

I have now solved this problem by creating additional coordinates and appending them to the existing coordinate set using 'cloneAndAppend', then using 'set_CoordinateSet' to append the new coordinate set onto the joint, and finally appending the modified joint to the model joint set.

Regards,

Gavin.

Re: Append coordinate to coordinate set of custom joint

Posted: Thu Jun 08, 2017 9:27 am
by asmatb
Hi,
I have the same problem as: "I’m trying to append coordinates to a custom joint" but here I’m trying to use the API in C++. I followed the same steps as mentioned here in this post:

1) Create an additional coordinate and appending them to the existing coordinate set
2) Append the new coordinate set onto the joint
3) And finally, append the modified joint to the model joint set.

My code runs and compiles but the coordinates have not been read, I’ve checked that in the xml file.

Could Gavin or anyone else please share your code (in matlab or in c++) how to append coordinates to the custom joint so that I can use it as a reference.
Regards,
Asma

Re: Append coordinate to coordinate set of custom joint

Posted: Tue May 22, 2018 7:55 am
by docvi
FYI, if it can help

This is what what i did and it works for me
viewtopicPhpbb.php?f=91&t=9061&p=0&start=0&view=

Vincent