Can't use Automatic weights
Automatic weight, which can fail for a lot of reasons in every non-manifold mesh, is not suitable for robot-like movements, because it leads to stretch the body parts with an "organic" feel, that is not robotic at all. When parenting (Ctrl P) use the option "with empty groups" instead. Then select all vertices of a rigid body part (i.e. the forearm), select the appropriate vertex group and click "assign". Repeat for every bone of the rig.