This paper introduces a hardware-in-the-Ioop (HIL) system to simulate plug and play controllers for autonomous underwater vehicles (AUVs). The HIL system is a real-time simulator composed of two parts: a model-based virtual plant and an embedded controller. As HIL system does not require the design of physical systems, therefore, it can reduce the control design cost. In this paper, controller and model are both implemented using Mission Oriented Operating Suite-Interval Programming (MOOS-IvP) software. At first, the AUV mathematical model is obtained by dynamic and hydrodynamic analyses. Then, a robust controller is designed considering the uncertainties and nonlinearities. The robust controller is implemented on a Raspberry Pi microcomputer, while the virtual plant is simulated on a computer. Finally, MOOS-IvP based HIL simulations are compared to MATLAB simulations.