Monday, April 26, 2010

The Controller

Until this point we controlled our quadrotor with keyboard input from a computer transmitted with our RF board from SparkFun. It was somewhat naive of us to try to even fly without controls for yaw, pitch, roll, and thrust. Finally we incorporated 2 joysticks from SparkFun on our wireless transmitter to allow us to control Thrust/Yaw with the left stick and Pitch/Roll with the right stick. We also added 4 LEDs (red, green, yellow, and blue) to our controller to indicate different statuses.

The inputs from the controller ranged from 0 to 5V and therefore from 0 to 1023 when using our 10 bit ADC on the ATMega32u4. This corresponded to +/- 512 resolution for yaw, pitch, and roll, and +512 resolution for thrust (ignoring negative thrust inputs). This was scaled appropriately to give smoother PWM responses. The idle thrust was also increased from, on a scale from 1000 to 2000, 1106 (our very lowest idle PWM) to 1200 in order to give us more resolution in controlling the thrust. Note that hovering is around 1300.

In the future we will add buttons to the controller for start and emergency stop. As of now we still have to press 's' on the PC connected to the controller and SPACEBAR for emergency stop.

Update:
We have now added battery voltage ADC to the wyvern code. The battery voltage is sent back in Volts*10 every 6 seconds to the controller. If the voltage is below 10V, all LEDs on the controller will toggle on and off to warn the user of a low battery.

1 comment: