Vector Field Aided Trajectory Tracking by a 10-gram Flapping-Wing Micro Aerial Vehicle

—Here we describe how a 10-gram Flapping-Wing Micro Aerial Vehicle (FWMAV) was able to perform an automatic trajectory tracking task based on a vector field method. In this study, the desired heading was provided by a vector field which was computed depending on the desired trajectory. The FWMAV’s heading was changed by a rear steering mechanism. This rear mechanism simultaneously (i) tenses one wing and relaxes the opposite wing, and (ii) moves the rudder in the same direction as the wing is relaxed. Due to the complex dynamics, system identification methods were used to identify simple linear models using a set of dedicated free flight tests. This yaw and roll simple models help to adjust the yaw controller and the inner loop roll controller. The experimental results obtained here show that a time-independent vector field-based strategy is robust to various initial position and/or speed conditions. The task of tracking circular and 8-shaped trajectories was accomplished successfully over tens of meters.


I. INTRODUCTION
During the last decade, Flapping-Wing Aerial Vehicles (FWAVs), which have also been called ornithopters, have been attracting considerable attention.Recent studies have focused on improving the agility of these vehicles [1][2][3][4] and controlling their height of flight [5,6], thus enhancing their performances.Nowadays, FWAVs are able to perform difficult tasks such as obstacle avoidance [7][8][9], fixed-object tracking [10] and trajectory tracking tasks [11][12][13].Studies on micro FWAV (called also Flapping-Wing Micro Aerial Vehicles FWMAVs) are quite rare [11].In parallel, remote-controlled two-wing ornithopters weighing only 10 grams have been available on the market since 2010 [14,15] and sold as crash-resistant toys by the company XTIM-BionicBird.The successive versions of these RC (Radio-controlled) models based on the same propulsion and directional mechanisms have been named Avitron, BionicBird, and more recently, Metafly.The Metafly (shown in Fig. 1) is endowed with 2 DC motors serving as its actuators: (i) the main DC motor is attached to a 2-stage planetary gearbox controlling the flapping frequency [14], and (ii) the second DC motor concomitantly tenses one wing and relaxes the opposite wing (in a differential manner) while adjusting the rudder to control the course [15].The speed of the Metafly is poorly controllable, however, as its flapping rate affects both its altitude and its speed.As regards the agility of FWMAVs, it has been suggested that relying solely on a rudder to change the direction of FWMAVs may be insufficient as this does not generate enough force required to perform agile maneuvers, even using bang-bang control methods [16].One commonly adopted solution here is the socalled banked turn in which roll motion is used to generate a change of direction [3,17] by means of dihedral wings [18,19], asymmetrical morphing of the wing surface [4], differential wing spoiler steering [20], or the generation of an asymmetric flapping amplitude [2,21], among other solutions.
Besides, the dynamics and kinematics of FWAVs are so complex that a large number of dynamic models have been presented in the literature [6,[22][23][24][25].Due to this complexity, the authors of most previous studies consider fixed-wing models, without taking the intra-flapping processes [26] or the heading actuator dynamics [27] into account.In these cases, the results of grey-box [28,29] or black-box [12,30] system identification have been used to model FWAVs' dynamics.Kim et al. [11,31] have succeeded in flying 4 ornithopters in formation along a circular trajectory.The cohesion of this formation was highly dependent, however, on specific initial conditions and on the fine tuning of these ornithopters, as the authors themselves mentioned [11].As vector field-based trajectory tracking is time-independent [32][33][34][35][36][37], this strategy can be used to overcome the poor controllability of the Metafly's flight speed when tracking various trajectories, as established in the present study.The present approach enables the vehicle (i) to track the trajectory robustly, regardless of the initial conditions, (ii) to follow complex trajectories, and (iii) to change its trajectory while in flight.The main contribution of this research can be summarized under the following three principal headings: • The identification of simplified yaw and roll linear models for the Metafly based on enriched free flight data.
• A novel 3-state (full left, neutral, full right) directional control system whereby the directional control is carried out by tensing and relaxing the wings while positioning the rudder appropriately.The commands of tensioning/relaxing the wings and of actuating the rudder are mixed (Fig. 2).The amount of time (t deflection ) the actuator remains full left or full right serves as the control input.
• This is the first implementation of a vector field method on a FWMAV (as far as we know) in order to enable it to time-independently track a trajectory, while enlarging the range of possible initial conditions.The modified Metafly FWMAV and the method used to control its heading are presented in detail in Section II.The system identification procedure, which was performed using real flight data and Matlab processing tools, is described, along with the simplified model, in Section III.The vector field strategy used to track various trajectories successfully is presented in Section IV.The results of various experimental tests validating the present vector field-based trajectory tracking approach are presented in Section V. Lastly, the authors' concluding comments and suggestions for future studies are presented in Section VI.

II. THE METAFLY FWMAV AND ITS HEADING CONTROL
In the modified version of the Metafly FWMAV used here, a Deltang RX43d receiver controlling the two actuators was embedded, which adjusted the flapping frequency and actuated the directional mechanism, respectively.A 3.7V/58mAh Lipo battery was used as the power source.A list of the Metafly's characteristics is given in Table I.
The heading control mechanism (described in Fig. 2) makes it possible to change the heading by initiating a banked turn (as depicted in Fig. 3).For example, in order to perform a left banked turn as in Fig. 3, the heading control mechanism tenses the right wing and relaxes the left wing while positioning the rudder to the left.This creates a negative rolling motion inducing a positive yaw moment.At the same time, there is also a considerable difference in the drag between the left and the right wings (because the right wing is tensed and the left wing relaxed), which also results in a positive yaw moment in the same direction as the turn we have referred to as the   proverse yaw moment (Fig. 3).During the rolling motion, as the left wing rolls down (see insert in Fig. 3), an additional wind from below is created.This additional wind is added to the velocity-induced wind to give the total upward-oriented wind (grey arrows in Fig. 3).The resulting opposite deflection of the lift (backward and forward) creates a negative yaw moment called the adverse yaw (see red arrows in Fig. 3).The adverse yaw is transient as it due to the rolling motion.The rudder also creates a small amount of positive yaw moment in the same direction as the yaw induced by the rolling motion and the proverse yaw, which causes it to turn appropriately, making the effect of the adverse yaw negligible.

III. METAFLY MODELING FOR THE HEADING CONTROL
The identification of the Metafly dynamics between the directional command and the yaw (heading) was performed.As mentioned above, the Metafly must perform a roll motion in order to change its heading.If the roll angle Φ exceeds 35 • , the turn is too tight and we observed that the Metafly will dive and crash.To overcome this problem, the roll motion is controlled and capped in an inner loop.Two transfer functions were identified: (i) H roll/t deflection (s) which relates the roll Φ (s) to the control input t deflection (s), and (ii) H yaw/roll (s), which establishes the relation between the yaw Ψ (s) and the roll Φ (s), so that:

A. Experimental Setup and Flight Tests
The experiments required for the identification took place in the flight arena.The effective volume in which the 10gram Metafly can be tracked at an acquisition frequency of 500Hz by the Vicon motion capture system (17 cameras) was 5x6x3m 3 (lxLxH).For this purpose, a set of adhesive or spherical reflective markers was suitably placed over the Metafly.The Metafly were controlled by an external workstation (equipped with Matlab and ROS), which delivered the 2.4GHz DSMX signals to the RX43D receiver embedded on the Metafly (via an Ethernet-to-DSMX bridge, see Fig. 4).Several identification flight tests were performed in order to identify the models.In these experiments, the PID controller: was previously implemented to make the Metafly hold its altitude constant with respect to the ground by adapting its flapping frequency.The gains were manually tuned and the command u flapping was sent directly to the onboard RX43D receiver that will actuate the wing-flapping mechanism.The latter version led us to take the flapping frequency as the only control input used to stabilize the altitude of the Metafly and to use the heading control mechanism (Fig. 2) as the only actuator of the rotational motion.Nonetheless, as it was not possible to adjust the angle δ R throughout the predefined range, we adopted the 3-state turning command strategy presented in Fig 2, thus taking the time t deflection as the actual rotational control input.Note that the directional control (full left, neutral, or full right) was defined by the sign of t deflection , so that a negative value allowed to turn right, and a positive value allowed to turn left.As shown in Fig. 5, the t deflection , roll and yaw data were recorded and then used in the Matlab System Identification Toolbox to retrieve the models.
Fig. 4. Four reflective markers enabled the Metafly to be tracked by the motion capture system.The embedded RX43D receiver applied the computed commands of both the flapping and the turning mechanisms in real time.
Fig. 5.For closed-loop system identification purpose, a human pilot stabilized the Metafly while a randomized signal was added to the t deflection input (here given by the joystick) in order to enlarge the input frequency range for more accurate system identification.A) For the sake of visualization and for identification purpose, the input t deflection was computed by measuring the time δ R was hold constant during the identification flight tests.B) Roll.C) Yaw during several banked turns.D) X-Y positions during system identification flight test.

