looking for two wheel driving formula with X, Y
August 2, 2011
I am using one joystick to control the robot. The range of value I fot from joy stick is 0~600 and the PWM to motor control is 40~140. So wheels will be nutrul around 95 as center point. 40 will go backward and 140 will go forward. This is what I have:
joyX = map(joyX, 0,600,minVal,maxVal);
joyY = map(joyY, 0,600,minVal,maxVal);
int speed_L = formula;
int speed_R = formula;
It's easy to go single direction but it's kinda tricky if I slightly move the joystick to position like joyX:125, joyY:82, by those values the left wheel should go like pretty much full speed forward and right wheel should go very slow backward.
I hope the image will explain a bit clear. Both wheel won't move when joyX:95,joyY:95;
Is there a formula to do this kind of 2 wheels driving? What should I have in RED text formula? Thanks in advance if anyone could help.