Help with righ(how to get rid of twists on the IK target poles)

Hi, I finally finished up a rig to find out that when I put weights for the bones on each of the meshes that some places where I added IK pole targets it twists and I have pretty much tried everything to solve it. If anyone knows of a way to solve this problem and keep the tracking of the IK target poles to the joint bones then I would appreciate it very much.
I will also add in the .blend file.
here is the link to the file:
https://www.box.net/shared/ha162yqye7nbmudffjdj
Thanks for reading.
Sorry that I spelled righ instead of rig.

You’ve got a couple of problems with that rig. To see what I mean, turn off bone shapes, and turn on x-ray in the armature panel. Select a forearm bone with the ik constraint, and delete the pole target bone and the pole target fields in the bone constraints panel. Now you will notice the arms are bent upwards, looks really painful… The problem is there is no ‘pre-bend’ to the arm, to see this, in the armature panel switch to ‘rest pose’ and view the model from the top. The arm chain is a straight line and that’s the problem. IK works best if you have a small amount of ‘pre-bend’ to the bone chain so it kinda knows how to bend. If you select the armature, enter edit mode and select the ball at the elbow and move it backwards some, then select the ball at the shoulder and move it forwards some, this will add a bit of ‘pre-bend’ and the rig works better.

Turn on axis in the armature panel to display the bones axis. The z-axis of the arm bones are pointing downwards, now you can go ahead and set up the pole target info in the constraint, and adjust the pole angle so the z-axis still points downward. For me, I did the left arm, and the pole angle set to 0 was correct. Same thing should work for the right arm.

Couple of things I noticed: The shoulder bone’s z-axis points up, the upper arm and lower arm z-axis points down, for consistency they should all point the same direction. Minor detail… Quick fix for this while in armature’s edit mode is to do a ctrl-n -> z-axis to reset the bone’s roll angle, (didn’t test it). A more serious problem is the fact that the leg bone’s z-axis it totally off. On one leg the z-axis points leftward, the other leg is rightwards, they should be pointing forwards or backwards and should match. Left leg z-axis points forward, so should the right leg. This can mess with the ‘copy pose’ and ‘paste flipped pose’ operations, which can be a time saver when animating.

Randy

Thanks for the help I will work on correcting the rig today and tomorrow and repost the .blend file tomorrow (hopefully).
*update
Ok I worked on a few of the things you mentioned and the rig does look a bit more orderly. I was wondering if you had any spare time to make sure that I fixed it the right way you told me to. Thanks again for the help.
here is the link to the new file:
https://www.box.net/shared/sjbyyn1gtoaik50jsbih