B. Identification of the model
Based on the data recorded during 4 different free flight tests, the functions H roll/t deflection (s) and H yaw/roll (s) were identified, using the Gauss-Newton search method, as follows: H yaw/roll (s) = − 7.455s + 8.179 The transfer functions were identified with a given fit percentage of 78% and 86% for H roll/t deflection (s) and H yaw/roll (s), Fig. 6.The Metafly control scheme, including the heading model.Two non-linearities (a deadzone/limiter and a quantizer) and two transfer functions, the heading dynamics (roll and yaw, respectively).The deadzone corresponds to the minimum time the DC motor had to actuate the heading control system.
The quantizer approximately reflected the refresh rate (80Hz)of the ethernet-to-DSMX bridge.The inner loop maintained the roll between ±35 deg so as to prevent the vehicle from diving and crashing.The outer heading loop controlled the yaw with respect to the direction setpoint Ψ desired , given by the vector field while the altitude control loop kept the height of flight constant.
respectively, while knowing that complex couplings between roll and yaw exist.Both of the transfer functions identified were used in the simulations performed for controller tuning purposes, which are presented in the following section.

A. The Vector Field theory
A vector field assigned a vector to each 2D coordinate in the (x, y) plane with a direction enabling it to converge with a desired path [34].Let us consider the (x, y) position of the robot, ξ = [x y] T ∈ R 2 and recall the orientation of the robot Ψ meas ∈ R [34], so that its velocity can be written as follows: where v flight ∈ R is the flight speed (taken for instance to be constant, since the flapping frequency was fixed by the altitude controller) and χ u ∈ R 2 is the directional unit vector.In addition, one can define a curvilinear desired path by the implicit equation: so that the function ϕ: R 2 → R is C 2 -smooth.The geometric curve P can be written in several implicit forms.The main restriction imposed on the curvilinear path is regularity, i.e. in the vicinity of P, one has: where ∥•∥ stands for the Euclidean norm.
The tracking error e track is defined by a strictly increasing C 1 -function ε (•) so that: The choice of ε (•) is a free parameter.By definition, e track = 0 if and only if ξ ∈ P. Thus, according to [38], the vector field χ can be simulated by the expression: with k n = const > 0, Note that γ ∈ {−1, 1} determines the direction in which P will be tracked.Eq. ( 9) was therefore used to find the desired directional unit vector field χ u d , and consequently, Ψ desired as follows: In addition, the derivative of χ u d along its trajectories, χu d , is given by: Assuming that χ u d = 1 and χ T u d χu d = 0, ω d is a scalar function that can be obtained explicitly from the set of equations: where H (ξ d ) stands for the Hessian: For instance, let us recall the implicit function that describes a circle with the radius r > 0 centered on c = [c x c y ] T ∈ R 2 , thus defining ϕ (ξ d ) as: Taking e track (ξ ) = ϕ (ξ ), γ = −1 and k n = 1, Eq. ( 9) applied over Eq. ( 16), we obtain the vector field: from which the directional unit vector field and its derivative, χ u d and χu d , can be computed.Fig. 7 shows the directional unit vector field of a circle with r = 1 and c = [0 0] T , which was used to perform the experimental tests, the vector field of which is described by the expression:

B. Roll and Yaw controllers
Once the desired attitude has been set, based on the vector field (Eq.17), the heading error and its derivative can be written as follows: such that Eq. ( 19) holds for Ψ desired − Ψ meas < 180°.Eq. (20 can be used to define a PD controller having the form: which gives a reference value that is passed through the filter F Ψ (s) in order to compute the roll reference Φ desired .The function sawtooth (•) serves as a wrapping function to fit the yaw angle between 0 and 360 [deg].More precision on the calculation of ėΨ can be found in [34].To carry out the experiments, the control scheme depicted in Fig. 6 was adopted.In this respect, a constant setpoint Z desired was given to the vehicle in order to keep its altitude constant by updating the flapping frequency command via the action of the PID controller C z (s) and the information provided by the MoCap Vicon i.e. the position and the orientation.The directional closed loop control takes the desired yaw angle Ψ desired computed with the vector field.Once this reference value has been computed, it is compared with the actual yaw angle Ψ meas of the Metafly so that the PD controller C Ψ and the filter F Ψ will produce the appropriate desired roll angle, which is limited to between −35 • and 35 • (to prevent the metafly from diving and crashing as observed in experiments), and this value is then compared with the actual roll angle.The resulting error is thus processed by the lead controller, C Φ which sends the t deflection command activating the rudder.The altitude of the Metafly is also controlled concomitantly.The lead controller C Φ and the filter F Ψ were included in a simulation that took all the non-linearities into account (Fig. 6) as well as the identified transfer functions (H roll/t deflection and H yaw/roll ) presented in section III.These controllers were tuned until acceptable behavior in automated flight was taken to have been reached.The filter F Ψ and the lead controller C Φ used for roll and yaw control, respectively, were defined as follows: These were used for the automated trajectory tracking of the Metafly presented in the following section.

V. EXPERIMENTAL RESULTS
Using the vector fields and the 3-state directional command, we established that the Metafly based on the model described Fig. 9. Metafly FWAV tracking with a circular trajectory which increased in size during flight: the vehicle followed a circular trajectory with a radius of 1.5m during 4 laps before taking another circular trajectory with a radius of 2.25m for another 4 laps. in section III and the controllers we developed, were able to perform circular trajectory tracking successfully .As shown in Fig. 8, the Metafly completed 21 circular trajectories with a radius of 1.75m (around 230m) successfully, while keeping a constant altitude.The radius error distribution was centered at 0.0548m and the standard deviation was 0.128m.Table .II summarizes the circular trajectory tracking performances obtained with a mean error of almost 0 in the radius.
In Fig. 9, the Metafly is able to change the radius of its circular trajectory during flight: it performed 4 circular laps with a radius of 1.5m before changing its trajectory and performing 4 larger circular laps with a radius of 2.25m.With the vector field method, the Metafly is able to follow more complex trajectories, such as an 8-shaped circuit set up in several steps, each of which was a section of the 8-shaped trajectory obtained with vector fields converging with a circle (Fig. 11).
The use of the vector field method for flapping-wing MAVs is one of the main contributions of this study.As discussed in the introduction, the vector field method can be used to track a trajectory without imposing strict initial position and/or speed conditions.In Fig. 10, tests were performed with various initial conditions.The circular trajectory tracking task was performed successfully with initial speeds ranging from 2m/s to 3m/s and various positions along a 1.25m-wide starting line.So far, outside the present range of initial conditions, the initial error of the heading angle is such that the Metafly cannot track the circle.

VI. CONCLUSION
In this study, it was established for the first time (to the best of our knowledge) that a vector field method could be used to make a micro FWAV perform trajectory tracking successfully over 230m.The vector field method, which was proved to be time-independent, enabled the Metafly to track trajectories for various initial position and initial velocity conditions.The results obtained here show that system identification based on enriched manual flight test data can provide an effective basis for designing FWMAV controllers.The 3-state directional command presented here enabled the Metafly to perform circular trajectory tracking and to track an 8shaped circuit while keeping a constant altitude.In future studies, we would like to (i) to increase the automation of the Metafly using micro-GPSs, gyros, magnetometers or optic flow sensors while taking into account the SSWaP (Speed Size Weight and Power) constraints of micro aerial vehicles [39,40], and (ii) to improve their vector field-based trajectory tracking performances in the presence of wind and obstacles outdoors.

Fig. 2 .
Fig. 2. Top view of the heading control mechanism.It consists of a DC motor actuator that turns the rudder and concomitantly applies a differential tension to the wings (relaxing or tensing them).A 3-state turning command (full-left, neutral or full-right) was used to efficiently apply the periodic command computed off-board.The periodic command t deflection updated at 5Hz set the duration of the deflection applied by the DC actuator between 50 and 150[ms].The DC actuator set the rudder angle to either δ R=-40;0;+40[deg] while tensing one wing and relaxing the opposite wing.

Fig. 3 .
Fig.3.On the Metafly, the directional mechanism concomitantly relaxes one wing (here, the left wing), tenses the opposite wing (here, the right wing) and turns the rudder (here, to the left): in this case, these adjustments cause a negative roll motion inducing a positive yaw moment.Contrary to the tensed right wing, the relaxed left wing results in a greater drag, which causes a positive yaw moment (in the same turning direction): this has been called the proverse yaw.The lift on the right wing is greater than the lift on the left wing in average during the flapping cycle.The additional wind generated by the roll motion (see insert) causes a deflection of the left lift vector forward and the right lift vector backward.A transient adverse yaw occurs as the direct consequence.The rudder (the vertical tail) creates a small positive yaw moment, making the Metafly more agile.

Fig. 7 .
Fig. 7. Vector field converging clockwise with a circle having radius 1, centered on (0,0).Desired orientation Ψ desired and the actual heading of the Metafly measured by the Vicon system (Ψ meas ).

Fig. 8 .
Fig. 8. Results of a circular trajectory tracking test based on the vector field approach: the circle (radius : 1.75m) was centered on the origin.The average flight altitude was z = 1.3m and 21 turns were completed.

Fig. 10 .
Fig. 10.Trajectory tracking taking a circular path with a radius of 1.5 [m] under several initial velocity conditions: initial velocity profile between 2 and 3 [m/s].

Fig. 11 .
Fig. 11.Metafly tracking an 8-shape trajectory: A) Steps segmentation according to the position of the vehicle to create an 8-shape circuit with vector fields.B) Resulting 8-shape trajectory performed by the Metafly.

TABLE II PERFORMANCES
DURING A CIRCULAR TRACKING TRAJECTORY IN FIG. 8