Monday, April 14, 2014

Breakthrough!!
After getting rather frustrated by the code not operating as I thought it should.
Well I spent a good hour just line by line inspecting the code and making sure I totally understand what I was asking it to do.  I removed about 120 lines of code that was essentially redundant, which also compounded the if else statements making them rather complicated.  So here it is in a working format.  Some very small things need some tweaks, and I am still researching switch cases to lay the code out better.
So check it out, working wall avoidance on pitch axis and roll axis.  I am only using 4 ultrasonic sensors to prove the concept.

Version 1.06 Beta working
So the drift factor is fixed but now I have a lovely error that I cannot figure out.  Once the distances trigger for danger area, it no longer allows any user control, even backing away from the wall.  Right now you could put the thing in a 10'X10' room it will automatically find the middle but that is not what we are after.
Most recent code:

1.05 beta

Wednesday, April 9, 2014

Second and third flight tests today.  We are almost there people.  Most of the wall avoidance did perform as expected.  I think I saw something in the logic of the code though so I tested that possible failure out later.  I see that the code as it was written is not doing anything with the sensor data if there is no updated input from the user.  I was afraid of that but assumed, yeah bad thing, that the Transmitter constantly updated the receiver whether the operator changed something or not.  This is not the case.

I was able to run the quad into the wall by letting it drift.  In other words, I started it moving towards the wall and then stopped giving it commands.  What occured was that the quad went to level out, but because we were testing in a hallway the momentum and eddy currents from the props let the quad drift towards the wall allowing the quad to hit the wall.  Never fear, I think I have a solution for this.
The way I had the code written before it only updated the data sent to the flight controller if it received input from the transmitter.  I have rearranged the if else statements to be driven more so by the ultrasonic sensors.  So first it checks to see which distance is closer in each axis, then it checks for the update flag and updates the flight controller.  if no update is seen then in the 45 cm range it still backs away from the wall and at the 60 cm range it tells the flight controller to stay put unless the TX/RX has an update that tells it to move away.

Posting version 1.04beta below.  More testing tomorrow.

text version of 1.04 beta


Monday, April 7, 2014

First Flight test today went... well not so good.  First off I found an issue with the APM 2.5 where the pitch channel is basically inverted.  If you move the stick up on your hand station to simulate pitch forward it increases the PWM frequency to between 1500 to 2000 milliseconds, and the radio calibration on the mission planner software for the APM shows this as correct.  The problem lies in the Arducopter firmware.  It registers 1500 down to 1000 as pitch down.  This is the opposite of what the hand station defaults to.  The solution was a minor rewrite of my code to account for this and reversing the channel in the hand station.  Problem one solved.
Problem two.  I did not have enough female to female extension jumpers to connect the ultrasonic's 4 wires to the Mega and I modified some female to male connectors.  This was not making a complete connection with the Mega board.  With the vibration that the Quad suffers in flight these connections became , well ... non connections.  If the sensors lose connection I get no distance data and no override or control happens to slow an approach towards a wall and no auto back away.  What does this mean, well for me it meant 3 broken props from 2 wall strikes while hovering 1 to 2 inches off of the ground.  Problem 2 will need attention before the next flight.
Well that's the bad news, now for the good news.  The quad avoided the wall in one direction perfectly.  The servos are also working perfectly to keep the ultrasonic sensors horizontal to the ground.  Once I get the hardware connection problems fixed we will try another flight test.  If everything goes well, the quad will actually be ready for demonstration by this weekend.

I updated the link for the current code on my dropbox account.

Wall avoidance 103beta  

Sunday, April 6, 2014

Weekend update.

So the Quad is now about 90% assembled.  I wanted to do some testing today, but ran out of time.  I am posting some pictures of what it looks like right now.  When this is all tested and working I will start a new blog with everything a little more organized.  I know this blog isn't really frequented by people outside my circles, but I wanted it to be open so anyone who may be interested.  For now, enjoy/hate my quads current state.  Understand this is not a mass produced store bought quad, all parts were either fabricated by us or ordered separately and assembled by either Jimmy or myself.
Note the ultrasonic mounts on all four cross beams.  They have servos attached that will change the pitch of the sensor to keep them horizontal during flight.


Im using a sensor sheild with the arduino Mega2560 so I can easily distribute power among the sensors.

My silly hinged double decker thing I made to get to the flight controller.


Those black parts were printed on the makerbot printer at the lowest resolution.  You can actually see the different layers of plastic.



yep thats flex tubing conduit you can buy from just about any auto parts place or hardware store, relly wanted the larger ones to be black though, couldn't find any.


Well for now that will have to do.  Tomorrow I will show our progress to our professor before continuing work on it.  Hopefully this week I can see if my code is going to save or destroy this quad.  

Wednesday, April 2, 2014

A quick update on the project.  We are printing the ultrasonic mounts today and hope to have the servo mounts printed tomorrow.  A quick drawing of the proposed quad copter is below:




Below is our first draft proposal for the project

The 3D models that we are printing
Servo mount to tilt the sensors
corner mount for the rods

While these presentations and proposal draft have changed, they show some of the process we have gone through to get the project to where it is now.

Some of our previous test videos with the quad copter:
 (we will be updating this channel with the new videos)
youtube channel of test flights

coming soon videos:
3D printing parts
assembly
outdoor test flights
indoor test flights

Tuesday, April 1, 2014

Well I found some more silly errors with my code, updated the link.  Just had my pins declared wrong and my array calls incorrect.
Meanwhile today the schools Maker bot 3d printer was being... well rather difficult is not a strong enough word.  Needless to say some foul language crossed my lips while in the heat of battle today with it.
What I learned from the maker bot today:
black ABS plastic + default settings + rafts = part moving around the build plate with the nozzle.  Too much fun.
Anyway we changed the build plate temperature to 115 C and slowed the printing movement down since the Maker Bot is on a table that allows it to shake a bit when moving between extrusions.
Tomorrow we will try 120 C on the build plate and see if that remedies my parts coming "unstuck from the build plate" issue.  We did get the last two corner mounts printed and now we will be working on the ultrasonic and servo mounts.  Servos for tilting the ultrasonic sensors with the Quad copter to keep them perpendicular to the walls.  It all makes sense, seriously.

I am thinking of trying out switch cases to replace some of the if else statements in the code.  Not sure how that will work since I would be trying to switch ranges.  I think something like:
switch(distancef)
{
case 1 ... 45:
do stuff
break;
}

yeah yeah I'm typing this from my vast knowledge in my brain and there are probably some syntax errors there.  Don't judge me I'm learning lol.

Back to the Quad copter.  Tomorrow I will post some drawings of the quad.  Those files are at the school on my laptop in my office so I don't have access to them right now.  Jimmy also finished redesigning the servo and ultrasonic mounts.  just go to one of his thingiverse posts listed a couple of blog posts back to see his work.

So, if we get all the parts printed within the new couple of days, and we get time to test the code I will be posting videos.  My current deadline for something proto typed and working is before April 24th 2014 for a presentation to the Industrial Advisory Committee.  So definitely look for updates between now and then.