Pages

Friday, April 26, 2019

CCD - Joint Rotation Constraints (1st Attempt)

My current solution does nothing to prevent overextension of joints, nor tight configurations of joint angles which “cause the chain to form a loop, intersecting itself” (Mukundan, 2009, p. 304).

Figure 1: Common drawbacks of CCD, including chain intersection (Mukundan, 2009, p. 304)

The problems this creates are clear - an example is demonstrated in figure 2:
Figure 2: Unconstrained solution allows intersections and overextension of joints

The animations my solutions produce must preserve the natural limits of the human body. Limiting the range of each joints’ rotation, coupled with the comparatively low degree of freedom of human limbs and my controllable trajectory plotter, should prevent the above problems.


Implementing Joint Constraints 

A joint class defines the rotation limits for each axis, for every joint in the chain. The CCD solution then iterates through an array of these joints, clamping their rotation values to those defined in the joint class.

Figure 3: Array of all chain joints

Checks are added to ensure that any joints rotations stay relative to their parents and children, so that joint limits can be maintained throughout the chain.

Figure 4: Joint rotation restrictions


Outcome 

Acting on the Bipeds joints (from hip to hand, to test with the single largest degree of freedom joint chain that could occur in the 3D biped model), the updated solution appears to maintain accurate function while rotation limits are maintained at each joint.

Figure 5: Joint rotation constraints applied to 3D biped (hips to hand)

However, when the same script was used to control the leg joint orientations, it was not as successful:

Figure 6: Joint rotation constraints applied to 3D biped (hips to heel)

While the joint constraints may appear to work correctly in figure 5, figure 6 shows the solution having to adapt to reach the target by rotating about the x axis only. Even in this case there is a ‘dead zone’ (semicircle) created just below the hips where the constrained rotations fail to accommodate the target location. After checking the min/max values for each joint in the chain I am certain these are not the cause of the issue - rather the method of clamping the joint rotations is preventing the solution from functioning properly.

When constrained on all three axis even more problems are apparent, as shown in figure 7.

Figure 7: Joint rotation constraints applied to 3D biped (hips to heel)

While developing my previous analytical IK solution I encountered behaviour similar to this, where singularities were created as the chain could adopt infinite configurations in order to accommodate the target position.
I have already accounted for singularities in my CCD implementation and confirmed its function, which again indicates my constraint method is incorrect.

While the constraints interfere with the application of rotations to the leg limbs, confusingly both arms are adjusted as intended across repeated tests.

The most crucial functions of my solution relate directly to the locomotion of the biped. While having constrained arm chains will add a further level of realism, the project will be non-functional if the leg chains cannot be controlled.

Despite numerous more attempts to create the constraints, the behaviour produced did not make any improvements.

I believe the cause of the issue to be something I have not encountered so far in development.

Despite having already spent more development time on this element than intended, it is so essential to the projects functionality that I feel spending further time researching and attempting to implement the needed behaviour is justified.


Next Objectives 

Although relevant sources are not common, I will look for examples of where other developers have encountered and overcome similar issues, and the methods used to do so.
As above, much of the behaviour planned to come after this element will reply heavily on functional angle constraints, so I believe the deviation and potential removal of later stretch goals is the correct decision for the project.

I will continue to research and explore alternate approaches to constraining joint rotations for at least another week, before reviewing the projects remaining objectives and the final deadline.


References
Mukundan, R. (2009). A robust inverse kinematics algorithm for animating a joint chain. International Journal of Computer Applications in Technology, 34(4), p.303-308. Available at: https://www.researchgate.net/publication/220171083_A_robust_inverse_kinematics_algorithm_for_animating_a_joint_chain [Accessed 12 Apr. 2019]

Bibliography
Bergen, G. (2014). Math for Game Programmers: Inverse Kinematics. Available at: https://www.gdcvault.com/play/1020056/Math-for-Game-Programmers-Inverse [Accessed 12 Apr. 2019]

Bouckley, J. (2018). An Introduction to CCD IK and How to use it - Unite Berlin 2018. Available at: https://www.youtube.com/watch?v=MA1nT9RAF3k [Accessed 15 Apr.]

Kenwright, B. (2012). Game Physics. pp.192-203.

Kenwright, B. (2012). Inverse Kinematics – Cyclic Coordinate Descent (CCD). Journal of Graphics Tools, 16(4), pp.177-217. Available at: https://www.researchgate.net/publication/263226178_Inverse_Kinematics_-_Cyclic_Coordinate_Descent_CCD [Accessed 14 Apr. 2019]