You are on page 1of 8

Hardware-in-the-Loop Simulation of UAV Non-Linear Control System of Mini-Helicopter

Vignesh Kumar Chandhrasekran1, Rimal Bhaskar Prasad1, Eunmi Choi1, Dugki Min2
1

School of Business IT, Kookmin University Jeongneung-Dong, Seongbuk-Gu, Seoul, 136-702, Korea vicky.tsc@gmail.com, b.bprimal@gmail.com, emchoi@kookmin.ac.kr
2

School of Computer Science & Engineering, Konkuk University, Seoul-143-701, Korea dkmin@konkuk.ac.kr Abstract
equipment in an operation of virtual environment. This testing leads to design the function effective countered by the control system for unmanned aerial vehicle. The critical problem in every field of engineering is making early decisions on specific design alternatives. This type of testing can be achieved in Hardware in loop simulation. Hardware in loop technique is a kind of real-time simulation where the input and output signals of the simulator show the time dependant values as the real process. Unmanned aerial vehicle includes ground station and other hardware elements to remotely pilot or self pilot the aircraft that can carry cameras, sensors, communication with other payloads. At the early stage the unmanned vehicle were used in military and defense application. Due to the need for monitoring some civilian application where the unmanned vehicle can help the human in the wilderness, trapped in collapse building or drift at sea. HILS technique is often used in critical hazardous application where a precise and methodological implementation is mandatory and it especially gets its wide application in military weapon research and design, as well as vehicle manufacture. One of the major contribution is this paper is to setup the HILS platform in the presence of some separated physical devices. The design and development of helicopter has much complexity and testing the system in the real time makes much cost. Testing embedded system is very difficult and has to encounter number of challenges such as, comparing actual output against the expected values, given all the present and past inputs Giving a combination of input makes sense. As the embedded system needs to manage control system of high flexibility in the field of unmanned aerial vehicle, hardware in loop simulation is technique used increasing in the development and testing of complex real-time embedded system. It provides an efficient platform for developing and testing real-time embedded system. HILS and UAV are composed of simulating computer, actuator, measurement equipment, sensors and controllers. The

This paper presents the design, simulation and real-time implementation of a control system for an autonomous mini-helicopter using QNX operating system with PC104 embedded board. The reliability of embedded computer systems can be difficult to analyze for several reason. In the development of unmanned vehicle initially it was much focused on military application to civilian application which has many issues in precise design and development cost. The rapid development in digital technology and Real-time embedded control system has been widely applied in various industrial fields. This includes developing flight test prototype and test articles early in the system life cycle to gain real experience and determine the real function such that the ultimate design leads to the correct development of the product. The flight operation and guidance for navigation can be developed early in the program to support the testing without any human intervention. Hardware in loop technique is a real time simulation where the input and output signals of the simulator show the same time dependent values as the real process. The GPS data and sensor real-time data in the HILS is fed into the closed loop of the control system which helps to tune and test the control system to directly fit into the UAV on real-time.

1. Introduction
In the development of aerospace there are various technology involved in making the vehicle intelligent. The vehicle intelligence includes vehicle longitudinal, latitude and position of the vehicle. The simulation of any system includes all experiment that emulates environment or condition to be experienced by the support of designing. The major factors in unmanned aerial vehicle include support of designing, testing and evaluating the control system. The designed system must be tested using realistic simulation of the

*Corresponding author: Eunmi Choi (emchoi@kookmin.ac.kr). "This research was supported by the MKE(Ministry of Knowledge and Economy), Korea, under the ITRC(Information Technology Research Center) support program supervised by the IITA(Institute for Information Technology Advancement)" (IITA-2009-C1090-0902-0026)

complexity of the plant under control is included in test and development by adding a mathematical representation of all related dynamic system. The software running on the HILS calculates the helicopters reaction to elevator deflection. It includes a physics model, containing helicopter mass, moment of inertia and aerodynamic characteristics, as well as the equation of motion. The result of calculation gives new value of the airspeed; pitch rate and normal acceleration are turned into digital signals and feedback to the embedded board. To reduce the cost and test the helicopter with high range of inputs with various situations the hardware in the loop simulation has be done and 3D visualization can be viewed when the simulation is carried out to know the actual behavior of the vehicle in the environment. QNX real time operating system is used for the control system; octagon board with PC104 has been used. In this research our focus is to design and develop a flight control system for unmanned aerial vehicle that can be used for real-time disaster prevention system. The main focus in this paper is to develop hardware in loop for testing unmanned aerial vehicle applicable for real-time disaster prevention system.

evaluating various control laws through hardware-inthe-loop simulation. The UAV experimentation system (UES) [8] has developed Hardware in-the loop system for demonstrating the automatic take-off/landing control for small UAVs.

3. Overview of Hardware in the loop Simulation


Hardware in the loop simulation enables to develop a dynamic simulation in order to study the response to certain stimuli cannot be analyzed in any other way. This is the implementation stage of the control algorithm into a system capable of running this algorithm in real time and interfacing with real plant model. The more realistic the plant model is the less time necessary here because the high-level design stage will have yielded a better controller already. It is this time translate the algorithm to production code and implant it into the prototype platform.

3.1 Development for HILS with V-shape Design


The V cycle is a representation of the typical process used for development of control system. Regardless of the application, the use of real-time and non-real-time simulation usually stems from the need to develop a robust control strategy for a complex system. The first step of the cycle is the requirement analysis. At this stage, it is necessary to define the extent if the system to control of an aircraft, referred to using the generic term plant, as well as the input that the controller can influence and outputs to monitor. It is very important to define the performance that the controlled system needs to achieve. This will determine if the controller is acceptable or not. The next stage is the high-level design, also called software in loop. The plant model is used in conjunction with a controller model to test the validity of the planned control strategies. This step does require simulation, but usually not in real time since both system models are part of a common mathematical model. However, it might be useful to distribute the processing of this model on multiple processors in order to accelerate the simulation and move to the next step faster. Once the control strategy has been selected, we move on to the function prototyping. The product of this is a real controller, perhaps with some diagnostics function, in a production ready format. With the prototype controller, the first step is to perform unit testing. This low-level testing usually involves the validation of the input and output interfaces and basic operation of the controller. Because the tests performed here involved only basic functionalities, a simple open loop simulator can be

2. Related Work
There are already different approaches on UAV helicopter HILS simulation. Rapid Software Prototyping Environment [1] presents the design, simulation and real-time implementation of a control system for an autonomous mini helicopter. Hardware in loop simulation is presented to study the use and advantage of prototyping environment in control design and simulation. Every module in the software environment was developed with Matlab/Simulink allowing rapid prototyping with automatic code generation for real-time operating system as QNX. Modeling and simulation of aerodynamic and ballistic system (SwRI)[8] uses model based design technique as part of its system design process to develop Ballistic models, design weapon scoring algorithm and test it in real-time system. SwRI staff evaluates fire control avionics with a mission relay tool which includes hardware in- the -loop simulation. It is capable for autopilot and it uses 6-DOF aircraft model for HIL simulation. NASAs Dryden [9] flight research center proposed the system that is design for the construction and testing hardware-in-the loop simulation using commercial software simulation packages and a custom designed simulation. This research described the integration of an avionics computer with unmanned aerial vehicle sensors and actuators, designing and implementing linear and non-linear simulation of the aircraft, setting up the control system architecture and

used. This means that the test system simple excites the input of the controller and monitors its outputs. There are no instances of the plant model needed to close the functional loop.
Define Requirement Complete integration and test

Subsystem level Specification

Subsystem level integration & test

Subsystem Design

Subsystem & integration

Subsystem Implementation

Figure 1: V-cycle representation

Once the basic functionalities have been validated, integration testing or hardware-in-the-loop tests will be done to validate the extent of the control algorithm as implemented in the prototype hardware. This includes all standard operating conditions and as many corners cases as possible. In order to do this, a real-time simulator running the plant model is the best test system. Once all of this is done, the prototype controller should have been thoroughly tested and can be connected to a real plant. Operational testing will allow the final calibration and adjustment of the control parameters to take place. Once the controller has gone into production, instead of inspecting the controller with real plant, they can be readily tested using the same plant simulator that was used in the prototyping stage, allowing rigorous, repeatable, automated tests to be carried out.

