Caterpillar goes into random rolls

My caterpillar robot begins moving forward fine then it suddenly begins to curl up trying to right itself when it has not tipped over. It will curl to the right then to left randomly then it will straighten out and fuinction normal. When the head antenna is activated it backs up and when the tail antenna is activated it moves forward. But randomly curls up. If it does fall over,it  does right itself fine. Anyone know why it would be be randomly curling up? I checked all the wiring and everything checks out. There are no shorts.