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.
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.
Wouldn’t The position on the X axis be proportional to the desired speed of the R motor? And the same with the Y axis and L motor?
so if X goes from 151 to 225, the right motor should go forward at an increasing speed. And from 149 to 75 it should go at an increasing speed backward.
I don’t know much about aneurysms, but wouldn’t you just need to do some simple math to convert the nummerical values from 75 to 150 to 225 into the corresponding numeric values for you motor output to go -100% to 0% to +100% ??
I think I’ve misunderstood your whole question here, but please help me understand.
1) Do I understand correctly that you were driving your bot in “tank style” or “two-three mode”? And now you want to convert to “Arcade style” or “one-two mode”? (pages 6.5 and 6.6 resp.)
2) Do I understand correctly that you are reconfiguring your VEX transmitter to the “12-mode” as documented? Or are you trying to emulate this mode by cleverly reprogramming your picaxe. And cleverly outsourcing any accidental aneurysms along the way?
You suggest that your pots are positioned diagonally. The manual does not make any mention of this. I would never doubt the tinkerer with the actual set on his workbench, so I will accept this as fact. However, I feel that the “software signal mixing feature” in “12-mode” is making it look like the pots are placed diagonally. Perhaps this is what you are referring to, but you don’t want to confuse us. Either way, it can be considered to be diagonal.
If the number is > 150 then you want the motor to go forward. If the number is < 150 then you want the motor to go in reverse. If the number = 150 then do nothing so the bot can slide.
What is the desiered result for the marks between slide and spin? (NNW, NNE, etc)
Take that values from the joystick as it sits, up-down axis called Y with values given from 75 bottom to 225 top, right-left values called axis X with 225 left, 75 right.
Y 225 X 225 <> 75 Joystick 75
PWM values for left and right wheels can then be calculated from formulas :
This community is simply great! I would like to thank you all, as it is awesome to have a (few) new sets of eyes on a problem… First off rik, I should have mentioned I am moving away from the VEX controller as I would like to build my own. I know the VEX system has the arcade/tank style controls built in, but the controler I am working on will only be one stick. By the way, have you guys seen these? It is almost the same joystick as the one in a PS2 controller, pots and all for 4 bucks from Sparkfun. At first glance, I am liking Robo’s math with some min’s and max’s added but I thank everyone for their help. When I get this guy going I will be sure to do a neat walkthrough for y’all. Thanks again, folks.
Ah. you coded it already. Fairy nuff. My approach was only slightly different. My bot takes as its inputs (1) speed and (2) radius of turn. I was about to sit and figure out how to convert speed and radius of turn (the results from MY algorithm) into coaxial track PWMs!
Do I still get the Coveted Rusty Soldering Iron Trophy for doing it first?
I recreated a diagram like it, using expected values. Correcting for SIN(joystick-angle). The Y/X numbers along the SE and SSE positions are reversed. And most numbers are off from the predicted values by as much as 30 (at ESE and NNW for example).
But from the resulting values I can deduce that your stick does not move around in a circle, but in a square. And a motor does not get full power unless the other motor is completely stopped.
But maybe that is just the way I expected them to be.
I have the same problem when I have the same problem when coding the nunchuck controller and the most clever solution I find was the if/else coding mess… I have came up with this remote controller as OddBot already metioned and it feeds my needs
must try to understand the robologist solution, seems much more easier than I though
No prob, hope it gets Walter No prob, hope it gets Walter going well. I hope to use this idea on an outdoor wanderer, to take over control when needed. Probably use an XBee link, with some of the little joysticks. I have some like you’ve shown, except no knob on the end so may have to Shapeloc something.
2D pots are normally like that. The X limit is flat for the full Y extents and vice-versa. I agree - it’s not intuitive. My first calculations overflowed for exactly the reasons you mention. Whatever I’d done, the bot went wherever I told it EXCEPT in a straight line.