testing single UAV platform has been the comprehensive software-in-the-loop and hardware-inthe-loop testing of components before a flight test. Software in-the-loop/Process in the loop is the intermediate process to build the final stage of the HILS. To utilize the software-in-the-loop configuration, the un-compiled software source code, which normally runs on the onboard computer, is compiled into the simulation tool itself, allowing this software to be tested on the simulation host computer. This allows the flight software to be tested without the need to tie-up the flight hardware, and was also used in selection of hardware. This configuration is illustrated in figure1. This configuration is also used in the field to support flight testing, by operating on high-end laptop computer; once any modification has been tested with SIL configuration the hardware-in-the-loop simulation configuration is used. A key ingredient to the success of the flight testing single UAV platform has been the comprehensive software-in-the-loop and hardware-in-the-loop testing of component before a flight test. The disadvantage of the SIL/PIL test is the changed timing behavior of the software which, however, can be compensated by a synchronization protocol with a simulated real-time clock.

4. UAV Architecture
In the development of mini-helicopter it has more complex functionality and has to take decision autonomously or remotely. The UAV architecture is much complex and required higher level of configuration for controlling the vehicle, receiving the inputs from sensors and GPS make communication with Ground control system with RF section. The payload of the helicopter will have the controller of helicopter, sensor section, camera section and the RF section for communication.
Visualization Tool Ground Control System Human Interactive FlightGear

3.2. Software-In-the-loop/Process-in-the-loop
The software of embedded systems in the aerospace industry as well as the automotive area must fulfill high safety requirements. The software-in-the-loop (SIL)/Process-in-the-loop (PIL) is an approach tests which couples partially integrated software with an environment simulation. Instead of the usage of electrical interfaces, software interfaces provided by the operating system are used here which allows a direct information-technical communication with the simulation. This results in a higher flexibility fir the execution of tests and does not require special hardware. Therefore, SIL/PIL tests can be introduced early during the software development and offers the possibility to execute tests before the hardware is available. A key ingredient to the success of the flight

GPS Data

Flight Control System

UAV Plant Model

Navigation Data HILS

Figure 2: UAV Architecture

To deliver reliable, flight-critical software that operates remotely and autonomously from the ground control

station, the research must focus on creating the design that allows both the hardware and the software to be cost-effectively integrated.

4.1. UAV Plant model


The UAV system models contain components of the plant environment, which include six-degrees-offreedom nonlinear dynamic models of the aircraft with all variables computed as outputs. The plant model also includes atmosphere and turbulence, the landing gear, the steering wheel, control surfaces, actuators, sensors, engine speed, exhaust gas temperature; we designed UAV System using QNX Real Time Operating System. These models are also used to design UAV embedded software components, including autopilot models and integrated navigation algorithms. The autopilot model includes flight phase and mode logic; longitudinal, lateral, and directional loop control; throttle and fuel mixture control; guidance and navigation data computation; and engine status monitoring.

meet the requirements, changes can easily be made in the model-based environment and the tests run again. Once the system meets all requirements, code can be generated for the application partition, which can be loaded into the target embedded board.

4.3. Ground Control System


Ground Station is a kind of control unit which monitors the state of the UAV and provides a flightpath to the Embedded Controller in the Flight System. Ground Station supports GUI for monitoring and sends location data which include a flight-path to the UAV. Ground Station uses the RF-Ethernet device for communicating with the UAV. In the ground, the operator can monitor the current states of the UAV and issue commands to the running UAV via the ground station component. The ground station component and the UAV flight system component must be connected via communication channels so that they may monitor and command each other. GCS is mainly used for the visualizing helicopter dynamics parameters such as pitch, yaw speed etc, and analyzing the data comes from the FCS.

4.2. Flight Control System


