Can't rotate object 360 degrees.

Can someone tell me how I can rotate my robot 360 degrees without it getting all twisted? In the screen shot below, I started at frame one with by inserting a (locrot) keyframe in it’s original rotation and location. Then I rotated it by 90 degrees at the tenth frame and raised it up a little (locrot), 90 more on frame 20 and raised it up a little more (locrot), but when I attempt to rotate it again 90 degrees on frame 30 , it gets all twisted.

Blend file: