--- a +++ b/Application/Examples/PushUp/Model/JointsAndDrivers.any @@ -0,0 +1,477 @@ +///This is the joint and driver file +AnyFolder JointsAndDrivers={ + + AnyFolder &RefHM = Main.Model.BodyModel; + AnyFolder &JntPos=.Mannequin.Posture; + AnyFolder &JntVel=.Mannequin.PostureVel; + + + + //------------------------------------------------------- + // Drivers - spine + //------------------------------------------------------- + AnyKinRotational PelvisThoraxRotMeasure = { + AnyRefFrame &Pelvis = .RefHM.Trunk.SegmentsLumbar.PelvisSeg; + AnyRefFrame &Thorax = .RefHM.Trunk.SegmentsThorax.ThoraxSeg; + Type=RotAxesAngles; + }; + + // ************************************ + // Drivers for the spine + // ************************************ + + //Neck driver + AnyKinEqSimpleDriver NeckJntDriver = { + AnyKinMeasure& lb = ..BodyModel.Interface.Trunk.SkullThoraxLateralBending; + AnyKinMeasure& ar = ..BodyModel.Interface.Trunk.SkullThoraxRotation; + AnyKinMeasure& fe = ..BodyModel.Interface.Trunk.SkullThoraxFlexion; + DriverPos=pi/180*{.JntPos.NeckLateralBending,.JntPos.NeckRotation,-1*.JntPos.NeckExtension}; + DriverVel=pi/180*{.JntVel.NeckLateralBending,.JntVel.NeckRotation,-1*.JntVel.NeckExtension}; + Reaction.Type={Off,Off,Off}; + }; + + //Thorax pelvis rotation driver + AnyKinEqSimpleDriver PostureDriver ={ + AnyKinMeasure& Ref2 = ..BodyModel.Interface.Trunk.PelvisThoraxLateralBending; + AnyKinMeasure& Ref3 = ..BodyModel.Interface.Trunk.PelvisThoraxRotation; + AnyKinMeasure& Ref1 = ..BodyModel.Interface.Trunk.PelvisThoraxExtension; + + DriverPos = pi/180*{ + .JntPos.PelvisThoraxLateralBending, + .JntPos.PelvisThoraxRotation, + .JntPos.PelvisThoraxExtension + }; + DriverVel = pi/180*{ + .JntVel.PelvisThoraxLateralBending, + .JntVel.PelvisThoraxRotation, + .JntVel.PelvisThoraxExtension + }; + Reaction.Type = {Off,Off,Off}; + }; + + + + + + AnyKinLinear SideWayLin = { + AnySeg &ThoraxSegRef =.RefHM.Trunk.SegmentsThorax.ThoraxSeg; + AnyFixedRefFrame &groundfootr= Main.Model.Environment.GlobalRef; + }; //Foot to ground + + + AnyKinMeasureOrg SideWayLinOrg={ + AnyKinLinear &ref=.SideWayLin; + MeasureOrganizer ={2}; + }; + + AnyKinEqSimpleDriver SideWayLinDrv = { + AnyKinMeasure& Jnt = .SideWayLinOrg; + MeasureOrganizer = {0}; + DriverPos = {0}; + DriverVel = {0}; + Reaction.Type ={Off}; + }; + + + AnyKinLinear ChestHeight = { + AnyFixedRefFrame &handground= Main.Model.Environment.GlobalRef; + AnyRefNode &thorax = .RefHM.Trunk.SegmentsThorax.ThoraxSeg.ij; + //AnyDrawPLine test={Thickness=0.005;RGB={0,0,1};}; + + }; + + AnyKinMeasureOrg ChestHeightOrg = { + AnyKinLinear &chestheight =.ChestHeight; + MeasureOrganizer={1}; + }; + + + + AnyKinEqFourierDriver ChestHeightDrv ={ + AnyKinMeasure& Jnt = .ChestHeightOrg; + Type = Cos; + AnyVar a0 =0.3; + AnyVar a1 =-0.15; + AnyVar b0 =0; + AnyVar b1=0; + AnyVar w = 2; + Freq = 1; + A = {{a0,a1}}; + B = {{b0,b1}}; + Reaction.Type = {Off}; + }; + + + + AnyFolder Right ={ + + //------------------------------------------------------ + //These definitions locks the hand to the ground + //------------------------------------------------------- + AnyFolder &hand = .RefHM.Right.ShoulderArm.Seg.Hand; + hand ={ + AnyRefNode HandBall={ + sRel={0.0,0,0}; + ARel={{-1,0,0},{0,0,1},{0,1,0}}; + + }; + }; + + AnyKinLinear HandToGroundLinMover = { + AnySeg &GroundNode = Main.Model.Environment.Right.Handle; + //AnyRefNode &HandNode = ..RefHM.Right.ShoulderArm.Seg.Ulna.us; + AnyRefNode &glove = ..RefHM.Right.ShoulderArm.Seg.Hand.HandBall; + }; + + AnyKinEq HandToGroundConstraintsMover={ + AnyKinLinear &handtoground =.HandToGroundLinMover; + }; + + + AnyKinRotational HandToGroundRotMover = { + AnySeg &GroundNode = Main.Model.Environment.Right.Handle; + AnyRefNode &glove = ..RefHM.Right.ShoulderArm.Seg.Hand.HandBall; + Type=RotAxesAngles; + }; + + + AnyKinEqSimpleDriver HandToGroundRotMoverZYX={ + AnyKinRotational &ref=.HandToGroundRotMover; + MeasureOrganizer={0,1,2}; + DriverPos={0,pi,0}; + DriverVel={0,0,0}; + Reaction.Type={On,On,On}; + }; + + /* + AnyKinLinear XYZmeasureElbowMover = { + Ref=0; + AnyFixedRefFrame &ground = Main.Model.Environment.Right.Handle; + AnyRefNode &elbow =..RefHM.Right.ShoulderArm.Seg.Humerus.em; + }; + + AnyKinEqSimpleDriver ElbowMotionZ = { + AnyKinLinear &Jnt = .XYZmeasureElbowMover; + MeasureOrganizer = {0}; + DriverPos = {0.0}; + DriverVel = {0.0}; + Reaction.Type={0}; + }; + */ + + + //Sterno clavicular joint driver + AnyKinEqSimpleDriver SCDriverRight ={ + AnyKinMeasure& ref1 =...BodyModel.Interface.Right.SternoClavicularProtraction; + AnyKinMeasure& ref2 =...BodyModel.Interface.Right.SternoClavicularElevation; + DriverPos = pi/180*{ + ..JntPos.Right.SternoClavicularProtraction, + ..JntPos.Right.SternoClavicularElevation + }; + DriverVel = { + ..JntVel.Right.SternoClavicularProtraction, + ..JntVel.Right.SternoClavicularElevation + }; + Reaction.Type={Off,Off}; + }; + + //Arm position driver + AnyKinEqSimpleDriver ArmPosture ={ + AnyKinLinear ShoulderElbowDist = { + Ref = 0; + AnyRefFrame& Thorax = ....BodyModel.Trunk.SegmentsThorax.ThoraxSeg.ij; + AnyRefFrame& Elbow = ....BodyModel.Right.ShoulderArm.Seg.Humerus.el; + }; + MeasureOrganizer = {1}; + DriverPos = {-0.1}; + DriverVel = {0.0}; + Reaction.Type={Off}; + }; + + + + + //------------------------------------------------------- + // Drivers for the leg, from hipjoint and downwards + //------------------------------------------------------- + + // ************************************ + // Drivers for the right leg + // ************************************ + + //Hip driver + AnyKinEqSimpleDriver HipDriverRight={ + AnyKinMeasure& ref1 =...BodyModel.Interface.Right.HipFlexion; + AnyKinMeasure& ref2 =...BodyModel.Interface.Right.HipExternalRotation; + AnyKinMeasure& ref3 =...BodyModel.Interface.Right.HipAbduction; + DriverPos= pi/180*{ + ..JntPos.Right.HipFlexion, + ..JntPos.Right.HipExternalRotation, + ..JntPos.Right.HipAbduction + }; + DriverVel = pi/180*{ + ..JntVel.Right.HipFlexion, + ..JntVel.Right.HipExternalRotation, + ..JntVel.Right.HipAbduction + }; + Reaction.Type={Off,Off,Off}; + + }; + + //Knee driver + AnyKinEqSimpleDriver KneeDriverRight={ + AnyKinMeasureOrg &Knee = ...BodyModel.Interface.Right.KneeFlexion; + DriverPos=pi/180*{..JntPos.Right.KneeFlexion}; + DriverVel = pi/180*{..JntVel.Right.KneeFlexion}; + Reaction.Type={Off}; + }; + + //Ankle driver + AnyKinEqSimpleDriver AnkleDriverRight={ + AnyKinMeasure& ref1=...BodyModel.Interface.Right.AnklePlantarFlexion; + #if BM_LEG_MODEL == _LEG_MODEL_LEG_ + AnyKinMeasure& ref2=...BodyModel.Interface.Right.AnkleEversion; + #else + AnyKinMeasure& ref2=...BodyModel.Interface.Right.SubTalarEversion; + #endif + DriverPos = pi/180*{..JntPos.Right.AnklePlantarFlexion,..JntPos.Right.SubTalarEversion}; + DriverVel=pi/180*{..JntVel.Right.AnklePlantarFlexion,..JntVel.Right.SubTalarEversion}; + + Reaction.Type={Off,Off}; + }; + + + //------------------------------------------------------ + //These definitions locks the Foot to the ground + //------------------------------------------------------- + + + AnyKinLinear FootToGroundLin = { + AnyRefNode &groundfootr= Main.Model.Environment.GlobalRef.FootGroundR; + AnyRefNode &Foot = ..RefHM.Right.Leg.Seg.Foot.GroundJoint; + }; //Foot to ground + + AnyKinMeasureOrg FootToGroundLinOrgY={ + AnyKinLinear &ref=.FootToGroundLin; + MeasureOrganizer ={1}; + }; + + + //Recruited actuator that can only push + AnyRecruitedActuator FootToGroundLinConstraintsReaction = { + AnyKinMeasure& foottoground =.FootToGroundLinOrgY; + Strength = 3000; + SET_DEFAULT_ACTUATOR_VOLUME; + Type = NonNegative; //This changes the actuator's force direction and means that it will only push + }; + + AnyKinMeasureOrg FootToGroundLinOrgXY={ + AnyKinLinear &ref=.FootToGroundLin; + MeasureOrganizer ={0,1}; + }; + + AnyKinEqSimpleDriver FootToGroundLinConstraintsXY = { + AnyKinMeasure& foottoground =.FootToGroundLinOrgXY; + DriverPos = {0,0}; + DriverVel = {0,0}; + Reaction.Type={On,On}; + }; + + + AnyKinMeasureOrg FootToGroundLinOrgZ={ + AnyKinLinear &ref=.FootToGroundLin; + MeasureOrganizer ={2}; + }; + + AnyReacForce FootToGroundLinOrgZReaction={ + AnyKinMeasure& ref=.FootToGroundLinOrgZ; + }; + + };//Right + + + AnyFolder Left ={ + + //------------------------------------------------------ + //These definitions locks the hand to the ground + //------------------------------------------------------- + /*AnyKinLinear HandToGroundLinMover = { + AnyRefNode &GroundNode = Main.Model.Environment.Left.Handle; + // AnyRefNode &HandNode = ..RefHM.Left.ShoulderArm.Seg.Ulna.us; + AnyRefNode &HandNode = ..RefHM.Left.ShoulderArm.Seg.Glove; + }; //Hand to ground + */ + AnyFolder &hand = .RefHM.Left.ShoulderArm.Seg.Hand; + + hand ={ + AnyRefNode HandBall={ + sRel={0.0,0,0}; + ARel={{-1,0,0},{0,0,-1},{0,-1,0}}; + }; + }; + + + AnyKinLinear HandToGroundLinMover = { + AnySeg &GroundNode = Main.Model.Environment.Left.Handle; + //AnyRefNode &HandNode = ..RefHM.Right.ShoulderArm.Seg.Ulna.us; + AnyRefNode &glove = ..RefHM.Left.ShoulderArm.Seg.Hand.HandBall; + }; + + + AnyKinEq HandToGroundConstraintsMover={ + AnyKinLinear &handtoground =.HandToGroundLinMover; + }; + + AnyKinRotational HandToGroundRotMover = { + //AnyRefNode &GroundNode = Main.Model.Environment.GlobalRef;//Main.Model.Environment.Left.Handle; + AnySeg &GroundNode = Main.Model.Environment.Left.Handle; + AnyRefNode &glove = ..RefHM.Left.ShoulderArm.Seg.Hand.HandBall; + Type=RotAxesAngles; + }; + + AnyKinEqSimpleDriver HandToGroundRotMoverZYX={ + AnyKinRotational &ref=.HandToGroundRotMover; + MeasureOrganizer={0,1,2}; + DriverPos={0,pi,0}; + DriverVel={0,0,0}; + Reaction.Type={On,On,On}; + }; + + + //------------------------------------------------------- + //This joint and driver controls the elbow pos in the frontal plane + //------------------------------------------------------- + //Sterno clavicular joint driver + AnyKinEqSimpleDriver SCDriverLeft ={ + AnyKinMeasure& ref1 =...BodyModel.Interface.Left.SternoClavicularProtraction; + AnyKinMeasure& ref2 =...BodyModel.Interface.Left.SternoClavicularElevation; + + DriverPos = pi/180*{ + ..JntPos.Left.SternoClavicularProtraction, + ..JntPos.Left.SternoClavicularElevation + }; + + DriverVel = pi/180*{ + ..JntVel.Left.SternoClavicularProtraction, + ..JntVel.Left.SternoClavicularElevation + }; + Reaction.Type={Off,Off}; + }; + + + //Arm position driver + AnyKinEqSimpleDriver ArmPosture ={ + AnyKinLinear ShoulderElbowDist = { + Ref = 0; + AnyRefFrame& Thorax = ....BodyModel.Trunk.SegmentsThorax.ThoraxSeg.ij; + AnyRefFrame& Elbow = ....BodyModel.Left.ShoulderArm.Seg.Humerus.el; + }; + MeasureOrganizer = {1}; + DriverPos = {-0.1}; + DriverVel = {0.0}; + Reaction.Type={Off}; + }; + + + //------------------------------------------------------- + // Drivers for the leg, from hipjoint and downwards + //------------------------------------------------------- + + // ************************************ + // Drivers for the Left leg + // ************************************ + + //Left hip driver + AnyKinEqSimpleDriver HipDriverLeft={ + AnyKinMeasure& ref1 =...BodyModel.Interface.Left.HipFlexion; + AnyKinMeasure& ref2 =...BodyModel.Interface.Left.HipExternalRotation; + AnyKinMeasure& ref3 =...BodyModel.Interface.Left.HipAbduction; + DriverPos=pi/180*{ + ..JntPos.Left.HipFlexion, + ..JntPos.Left.HipExternalRotation, + ..JntPos.Left.HipAbduction + }; + DriverVel = pi/180*{ + ..JntVel.Left.HipFlexion, + ..JntVel.Left.HipExternalRotation, + ..JntVel.Left.HipAbduction + }; + Reaction.Type={Off,Off,Off}; + }; + + //Knee driver + AnyKinEqSimpleDriver KneeDriverLeft={ + AnyKinMeasure& Knee =...BodyModel.Interface.Left.KneeFlexion; + DriverPos=pi/180*{ ..JntPos.Left.KneeFlexion }; + DriverVel = pi/180*{ ..JntVel.Left.KneeFlexion }; + Reaction.Type={Off}; + }; + + + + + //Ankle driver + AnyKinEqSimpleDriver AnkleDriverLeft={ + AnyKinMeasure& ref1=...BodyModel.Interface.Left.AnklePlantarFlexion; + #if BM_LEG_MODEL == _LEG_MODEL_LEG_ + AnyKinMeasure& ref2=...BodyModel.Interface.Left.AnkleEversion; + #else + AnyKinMeasure& ref2=...BodyModel.Interface.Left.SubTalarEversion; + #endif + DriverPos = pi/180*{..JntPos.Left.AnklePlantarFlexion,..JntPos.Left.SubTalarEversion}; + DriverVel=pi/180*{..JntVel.Left.AnklePlantarFlexion,..JntVel.Left.SubTalarEversion}; + Reaction.Type={Off,Off}; + }; + + + //------------------------------------------------------ + //These definitions locks the Foot to the ground + //------------------------------------------------------- + + AnyKinLinear FootToGroundLin = { + AnyRefNode &groundfootr= Main.Model.Environment.GlobalRef.FootGroundL; + AnyRefNode &Foot = ..RefHM.Left.Leg.Seg.Foot.GroundJoint; + }; //Foot to ground + + AnyKinMeasureOrg FootToGroundLinOrgY={ + AnyKinLinear &ref=.FootToGroundLin; + MeasureOrganizer ={1}; + }; + + //Recruited actuator that can only push + AnyRecruitedActuator FootToGroundLinConstraintsReaction = { + AnyKinMeasure& foottoground =.FootToGroundLinOrgY; + Strength = 3000; + Type = NonNegative; //This changes the actuator's force direction and means that it will only push + SET_DEFAULT_ACTUATOR_VOLUME; + }; + + /* + AnyReacForce FootToGroundLinConstraintsY = { + AnyKinMeasure& foottoground =.FootToGroundLinOrgY; + };*/ + + AnyKinMeasureOrg FootToGroundLinOrgXY={ + AnyKinLinear &ref=.FootToGroundLin; + MeasureOrganizer ={0,1}; + }; + + AnyKinEqSimpleDriver FootToGroundLinConstraintsXY = { + AnyKinMeasure& foottoground =.FootToGroundLinOrgXY; + DriverPos = {0,0}; + DriverVel = {0,0}; + Reaction.Type={On,Off}; + }; + + AnyKinMeasureOrg FootToGroundLinOrgZ={ + AnyKinLinear &ref=.FootToGroundLin; + MeasureOrganizer ={2}; + }; + + AnyReacForce FootToGroundLinOrgZReaction={ + AnyKinMeasure& ref=.FootToGroundLinOrgZ; + }; + + };//left + +};