Quadrotor Control
Designed and built a quadrotor for autonomous flight. Implemented code for IMU, joystick control, PID control, and Vive sensor integration.
Video Demo
Inertial Measurement Unit (IMU)
We get data from both the accelerometer and gyro in the IMU.
- Calibrated all 3 gyro DOF to counter drift
- Calibrated pitch and roll
- Implemented complementary filter to high pass gyro output and low pass accelerometer output so that both the low noise of the gyro and the long term accuracy of the accelerometer can be utilized
Safety Limits
To prevent the quadrotor from undesired behaviors, we implemented a number of safety measures to stop the program:
- Any gyro rate >300 degrees/sec
- Roll angle >45 or <-45
- Pitch angle >45 or <-45
- Keyboard timeout
P Controller
To provide linear feedback, we implemented proportional controller following:
Motor PWM = neutral_power +- pitch/roll/yaw_error * P_value
I Controller
To counter constant offsets (power difference of motors, shifts in weight, etc.), we implemented integral controller following:
I_term += error * I_gain for every time step
D Controller
To maintain angular velocity, we implemented derivative controller following:
Motor pulse width = neutral_power +- pitch/roll/yaw_velocity * D_value
Joystick Control
To incorporate manual control, we implemented support for joystick input that would do the following:
- Changing roll/pitch angle
- Increase/reduce thrust
- Pause/unpause flight
- Calibrate sensors
- Kill program
- Joystick heartbeat detection (for safety)
Vive Lighthouse
To achieve autonomous flight, we need to know the pose of the quadrotor in 3D space. We added 4 sensors that would take in IR light transmitted from the Vive Lighthouse, which provides 2 sweeps of planar light. We can then get the X, Y, Z, and theta position of the quadrotor for autonomous flight.
Source Code
Group Members
Eric Yang