Drogon Quadcopter Update : Flight Control

It has been too long since my last update, so here is what’s been going on. Up to my last update where I was testing under full manual control I was in a hurry to get the robot running. In that, I was successful. I got the hardware assembled, access to the hardware via the Arduino, and verified it all worked. The next big step was to develop the flight control software to keep the robot stable in flight and to be able to move where I want it to move. That is what I am working on now.

I have made a few attempts at flight, mostly tethered. There was one untethered test with unsuccessful results although I did get off the ground for the first time which I was not able to do under manual control:

The flight control algorithm approach I am using has three components:

  1. Position — Determines the position of the robot from the sensors.
  2. PID Control — Uses the current position versus the desired position to make adjustments to motors using a PID feedback control algorithm.
  3. Continual Learning — Measures success of PID Control to make adjustments to PID algorithm parameters.

I am approaching these components in order, with as much flight testing as I consider safe during the process to work out bugs, see how it performs, and gather data. I plan on developing a relatively simple Position algorithm so I can develop the PID Control algorithm and model the best PID algorithm parameters I am able to manually tune. Hopefully with that I will get more flight data to improve the Position algorithm and gather data for the Continual Learning algorithm. Then I will tackle the software for the Continual Learning algorithm. I don’t yet have a full plan for that, but I have many ideas on where to start.

The first challenge is simply getting accurate positional data from the accelerometer and gyroscope. First, the sensors measure different things. The accelerometer measures acceleration, which can give some indication of position by effect of the acceleration due to gravity since the acceleration due to gravity is constant. The gyroscope measures rotational velocity in degrees per second. Second, both are fairly noisy, especially with the motors going and the copter starts moving. Right now I have a very simple algorithm to combine the two sensors into a single angular offset of the pitch and roll (ignoring yaw for now) with a running average filter. I have also developed the main PID control algorithm, with some potential improvements to try once I get it running.

To tie these pieces together and to turn them into final motor adjustments, I have a series of translation steps that need to be made. First I have to translate the coordinate space of the robot, which is how the position of the robot is tracked, to the coordinate space of the motors because the motors are offset 45 degrees from the axis of the robot (called an “x” configuration quadcopter as opposed to a “t” configuration). This translates the position of the robot, through rotation matrices, to determine the position of each motor. To determine the error value to use in the PID algorithm, I use the arc-length of the offset of each motor from the zero-position (to achieve robot motion, instead of the zero-position, the offset will be from a target position which would cause the desired motion). Two error adjustments are calculated and applied oppositely to opposite motors by adding (or subtracting for the opposite motor) to a target motor speed. The target motor speed is currently determined by the receiver channel 3 value.

I am currently modelling the PID algorithm to guess at good PID algorithm parameters by feeding position changes into the algorithm and analyzing the results. More on this later.

Share

Drogon Quadcopter Update : Manual Control

As part of the development process for Drogon, I wanted the first attempt at flight to be under full manual control. I did not expect to be able to fly, I wanted to see what happened. At the very least I hoped to validate things like the motors providing enough lift and to collect sensor data to help build the stabilization algorithms.

During the manual control testing I am only working from the Arduino. The Raspberry Pi is only acting as a logger, reading the stream of sensor and control data from the Ardruino over the serial connection. The Raspberry Pi won’t really be used until I get further along with the stabilization, control, and management software.

The first set of tests were tethered to a wood pallet. The pallet is large and heavy enough to give the quadcopter a safe and restricted environment to test flight controls. In my first attempt, the tether lines were too long so it ended up just tipping over and the propellers slammed into the pallet. Fortunately it came away with no real damage.

Here’s a picture:

PalletPic

And here’s a short video clip:

The next tethered test was more successful. I shortened the tether lines and was able to gain lift off the ground and even verify the manual direction controls worked.

Now that the controls were validated with tethered testing, I moved on to outdoor un-tethered flight testing. As expected, full manual control did not achieve flight. Just a lot of tipping over. Below is a shorter clip from the test session.

Next steps are to begin work on the stabilization algorithm. I expect that to be a gradual process as I build out, tweak, redesign, tweak some more, and optimize the code and algorithm constants. As it stands at the time of this post I have made some progress on the stabilization algorithm and even made a few test flight attemps. I hope to write up a post on it soon. Check out my YouTube playlist with all of the test videos:

http://www.youtube.com/playlist?list=PLclL3kp0O7XUoYn2oOVWTNV-DFnEPoXih

Check out the GitHub project for the work in progress

https://github.com/joemonti/drogon-arduino

Share

Drogon Quadcopter Update : Final Assembly (Almost)

Assembly is just about complete now on the Drogon Quadcopter at least to be able to do initial flight tests. Motors and speed controllers are all mounted with the wires secured. The speed controllers have been programmed with the programming card and have been verified that they spin in the correct direction. Next steps are to finish up the coding and attempt first flight.

Here are some photos:

IMAG0103 IMAG0106

I did run into a few issues. The big one was that when I first hooked everything up I setup a test to make sure the motors, speed controllers, etc worked. Well, they didn’t. None of the motors from any of the four I/O pins I was using worked. I couldn’t even arm the speed controllers which I thought I had worked out. After testing everything from the control signal to the basic I/O of the I/O pins, I traced it back to not even being able to read 3.3v with a multimeter when setting the pins with digitalWrite to HIGH. I may have reversed polarity when I was first making sure everything got power. Whatever the cause, those pins (2-5) were dead. To work around the issue so I didn’t have to buy and wait for a new Arduino quite yet, I rewired the 4 pins (8-11) intended for the LEDs instead to the motors, updated the code, and right away I got the speed controllers arming and spinning up without issue. I still need to re-wire the LEDs. I added a new header to the Arduino shield to borrow 4 unused pins.

I also still need to mount the Raspberry Pi Camera module. I have the mount, screws, and standoffs. I just need to drill everything out and mount it. But I think I will hold off until I make first flight. As an alternative, how about a Google Hangout? I can mount an old Anrdoid phone on the Quadcopter. Let me know if you’d like to join the hangout.

Next post I hope to be flying!

Share

Drogon Quadcopter Update : Build Progress

I have started mounting and wiring more parts on Drogon. Here’s a photo:

IMAG0054

The first is that I have mounted and wired the LEDs for each arm. They will blink relative to the speed of their corresponding motors. Also, the two front arms have red LEDs and the two back arms have green LEDs so I can better tell the front from the back. The LEDs came mounted in a small plastic housing meant to pressure fit into a hole, so I chose to drill through the arms (hopefully this wont compromise the strength too much!) so the LEDs came out the bottom. This way they would be most clearly visible while the quadcopter is above you.

Second, I had only enough screws to mount one motor (the rest are coming soon) so that is now mounted along with its speed controller. For now the wires are a little loose because I may need to reverse the direction of the motor.

Next I added the USB hub to manage power for the Raspberry Pi. And finally I made the wire and connected the serial line between the Raspberry Pi and the Arduino.

Still more work to go but making progress.

Share

Drogon Quadcopter Update : Boards Mounted

Quick project update. The boards (arduino+custom shield, RaspberryPi, and receiver) now have their holes drilled and are mounted on the frame. I also have added the rigging for the battery (rubber mat and velcro strap). Here are a few photos.

IMAG0040

IMAG0045

 

I needed to order a few additional parts for mounting motors and Raspberry Pi camera module. So now waiting on those.

Share

HoverDrone is now Drogon : A Semi-Autonomous Quadcopter

The HoverDrone project has been given a new name: Drogon. Named after one of Daenerys Targaryen‘s 3 dragons, Drogon, from the A Song of Ice and Fire book series (A Game of Thrones, A Clash of Kings, and others) by George R.R. Martin. I think the name is fitting for the project, although I hope it never breaths fire (either intentionally or unintentionally). I’m not a big fan of the word “drone” given its negative connotations and implication that it is unintelligent and/or human controlled.

I have started a few new Github projects for the Drogon software systems:

  • drogon-arduino : Arduino sketch for handling low-level flight stabilization, navigation, and sensor management.
  • drogon-master : A Java web application to run on Drogon’s Raspberry Pi providing high-level control and management.

The project is still in very earl stages. Drogon cannot yet fly but it is coming together.

Share

HoverDrone Update : New Parts Received

Received more parts today. Most importantly the rest of the motors and speed controllers, along with some miscellaneous parts. Soldered a bunch of connectors and the wire harness. I have almost everything I need. Still waiting on another shipment of miscellaneous parts and I’m sure I’ll need more random parts as I assemble it all. I was hoping to get all of the motors and speed controllers mounted, but the motor screws I got are too long. Getting close!

Photo of the four motors/propellers….

IMAG0371

Closeup of the wire harness to split the power from the battery to the speed controllers, Arduino, and Raspberry Pi (needs large heat shrink tube)…

IMAG0369

Share

HoverDrone : Arduino Shield Complete

I finished soldering the Arduino Shield to interface the Arduino Due with with the rest of the HoverDrone components. I started with the DIY Shield for Arduino from Adafruit. It contains:

  • 3 Status/activity LEDs
  • 4 connectors for LEDs that will go on the end of each of the 4 arms of the quadcopter
  • 4 connectors for the speed controllers
  • RJ11 connector for the receiver
  • 1 connector for IR sensor
  • 3-Axis accelerometer breakout board
  • 3-Axis gyrosope breakout board

Here is a photo of the completed shield sitting on top of the Arduino Due

IMAG0367

Share

Vex Robotics Transmitter/Receiver on Arduino

Success!! The Vex Robotics receiver is now working on Arduino. For now I am using an Arduino Duemilanove because it runs at 5v logic levels so I don’t have to do any logic level conversion for the receiver which I can only assume is intended for 5v and the Arduino Due runs at 3.3v. Once I have a proper 5v-3.3v level shifter circuit I’ll get everything setup for HoverDrone testing.

Here is a shot of the test setup:

vexreceiverarduino

I have a simple test Arduino sketch to log the receiver data to the serial console. All 6 channels work great, I just need to put together the math to map it to the quadcopter motors. Here is the code on GitHub:

https://github.com/joemonti/vex_receiver_testing

Share

HoverDrone : A Semi-Autonomous Quadcopter : Part 1

I started a new project code named HoverDrone. The goal of this project is to build a semi-autonomous quadcopter capable of:

  1. Self-stabilized flight
  2. Self landing and takeoff
  3. GPS waypoint navigation
  4. Video capture and streaming

The first phase of the project, however will be to provide as manual as possible control by radio control. This will serve to achieve flight as quick as possible, to test flight capabilities, and to collect data for flight control algorithms.

For low-level flight control and sensor management, it will use an Arduino. In the first phase of the project, the Arduino will read the output from a radio receiver and translate that to increasing or decreasing power to motors. It will also perform data logging to an on-board Raspberry Pi via I²C or serial.

Here is a picture of the frame I am using (for the first version of the HoverDrone I am using a kit, next version, or if/when this one breaks, will be a custom built frame) and the motor/propeller I am using for testing:

HoverDrone with One Motor/Prop

Below is a video of the first test of the speed controller from the Arduino:

That first test was not correctly interfacing with the speed controller. Even at full control signal from the Arduino, the motor was not getting nearly as much power as I expected. The problem was I was using the analogWrite function instead of the Servo library for controlling the speed controller. The difference is that analogWrite is intended for directly PWM control, while speed controllers expect a slightly different signal in terms of its timing for what you would use with servos. Once I fixed that I was able to fully control the speed controller. This is a video of a test running at much higher speeds.

At this point, the parts I am testing with are:

  1. Arduino Due
  2. Raspberry Pi Model A
  3. Vex Robotics Radio Transmitter/Receiver (I just happend to have one)
  4. Hobbyking X580 Glass Fiber Quadcopter Frame w/Camera Mount 585mm
  5. AX-2810Q-750KV Brushless Quadcopter Motor
  6. Turnigy Multistar 30 Amp Multi-rotor Brushless ESC 2-4S (OPTO)
  7. Turnigy 2200mAh 3S 20C Lipo Pack
  8. 3-Axis Accelerometer
  9. IR Sensor
  10. Miscellaneous bits to put it all together and for testing (breadboard, wire, LEDs, resistors, rotary encoder)

The code I am using for this testing phase is in my Github repository:

https://github.com/joemonti/hoverdrone-testing

Stay tuned for more posts and videos as I make progress on the project.

Share