Can I merge multiple objects into one, while keeping the rig working?
For the rigging of machines / robots / non-organic objects, etc. you have 2 methods.
If you want to keep separate objects, use basic parenting: Select on piece, shift select the armature, switch to Pose mode, select the bone you want and CtrlP &gt; Bone
If you want to join all your objects into on (i.e. your case), parent with vertex groups:

Select all your objects, join them with CtrlJ
Select the object, shift select the armature, press CtrlP &gt; parent With Empty Groups (which is going to create vertex groups in your objects but no vertex is assigned for the moment)
Go in Edit mode, select one part of tour object (example: the head), go into the Properties panel &gt; Object Data &gt; Vertex Groups, select the head vertex group (i.e. the vertex group that has the name of the bone that is supposed to control the head), click the Assign button under the Vertex Groups list, and so on