Proceedings of COBEM 2009 Copyright c 2009 by ABCM 20th International Congress of Mechanical Engineering November 15-20, 2009, Gramado, RS, Brazil A REAL-TIME SIMULATOR FOR AUV DEVELOPMENT João Lucas Dozzi Dantas, joao.dantas@poli.usp.br Ettore Apolonio de Barros, eabarros@usp.br Escola Politécnica da Universidade de São Paulo Abstract. This work presents a real-time software for simulating the motion and operation of the main systems of an AUV. The real- time characteristics were defined so that the AUV control system can be tested taking into account the real characteristics of the embedded hardware, such as sensors and actuators. The simulation software includes a number of modules that represent the vehicle dynamics, environmental perturbations, actuators and sensors dynamics. In order to provide an easy integration of the simulation into the HIL system, the "Real-Time Workshop" together with the xPC Target was chosen as the development environment. They allow for the easy, simple execution on real-time of models generated by Matlab/Simulink tools. Keywords: Hardware-in-the-Loop, Simulator, AUV, Real-Time, Dynamics 1 INTRODUCTION The presence of simulators in the academy or industrial environment is quite usual since they can provide fast testing of devices and more complex systems at lower cost when compared to experiments on prototypes. However, in mechatronics systems, modeling components such as sensors and actuators may provide unreliable re- sults. In order to improve the realism of simulators, the hardware in the loop, HIL, approach includes components such as sensors or actuators that are embedded into a virtual environment. In field robotics, HIL has been used for testing the performance control and navigation software of autonomous aerial (Shixianjun et al., 2006, Imado et al., 2006 and Göktogan et al., 2003) and underwater (Lane et al., 2001, Song et al., 2003 and Devie and Lemaire, 1998) vehicles, for instance. This work presents the real-time simulation software that is going to be integrated into a HIL system of an autonomous underwater vehicle, AUV. The vehicle equations of motion are implemented into the simulation software, which generates the motion variables to be used by the real-time control system. In the future, such variables will be used as reference values for moving a mechanical platform which supports the real sensors included into the AUV. The actual signals from the sensors are going to be used for feeding the control and navigation software instead of the simulated ones. The final objective of this simulator is to test the control systems in the AUV embedded computer, both in software and hardware levels. The embedded computer test is going to be conducted using the simulator operating in real time, i.e. the simulation loop of the HIL system only consider the hardware and software of the AUVs embedded computer, and a computer running the simulation software in real time. This way, besides the simulator calculate only the dynamics of the simulated vehicle, it would be responsible for generating the sensors signals in a manner close to real. The technique of simulation in a HIL system was studied and implemented in the works Shixianjun et al. (2006) and Imado et al. (2006). In the first one the implementation occurred using a mechanical platform with one degree of freedom to perform the simulation of the attitude of an unmanned aerial vehicle (UAV). The second work used a robot manipulator of six degrees of freedom to simulate the position and orientation, in scale, of the simulated vehicle. Being this the type of mechanical platform which will be used together with the software’s simulation. As the HIL simulator must operate together with "real systems", one of its main requirements is to operate in real time and with a good synchronization among all the critical systems of HIL, as exemplified by Lane et al. (2001). To make the development of real-time simulator easier and practical were used the following softwares, in a similar manner to that implemented by Shixianjun et al. (2006): Matlab (MathWorks, 2008a), for high-level programming; Simulink (MathWorks, 2008c), for the modeling and simulation; Real-Time Workshop (MathWorks, 2008b), conversion toll of real time code; and xPC Target (MathWorks, 2008d), real-time environment of simulation. All developed by the Mathworks, and also having various tools of communication and simulation developed, allowing the generation of very complex, optimized and real-time softwares in a quickly and practical way. A second important requirement for this software is the dynamics simulation of the vehicle which have to be very realistic. For this, work Song et al. (2003) was considered a HIL simulator containing both the dynamics of the simulated vehicle as the dynamics of the sensors and the environment. In this work, was considered beyond the dynamics of the AUV the dynamics of their actuators. The mathematical models of dynamic equations governing the movement of the vehicle, used in this simulator, were based on the methodology presented by Ishidera et al. (1986), which are used fairly complete dynamic equations. How- ever, to model the hydrodynamics of AUVs were used models of non-linear efforts, which were thoroughly studied and