Its funny that all the robot-goes-rampage thing always started with a robot/A.I./Super Computer becoming sentient and in order to protect itself, practically wipes out humanity. This has been depicted in Matrix (with B1666ER), Terminator (SkyNet), SAAB (Silicate wars), and other.
So to avoid having a robot triggered Armageddon, just do the simple thing, put a limit on robot A.I.