I remember watching that some time ago. It took a google search to link the name up with the anime, I don't know why but in my head the anime is named Zearth

. I can't recall how it ended though, I just remember them finding out what they were actually fighting and that they had a traitor amongst them. That robot was pretty mean looking though, probably the only reason I can still remember it.