I understand you need to calculate variables “jAngsL”, “jAngR”, “siminL”, “siminR”.
These indicate the joint angles (“jAngsL”, “jAngR”) and are calculated using inverse kinematics (IK). The calculations are made by setting the base of each leg as an end-effector and foot as the base.
In the file, the function “invKinBody2Foot” calculates the joint angles required to position the foot at a specified transformation relative to the body.
Here's a brief summary about the approach followed in the "invKinBody2Foot" function:
- The input “tform” is a transformation matrix describing the foot’s position and orientation relative to the body.
The function first applies some offsets to convert this transformation from the body to the foot into a form that relates the base of each leg to the foot.
2. The function “invKinBody2Foot” computes the inverse of the transformation matrix. This is done by taking the transpose of rotation matrix R and adjusting the position vector “p”. This effectively transforms the problem into finding the joint angles that position the foot relative to the base of the leg.
This function uses an analytical inverse kinematics solution derived from the paper which the above file mentions at its beginning. This involves solving for the joint angles in reverse order, starting from the foot and moving towards the hip.
So, the computed joint angles “th1” through “th6” are packed into a vector “th” representing the complete set of joint angles needed for foot to achieve the desired position and orientation.
Hope this helps!