QUB-ASL / bzzz

Quadcopter with ESP32 and RaspberryPi
MIT License
7 stars 1 forks source link

Yaw control from the RC #66

Closed alphaville closed 1 year ago

alphaville commented 1 year ago

Let us re-introduce the following line in main.src

yawReferenceRad += radio.yawRateReferenceRadSec() * SAMPLING_TIME;

But,

alphaville commented 1 year ago

Quick update: @gunturiCM is working on this now.

Firstly, let $\dot\psi^{\rm ref}$ be the yaw rate commanded by the stick on the RC. Then, the following transformation will be applied

$$\text{yaw rate} = \begin{cases}0, &\text{if} |\dot\psi^{\rm ref}| < \delta \\ \dot\psi^{\rm ref} - \delta, & \text{if } \dot\psi^{\rm ref} > \delta \\ \dot\psi^{\rm ref} + \delta, &\text{if } \dot\psi^{\rm ref} < -\delta \end{cases}$$

Secondly, if may (or may not) be a good idea to disregard the magnetometer measurements.

Thirdly, one idea is to have a controller that looks like:

$$u = K_p q^{\rm err} + K_d (\omega - \omega^{\rm ref}),$$

where $q^{\rm err}$ is the vector part of the quaternion error and $\omega^{\rm ref} = (0, 0, \omega^{\rm ref}_z)$ is an angular velocity reference.

patchedByBatman commented 1 year ago

I have opened another experimental branch to see if we can use the yawRateReference to control the Yaw and have the yawreference = currentYaw.

patchedByBatman commented 1 year ago

This has been addressed and solved in #71. The code was tested and successfully merged. This issue is ready to be closed.