IK constraint bone to inital plane

Hi, I’m trying to rig a chain of pivot and ball joint to animate a mechanism

IK chain of 3 bone make nearly the result I want, but the vertical pivot gets twisted because of an angle

How can I fix my rig to make the vertical white rod stay in its plane ?
I tried IK contraints but it doesn’t seem to work. And it seems I can’t understand pole contraints.

Here is the file
SO_Rig.blend (5.58 MB)

I am on holiday without my Mac so I cannot look at your file until Saturday. But the way I would stop an IK chain twisting is to lock the appropriate axes in the first bone in the IK chain using the IK Properties panel, which you find in the bone section of the armature. If this is not the answer, you will have to wait until I get home as nobody has answered you yet.

Cheers, Clock. (Sent from my iPhone so involved me in difficult typing…)