As an interlude to our TELLO drone autonomous flight programming, we will introduce physical unit management into our Jupyter Notebooks to avoid calculation mistakes. If we develop code for any airborne platform above 180 grams, it is worth considering the homogeneity of __dimensional analysis__ before we __crash anything__.

After tampering with some open-source Python modules for this task, this one, __forallpeople____,__ offers the best balance in usability and performance. We will install the module on our Jupyter environment if needed:

`!pip install forallpeople`

And following the module documentation, we create a default International System units environment:

```
import forallpeople as si
si.environment('default', top_level=False)
```

We will test dimensional homogeneity with an elementary drone potential energy analysis. If our drone is 0.18 kg in weight and we command it to raise 30m above the current flight level, how much is the change in potential energy? This energy change will come from draining the batteries and provides an alternative method to measure the energy efficiency of our drone. With these physical values:

```
mass = 0.180 * si.kg
h = 30 * si.m
g = 9.8 * si.m / si.s**2
print(mass, h, g)
```

`180.000 g 30.000 m 9.800 m·s⁻²`

These are now physical magnitudes with attached SI units. We can verify that our mass is expressed in g, altitude in meters, and the acceleration of gravity in meters per second squared. The potential energy change when raising 30 meters is then:

```
d_potential = mass*g*h
print(d_potential)
```

`52.920 J`

Good, the potential energy change is expressed in Joule. The dimensions are homogeneous and as expected. By doing this calculation, we have found the minimum amount of energy needed to raise by 30 meters, disregarding the effects of drag on the drone cross-section as it climbs.

For an initial power estimate and to check the accuracy of the calculation, we need to know how much power is used to keep the drone in a hovering flight at sea level. This calculation for helicopters is complex and requires parametrizing the aerodynamics of the blades, mass distribution of the blades, and assumptions regarding airflow through the hovering disk. Our approach illustrating unit usage is different. We will let our fully charged TELLO drone hover for a while, starting with a full charge battery and checking how long does it take for the battery to report a 10%, 20%, and 30% charge drop. To fully characterize the energy exchange, we need to keep it hovering until the battery is empty. In this way, we can check any non-linearities in the power discharge.

The total power stored in a fully charged battery is 1100mA-hour, delivered at 3.8 Volts, so the total energy stored is:

```
V = 3.8 *si.V
I = 1100e-3 * si.A * (si.s*3600)
capacity = V*I
print(capacity)
```

`15.048 kJ`

The unit calculator takes care of the dimensions for us. Then, for a 10% battery discharge point, that happens one minute after the flight starts, the power consumption is:

```
discharge = 0.1
time = 60 * si.s
hover_power = capacity * discharge / time
print(hover_power)
```

`25.080 W`

In this hypothetical case, the drone requires 25 Jules every second to maintain a hovering position.

We are ready to introduce these calculations, including the international system definitions, into our flight mission and mission recording functions to obtain an empirical characterization of the flight time remaining our drone has with a given battery.

Do not hesitate to __contact us__ if you require quantitative model development, deployment, verification, or validation. We will also be glad to help you with your machine learning or artificial intelligence challenges when applied to asset management, automation, or intelligence gathering from satellite, drone, or fixed-point imagery.

The link to the notebook for this simple analysis is in this __link__.

## Comments