Problem with shaft encoders

Right now our team is working on programming skills, and we have two shaft encoders in our base. Even though we do the forward and backward movements like a charm, when it comes to turning the robot sometimes makes the desired turn and sometimes fails by a lot. I’ve tried to put the motors to 50 speed when turning but this doesn’t help a lot. Any suggestions?

Well what does the code look like? And can you post a video of the behavior it produces.

This is the code, and right now I dont have any videos of it but I’ll try to post one in a couple of days. @tabor473