Single joystick control problem

Ok, I know someone must have worked this out…

We’re having trouble trying to correct the “backwards is backwards” problem with single joystick control.

We are using the following algorithm:
(We do have the appropriate limits in place to keep all values acceptable.)

L=x+y-127
R=y-x+127

Everything forward works fine, as does straight back, but “back and to the left” actually results in “back and to the right”.

How can we correct this?

-Mr. Van
Coach, 599

the code we downloaded was like that too last year. i just thought it was supposed to be, as we had no programmers… and anyways, i hate single stick drive anyways.

gwross and I experimented with a bunch of different single stick algorithms in 1998, trying to correct the problem that you described. We never found a solution we were completely happy with though. It’s not as simple as checking if you are going back and reversing the directions as that creates a spike as the motors suddenly change directions as you cross the axis.

Mr. Van
One thing you have to remember is that robots are not cars. They do not drive like cars. If I’m understanding you correctly, when the joystick is pushed to the back left corner, the robot is going backwards and to the right, but it is still turning to the left relative to the forward direction. This is consistent with tank style robot drive systems.

This is the way that single joystick drive has been since the beginning and it is the way that most robots are set up. I say most because robots with swerve drives can be set either way, depending on driver preference. Last year, on 1114’s swerve drive, the turning was “car style”(ie, what your hoping to attain). We also had a button to switch between swerve, and tank style steering. It became very confusing since in either mode, turning in reverse became opposite.

Your drivers just have to get used to it. After a couple of hours, it will be second nature.

I hope this helps, and sorry if I confused anyone more than they already were.

Well, I don’t have a robot here to test with, but one way you could correct this would be to create an if() loop after the drive code that revereses the direction of the robot’s movement on the x axis. Sorry, I can’t think of the exact formula that you would use, but the code would go somewhat like this:


if (y >= 127)
{
  "Normal" Drive Code
}
else
{
  X-Axis Reversed Code
}

i would recommend getting used to the way it is currently instead of changing the default. when i first messed around with the Edu-bot (i forget what they call it now), i noted it to be backwards. However, when you are far away driving instead of “inside” (like a car), it makes life sooo much easier. you want to turn clockwise? push right. counterclockwise? push left. it is more intuitive if you want to turn your robot towards something. also, i THINK if it was set up the other way, if u were counter-rotating (full left or right), and pulled back, instead of slowing, and stopping, one side would have to completely change direction, which is not the smoothest thing for your robot.

One solution that we use is an Head/Tail switch or trigger.
The operator or better yet the driver, pulls a trigger, and the robot head becomes the tail and the tail becomes the head. (front > back, back > front)
Hit the switch again and it switches again.
We also had a toggle for one-stick > two-stick and back.

After teaming with Eric S and scatching our heads a while, I think we’ve come up with the reason and a solution to the backward left isn’t really backward left problem. It’s a bit complicated, but it has to do with having the tread speed differential (Dt) being a function of both joystick x and y input. Currently, the Dt is x-127. If you use a Dt = (x-127)((y-127)/127), you get a solution where the robot will turn left when you ask it to.

However, and there always is a however, you lose the ability to spin on the axis of the robot. This is because the slope of the Dt vs x curve is zero when y equals 127.

I told you that it was a little complicated. Anyway, here’s the equations:
Tread 1 = -x + ((xy)/127) + 127
Tread 2 = 2y + x - ((x
y)/127) - 127

I will leave the exercise of determining right and left to the reader at this time. It was not relevant to the derivation, so I didn’t worry about it yet.

I hope to write up a white paper on this over Thanksgiving weekend.