Wednesday, May 28, 2014

Day Two. Objective: Autonomous Flight

Note: This is a series of articles in which we document our attempt to build an autonomous drone for the Sparkfun AVC.  The previous post is here.

Day two was an insanely fun day.  We all agree that this project is even more fun than we thought it would be.  We logged a lot of time flying and crashing the hexcopter today.  Side note: I am, hands down, the worst pilot in the family.  You won't see me at the controls on competition day.

I will say that the DJI F550 is one tough little copter.  We've abused it pretty thoroughly and the only damage it's taken is some scrapes and chips on the propellers.  There are a couple of new propeller sets on order.

Spinning Out of Control

As we left off from the previous night, we had a copter that would just spin around every time we took off.  Our first guess was that it was a transmitter calibration problem, but that checked out fine.  Is it possible that there is a trim setting in the autopilot that was off?  Our research turned up nothing.  Alex finally figured out that our motors were rotating backwards from what the autopilot expected.  The diagram below shows the correct configuration, we had fixed the motor numbers but had not noticed that each pair was rotating exactly backwards from what the Pixhawk expected.  Another silly mistake, but we're learning!


After rewiring our motors - yet again! - controlled flight was finally achieved.  This was an exciting milestone and we all took turns flying our new creation.


After a few very small, very controlled flights around our living room, we took it out to the back yard so we could get some elevation.  This allowed the younger, more dextrous members of the team to get some real flight time in.  I guess we can no longer claim that all that video game playing is a complete waste of time.  If you've never flown a quadcopter, I highly, highly recommend it.  So much fun.

We then spent some time testing out the stabilize, loiter, and land modes that we bound to a switch on our transmitter.  Stabilize mode attempts to keep the copter level but otherwise gives you complete control.  Loiter mode attempts to maintain the copter's current altitude and position.  It turns out that you can still control the copter and move it around in this mode, but it's quite a bit less sensitive to control input from the joysticks.  This mode was the easiest for me to fly.  Land mode, as you'd expect, just executes a soft landing and it does a remarkably good job.  The altitude sensor seems very accurate, which will make maneuvering around the obstacles on the AVC course a bit easier.

On to Autonomous

The next step was to add our GPS unit to the copter and connect it to the autopilot.  We really need to mount it on a platform above the electronics, but for this prototype we just zip-tied it to the quad base.  This may have hampered our accuracy somewhat and probably led to a crash that you'll see in the video below.

We elected to recalibrate our compass since the GPS receiver has its own, although this may have not been necessary.  Matt then initialized the flight planning software by setting the home location, adjusting the altitude down to a safe testing height (no higher than our backyard fence) and creating a flight plan.  He also replaced loiter mode with autonomous mode on our transmitter switch so we could take the copter in and out of autonomous mode with the flip of a switch in case of emergency.

Matt's first flight plan was to manually takeoff, engage auto mode, go to a waypoint and loiter, and then re-engage manual flight and land.  As mentioned previously, it turned out that our GPS receiver really isn't accurate enough to reliably navigate a space as small as our back yard.  It may be a problem with our compass, the magnetic declination settings, or maybe we're getting some interference with our GPS receiver.  Classifying this problem is on our task list for future investigation.

Eventually we worked around the accuracy issue and progressed to a flight plan with full autonomous take off, proceeding through two waypoints in our backyard, and a fully autonomous landing.  Check out this video for the day's highlights!




Tomorrow's objective will be to fly to a waypoint and drop a tennis ball from the hexcopter and return to the start point for landing - our first real mission simulation for the AVC! Check back tomorrow to see how we do.

Next: Day Three

No comments:

Post a Comment

Please Note: All comments are moderated. That's why you won't see your comment appear right away. If it's not some stupid piece of spam, it will appear soon.

Note: Only a member of this blog may post a comment.