## Update: Karan 2019-02-09

##### 1. Quick updates (January 1st – February 9th)
• Fixed the integral controller for yaw and position.
• Analyzed the horizontal sweep experiments for force and torque (they are very promising)
• Gave the prelim
• Moving average to smoothen sensor noise.
• Tried to incorporate a theoretical model for velocity field below a quad (still working on this)
• Wrote a script to get forces and torques on a quad from the velocity field
• Cleared the prelim
• Conducted velocity field experiments for the miniquad and tried fitting a model to it
###### A. Integral controller

The position and yaw integrator has been added in codes QuadcopterPositionController.hpp and QuadcopterAttitudeController.hpp respectively. Each vehicle now has its own variable for storing the integrated value and this works in experiments (except for the miniquad (MQ) giving some oscillations, but that is probably a tuning or hardware problem because the largequad (LQ) did not oscillate).

###### B. Horizontal sweep experiments

A description of the experiment:

1. The miniquad (MQ) is on the top and is held fixed at (0, 0, 3.5)
2. The largequad (LQ) on the bottom is first brought to (0, -2, desiredHeight).
3. After 5 seconds, the LQ is commanded to move in positive y-direction at 0.2 m/s. This is done until it reaches (0, +2, desiredHeight). (This takes 20 seconds.)
4. 5 seconds after that, both the quads land.
5. desiredHeight can be anything. In my experiments, these are 3.0, 2.5, 2.0, 1.5 and 1.0 giving vertical separations of 0.5, 1.0, … 2.5 respectively.

A sample force plot for vertical separation of 1.0 m is shown below,

It can clearly be seen that there is a significant force when the LQ is within 0.5 m of the MQ in the horizontal direction. This variation can be approximated with a gaussian distribution which is covered in the theoretical model.

A sample roll torque plot for all vertical separations is shown below,

This can be explained by imagining the motion of the LQ below the MQ. When it approaches the MQ, there is more air flow on the part of the LQ closer to MQ, hence it would get a positive roll torque. The torque magnitude depends on 2 things: value of the velocity of air flow, and gradient of the velocity across the LQ. Hence it achieves a peak, but dies down at y=0, because the velocity field is symmetric on the LQ.

###### C. Moving average

These are required to get a neat trend rather than points all over the plot we can’t make sense of. To give an example, here is the torque plot without using moving average,

The rate gyro does not have as much noise as the accelerometer and hence we can at least see the trend in torque.

Here is a plot of the forces without moving average (same experiment as shown in previous section),

The noise level (~0.2 N) is comparable to the maximum force (~0.6 N) itself.

###### D. Theoretical Model

I have read multiple papers on getting velocity fields and each one has their own take on how to represent it. In general a velocity field below a quad is axisymmetric and hence can be written in cylindrical coordinates as $V=V(z,r)$, where z is the axial separation, and r the horizontal (or radial) separation.

Further, $V(z,r)=V(z)e^{-k(z)r^2}$ in most papers. What changes across the papers is $V(z)$ and $k(z)$. Some papers have an inverse relationship $\left(V(z)=\frac{V_o}{1+cz}\right)$, while others have a linear relationship $\left(V(z)=V_o(1-cz)\right)$. It seems that each one uses a function appropriate for their application.

According to Navier-Stokes analytical solution, the relationship should be proportional to 1/z.

###### E. Velocity field experiment

A miniquad was held sideways such that its z-axis aligns with the lab y-axis. It was run at various thrusts and velocity was measured at different locations.

The results for axial velocity (r=0) are shown below. The solid line is a least-squares fit assuming an exponential decay model:$\left(V(z)=V_oe^{-cz}\right)$. $V_o=1.25V_i$, where $V_i$ is the induced velocity given by the actuator disk theory.

It predicts well in the far-field (> 1m) but doesn’t work well in the near-field because the flow is still accelerating.

Similarly, velocities varying with r coordinate, with z fixed:

Solid lines are a gaussian fit. The standard deviations turn out to be proportional with the axial separations.

##### 3. Planned work for the next week
• Fix a model for velocity
• Compare the theoretical predictions with experimental results
• Conduct more proximity flight experiments
• Conduct a velocity field test experiment with better testing rig (assigned to Trey)
• Continue writing the paper

## Update: Karan 2018-12-30

• Performed proximity flight tests for constant velocity sweeps (both horizontal and vertical sweeps)
• Changed the integral controller for position
• Added an integral control for  yaw (via a hack)
• Attempted some past prelim papers
##### Change in position controller integral action

Last week, I had added an integral controller for position in the QuadcopterController code. In this approach, I had defined a static variable to store the value of integrated position error. Although this works for one vehicle, turns out that if we have 2 vehicles, both of them will share the same integrated error. This would be wrong, and can result in vehicles maintaining undesirable setpoint (as long as the sum of the position errors of both vehicles is 0).

This was changed and now I have an integral control in rostools itself and not in the low level controller. I added it in ExampleVehicleStateMachine (EVSM) in StageFlight. This works independently for both vehicles and has been tried in an experiment.

The integrated error is multiplied by a gain and then commanded as a desired acceleration which is passed on to the low level controller.

##### Integral Action for Yaw

Since I am kind of constrained by time, I wanted to add this fast enough and hence did not want to mess with the low level controller (QuadcopterAttitudeController or QuadcopterController). So I again tried adding it in the EVSM code. But it did not have an option to specify angle rates. So I could not command it as a desired angular acceleration. So instead, I just defined a new variable called _commandedYawAngle = _desiredYawAngle + “integral term”. The ‘commanded yaw’ was then passed on as a ‘desired yaw’ as shown below.

This is pretty much a hack and does not get the yaw error to 0. But it does reduce it by a good amount. For example, the miniquad usually has a 60 degrees error between desired and actual yaw. With my hack, this error falls to about 10 degrees.

I would definitely look into improving this once I’m not loaded with time constraints (Prelim + paper deadline). Suggestions are also welcome here.

##### Velocity Sweep experiments

I shall let some of the videos speak so that it gives an idea of what a velocity sweep experiment looks like. These videos are with the position integral control in action, but Yaw integral control is absent.

I also tried vertical sweep experiments with yaw integrator but no videos were taken for those. The only thing I can conclude is that integral action to yaw is making the quads unstable – they keep oscillating horizontally.

Here are some results for force vs. separation for the vertical sweep experiments at various yaw angle differences:

At yaw difference of 0 degrees the aligned props of top and bottom quad rotate in the same direction, whereas at 90 degrees, the aligned props are contra-rotating.

The magnitude of forces are similar for all experiments, but the slopes are not. The values of slopes are as follows:

• Yaw diff = 00 deg -> slope = 0.064 N/m
• Yaw diff = 45 deg -> slope = 0.118 N/m
• Yaw diff = 90 deg -> slope = 0.208 N/m

I have also repeated the experiments, and slope values are similar for the same desired yaw differences. So I can conclude that the rate of change of forces with vertical separation increases as the yaw difference increases from 0 deg to 90 deg.

##### 3. Planned work for the next week
• Analyze data of horizontal separation experiments and compare the spread of forces with the theoretical model.
• Study more for the prelim exam

## Update: Karan 2018-12-21

• Implemented theoretical model to get flow fields
• Wrote a new control node to fly from one-point to another at constant speed – tried and tested in experiments
• Added integral action to Quadcopter Controller – tried and tested in experiments

To check out the codes for integral action and constant velocity trajectory, check out my branch ‘Karan/aerointerf’

##### Constant velocity trajectory

The code basically gets the top quad to a desired height, and the bottom quad to an initial desired position. After some time the bottom quad starts moving to a final desired position at a desired speed. Both the quads then land at the end time. All the quantities in bold are user specified.

Majority of the code was copied from QuadMocapRatesControl. All I had to do was add another flight stage for the constant velocity maneuver, and command a velocity through ExampleVehicleStateMachine.

##### Integral Action

This was desired for 2 reasons:

1. When the center of mass of a quad is not exactly where the code thinks it is (for example due to battery placement not being precise), the quad is a ‘constant disturbance torque’ acting on it. This results in a setpoint offset and the quad is unable to maintain its desired setpoint.
2. In my proximity flight experiments, we have disturbance torques and forces due to the top vehicle on the bottom vehicle. This sometimes leads to the bottom quad maintaining a position offset from the desired setpoint.

