balljoint
Posted: 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
Thank you
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);