balljoint

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
dani mendez
Posts: 24
Joined: Tue Aug 07, 2018 1:40 am

balljoint

Post by dani mendez » Mon Jul 22, 2019 9:55 am

I want to use a balljoint, but I can not find an example. Could someone give me an example of how you should write the code for a balljoint?
Thank you

Tags:

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

Re: balljoint

Post by jimmy d » Mon Jul 22, 2019 10:21 am

Matlab, Python, C++?

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

Re: balljoint

Post by jimmy d » Mon Jul 22, 2019 10:28 am

Below is some Matlab code for making a pinjoint between a thigh and a pelvis. You can adjust to make it a Balljoint. Use the BallJoint API documentation to help.

Code: Select all

%% Create a Left Thigh
leftThigh = Body();
leftThigh.setName('LeftThigh');
leftThigh.setMass(1);
leftThigh.setInertia(Inertia(2,2,0.02,0,0,0));

 % Create a Pin joint
locationInParent    = Vec3(0,0,-0.2);
orientationInParent = Vec3(0,0,0);
locationInChild     = Vec3(0,0.25,0);
orientationInChild  = Vec3(0,0,0);
LThighToPelvis = PinJoint('LThighToPelvis', pelvis, locationInParent, ...
    orientationInParent, leftThigh, locationInChild, orientationInChild);

 % Update the coordinates of the new joint
LHip_rz = LThighToPelvis.updCoordinate();
LHip_rz.setRange([deg2rad(-100), deg2rad(100)]);
LHip_rz.setName('LHip_rz');
LHip_rz.setDefaultValue(0.312511671);
LHip_rz.setDefaultSpeedValue(-0.245407488);

 % Add geometry to display in the GUI
ThighLength = 0.5;
leftThigh.attachGeometry(Ellipsoid(ThighLength/20, ThighLength/2, ThighLength/20));

% Add the joint to the Model.
model.addJoint(LThighToPelvis);

POST REPLY