Both of the above issues are resolved using integral action. But we should follow caution while implementing it as integral action can lead to oscillations and instability. To implement this, I just changed a small part in the QuadcopterController as shown in the screenshot below,

I have a tuning constant Ki, and a variable ‘cumerrPos’ which keeps adding the position error (equivalent to integrating). A catch here is declaring the integrator (cumerrPos) as a static variable so that the value is not reset every time we call the Controller function. I have tried declaring it as a regular Vec3, but it does not work.

##### Theoretical Model

I followed the model in the paper titled “Propeller Slipstream Model for Small Unmanned Aerial Vehicles“. This model assumes a gaussian distribution of flow velocities in the zone of established flow (ZEF,
explained in the previous update). ZEF begins at about 5 propeller diameters (Dp) from the propeller plane, but since we have 4 propellers on the quadcopter, I relaxed this condition and assumed that ZEF begins at 10*Dp.

The peak value of this distribution at a specific axial distance is assumed to decrease linearly with the axial distance. The spread increases with increase in axial distance.

The peak and spread values of the distribution also depend on a factor called ‘viscosity constant’ (K_visc) but there is very limited research available on this parameter. So to start with, I assumed some value for it by assuming that flow becomes indistinguishable from ambient flow at about 100*Dp. I can use this in the formula for peak value and get K_visc.

After doing all that, here are the plots. The coordinate system is same as our lab. Plots are made for various planes below the quadcopter – 1 m, 2 m, and 3 m.

The peak velocities seem reasonable (similar to those predicted by actuator disk model), but there seems to be a small problem with the spread – it is too little. At z = 2 meters, I would definitely expect there to be some flow at lateral separations of 1 m. But I cannot claim anything solid because I have not done experiments with both horizontal and lateral separation. So I shall be doing these in the coming days to verify if the theory is giving something sensible. If the experiments say otherwise, either K_visc is not very well understood by me, or the model is not suitable for us.

##### 3. Planned work for the next week
• Perform proximity flight experiments with the constant velocity trajectory code. One set of experiments to sweep horizontally at different vertical separations, and another to sweep vertically (while being aligned) at various yaw angle phase differences.
• Analyze that data, and compare with theoretical predictions to verify whether the theory makes sense.
• Look into the eVTOL paper submission formalities.
##### 4. Plans for next 30 days
• Get a complete set of empirical data for forces and torques vs separation.
• Complete and submit the eVTOL symposium paper.

## Update: Karan 2018-12-09

• Brainstormed on a theoretical approach to predict forces and torques on the bottom quad due to the top quad.
• Studied propeller slipstream model

The theoretical approach we follow lies on the assumption that all the disturbances on the quads due to air flow are effectively due to 2 types of forces:

1. Pressure Drag
2. Propeller inefficiency due to incoming flow

The pressure drag is simply as a result of the incoming flow (due to the top quad) exerting forces on the bottom quad which is assumed to be a bluff body. Hence all we need is the velocity field on the bottom quad. This is given by the propeller slipstream model.

Propeller inefficiencies on the other hand are due to the change of the thrust constant used in our code (thrust = constant * rpm^2). The word ‘inefficiency’ is misleading because the propeller performance could even ‘improve’ with oncoming flow (that is the constant could increase). Only experiments will tell.

###### Propeller slipstream model

Propeller slipstream model is a distance dependent model which characterizes the downwash due to a propeller (a.k.a. propeller slipstream or propwash). This model was chosen because it has distance dependence which makes it superior to many other models including the actuator disk model. The actuator disk model uses momentum theory (only) which predicts contraction of the downstream flow but does not consider diffusive effects due to viscosity of air.

The propwash model takes into account these diffusive effects and hence the airflow of a propeller initially contracts due to dominant pressure forces from the motion of the propeller. After a certain distance in the axial direction, the viscous forces start to dominate and there is a reduction in velocity which results in expansion of the flow (to conserve mass).

Essentially, the downstream flow of a propeller undergoes contraction, reaches a minimum at the ‘efflux’ plane, and then undergoes expansion.

For ease of explanation here are some parameters that I will use for succinctness: Radius/diameter of propeller (Rp/Dp); radial distance from the axis of symmetry or propeller axis (r); axial distance from propeller (z or x, used interchangeably); radius/diameter of the efflux plane flow cross-section (Ro/Do). (Note that Do<Dp)

