I am trying to control the Rover 5 robot using an Android app with a touch-based joystick control in the app UI. I want to calculate the speed of the left and right motors in the rover when joystick is moved.
From the joystick, I get two values, pan and tilt. I convert them into the polar coordinate system with
theta. Where r ranges from 0 to 100 and theta from 0 to 360. I want to derive an equation which can convert the
(r, theta) to
(left_speed, right_speed) for rover. The speed values also are in the [0;100] range.
Now, here is what I have figured out till now. For any value of
theta = 0 then
left_speed = r, right_speed = -r (turning right on spot)
theta = 90 then
left_speed = r, right_speed = r (moving forward at speed r)
theta = 180 then
left_speed = -r, right_speed = r (turning left on spot)
theta = 270 then
left_speed = -r, right_speed = -r (moving backwards at speed r)
For other values, I want it moving and turning simultaneously. For example,
theta = 45 then
left_speed = alpha*r, right_speed = beta*r (moving forward while turning right)
So, basically for any
(r, theta), I can set speeds as,
(left_speed, right_speed) = (alpha*r, beta*r)
I need to formulate an equation where I can generalize all these cases by finding
beta based on
How can I do this? Is there is any existing work I can refer to?