# Concepts of Quadrotor control:
## Differential flatness:
* A system if differentially flat if
* its relative degree is equal to order of the system.
* it is locally diffeomorphic( Transformation between z and x coordinate sytem is invertible)
> why do this conditions lead to differential flatness, For me this concept of differential flatness if very abstract. I want concreate understanding.
### Concreate understanding:
* Output y and it derivatives needs to be locally independent.
* It means there is no relations like $h(y, \dot{y}, \ddot{y}, ...) = 0$.
* Why this is important? Local independence allows us to generate trajectories of the output without constraining other output.
* The Transformation $z = T(x)$ and its inverse exists locally if system is diffeomorphic locally at some point $x_0$
* Apart from this, it is not necessory that you check it for every system, this conditions, to proceeds towards finding the state as a function of derivatives of outputs.
* If you find the algebric relation between required state and derivatives of output. The output can be said as differentially flat( I have no proof, simply from the initial understanding of the concept)

## Incremental Nonlinear Dynamic invesion Control(INDI control):
* This is basically Input output linearisation which is Nonlinear dynamic inversion
> u = $\phi(x,v)$
> v should be defined such that linearized system is stable.
> v is usually equal to nth derivative of output y. i.e, $y^{(n)}$
> In our case what are we doing ?
* I need to find the proof that internal dynamics in this case is stable.

## Dynamics of the quadrotor:
* Derivation of equation of motion comes from $dL/dt = \tau_{ext} \text{ and } dP/dt = f_{ext}$ Here L and P are angular momentum and linear momentum respectively.
* Equations of motions:
$\tau + \tau_{ext} = I\dot{\omega} + \omega\times I\omega$
$m\dot{v} = g\hat{i_z} + \tau b_z + f_{ext}$
Here, $\hat{i_z}$ is z direction in the intertial world frame and $\hat{b_z}$ is the z direction in body frame.
> how will we get bz in intertial frame from quaternions ? (Do we need to know this ?)
* Time derivative of quaternion:
$\dot{q} =\text{ 0.5 } \times q \text{ o } [ 0 ,\omega]^T$ with hamilton product.
Derivation:


* Heading of vehicle:// TODO... Finish this, it is important for understand of yaw control and implementation of dfbc control.
It is the direction of the nose of the vehicle , it can be different from the actual movment of the vehicle.
* Understanding of projection is necessory:[wiki](https://en.wikipedia.org/wiki/Projection_(linear_algebra))
> - [Linear algebra projection notes](https://drive.google.com/file/d/1_GCgVXQ85TZ5wx5izvMKQATzdCjua4Wh/view?usp=sharing)
> - Matrix P is projection matrix if $P^2 = P$ and It is orthogonal projection matrix if $P^2 = P = P^T$
> - Matrix which is not orthogonal is oblique projection matrix.
*

## Important papers:
1. [Nonlinear Quadrocopter Attitude Control](https://www.research-collection.ethz.ch/server/api/core/bitstreams/ef3da141-58dd-4062-8ed5-481a42c06158/content):
Important to understand the quaternion control law, stability proofs and robustness proofs.Also this is implemented in px4. Standard attitude control now.
2.