The propwash is divided into 2 regions: a near-field region and a far-field region. In the near field region, we have dominant pressure forces and the flow contracts. The radial flow profile is also very peculiar – it has a peak at a particular radial distance, rather than at the axis of the propeller. If we give it a thought, it turns out to be logical because the speed of the cross-section of the propeller near the center is low compared to that towards the tip (v=r*$\omega$). A peak is probably obtained because the chord length of the propeller is smaller at the tip (r=Rp) as compared to somewhere a little behind the tip (r<Rp).

The far-field region is divided into 2 zones: a zone of flow establishment (ZFE) and a zone of established flow (ZEF) (I hate the acronyms but these are what are used in the paper and I want to be consistent). In ZFE, the flow still has a peak at r>0, but this peak slowly moves towards the axis (r=0). The axial size of this zone is about 3.25*Do, and at the end of this zone, the peak is finally at the axis. Beyond this zone is the ZEF where we have a single peak. Here the flow is assumed to be gaussian with a variance dependent on ‘z’ and viscosity of air.

The image shown below summarizes all the regions and zones very well.

Since Do<Dp, we know that the ZFE is smaller than 3.25*Dp, where Dp is obviously known to us. The question that remains is to find xo. The paper does provide a formula to obtain xo, but the parameters used in it are empirical (for example, coefficient of thrust) that we have to determine experimentally for our quads.

Roughly, xo lies between 1-3 propeller diameters, so we know that the ZEF assumption would be valid beyond 6-8 propeller diameters.

###### Propeller inefficiency

These would be characterized by directly doing experiments with a propeller on a thrust stand with oncoming flow (using Jason’s nozzle, if he allows it; if not, then any other fan). The thrust constant would be calculated for various flow velocities which will give us a relation between the two. This then in conjunction with the propwash model could give us accurate estimates of RPM to produce a given thrust, rather than using a constant coefficient.

##### 3. Planned work for the next two weeks

(Planned work is for 2 weeks, because this week me and Trey might not get enough time due to the end-semester exams)

My plan is to use the theoretical knowledge of flow field in the ZEF to predict the forces and torques on the bottom quadrotor. The top quadrotor is assumed to be a single rotor with 4 times the area of its individual propellers. This assumption is reasonable because we are working in the ZEF where the flow is expected to become axisymmetric with a single peak at the axis itself. Once we have the expected forces and torques, we can modify the controller to produce motor thrusts such that they can counter the effect of these forces and moments.

## Update: Karan 2018-11-30

• Conducted MQ-LQ experiments
• Analyzed torque disturbances
• Obtained frequency domain response of forces
###### MQ-LQ Experiments
• Astonishingly, the miniquad could hover below the large quad for as low as 1 m. It did not crash for any of the proximity flight experiments.
• The experimental data shows that the value lies between 0.25-0.35 N. Attached below is a plot for the same:

• The forces show a sharply decreasing tend with increasing separation. The commanded setpoint separations were maintained well by the miniquad (It settled about 0.3-0.5 m below the setpoint, but was not disturbed too much).
• Actuator disk theory predicted a very high value of force: 3.3 N for large quad on top of miniquad. Here is how it was obtained
• Let the weight of the top quad be ‘W’. Then each propeller provides a thrust of ‘W/4’ in hover. Using this thrust ‘T’, and the area of the propeller ‘A’, we can get the flow velocity ($V_o$) as $\displaystyle \sqrt{\frac{2T}{\rho A}}$ ($\rho$ being the density of air)
• Substituting W=6.4 N, and A = 0.0324 m^2, we get $V_o$ = 8.96 m/s. Using this velocity as the oncoming flow for the miniquad, and assuming this acts as a drag force on the projected area of the miniquad (84.5 cm^2), we get 3.3 N as the force.
###### Torque Disturbances
• A script was written to characterize the torque disturbances using the angular accelerations and motor forces. The script was implemented on both sets of experiments (LQ-MQ and MQ-LQ).
• The thing about torques is that they are pretty non-intuitive. It is difficult to say what values of torque you would expect, or what level of disturbance will a specific torque cause. In any case, shown below are the plots (6 of them, so please bear with me or just skip them).

