joystick comparison within percentage

Were trying to figure out how to compare two joysticks used for a tankdrive system but have them have a percentage of difference allowed between them. With at touchy as they are there is no possible way that our driver would be holding the sticks exactly equal unless they are in the full -1,1, or 0 positions.

I have looked at the in range and coerce functions but don’t fully understand them enough to figure out if they will do what were trying to do.

Right now we have our 2 joysticks and can figure out what the driver entended to do with the sticks but want to allow for a 10% or so margin of error so that the driver does not have to be super percise.

would someone either be able to provide us with a sample block of labview code or at least point us in the right direction and functions to use.

Thanks so much!

In previous years, we did “arcade style” control in the code, even when the drivers used “tank style” input. The speed value was computed from the sum of the two joysticks, and the turn value was the difference. We applied a deadband function to the turn value, which does pretty much what you’re asking for. A simple deadband is done like this: if the value is within a certain distance of zero, set it to zero.

(To turn arcade drive values back into tank drive values, the left motor is controlled by the speed plus the turn, and the right motor is controlled by the speed minus the turn.)

Chad - come down with John Monday or Tuesday. I’ll give you our Drive so you can see how it’s done.


I just made a quick SubVI for what I think you’re asking for…

Is it what you need? It’ll set both drives equal to the average of both sticks if the inputs from the sticks are within 10% (or whatever percentage you set) of each other, otherwise it takes the direct inputs and sends them through to the outputs (i.e, when you’re turning).

Drive Straight (Tank) (12.2 KB)

Drive Straight (Tank) (12.2 KB)

I will need to try it out next time I get on a machine with labview and see if it does the job or not. I think you hit right on with what were wanting to do.

Thanks for the help