Compute the hovering capabilities of drones with arbitrary configurations.
Updates:
[24 September 2024]
Custombody
and standard body classes is now able to compute mass, inertia and C.G. location given propeller locations. To enable this, simply leave outmass, cg, Ix, Iy, Iz, Ixy, Ixz, Iyz
when calling the class.- Automatic computation can be overridden by defining the mass, inertia and C.G. properties when calling the class.
- Automatic computation override only available on
Custombody
. Standard bodies does not have this override feature yet. - See the section on Defining drone bodies for more details.
[28 May 2024]
- Packaged library - dronehover
- Changed definition of propeller direction to
"ccw"
or"cw"
.
[20 May 2024]
- Motor commands are now proportionate to the square of motor RPM.
- Propeller forces are now defined using force and moment constants rather than maximum thrust and moments.
Create a virtual environment and run pip install .
Run example python3 examples/hover_quad.py
to test.
The drone has a body-fixed coordinate system which follows the North-East-Down (NED) convention (
Drones are defined using classes, and require propeller properties as class variables.
Propeller properties are defined using dictionaries, and require the following keywords:
"loc":[x,y,z]
: List that defines the
"dir":[x,y,z,r]
: List that defines the direction of thrust and rotation for the propeller. Includes 4 numbers, first 3 numbers are the
"propsize
: Size of propeller in inches. Propeller constants and motor mass extracted from a propeller library.
Example:
props = [{"loc":[length*cos(1/4*pi), length*sin(1/4*pi), 0], "dir": [0, 0, -1, "ccw"], "propsize": 4},
{"loc":[length*cos(3/4*pi), length*sin(3/4*pi), 0], "dir": [0, 0, -1, "cw"], "propsize": 4},
{"loc":[length*cos(5/4*pi), length*sin(5/4*pi), 0], "dir": [0, 0, -1, "ccw"], "propsize": 4},
{"loc":[length*cos(7/4*pi), length*sin(7/4*pi), 0], "dir": [0, 0, -1, "cw"], "propsize": 4}]
There are 2 ways to define the drone body.
- Creating a class that follows the format as seen in
drone_hover.standard_bodies
. - Call the
Custombody
object
When using Custombody
, inertia properties are optional parameters. Inertia properties of the drones are computed automatically. If inertia properties are defined, the automatic computation will be overridden.
Inertia properties are the mass and moment of inertia of the drone, and are defined using variables. C.G. location is also defined as a list.
Example:
from drone_hover.custom_bodies import Custombody
drone = Custombody(props) # Automatic computation of inertia properties
drone = Custombody(props, mass, cg, Ix, Iy, Iz, Ixy, Ixz, Iyz) # User defined inertia properties
The propeller constants are compiled into a library (dictionary) and can be found in the __init__.py
file.
This code utilizes 2 levels of mapping for the propeller commands.
- The propeller angular velocity is normalized such that
$f:\omega \rightarrow \hat{\omega}$ , where$\omega \in [0.02\omega_{max}, \omega_{max}]$ and$\hat{\omega} \in [0.02, 1]$ . The factor 0.02 is arbitrarily selected to be the idling speed of the propeller. This mapping embeds the propeller information into the propeller effectiveness matrices. - When giving actual commands to the drone, it is more convinient to give a command
$u \in [0,1]$ . Hence, a second map$g:\hat{\omega} \rightarrow u$ is defined.
This is done to ensure that the equations remain linear (to
Optimization is performed using scipy.optimize.minimize
module, using the SLSQP algorithm.
- Determine whether a drone can hover statically, while spinning, or not able to hover at all.
- Works on drones with arbitrary configurations (e.g. number of propellers, location of propellers, direction of propellers, etc.).
- Computes the input commands for most efficient hover.
- Computes the maximum thrust to weight ratio at hovering configuration
- Computes the cost of most efficient hover.
- Spinning hover optimization does not work when force is aligned with torque for all values of input commands. SLSQP require constraints to be twice differentiable. To consider alternative optimization algorithms.