This paper conducts a detailed study on adaptive compensation for RTHS, with a focus on robustness against the choice of adaptive gains. The main goal is to design a dynamic compensator that does not require previous knowledge of the specimen interaction with the transfer system. Hence, an adaptive gain optimization procedure is proposed to improve the robustness of this technique. Optimal adaptive gains are obtained through a particle swarm optimization approach, where the evaluation of the objective function is carried out by a series of numerical simulations of the interactions between specimen-transfer systems. As a proof-of-concept, this method is evaluated using virtual RTHS simulations, including the controller design and calibration processes. The method achieves excellent compensation using the same controller for various experimental scenarios, including different partitioning cases, uncertainties in the actuator and experimental substructure parameters, and noise in measured signals. Through this development, structural laboratories will be capable of testing different substructures while avoiding unnecessary system identification to capture specimen interaction, and without a significant compromise in accuracy or laboratory safety.