The Flight System component has three parts, embedded controller, sensors, and actuators. A gyroscope and a GPS receiver were used as the sensors of Flight System. The gyroscope was used to provide attitude data. The gyroscope was set to generate roll, pitch, and yaw data and sends the data to the Embedded Controller, which was connected to the gyroscope via a serial port. The GPS receiver was used to produce geometric location data periodically. The GPS provided standard location data via a serial port for the Embedded Controller in the Flight System. A Servo-Actuator that was an actuator of servo motors controlled by PWM (Pulse Width Modulation) signals in the Flight System was assembled by us. The ServoActuator was designed to receive servo-control data from the Embedded Controller via a serial port and convert the data to PWM signals and use the signals to control directly connected servo motors. For Embedded Controller contains the control laws and receives inputs from GPS and sensors and guide the UAV in the desired waypoint. The control system is modeled in discrete time and uses fixed sample rates and comprised of a set of control laws. The typical model also contains finite state machines within Stateflow for mode logic in addition to the classic feedback control block diagrams. During simulation, model profiling information can be collected to evaluate performance and optimize loading. Model coverage tools are used to reveal possible errors by providing structural coverage such as modified condition/decision coverage. If the system does not

5. Mini-Helicopter Model
The design of helicopter model includes lot of mathematical analysis for making the helicopter dynamics much accurate. A helicopter is highly nonlinear multi-output system, which is exposed to severe disturbance from the atmospheric conditions such as its own rotor wake and wind gusts. The mathematical model of the helicopter must be in a detailed explanation of the dynamic model. The UAV helicopter is modeled with a set of nonlinear differential equations. The helicopter is considered as

a rigid body incorporating a force and moment generation process. The connections between subsystems and state and control variables are defined in Figure 3.

Figure 3: Connections between subsystems and state/control variables in a model helicopter

In this model, state variables and input signals are the following (see Figure 3):

Plant Model (Non Linear Dynamics Helicopter Model), Control System and Ground Control Station software to facilitate HILS simulation. The major programming language used was C/C++ for developing Control System and HILS package. Where P is the helicopter position in inertial coordinates, and = [ ]T are the helicopter Euler angles. The forces (fb) and torques (b) generated by the main rotor are controlled by the main rotor thrust (mT) and the longitudinal (a) and lateral (b) tilts of the tip path plane of the main rotor with respect to the shaft. The tail rotor is considered as a source of pure lateral force and anti-torque, which are controlled by the tail rotor, thrust (tT).Definition for both inertial and body coordinate frames are shown in Figure 4.

6.1 Design & Development of Plant Model


The first part of the design was the Plant model, which conforms to 6 Degree of Freedom Non-linear dynamics and the corresponding mathematical functions to calculate the dynamic behavior of the helicopter are defined and it will work in conjunction with the control system. It receives the input from the control system and in case of deviation it will recalculate the way point and guide the helicopter in right direction and it output will be received through actuators and sent as input to flight control system. In HILS the helicopter model is designed based on the mathematical functions that confirm to 6 degree if freedom non-linear dynamic model that is shown in the previous section. The issues addressed in the HILS package of the code are real time simulation of the flight dynamics, data communication with FCC: read control inputs and send state variables. Monitoring and packet control. The HILS is generic in nature and it can easily be adapted for any on-board computer.

Figure 4: Inertial coordinate system and body coordinate system

The equations of motion for a rigid body subject to body force fb and a torque b applied at the center of mass and specified with respect to the body coordinate frame is given by the Newton-Euler equation in body coordinate, which can be written as:

6.2. Design & Development of Flight Control System


The second part of the design is the FCC, which contains the on flight parameters of the flight control system. In this part the control laws are defined and it receives the dynamic data from GPS and Inertial Navigation System (Sensors), to check periodically the behavior of the plant model and transmit the proper signal to guide the helicopter in right direction. The flight control receives the input from GPS and Navigation sensor in the form of packets and it provides the dynamic data to the flight control system. Control parameters in the control system receives the GPS and navigation data and starts initializing the sensor navigation data using navigation data module, GPS data and data for longitude degree, latitude degree, collective degree and rudder degree from swap module and data scheduling will be managed by packet transformation. These functions are passed to the global data which has PacketSwm function manage data packet information and navigation sensor information.