1. LQ-MQ

a) Roll

b) Pitch

c) Yaw

• The pitch and roll torques are around 0.05 Nm on the bottom quad (LQ), and of the order of 0.002 Nm on the top quad (MQ).
• As mentioned before, torque values are non-intuitive. A way to think about it is imagining a weight being placed at one of the motors of the quads. For example, the large quad has an arm length of 0.166 m, so 0.05 Nm torque is equivalent to a weight of 30 g placed at one motor. This is significant enough to cause angular motion, but small enough to easily overcome by increasing/decreasing the RPM of motors. All we need to know is the quantity of this change, and at what relative location to implement this.
• For the MQ here, it is like placing a 3 g weight at the motors which can be ignored (and even mitigated if we are that sensitive about the performance).
• Yaw torques are much lesser than pitch and roll torques which is as expected because direct push by air flow cannot cause a yaw torque. Yaw disturbances also don’t affect the performance much as compared to roll and pitch disturbances.

2. MQ-LQ

a) Roll

b) Pitch

c) Yaw

• This pitch and roll torques now have values around 0.005 Nm for the MQ (bottom vehicle) and about 0.02 Nm for the LQ.
• Equivalent weights – 8 g for MQ, and 12.5 g for LQ.
• As before, for the top quad, the weight can be ignored but can include to improve performance.
• For the bottom quad, 8 g weight is significant as each motor produces about 35 g during hover. However, this additional thrust can be produced easily by the motors and hence we can avoid loss of control.
• Once again, yaw disturbances are way below the pitch and roll torques, and hence we can safely ignore them.
###### Frequency content of disturbances

A frequency response was obtained to check whether the disturbances have a periodic nature of any sort, or if they are just white noise. We get a frequency response using fourier transform to move from time domain to frequency domain. Once in, the response shows magnitudes at various frequencies, which helps in realizing what kind of periodic nature the signal/disturbance has.

(DC component has been eliminated for all the frequency domain plots shown below)

Shown below is a plot of aerodynamic force (on the bottom quad) vs. time, and that of the frequency content of the force for the LQ-MQ experiment at 1.0 m separation.

• We have high magnitudes for frequencies between 0-2 Hz. This suggests that either the forces are periodic with that frequency, or that the quad enters and exits the downwash regime with that frequency. In either case, the frequency is much lower compared to our sensor/estimator frequencies and hence can be mitigated easily.
• For frequencies beyond 2 Hz, the magnitude is pretty small and fluctuates a lot. Imagine trying to characterize noise using frequency domain analysis, and the frequency content itself is noisy. Pretty frustrating. But since the magnitudes are low, we can again safely ignore them.

I am attaching the plot for the MQ-LQ experiment (1.0 m separation) just for reference. Similar conclusions hold.

Frequency content of the torques is also very similar. Not attaching those for the sake of brevity.

##### 3. Planned work for next week

Since the empirical approach (analyzing sensor data) has not resulted in great conclusions so far, I am planning to take a theoretical approach. I will start by studying advanced models for flows through propellers. There is an excellent paper on distance dependent flow profile of a propeller downwash and another great paper on empirical model of UAV downwash.

• I plan to study these papers and build a conceptual model.

## Update: Karan 2018-11-26

• Finalized BOM for miniquad v2.0 and ordered the components.
• Completed the theoretical predictions of forces for proximity flight experiments using actuator disk model.
##### 2. Detailed update of the theoretical predictions
• Actuator disk theory (a.k.a. momentum theory) has the following assumptions:
• Propellers are flat, bluff disks which accelerate the air flow. It doesn’t take into consideration the shape of the propellers or number of blades. It only uses the diameter of the propellers.
• The actuator disks are not accelerating, i.e. there is a constant (or zero) inlet flow velocity, and a constant exit flow velocity.
• By assuming that the inlet flow velocity is zero, we can predict the exit flow velocity (and also the velocity at the propellers).
• The thrust produced is assumed to be 1/4th of the weight of the quadcopter for which parameters are being calculated.
• Exit flow velocity (v0) is calculated using the formula v_0 = sqrt(2*T/(rho*A)), where T is the thrust, rho is the density of air, and A is the area of the propeller disk.
• Bottom quadcopter is assumed to be a bluff body with a drag coefficient (C_D) of 1.00. The affected area is the minimum of the projected area of the bottom quad, and the projected area of the flow field (4 * area of one disk / 2). The ‘/2’ comes from the fact that flow accelerates on exiting the propeller to twice the velocity (assuming the inlet velocity is 0).

