Ok I think I now completed all of the 1 and 2 standard joints.
they now inherited from some joint, for example the corkscrew and the sliding contact inherit from the slider so they has all the properties of the slider.
the universal inherit from the hinge, so it has all the features of a the hinge, plus its own.
My mistake was that I was too greedy, I wanted to inhered from a common joint and that makes it too difficult, instead is like evolution, joints has common heritage and is a leaf joint needs a functionality from some other joint that is on a separate branch, they copy the functionality (converge evolution).
this is the case of the sliding contact, is a slider but is also a hinge, but since it has more in common with a slider, it is derived from slider and copy, paste and edited the hinge functionality.
This seem to be a lot more consistent and simpler. because now similar Joints have the same reference,
for example before if I was using a hinge and I wanted to change to a slider contact to add suspension, they were using different frames, so lot high level setup had to changed, now the joint can be a slider contact and making a is just and option.
And example of that is a tank vehicle, some wheels has suspension and some do not, now they all can be slider contacts.
This does not solve everything but I like better.
now to the 3dof joints, and these are there one lineage.
Ah Joe, if you sync, I committed two Universal joints spinning on the two axis.
you will see that one bends and the other does not.
this is where the physics get strange, the joint on the right, is the one that is correct.
while the one of the left does not bends but is wrong.
here is the reasoning and why the change I made to move the derivatives to the joint payoff.
Remember the Gyro, if the object has one angular velocity and the gravity apply a torque to try to toppled the disk, the joint generates a side torque that gives a processing angular velocity.
here we have the pivot at the center of mass but the wheel has a precessing velocity, therefore there move be a conservative torque acting on it to bend to the side.
you can see that effect in this video, at 2:30
https://www.youtube.com/watch?v=NeXIV-wMVUksee that when the professor hangs a weight, the wheel changes its velocity and bends to match the conservation of angular momentum.
then he removes the weights but the wheel keeps the bend angle regardless.
what happen is that the is the orientation that matches the main angular velocity and the processing velocity.
The moral is that each processing velocity has a unique side tilt angle. and that's inevitable.
This is what was different before. I was using this angle as an contraint error violation and apply a torque to fix it, but that generates a perpetual non conservative torque in the system that try to rotate the entire system.
now the joint does what the derivative say they has to do, and the error violation is added by the joint implementation.
in the case of the universal joint now we have the option
joint1->SetHardMiddleAxis(0);
which is applied to the left joint and that one use the angular error to generate a torque that keeps the wheel up.
But remember that joint is actually applying a torque to the two bodies, if the parent body was has a non zero mass, that system will be spinning around in way that would not make sense, because it getting a torque from the thin air. the one on the right will be acting as a body that will be moving in place, because after the momentum align all torque will be conservatives and produce zero work.
This is what explain all the problems we were having when using joint that rotate in three axis to control the balancing gait, is was clear that the joint was adding these weird torques that were coming form the conversion of error violations to joint accelerations.
This is new information, we did no have before.
anyway I will continue with the 3dof joints now.