The use of mobile robots for machining large components has received considerable research interest for the application of industrial robots in the machinery manufacturing sector. However, the low structural stiffness of industrial robots can result in poor machining quality under the action of cutting forces. Therefore, this paper proposes a simultaneous optimization method the mobile robot base position and cabin angle using homogeneous stiffness domain (HSD) index for large spacecraft cabins. First, a nonlinear joint stiffness model that considers the gravity compensator mechanism is established to describe the stiffness characteristics of heavy-duty robots more accurately. Subsequently, a HSD index is proposed to evaluate the overall stiffness values and stiffness fluctuation for all robot postures in the machining program. An optimization model is then established based on the HSD under the constraints of machining accessibility, joint angle limitation and singularity. The optimal base position and cabin angle are determined simultaneously using the sparrow search algorithm. Finally, simulation and milling experiments are used to demonstrate that the optimization method proposed in this paper can effectively improve the machining quality.