QUB-ASL / bzzz

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

Yaw rate based controller. #71

Closed patchedByBatman closed 1 year ago

patchedByBatman commented 1 year ago

Ready to release

Main Changes

Instead of having a yawReference to command the drone to move to a set yaw, this code tries the following:

  1. Set the currentYaw as the yawReference. This means that we are never correcting the yaw.
  2. We take the yawRate from the RC and command a yawRateReference. We were not commanding any angular velocities previously, so we were feeding angularVelocityCorrected directly to the controller. Now we provide yawRateReference to the controller and inside the controller, we update it as
    yawRateError =  angularVelocity[2] - angularVelocityYawRef;
    control[2] = m_angularVelocityGain[2] * yawRateError;

There were other similar implementations for yaw control, one such implementation can be found in Ardupilot.

Associated Issues

Tests

Testing is done. The drone flies well. It stabilizes in the air; the drone was never found to yaw unnecessarily during the entire testing period.

patchedByBatman commented 1 year ago

The testing is done, and the code is ready for review. @alphaville, and @jamie-54 please have a look.