Math Guru assistance please
RS_Jim
Posts: 1,764
Hi,
I am afraid that my trig skills have atrophied over the years since high school. I am working oon a remotely controlled robot that uses diferential stearing. The motor control portion is all working fine and I have an XBEE link I can use to provide the necessary remote signals. My problem is translating the XY analog signals into digital commands for each wheel motor. I can see where the Tan function would derive the signals but not sure how to translate that into motor speeds. Any ideas where I might find the answers?
Jim
I am afraid that my trig skills have atrophied over the years since high school. I am working oon a remotely controlled robot that uses diferential stearing. The motor control portion is all working fine and I have an XBEE link I can use to provide the necessary remote signals. My problem is translating the XY analog signals into digital commands for each wheel motor. I can see where the Tan function would derive the signals but not sure how to translate that into motor speeds. Any ideas where I might find the answers?
Jim
Comments
You just want to convert the x and y to two motor speeds?
I know there's a simple formula for this. No trig needed. I think it's just addition and subtraction.
I'll be back in a bit with the formula.
In case my variable names aren't easy to follow, here's the code again.
leftSpeed = y - x
rightSpeed = -1*(y + x)
I'm pretty sure these equations assume the center values of x and y are zero.
The exact equations will depend on your joystick's pot orientations and which wheels need positive verse negative power to move forward.
http://learn.parallax.com/tutorials/xbee-wireless-sumobot-tilt-controller
KeithE, I will study the link further to see what might be relevant .
Jim
When Y is zero, moving X will cause the robot to rotate in place.
I'm pretty sure I could help adapt the algorithm to work with your setup if need it.
I tried your formula and something is not working correctly. My expectation was that when the y was advanced and the x remained neutral, both wheels would advance approximately the same amount. What is happening as y is advanced one wheel is increasing and the other is decreasing. I haven't tried it with the second set of formulas.
Jim
Here I am trying to solve a problem in software that has an easy solution in hardware! Reverse two motor wires!
Jim
If you're still having trouble, describe your input values (x and y ranges) and what pulse value cause forward and reverse motion on each motor and I can adjust the equations to match your setup.
Duane
As the famous Bob Pease said, "My favorite programming language is solder".