INT J COMPUT COMMUN, ISSN 1841-9836 8(5):760-768, October, 2013. Scalable Architecture for CPS: A Case Study of Small Autonomous Helicopter J. Yao, J. An, F. Hu Jianguo Yao*, Jie An, Fei Hu School of Software Shanghai Jiao Tong University, Shanghai, China 800 Dongchuan Road, Minhang, Shanghai 200240, China *Corresponding author jianguo.yao@sjtu.edu.cn anjie@sjtu.edu.cn, hufei@sjtu.edu.cn Abstract: Building a scalable and highly integrated systems is an important re- search direction and one of key technologies in Cyber-Physical Systems (CPS). Au- tonomous helicopter is a typical CPS application and its flight presents challenges in flight control system design with scalability. In this paper, we present the integration architecture of hardware and software for the flight control system based TREX 600 helicopter. In order to enhance scalability, the flight control system uses the PC104 and the ARM which is exerted to process the measurement data, including the posi- tion, attitude, height etc. The flight control is developed based multi-loop decoupling PI control which is easy to be implemented. Finally, the flight control system is successfully verified in the actual autonomous flight control experiment. Keywords: Cyber-Physical Systems (CPS); autonomous helicopter; component. 1 Introduction Cyber-Physical Systems (CPS) consider both cyber parts (e.g., computing and communica- tion) and physical parts (e.g., hardware), as well as their interactions [1]. Autonomous helicopter is one of typical applications in CPS and requires dynamic configuration of system-level perfor- mance. Helicopter has the advantage of being able to vertically take-off/landing, hover and lateral flight. Because of its flexible flight maneuver, even in a restricted region helicopters can fly free and hover in the air for a long time. These characteristics make unmanned aerial vehicle (UAV) applicable for many military and civil applications. For example, geographic map detec- tion and aerial photography, security patrols, combat assault, resources exploration, forest fire prevention, film shooting, pesticide spraying etc. UAV has become a popular research topic for many military and university research institutions recently. The UAV flight control system developed by Stanford University airborne module includes two GPS receiver, one tachometer for wing feedback, two sets of video camera and transmitter; one Pentium-486 processing board, which can realize the automatic hovering and landing [2]. The American Georgia Tech University UAV airborne module includes one DGPS receiver, one heading magnetometer, three axis inertial attitude angular velocity measuring unit, one set of sonar and radar altimeter gets height information, one set of cameras, one PIIPC processing board and wireless card, which not only can manipulate the autonomous flight, can also identify the building and its entrance [3]. American Berkeley University Research of UAV, now can be done independently of the take-off and landing, obstacle avoidance in the complex environment based vision technology, on specific target tracking and anti-tracking, collision detection and multiple machine coordinated flight. Meanwhile, there are researches on UAV flight control system in China, such as Zhejiang University has implemented UAV airborne system which is based DSP-CPLD, the main research of it is in the hardware realization and software interface; Nanjing University of Aeronautics & Astronautics has designed a UAV flight control system which is based 586-Engine micro control module. Copyright c⃝ 2006-2013 by CCC Publications Scalable Architecture for CPS: A Case Study of Small Autonomous Helicopter 761 Figure 1: Implemented rotorcraft UAV. Figure 2: The avionics control system box. Based on the listed components for a UAV airborne system, we design and assemble a simple prototype UAV helicopter. A TREX 600 radio-controlled helicopter is chosen as the basic flying vehicle. A simple avionic system will be designed. The miniature PC104 [4] [5] computer will be taken as the airborne computer system. ARM will be taken as the sensor data collection controller [6] [7]. The ARM data collection controller not only reduce the burden on the PC104, but also make the airborne system scalable. The full avionic system has been tested successfully on controlling the TREX 600 helicopter model, and the helicopter can realize fixed point hover and autonomous trajectory plan flight. The outline of this paper is as follows. The components of avionic system are introduced in Section 2 in details. A flight control law which is based multi channel decoupling PID control has been designed and implemented in Section 3. Section 4 show the effect of the overall actual flight control experiment. Finally we summarize some conclusions in Section 5. 2 TREX 600 Helicopter Model Description We choose a small size model helicopter (i.e., TREX 600) which is available in the market as the basic aircraft of UAV system. TREX 600 is a low cost model helicopter and it can easily to be upgraded. We can buy the individual parts of the model helicopter in market easily. TREX 600 model helicopter is a high quality toy helicopter in the hobby industry. The control way of main rotor blades is CCPM, three servos are linked to the swashplate to control collective and cyclic angles of attack of the main rotor blades. We upgraded the model to be a UAV helicopter with a complete auto-pilot system, sensors and a necessary communication modem. The manual and autonomous control model is switched by the 7 channel of the receiver. The helicopter itself weights about 1770g, and it can provide an effective load up to 1200g, which is far above our budget on the weight of the avionic system and other components to be upgraded. The fuselage of helicopter is constructed with carbon fiber board, which can well protect the flight control equipment. The protected principle is the helicopter body will break open at the crash moment, and the disintegration of aircraft can reduce the impact of crash. The main rotor blades are replaced with heavy-duty carbon fiber ones, which has the quality of high weight and high hardness. The new rotor blades can accommodate extra payloads. The helicopter is powered by a 600XL brushless electric motor which generate 2.68hp at about 14000rpm.The full length of fuselage is 1200mm,the height of helicopter is 405mm.The main rotor is about 1350mm and the tail rotor is 240mm. The implemented rotorcraft UAV is shown in Fig. 1. Designing and installing the flight control system is the first step to implement of the UAV helicopter system. It is necessary to take into account the particularity of environment during the design process, strong magnetic field as well as intense vibration interference environment. So we must adopt the shielding and shock-absorption measures. In addition, the weight and 762 J. Yao, J. An, F. Hu the size of the avionics box are strict limited because of the limited payload capacity. On the other hand, helicopter’s center of gravity position has a great influence on the flight. The general center of gravity position is in front of the main spindle 10mm. The standard must be fulfilled both before and after the installation of flight control system, so as not to destroy the balance of the helicopter. We adopt the design pattern of integrated avionic system [8], which is shown in Fig.2. All the flight control system equipment installed in a 26×16×7cm aluminum box, which can play the role of electromagnetic shielding. To try not change the aircraft center of gravity, aluminum box frame mounted on the bottom of aircraft’s landing gear. Because of there is no enough room under the original landing gear to install the designed avionics system. While we re-design a landing gear with aluminum alloy and make a larger room under the gear for the control box, the dimensions of it is 30×29×43cm. Soft connection is adopted between the new and old landing gear, which can protect the flight control equipment when the helicopter land on the ground. To avoid the disciplinary vibration about 30HZ caused by characteristic of the helicopter, silicon rubber are mounted between the aluminum box and the new land gear. Experiments show that the measures we take can effectively isolate vibration source. 3 Scalable Architecture for Helicopter System The overall structure of the flight control system shown in Fig.3. Using a PC104 as a flight control computer, it is the core of the system. The input data of the PC104 are flight sensor data and control commands, output data of it is servo control signal PWM signal. One ARM board is used as the flight data collection module, it collect data of each sensor and then send them to PC104 flight control system via Ethernet. Ground station PC send PC104 control commands through wireless module. The control commands contain the helicopter’s flight path. A servo controller board which is to control the switch between the automatic mode and manual mode. It not only guarantee flight safety but also ensure that the control algorithm to be tested and validated [9]. Figure 3: The logical connection diagram of rotorcraft UAV system. 3.1 Flight Control Computer Component The computer system installed on the helicopter is PCM-3586, a typical industrial embed- ded computer system. PCM-3586 is a low power consumption (4W@800MHZ), X86 embedded motherboard which is designed specifically for PC104 field. The CPU type of PCM-3586 is SOC Vortex86DX, it has serial/parallel port, high-speed USB2.0, 10M/100M Ethernet, 256MB DDR2 system memory, 4G hard disk, 16 channel PWM output. The installed operating system in PC104 is Fedora11, which integrates the GCC compiler and eclipse development environment. The main tasks of PC104 include: Scalable Architecture for CPS: A Case Study of Small Autonomous Helicopter 763 • To maintain wireless communication with the ground station computer, the exchange data consist of control commands and monitoring information. • Receiving sensor flight data, including flight attitude, altitude, heading, latitude and lon- gitude information. • To execute flight control laws with a main frequency of 50HZ, and generate PWM signal to drive actuators. 3.2 Flight Data Collector Component The ARM9 industrial embedded computer system is used as Flight data collector. It has a Samsung S3C2440A processor, fully compatible with Linux OS, with a main frequency 400MHz and a 64MB SDRAM. One 256MB compact NAND flash disk is taken as the storage media of the Linux OS, which kernel version is 2.6.32.2 and integrated the Arm-Linux-GCC cross compiler environment.100M Ethernet RJ-45 interface (using DM9000 network chip). The flight data collector receive the sensors data includes: height(altimeter), flight heading(three- axis compass), the aircraft attitude(gyro), position (GPS), and then use the tracking differentia- tor filter way to isolate the biases. The output sensor data is transmitted to the flight control computer through the Ethernet which is based on UDP protocol. 3.3 Position Sensing Component HC12 OEM can tracks GPS L2 and SBAS satellite signal produced by a Canada com- pany.GPS provides three dimensional coordinate, which difference accuracy less than 0.5 meters. The GPS provides position estimates at 10Hz. The OEM board should connect with the GPS antenna to get the position information. 3.4 Attitude Sensing Component The CS-VG-02 vertical gyroscope is used as the aircraft attitude sensor, which is inertial sensor based MEMS technology. The gyro is used to measure inclination of the helicopter relative to the horizontal plane, it has two sensitive axes respectively detect roll and pitch angle change, can output angle and angular rate signal simultaneously. The gyro angle static accuracy precision of less than 0.6 and dynamic accuracy of less than 2.5 degrees. It provides fast response time up to 200Hz and communication interface is RS422. 3.5 Heading Sensing Component Flight heading sensor use the MWC3000L high-precision digital three-axis compass, which integrated three-axis magnetic resistance sensor and two-axis tilt sensor on-chip. It provides roll angle, pitch angle, heading angle and magnetic state, orientation repeatability of 0.5 degrees and inclination repeat of 0.1 degrees. The information update rate is 20HZ. But we found that the heading angle signal generated by compass under the condition of vibration can not be used. Because of the roll and pitch angle in vibration condition is unstable, which leads to the heading angle instability. Accurate yaw angle can be calculated by the original data of three axes compass. Under the premise of making the compass’s installation position parallel to the earth’s surface, yaw angle can be calculated from the magnetic field in the X, Y direction components.The yaw angle ϕ calculation formula is shown as follows: 764 J. Yao, J. An, F. Hu ϕ =   90 + arctan(hx/hy) × 180/π, Hy > 0 270 + arctan(hx/hy) × 180/π, Hy < 0 180, Hy = 0,Hx < 0 0, Hy = 0,Hx > 0 (1) where Hx is the X-axis direction of the magnetic component,and Hy is the Y-axis direction of the magnetic component. Direction is the heading signal of helicopter. 3.6 Low Height Sensing Component In order to ensure that the aircraft can be controlled stability during the takeoff and landing state, the vertical height should be guarantee to be accuracy. In the take-off and landing condi- tions, height of the helicopter generally less than 1 meter in height control. Based on the above considerations, we selected the ultrasonic ranging module to complete the height measurement. Ultrasonic ranging module uses the voltage DC5V, with less than 15 degrees sensitive angle, detecting distance is 2cm-450cm, accuracy is 0.3mm+1%, and the data update rate is 40HZ. 0 10 20 30 40 50 60 70 0 0.5 1 1.5 2 Time(s) H e ig h t( m ) actual filter Figure 4: Height before and after TD. The aircraft itself will generate about 30HZ vibration in the actual flight, which will affect the data of ultrasonic range module. The vibration can make the data we collected would emerge burr. We use tracking differentiator filter to filtering and tracking the signal. Fig.4 shows the effect before and after the filtering. 3.7 Actuation Component The servo controller board has the function that switch the helicopter control between manual mode and automatic mode. Channel 7 in the radio control system is in charge of the mode of switch. The servo controller board shares a power supply with the servos. Such a design can ensure that the manual operation can run independently. The UAV helicopter can be operated in either the automatic mode or manual mode. All of the servos are driven by a pulse width modulated(PWM) signal. So the input and output signal of the servo controller board are PWM signal. We use 74LS157 as the core selection chip, which is a type of either-or chip. The analysis of PWM signal is accomplished by a Micro control unit (MCU) C8051F330.PWM signal is resolved into high-low level, and then drive the selection chip. Each signal which in and out the servos controller board would be processed with light-coupled isolation, which can effectively prevent the signal interference. The update rate of all sensors is ranging from 10-200HZ, which is enough for implementation for advanced control algorithms. Scalable Architecture for CPS: A Case Study of Small Autonomous Helicopter 765 0 5 10 15 20 25 30 −1 −0.5 0 0.5 1 Time(s) L a te ra l v e lo ci ty (m /s ) Figure 5: Lateral velocity. 0 5 10 15 20 25 30 −2 −1.5 −1 −0.5 0 0.5 1 1.5 Time(s) L o n g itu d in a l v e lo ci ty (m /s ) Figure 6: Forward velocity. 4 Cyber Algorithm Design 4.1 Online Flight Data Processing GPS provides world geographic coordinate information, which can be applied to the position control algorithm. Gyroscope provides aircraft attitude information, which can be applied to the attitude control algorithm. But there is no sensor to acquire the velocity information of helicopter which need to be used in the velocity control algorithm. In order to get the velocity information, we adopt the tracking differentiator to tracking the location information of the GPS. Tracking differentiator can extract reasonable differential signal of the measuring data with the predicted and tracked effect [10]. The general problem describe as a mechanical system that initial with the signal of position and velocity at t moment and output the signal of position and velocity at t+1 moment. The second order discrete forms of tracking differentiator is shown as follows: x1(t + 1) = x1(t) + h × x2(t) x2(t + 1) = x2(t) + h × fhan(x1(t) − x(t),x2(t),r,h0) (2) where x1 describing the motion of the target’s position and x2 is the velocity information of the target. h is the sampling step. The function fhan() is shown as follows: fhan = { −r × a1/d, ∥a1∥ ≤ d −r × sign(a1), ∥a1∥ > d (3) with d = rh0 d0 = dh0 y = x1 − x + h0x2 a0 = √ d2 + 8r∥y∥ a1 = { x2 + y/h0, ∥y∥ ≤ d0 x2 + sign(y)(a0 − d)/2, ∥y∥ > d0 (4) where r is speed factor and h0 is the filter factor, speed factor determines the tracking velocity, filter factor determines the filter effect. The filter effect is proportional to the h0, and the level of phase lose is inversely proportional to the h0. The input signal of the tracking differentiator is velocity of helicopter which is calculated by the GPS information. And its output signal is the predicted velocity of helicopter. The effect of forward and lateral velocities is given in Fig.5 and Fig.6. 766 J. Yao, J. An, F. Hu Figure 7: Position controller scheme. 0 5 10 15 20 25 30 −1 0 1 2 3 4 5 Time(s) R o ll a n g le (d e g ) Figure 8: Roll angle during the flight 4.2 Control Algorithm Design The flight control system algorithm uses the body coordinates as the navigation coordinate. The position information which GPS provides is in the WGS-84 coordinates. First of all, the information of GPS (longitude, latitude, altitude) need to be converted into world geographic coordinates (NED coordinates), and use the position data when helicopter take-off as the original point. Then we must transform the NED coordinates into the body coordinates during the navigation control process [11]. Simulation studies have shown that a better strategy for the control of a small-scaled heli- copter is to use the flight controller as consisting of three cascaded controllers: an inner loop attitude control, a middle loop velocity control and an outer loop position control [12]. The overall flight control scheme is shown in Fig.7. Height Control The height control is a one loop scheme which is a PI controller using feedback from ultrasonic range finder generates collective pitch demands. In order to improve the control stability, we use the vertical velocity signal as the compensation for the collective pitch demands. The calculated formula is shown as follows: Ze = zcurrent − zc Vzc = K zv p Ze Vzc = [Vzc] V limz −V limz Zs = (Vz − Vzc) × Kzvp Ac = K z pZe + K z i ∫ t 0 (Ze + Zs)dt (5) where zcurrent is the actual height of helicopter and zc is the target height. Ze is the height error and it can be used to calculate the Zs which is the compensation for the collective pitch control signal. Ac is the collective pitch control signal. V limz is the limitation of the speed of hight. p zv and Kzp are the proportional control parameters. K z i is the integral control parameter. Yaw Control The yaw control is a proportional controller using the feedback from the digital compass generates the rudder channel control demands. GY401 is used to increase yaw control stability. According to body sway velocity, GY401 will make reverse compensation signal to the actuator and suppress the helicopter tail rotor’s swing which just as a tail rotor damper. Scalable Architecture for CPS: A Case Study of Small Autonomous Helicopter 767 0 5 10 15 20 25 30 −2 0 2 4 6 Time(s) P itc h a n g le (d e g ) Figure 9: Pitch angle during the flight. 0 5 10 15 20 25 30 160 180 200 220 240 260 280 Time(s) H e a d in g a n g le (d e g ) Figure 10: Heading angle during the flight. 0 5 10 15 20 25 30 0 2 4 6 8 Time(s) H e ig h t( m ) actual reference Figure 11: Height control during the flight. −20 −15 −10 −5 0 5 10 15 20 −20 −10 0 10 20 East direction(m) N o rt h d ir e ct io n (m ) actual reference Figure 12: Position control during the flight. Position Control The position control is a three-cascade scheme which includes an inner loop, a middle loop and an outer loop. The outer loop takes target position as desired position as inputs and generates desired velocity to the middle loop which using the feedback from the GPS. The middle loop is designed as velocity controller which takes desired velocity as inputs and generates the desired attitude angles to the inner loop. The inner loop is designed as the attitude controller which takes desired attitude angles as inputs and generates the actuator commands that drive the helicopter reach the desired attitude. Finally the helicopter will reach to the target position through the control demands. 5 Real-Life Autonomous Flight Experiments A three-loop control scheme for rotorcraft UAV system was design and implemented using TREX 600 platform. We use the fixed-point hovering experiment to show the controlled effect. The target point is at longitude 12126.31838 and latitude 3101.44161,which change into the NED coordinates is XYZ(-7.0658, 2.4706,6).X stand for the west-east coordinate, Y stand for the south-north coordinate, and Z is the height coordinate. Fig.8-Fig.10 show three-axes angles during the flight. Fig.11 and Fig.12 show that position which controlled by the outer loop is get a stable response. The control accuracy is of a radius of two meters. 6 Conclusion This paper describes the Cyber-Physical System implementation of the rotorcraft UAV and control scheme based on TREX600 aeromodelling helicopter. The rotorcraft is a small helicopter model, which will be changed to adapt to the heavy load in future. The rotorcraft UAV system has been tested successfully for automatic flight, including take-off and landing. 768 J. Yao, J. An, F. Hu The system also has some deficiencies, such as poor wind-resistant performance. There is an influence on the control precision when the wind speed is 5m/s. The flight path is not stable enough, and the altitude of helicopter would be effected when the helicopter flight forward. The next step is to integrate the wind model into the existing control model so as to improve the flight stability, and add new application tasks. Acknowledgement This work was supported in part by National Natural Science Foundation of China (No.61303013), Shanghai Natural Science Foundation (No.12ZR1445700) and Research Fund for the Doctoral Program of Higher Education of China (RFDP) (No.20120073120039). Note: The authors con- tribute equally for the work in this paper. Bibliography [1] Yao, J. et al; NetSimplex: Controller Fault Tolerance Architecture in Networked Control Systems, IEEE Transactions on Industrial Informatics, 9(1), 346-356, 2013. [2] Nonami K; Prospect and recent research & development for civil use autonomous unmanned aircraft as UAV and MAV, Journal of System Design and Dynamics, 1(2),120-128, 2007. [3] Johnson, E. et al; The georgia tech unmanned aerial research vehicle GTMax, Proc. of AIAA Guidance, Navigation, and Control Conference, Austin, 2003. [4] Qi, J. et al; The servoHeli-20 rotorcraft UAV project, Proc. of the 15th Int. Conf. on Mecha- tronics and Machine Vision in Practice (M2VIP 08), Auckland, New-Zealand, 2008. [5] Cai, G. et al; An overview on development of miniature unmanned rotorcraft systems, Fron- tiers of Electrical and Electronic Engineering in China, 5(1), 1-14, 2010. [6] Zhou, W. et al; Research on UAV Flight Control Computer Based on ARM, Computer Measurement & Control, 17(7),1286-1288, 2009. [7] Cai, G. et al; Construction, modeling and control of a mini autonomous UAV helicopter, Proc. of IEEE Int. Conf. on Automation and Logistics (ICAL 08),Qingdao, China, 2008. [8] Gu, Y. et al; Integrated avionics system for research UAVs, Proc. of AIAA Guidance Navi- gation and Controls Conference and Exhibit, Honolulu, Hawaii, 2008. [9] Cai, G. et al; Development of fully functional miniature unmanned rotorcraft systems, Proc. of the 29th Chinese Control Conference (CCC 10). Beijing, China, 2010. [10] Su, X. et al; The research on single-antenna DGPS determination attitude method based on tracking-differentiator, J. of Projectiles, Rockets, Missiles and Guidance, 31(2), 199-204, 2011. [11] Peng,K. et al; Design and implementation of a fully autonomous flight control system for a UAV helicopter, Proc. of the 26th Chinese Control Conference, Zhangjiajie, China, 2007. [12] Shim,D. et al; Hierarchical Control system synthesis for rotorcraft-based unmanned aerial vehicles, Proc. of AIAA Guidance Navigation and Controls Conference and Exhibit, Denver, Co, Aug, 2000.