Results of the calculations:

I predicted forces on the bottom quadcopter due to the airflow of the top quadcopter, which are as follows:

• LQ-MQ case: LQ experiences a force of 0.736 N. The force calculated experimentally came out to be in the range of 0.5-0.6 N which is pretty close (for vertical separations upto 2 m).
• MQ-LQ case: MQ experiences a force of 3.33 N. The experiments have not been performed for this yet. If the predicted value is close to the actual force, then the miniquad cannot hover below a large quad. This is because the weight of the miniquad itself is 1.5 N, and its theoretical maximum thrust capacity is 4.6 N (assuming maximum discharge from the battery).

Limitations of actuator disk theory:

• It does not give a dependence of the flow velocity on the distance from the disk.
• It is an ideal model which does not consider the shape of the propellers or the number of blades.
##### 3. Planned work for next week:
• Conduct MQ-LQ experiments.
• Analyze the data of the above experiments and compare it with theoretical predictions.
• Look into ‘better’ models (theoretical or empirical) – something that can give a distance dependence.
##### 4. Plans for next 30 days:
• Characterize torque disturbances on the bottom quadcopter.
• Analyze frequency content of disturbances (this might characterize noise rather than actual disturbances but still worth a try).
• Need to check out python packages for fft (fast fourier transform), or use MATLAB on bag files.
• Design a new rates controller to mitigate these disturbances.

## Update: Karan 2018-11-16

### Problem Statement: Characterizing aerodynamic forces on quadcopters flying in close proximity due to their respective downwash.

I will be using some acronyms in my posts and will list them once: CF – crazyflie (the smallest quad we have – until now); MQ – miniquad; LQ – large quad.

##### 1. Quick summary

A quick summary of what I have done till now, to have a connection and not suddenly start with this week’s updates:

• Conducted proximity flight experiments with different pairs of quads (CF-CF, LQ-CF, LQ-MQ). When I say LQ-MQ experiment, it means that LQ was at the bottom and MQ at the top.
• Collected data for each experiment.
• Wrote a script to obtain the forces experienced by the quads and their variation with vertical and horizontal separation.

Here are some sample plots of aerodynamic forces vs separation for LQ-MQ experiments:

These plots may seem like a random point cloud with no meaning, and this is what I have been struggling with over the past 3 weeks. The following methods were tried to mitigate this and get a trend:

• Simulated dummy forces to confirm that there is nothing wrong with the script. A spring force was added in the simulator and a plot made for its data. The plot showed a clear trend and hence it was verified that there was nothing wrong in the script.
• Moving average: Noise could be one factor leading to randomness and the belief is that a moving average can essentially cancel out the randomness. This did not help – I still get a meaningless point cloud.
• Filtering based on horizontal separation: All the data points with a horizontal separation greater than the sum of radii of the 2 quads were removed to only keep the data in which there was an overlap between the 2 quads in top view. This again did not give any results for a single experiment, but when data for multiple experiments was plotted together, there was some trend that could be observed. See plot below for LQ-MQ experiment:

For this week, the following was work was done:

• Analyzed data to get aerodynamic forces on the top vehicle. It experiences “near zero” forces. These forces are less than 5% of the weight and hence can be neglected (maybe I can include these in the future for better control). The forces on the bottom vehicle though are of the order of 10% or more of the vehicle weight. Sample plot shown below for LQ-MQ experiment.

• Conducted time of flight tests for the miniquad with various payloads. The miniquad weighs 150 g. Here are the flight times with a fully charged 800 mAh (2S) battery for various payloads:
• 0 g – 270 s
• 50 g – 213 s
• 100 g – 169 s
• We weren’t able to sustain the flight for a 150 g payload. This turned out to be a voltage drop issue which was rectified this week. The issue was as follows:
• The battery voltage dropped to about 5.2 V for a fully charged 2S battery.
• This reduced the maximum power output to a point beyond which the motors could not produce enough thrust to even hover.