Tuesday, October 11, 2011

Videos!

So after the semester ended, I didn't have as much time as I thought before I left for my internship.  Then when I got back, school started pretty quick.  So I finally had some time to upload my videos from demo night.  Enjoy!


Monday, April 25, 2011

Attachment of Showcase Handout

Here is a PDF copy of my Showcase Handout (click to see full size image).  I've turned in my last assignment for my other classes today, so over the next week I hope to add a few more posts regarding shopping lists, code snippets, and other miscellaneous tidbits.  Stay tuned.

Monday, April 18, 2011

Completed!

I have finished my Droid.  The software is complete.  The body design is complete and built.  All of his hardware is finished (and it all fits inside... I was worried for a bit :-D).  I'll post follow up pictures, video, and information after the presentation on Thursday as a sort of after-action review.  See everyone on Thursday!

Friday, April 15, 2011

New drive values - implemented!

So my theory worked, and now I have new CONTINOUS drive values based on my previous post.  I have put together a little demo video showing the output values as I move the drive stick around.  Each tick, two sets of numbers are printed.  The first row is the data being sent from the controller... the only two of importance for this video are the first two values, they are the Y and X values (respectively).  I put Y first because that determines forward/backward, while the X determines left/right.  The second row consists of the sine/cosine values based on the stick angle.  The first one is the left wheel, the second is the right.  As these stick values change, the droid calculates the angle they create and assigns sine and cosine values to them, which I'll work out to be percentages of speed.  When both values are equal, they are only at 0.71, so I have one last thing to do to scale these values so that there is always a 1.00 (basically I'll take the largest magnitude of the two and divide them both by that).  Again, these are only percentages, the final speed will be determined by how far the stick is from center multiplied by these percentage values.

In my video, I start out pushing the stick to the right, then slowly circle counterclockwise slowly about 1.25 times around.  If you follow my rotated unit circle from my previous post (and you have a good idea of the decimal values of fractions shown) you can see that this will work just fine.

(Currently my video is not uploading right... I'll take a look tonight and fix it then.)

UPDATE:  So the Jing video I recorded is a .swf file, and for some reason it isn't letting me upload it.  Suffice to say, I won't be worrying about the video... but believe me, it was good.  :-)  No it wasn't, it was a bunch of numbers flying up a screen.  I'm really tired... only thing left to do is paint him and he's done done.

Thursday, April 14, 2011

Drive values solved... hooray trigonometry!

So I've been trying to decide how to determine the values to set the drive motors from the X-Y axis values that I'm sending from the controller.  When the stick is just moving in the Y direction, I want both wheels to go the same speed (forward or backward), when the stick is just moving in the X direction, I want both wheels to go the same speed, but in opposite directions (forward/backward or backward/forward), and when the stick is in some combination of the two axes, I want the values to interpolate between these extremes. 

My initial calculations caused some deadspots in the stick values where the droid wasn't moving in the direction that I was expecting (or it wasn't moving at all).  So I thought instead of having discrete cases to do certain things with the values, if I could find continous functions that I could feed in these inputs that would output the values I wanted, I wouldn't have to have a bunch of if-else statements.  So I set out to find these functions.

Today I was brainstorming and thought "maybe cyclical trig functions would help out", so I looked up the unit circle:

I got this picture from:
http://www.mathpeer.com/images/trig/unit_circle.gif
 






















Well, this isn't exactly helpful... I mean, full Y and no X should be both wheels forward... here, it would be full right, no left.  Then I put my head on my chin and thought some more... and while my head was tilted on its side, I finally got it... what if:


... I turned the unit circle a little bit (about 45 degrees).  Now, full Y and no X would give me the same value for both wheels (with sine and cosine).  What about my other conditions?  Well, full left X and no Y will give two values of equal magnitude, but opposite direction... and full right X and no Y gives the opposite effect... AND full backward Y and no X gives the same values, but both negative.  EUREKA!

So, my new process will be:

1) Input X and Y axis values from the controller (from 0 to 255)
2) Map these values so there are negative and positive values (ie: -200 to 200)
   (this will allow me to determine which quadrant of my new unit circle the stick is in)
3) Determine the angle from one of the axes using the X-Y values and arctangent (arctan(X/Y) = angle)
4) Assign cosine of this angle to one wheel, and sine of this angle to the other
   (these sine/cosine values will now act as percentages of SPEED, determined by how far from center the stick is [calculating the length of the hypotenuse, since X and Y act as the other two sides])
5) Multiply these assigned percentages to the speed and set the results to the wheels

Voila!  No if-else trees, just short pre-process calculations then set values and go.

In theory... I've only come up with these just now during my Thursday classes.  I'll test these ideas tomorrow and hopefully, that will be the end of the drive tweaking (and indeed, the end of the software development entirely).

Wednesday, April 13, 2011

Construction 99% Completed - Phase IV

The legs are finished... complete with foot shells!  All that's left now is to use my rough skin to make the final skin, paint everything, and finish the final programming (adding a few more button functions to play 16 sounds).  I can see the light at the end of the tunnel... I just might faint!!! (Or maybe that's just my body telling me to get to sleep... this is the fifth night out of the last seven that I'm up past 1am... but I'm loving every minute of it!)

Tuesday, April 12, 2011

Magic legs - Phase III

R2D2's got magic legs!  I finally decided on how to attach the legs to the main body... with removable pins through a support beam.  I've also decided at this stage that (unless there are any complaints from Professor McDaniel) this will be the last picture I post until the big reveal at the expo.  I'll still post updates, but I'm really proud of my droid and I want his final appearance to be a surprise.  See you guys on the 21st!