Pages

Friday, May 31, 2019

CCD - Joint Rotation Constraints (2nd Attempt)

While I have struggled to find IK sources which describe this problem or solutions to it, further reading and involvement in robotics/maths forums did indicate some potential solutions.

Using these prompts and research from recent weeks I have made multiple more attempts to rewrite my constraint method and CCD script itself to keep the CCD function, while allowing joints to rotate within their defined boundaries.

Alternate Attempts 

Having made my solution to prevent singularities within the IK calculation I considered the rotations themselves. Having researched gimbal lock in a previous blog entry I realised that the constraints on specific axis may be preventing the successive axis from rotating as intended.
To overcome this, I calculated the corrective joint rotation in quaternions, then applied this to the joints before clamping quaternion values.
Unfortunately, this did not yield improved behaviour – pointing again to singularities as a potential cause.

I reverted to my previous CCD implementation and reviewed my method of clamping to the allowed rotation values.
I reviewed how, and at which point each joint was having its rotation boundaries enforced. I have ensured that the restrictions are applied before the subsequent joint is assessed so that the constraints of any joint should not directly impact later joint’s ability to accurately reach toward the target position.

I have attempted to beak the assessed quaternions down in to their separate parts, though doing so to compare the values to the angular limits then reapplying them to joint rotation gives the same outcome as use of Euler angles.

After exhausting all ideas I turned to using Unity’s ‘Rotation Constraints’ component to enforce the joint angle limits.
The performed more poorly than my own implementation, causing significant jitter, singularities and appeared to interfere with the angle configurations of later joints.

Figure 1: Further failed attempt Figure 2: Further failed attempt

Still puzzled over the failure of my attempts, and how the initial attempt was able to constrain the arms and spine while accommodating the CCD algorithm - while it prevented the CCD algorithm from manipulating the leg chains, has left me in a position where all avenues my research has found have been explored and failed.


After seeking the advice of my specialist tutor, I agree that it is now time to move on and look to tackle the remaining project milestones with the development time I have remaining.
 


Outcome 

No CCD constraints I have written have successfully constrained the applied angles. While functional for the biped spine and arms, the algorithm was not able to control the leg chains.
For my solution, the arm chain behaviours would simply exist to add further realism to the biped locomotion, whereas the leg chains are fundamental to the functionality of the biped. Currently the attempted constraints prevent the CCD algorithm from manipulating the legs at all, so must be reverted to my earlier unconstrained CCD algorithm, shown in figure 3:
Figure 3: Unconstrained CCD solution


Next Objective 

I am very aware of how much development time has already been spent working towards this goal and am conscious of not spending further development time unnecessarily. I am not confident that investing more development time in this functionality will allow me to create the behaviour I need.

I expect this to make the remainder of development extremely difficult – as until now I have anticipated and planned all the later functionality to use the constraints imposed by the CCD algorithm as a basis for their own solution logic.
Despite the risk of advancing without the constraints in place, I think if I do not attempt to move forward with development (as there is little time remaining until the deadline), the project will likely never progress past its current stage.

My next entry will not attempt to add any form of CCD constraint, as my focus turns to implementing a 3D biped locomotion system.