Setting opposing target movement of configurable joints

I have 2 configurable joints that rotates only in x-axis in the opposite direction. I had a look at this but I am not certain how to capture only the X axis value when the rotation is expressed as Quaternion.

Think of it as 2 platforms ----O---- ----O---- , O is the pivot, that must rotate in opposite direction by using targetRotation

My proposed algorithm is as follows:

  1. Get self initial rotation
  2. Get target initial rotation
  3. Find target current rotation
  4. Find the difference of target’s angle in x
  5. Apply the difference in current joint as a negative value

Any pointers how to obtain the x rotation value from the configurable joint and apply it to current joint?

EDIT: I figured out the first one by using Transform.localEulerAngles

Solved the last step by using ConfigurableExtension.cs and use it as the following

SetTargetRotational(myJoint, Quaternion.Euler(angleNeeded, 0, 0), myJointInitialRotation);

Done! My system is working neatly. Thanks to mstevenson for his script.