I am trying to model a golf swing. I have two problems.
I connected the right hand to the golf club using these lines:
AnyKinEqSimpleDriver Right_hand_attach =
{
AnyKinLinear lin =
{
Ref = 0;
AnyRefNode& base = Main.HumanModel.BodyModel.Right.ShoulderArm.Seg.Hand.cluboriginR;
AnyRefNode& target = ..dummyseg.P1;
};
AnyKinRotational rot =
{
AnyRefNode& base = Main.HumanModel.BodyModel.Right.ShoulderArm.Seg.Hand.cluboriginR;
AnyRefNode& target = ..dummyseg.P1;
Type = RotAxesAngles;
};
DriverPos = {0,0,0,0,0,0};
DriverVel = {0,0,0,0,0,0};
Reaction.Type = {On, On, On, On, On, On};
};
This works fine. But when I try to connect the left hand to the same node using the similar code, it gives me the Model is kinematically over-constrained error. How can I fix this?
There is a marker on the golf club. When I connect this marker to a node on the club, it gives me the over-constrained error. These are the lines:
You can consider starting from the golf model and using your own data.
As far as the errors are concerned, it is normal that if you try to add drivers connecting the golf club to the right hand in 6 dof, then to the left hand in 6 dof, and then also drive it using marker data, you have basically added 15 constraints to the golf club when it really needs 6. That is why you see the over constrained error because all these constraints are not going to be perfectly consistent with each other. I suggest you pick 6 constraints that you are confident of and don't use the others. So, three could come from the marker, and 3 could come from the hand, but it's up to you. Alternatively, you could add soft drivers and over-constraint the system. But the inverse dynamics study would also need to be updated to use the over determinate solver.
I connect the left hand similarly and define the driver as Soft. Then add these lines to the end of InverseDynamicSettings.any to over-constrain the solver: