Append coordinate to coordinate set of custom joint

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Gavin Lenton
Posts: 7
Joined: Mon Feb 17, 2014 5:19 pm

Append coordinate to coordinate set of custom joint

Post by Gavin Lenton » Mon Oct 10, 2016 10:38 pm

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.

User avatar
Gavin Lenton
Posts: 7
Joined: Mon Feb 17, 2014 5:19 pm

Re: Append coordinate to coordinate set of custom joint

Post by Gavin Lenton » Sun Oct 16, 2016 8:36 pm

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.

User avatar
Salhi Asma
Posts: 3
Joined: Tue Aug 02, 2016 8:03 am

Re: Append coordinate to coordinate set of custom joint

Post by Salhi Asma » Thu Jun 08, 2017 9:27 am

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

User avatar
Vincent Fohanno
Posts: 23
Joined: Thu May 10, 2018 10:03 am

Re: Append coordinate to coordinate set of custom joint

Post by Vincent Fohanno » Tue May 22, 2018 7:55 am

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

POST REPLY