212 lines (190 with data), 7.8 kB
//This file repicates the kinematics of the model at load time
//The file will set the Axes0 values for the segments the calculations is based
//on the joint driver values in the mannequin file.
AnyFolder &ref=Main.Model.HumanModel;
AnyFolder &JointPos=Main.Model.Mannequin.Posture;
ref.Trunk.SegmentsLumbar.PelvisSeg.r0 =
{JointPos.PelvisPosX,JointPos.PelvisPosY,JointPos.PelvisPosZ};
ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0=
RotMat((pi/180)*JointPos.PelvisRotZ ,z)*
RotMat((pi/180)*JointPos.PelvisRotY ,y)*
RotMat((pi/180)*JointPos.PelvisRotX ,x);
//Thorax
ref.Trunk.SegmentsThorax.ThoraxSeg.Axes0=
ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0*
RotMat((pi/180)*JointPos.PelvisThoraxExtension ,z)*
RotMat((pi/180)*JointPos.PelvisThoraxRotation ,y)*
RotMat((pi/180)*JointPos.PelvisThoraxLateralBending ,x);
//This is a rough approximation
//L1Seg
ref.Trunk.SegmentsLumbar.L1Seg.Axes0=
ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0*
RotMat(5/6*(pi/180)*JointPos.PelvisThoraxExtension ,z)*
RotMat(5/6*(pi/180)*JointPos.PelvisThoraxRotation ,y)*
RotMat(5/6*(pi/180)*JointPos.PelvisThoraxLateralBending ,x);
//L2Seg
ref.Trunk.SegmentsLumbar.L2Seg.Axes0=
ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0*
RotMat(4/6*(pi/180)*JointPos.PelvisThoraxExtension ,z)*
RotMat(4/6*(pi/180)*JointPos.PelvisThoraxRotation ,y)*
RotMat(4/6*(pi/180)*JointPos.PelvisThoraxLateralBending ,x);
//L3Seg
ref.Trunk.SegmentsLumbar.L3Seg.Axes0=
ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0*
RotMat(3/6*(pi/180)*JointPos.PelvisThoraxExtension ,z)*
RotMat(3/6*(pi/180)*JointPos.PelvisThoraxRotation ,y)*
RotMat(3/6*(pi/180)*JointPos.PelvisThoraxLateralBending ,x);
//L4Seg
ref.Trunk.SegmentsLumbar.L4Seg.Axes0=
ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0*
RotMat(2/6*(pi/180)*JointPos.PelvisThoraxExtension ,z)*
RotMat(2/6*(pi/180)*JointPos.PelvisThoraxRotation ,y)*
RotMat(2/6*(pi/180)*JointPos.PelvisThoraxLateralBending ,x);
//L5Seg
ref.Trunk.SegmentsLumbar.L5Seg.Axes0=
ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0*
RotMat(1/6*(pi/180)*JointPos.PelvisThoraxExtension ,z)*
RotMat(1/6*(pi/180)*JointPos.PelvisThoraxRotation ,y)*
RotMat(1/6*(pi/180)*JointPos.PelvisThoraxLateralBending ,x);
//SkullSeg
ref.Trunk.SegmentsThorax.SkullSeg.Axes0=
ref.Trunk.SegmentsThorax.ThoraxSeg.Axes0*
ref.Trunk.SegmentsThorax.ThoraxSeg.T1Seg.ARel*
RotMat((pi/180)*JointPos.NeckExtension,z)*
ref.Trunk.SegmentsThorax.SkullSeg.NeckNode.ARel';
//Right leg
ref.Right.Leg.Seg.Thigh.Axes0 =
ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0*ref.Trunk.SegmentsLumbar.PelvisSeg.HipJointRight.RotNode.ARel*
RotMat((pi/180)*JointPos.Right.HipFlexion,z)*
RotMat((pi/180)*JointPos.Right.HipExternalRotation,y)*
RotMat((pi/180)*JointPos.Right.HipAbduction,x)*
ref.Right.Leg.Seg.Thigh.HipJoint.RotNode.ARel';
//shank
ref.Right.Leg.Seg.Shank.Axes0 =
ref.Right.Leg.Seg.Thigh.Axes0*
ref.Right.Leg.Seg.Thigh.KneeJoint.ARel*
ref.Right.Leg.Seg.Thigh.KneeJoint.RotNode.ARel*
RotMat((-pi/180)*JointPos.Right.KneeFlexion,z)*
//RotMat(pi,y)*
ref.Right.Leg.Seg.Shank.KneeJoint.RotNode.ARel'*
ref.Right.Leg.Seg.Shank.KneeJoint.ARel';
//Foot
ref.Right.Leg.Seg.Foot.Axes0 =
ref.Right.Leg.Seg.Shank.Axes0*
ref.Right.Leg.Seg.Shank.AnkleJoint.ARel*
ref.Right.Leg.Seg.Shank.AnkleJoint.RotNode.ARel*
RotMat((pi/180)*JointPos.Right.AnklePlantarFlexion ,z)*
RotMat((pi/180)*JointPos.Right.AnkleEversion ,y)*
ref.Right.Leg.Seg.Foot.AnkleJoint.RotNode.ARel'*
ref.Right.Leg.Seg.Foot.AnkleJoint.ARel';
//
// //right humerus
//ref.Right.ShoulderArm.Seg.Humerus.Axes0 =
//ref.Trunk.SegmentsThorax.ThoraxSeg.Axes0*
//ref.Trunk.SegmentsThorax.ThoraxSeg.ij.ARel*
//ref.Trunk.SegmentsThorax.ThoraxSeg.ij.RotNode.ARel*
//RotMat((pi/180)*JointPos.Right.GlenohumeralFlexion ,z)*
//RotMat((pi/180)*JointPos.Right.GlenohumeralExternalRotation ,y)*
//RotMat((pi/180)*JointPos.Right.GlenohumeralAbduction ,x)*
//ref.Right.ShoulderArm.Seg.Humerus.gh.RotNode.ARel'*
//ref.Right.ShoulderArm.Seg.Humerus.gh.ARel';
//
// //right ulna
//ref.Right.ShoulderArm.Seg.Ulna.Axes0 =
//ref.Right.ShoulderArm.Seg.Humerus.Axes0*
//ref.Right.ShoulderArm.Seg.Humerus.fe.ARel*
//ref.Right.ShoulderArm.Seg.Humerus.fe.RotNode.ARel*
//RotMat((pi/180)*JointPos.Right.ElbowFlexion,x)*
//ref.Right.ShoulderArm.Seg.Ulna.fe.RotNode.ARel';
//
//
// //right Radius
//ref.Right.ShoulderArm.Seg.Radius.Axes0 =
//ref.Right.ShoulderArm.Seg.Ulna.Axes0*
//ref.Right.ShoulderArm.Seg.Ulna.ps2.ARel*
//ref.Right.ShoulderArm.Seg.Ulna.ps2.RotNode.ARel*
// //RotMat(-pi/2,z)*
//RotMat(0.0,y)*
//RotMat((pi/180)*JointPos.Right.ElbowPronation ,x)*
//ref.Right.ShoulderArm.Seg.Radius.PointPS2.ARel'*
//ref.Right.ShoulderArm.Seg.Radius.PointPS2.RotNode.ARel';
//
//
// //right hand
//ref.Right.ShoulderArm.Seg.Hand.Axes0 =
//ref.Right.ShoulderArm.Seg.Radius.Axes0*
//ref.Right.ShoulderArm.Seg.Radius.wj.ARel*
//ref.Right.ShoulderArm.Seg.Radius.wj.RotNode.ARel*
// //RotMat(0.0,y)*
//RotMat((pi/180)*JointPos.Right.WristFlexion,y)*
//RotMat((pi/180)*JointPos.Right.WristAbduction,z)*
//ref.Right.ShoulderArm.Seg.Hand.wj.RotNode.ARel'*
//ref.Right.ShoulderArm.Seg.Hand.wj.ARel';
//
//
//Left hip
ref.Left.Leg.Seg.Thigh.Axes0 =ref.Trunk.SegmentsLumbar.PelvisSeg.Axes0*ref.Trunk.SegmentsLumbar.PelvisSeg.HipJointLeft.RotNode.ARel*
RotMat((pi/180)*JointPos.Left.HipFlexion,z)*
RotMat((pi/180)*JointPos.Left.HipExternalRotation,y)*
RotMat((pi/180)*JointPos.Left.HipAbduction,x)*
ref.Left.Leg.Seg.Thigh.HipJoint.RotNode.ARel';
//left shank
ref.Left.Leg.Seg.Shank.Axes0 =
ref.Left.Leg.Seg.Thigh.Axes0*
ref.Left.Leg.Seg.Thigh.KneeJoint.ARel*
ref.Left.Leg.Seg.Thigh.KneeJoint.RotNode.ARel*
RotMat((-pi/180)*JointPos.Left.KneeFlexion,z)*
//RotMat(pi,y)*
ref.Left.Leg.Seg.Shank.KneeJoint.RotNode.ARel'*
ref.Left.Leg.Seg.Shank.KneeJoint.ARel';
//left foot
ref.Left.Leg.Seg.Foot.Axes0 =
ref.Left.Leg.Seg.Shank.Axes0*
ref.Left.Leg.Seg.Shank.AnkleJoint.ARel*
ref.Left.Leg.Seg.Shank.AnkleJoint.RotNode.ARel*
RotMat((pi/180)*JointPos.Left.AnklePlantarFlexion ,z)*
RotMat((pi/180)*JointPos.Left.AnkleEversion,y)*
ref.Left.Leg.Seg.Foot.AnkleJoint.RotNode.ARel'*
ref.Left.Leg.Seg.Foot.AnkleJoint.ARel';
// //left humerus
//ref.Left.ShoulderArm.Seg.Humerus.Axes0 =
//ref.Trunk.SegmentsThorax.ThoraxSeg.Axes0*
//ref.Trunk.SegmentsThorax.ThoraxSeg.iji.ARel*
//ref.Trunk.SegmentsThorax.ThoraxSeg.iji.RotNode.ARel*
//RotMat((pi/180)*JointPos.Left.GlenohumeralExternalRotation ,y)*
//RotMat((pi/180)*JointPos.Left.GlenohumeralFlexion ,z)*
//RotMat((pi/180)*JointPos.Left.GlenohumeralAbduction ,x)*
//ref.Left.ShoulderArm.Seg.Humerus.gh.RotNode.ARel'*
//ref.Left.ShoulderArm.Seg.Humerus.gh.ARel';
//
//
// //left ulna
//ref.Left.ShoulderArm.Seg.Ulna.Axes0 = ref.Left.ShoulderArm.Seg.Humerus.Axes0*
//ref.Left.ShoulderArm.Seg.Humerus.fe.ARel*
//ref.Left.ShoulderArm.Seg.Humerus.fe.RotNode.ARel*
//RotMat((pi/180)*JointPos.Left.ElbowFlexion,x)*
//ref.Left.ShoulderArm.Seg.Ulna.fe.RotNode.ARel';
//
// //left Radius
//ref.Left.ShoulderArm.Seg.Radius.Axes0 =
//ref.Left.ShoulderArm.Seg.Ulna.Axes0*
//ref.Left.ShoulderArm.Seg.Ulna.ps2.ARel*
//ref.Left.ShoulderArm.Seg.Ulna.ps2.RotNode.ARel*
// //RotMat(-pi,z)*
//RotMat(0.0,y)*
//RotMat((pi/180)*JointPos.Left.ElbowPronation ,x)*
//ref.Left.ShoulderArm.Seg.Radius.PointPS2.ARel'*
//ref.Left.ShoulderArm.Seg.Radius.PointPS2.RotNode.ARel';
//
//
// //Left hand
//ref.Left.ShoulderArm.Seg.Hand.Axes0 =
//ref.Left.ShoulderArm.Seg.Radius.Axes0*
//ref.Left.ShoulderArm.Seg.Radius.wj.ARel*
//ref.Left.ShoulderArm.Seg.Radius.wj.RotNode.ARel*
// //RotMat(0.0,y)*
//RotMat((pi/180)*JointPos.Left.WristFlexion,y)*
//RotMat((pi/180)*JointPos.Left.WristAbduction,z)*
//ref.Left.ShoulderArm.Seg.Hand.wj.RotNode.ARel*
//ref.Left.ShoulderArm.Seg.Hand.wj.ARel';
//