Bone heat weighting: failed to find solution for one or more bones after i remove doubles
I quickly fixed it , First you have to select the robot then press[ ALT + P ] , Then select clear parent and keep transformation

Do that to the armature aswell.

Now select the robot , Hold SHIFT and right click the armature . 

Press CNTRL + P

Add automatic weights. 

It will now work , if you have problems just ask

Also keep in mind you will have to some manually weight distribution because it does get messy