Where vb is the body velocity vector, b is the body angular velocity vector, m specifies the mass, I is an identity matrix and I is an inertial matrix. Non linear control techniques are useful to control the helicopter when the state variables are allowed to vary significantly around their values in the equilibrium. In this control law the rotation due to the yaw is considered. Furthermore, a non-linear function precluding the loss of stability when the variations in the roll and pitch angles are significant and the helicopter is in a position significantly separated from the hovering coordinates

6. Design & Development of UAV for HILS


Based on UAV HILS architecture, we have used QNX-Real Time Operating System to develop our

6.3. Design & Development of Ground Control station

The final part of the design is the GCS- Ground Control Station, which helps to monitor the helicopter position and behavior remotely. It is connected to FCC and receives signal through RF modem. Measurement studio API is used with the Airs Active X control. GCS receives the following data from FCC such as Roll, Pitch and Yaw. We can also view the position of the UAV and GPS data such as latitude and longitude values. In case of operating in Manual mode we can also set the Side Speed, Forward Speed, altitude and yaw altitude from GCS to FCC. Ground Control Station (GCS) is used to control the helicopter remotely. The GCS provides a convenient way for command, control and monitoring activities with control elements, up- and downlink, status and navigation information. It keeps system control and data communication separated from sensor-control and -downlink.

function will receive input from navigation and GPS data module and params function manager the parameter data through packet transformation. All this information will be sent to plant model through control parameter module. The navigation sensor parameter contains the direction such as altitude, longitude, etc., with the help of control parameters module plant model communicate with the global data using packet swapping, navigation sensor and parameter module get all control signals. These signals are then transmitted to plant model to guide the UAV in the desired way point and control its dynamic behavior. The dynamic module that contains the helicopter mathematical model is used to calculate the helicopter dynamics such as Torque. Moment of Force, Omega, Rudder, Lamda, Fuselage force moment, Side speed, Forward speed, Roll rate, Pitch Rate, Yaw Rate, Altitude, Longitude and Lateral Flapping, Collective pitch, Tail Rotor pitch and shear Wind. Using a Global Positioning System (GPS) receiver with an RS-232 serial interface as an example (shown in figure 6), we can use MATLAB and Instrument Control toolbox to work with diverse external devices without leaving the MATLAB environment. MATLAB automatically generate a MATLAB script that can be shared, reused, or incorporated into a MATLAB application. The GPS is configured to broadcast NMEA format data, a common option in consumer-grade GPS receivers. After connecting the GPS receiver to COM1, we can select the Configure tab for COM1 and set it to match the serial port parameters. NMEA defines these parameters as baud rate 4800 bits per second, 8 data bits, 1 stop bit and no parity.
MATLAB

Figure 5: HILS System Setup

This ensures flexibility and easy reconfiguration without comprising system stability.

Execute tmtool

Test and measurement tool

6.4. GPS and Navigation input Handling in HILS


COM1

For generating the GPS data an open source tool which is integrated with the MATLAB send the appropriate GPS data. The open source GPS data gives varying information in different ranges for minihelicopter behavior. The information from the GPS gives the position, altitude, and longitudinal parameters to flight and directs the flight with the way point ad destination. Also the real navigation parameters are modeled using matlab to send to the flight control system. The GPS and sensor data is send to the flight control system via serial ports. Similarly NavSensor

Find and connect COM1

GPS

Figure 6: Flow of serial communication between Matlab and GPS

Figure.7 show the MATLAB script that was generated when interacted with TMTool with GPS connection. Once we have exported the updated script in MATLAB_GPS.m, we can insert MATLAB routines to filter the data stream.

% Create a serial port object. obj1 = instrfind('Type', 'serial', 'Port', 'COM1', 'Tag', ''); % Create the serial port object if it does not exist % otherwise use the object that was found. if isempty(obj1) obj1 = serial('COM1'); else fclose(obj1); obj1 = obj1(1); end % Set BaudRate at 4800. obj.BaudRate = 4800; % Connect to instrument object, obj1. fopen(obj1); % We only want the strings with $GPGLL data=''; while isempty(strmatch('$GPGLL',data)) data = fscanf(obj1); end % Parse the string to obtain coordinates [lat,data] = strtok(data,','); [lat,data] = strtok(data,','); [nsCardinal,data] = strtok(data,','); [long,data] = strtok(data,','); [ewCardinal,data] = strtok(data,','); lat = str2double(lat); long = str2double(long); % Display the results disp({lat,nsCardinal,long,ewCardinal}); % Free the serial port fclose(obj1);

