Let's Make Robots!

Write a algorithm for Chris and be Loved...

Well folks,

I have been working on this problem for 4 days now and don't seem to be making any headway. There has got to be a math or programming geek out there that can figure this one out. The video should be self-expanitory, and the chart with the values is right here. In addition, I attached the pic as a file as well (full size) so you might be able to see the numbers a bit better. --Sorry no scanner.

 

Walter_1_3_Joystick_001.jpg

AttachmentSize
Walter_1.3_Joystick_001.jpg2.68 MB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I hashed out something in C++ that seems to works, it's a rediculous if - else-if block though. I've tried all of the values at 0, 45, 90, 135, 180, 225, 270, 315 and 360 degrees in that chart. The in-betweens weren't mentioned in the video though.Hopefully if this is what you're looking for you can adapt it to whatever you have to write it in.

    if (y <= 225 && y > 150 && x == 150)
        cout << "Top Left Slide";
    else if (x <= 225 && x > 150 && y == 150)
        cout << "Top Right Slide";
    else if (x <= 225 && x > 150 && y <= 225 && y > 150)
        cout << "Forward";
    else if (x >= 75 && x < 150 && y >= 75 && y < 150)
        cout << "Reverse";
    else if (y <= 205 && y > 150 && x >= 95 && x < 150)
        cout << "Left Spin";
    else if (x <= 205 && x > 150 && y >= 95 && y < 150)
        cout << "Right Spin";
    else if (x >= 75 && x < 150 && y == 150)
        cout << "Bottom Left Slide";
    else if (y >= 75 && y < 150 && x == 150)
        cout << "Bottom Right Slide";

 

EDIT: I forgot to ask whether it's full-on for the motors, or if it's gradual depending on where the stick is. If it's the former, this needs some changes, but just some of the logic which is easy to figure out.

I think you'll find that he'll need that translated into picaxe basic :D
Algorithms aren't usually written in picaxe basic...

Ha...should have figured that off the bat!

The logic should still apply though, unless I'm missing something?