Can't use Automatic weights I want to rig and use automatic weights to a robot.



The problem is that when I try to choose Armature Deform with automatic weights, I get error:

Bone Heat weighting: failed to find solution for one or more bones

I tried searching for a solution to this problem and was informed that I should make sure my mesh doesn't have doubles and also make sure to join together all the objects. I have done that but still get this problem. 

I would appreciate if anyone could help me with this problem.
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.