found variation with varying GPS data and navigation data which was used for flight control system. This hardware-in-the-loop simulation is helpful in reconstructing post flight and analyzing system performances. It saves expenditure of test and evaluation by switching to simulation validation from actual flight tests. The future work will be focused on Feeding Dynamic GPS and Sensor Data for HILS simulation and synchronization of GPS data with Control System module.

8. Reference
[1] Carlos Mario Vlez, Andres Agudelo and Jorge Alvarez, Modeling, Simulation and Rapid Prototyping of an Unmanned Mini-Helicopter, AIAA Modeling and Simulation Technologies Conference and Exhibit 21 - 24 August 2006, Keystone, Colorado, pp 1-10 [2] Weidong Xiang, Paul C. Richardson, Chenming Zhao, and Syed Mohammad, Automobile Brake-byWire Control System Design and Analysis, Vehicular Technology, IEEE Transactions, Jan. 2008, pp. 138 145 vol.57 [3] Elisabeth A. Strunk, John C. Knight, and M. Anthony Aiello, Distributed Reconfigurable Avionics Architectures, Digital Avionics Systems Conference, 2004. DASC 04. The 23rd, 24-28 Oct. 2004, pp. 10.B.4- 101-10 Vol.2 [4] Y. C. (Bob) Yeh, Safety Critical Avionics for the 777 Primary Flight Controls System, Digital Avionics Systems, 2001. DASC. The 20th Conference, 14-18 Oct. 2001, pp. 1C2/1 - 1C2/11 vol.1 [5] Elisabeth A. Strunk, John C. Knigh, Assured Reconfiguration of Embedded Real-Time Software, Dependable Systems and Networks, 2004 International Conference, 28 June-1 July 2004, pp. 367 376 [6] Kristina Ahlstrom & Jan Torin, Future Architecture of Flight Control Systems, Aerospace and Electronic Systems Magazine, IEEE, Dec. 2002, Volume: 17, Issue:12, pp. 21 27 [7] Shixianjun, Song jiakun , and Liu hongxing, Hardware-in-the-loop simulation framework design for a UAV Embedded Control System, IEEE, Proceedings of the 25th Chinese Control Conference, , Harbin, Heilongjiang, 7-11 August, 2006, pp 18901894

Figure 7: MATLAB script that was automatically generated when we interacted with TMTool

7. Conclusion
The HIL simulation provides accurate performance due to inclusion of actual hardware. The advantages of HIL include the hardware testing, support of production of flight hardware, acceptance testing of onboard software, support of production. This paper the main focus was on setting up the HILS environment and developing the Helicopter model and control system for Unmanned Helicopter for RealTime Disaster Prevention System application. Also in the HILS, we have added the GPS and Navigation data that was collected in the real on flight testing. QNX OS as the development environments, for which the Octagon embedded board, was used for the Flight Control System. The simulation testing was done and

[8] P. Riseborough ,Automatic Take-Off and Landing Control for Small UAVs, 2004 5th Asian Control Conference,IEEE, April 17, 2009, pp 754-762 [9] Modeling and simulation of Aerodynamic and Ballistic System, http://www.swri.org/ [10] NASA's Dryden Flight Research http://www.nasa.gov/centers/dryden Center,

[11]Ashish Tewari Indian Institute of Technology, Modern Control System Design with MATLAB and Simulink, John Wiley & Sons, 2002 [12] Hermann Kopetz, Fellow, IEEE and Gunther Bauer, The Time-Triggered Architecture, Proceedings of the IEEE, Jan. 2003, Volume: 91, Issue:1, pp.112 126 [13] Alessandro Casavola and Emanuele Garone, Adaptive fault tolerant actuator allocation for overactuated plants, American Control Conference, 2007. ACC '07, 9-13 July 2007, pp. 985 - 3990

You might also like