# FIRST Robotics Competition Discussions

cancel
Showing results for
Did you mean:

## How to set range of throttle on joystick?

Right now the throttle is -1 to 1 I want it to go to 0 to 1, and on the other joystick the throttle to go from 0 to -1. Any help would be awesome thanks.

Message 1 of 3
(4,728 Views)

## Re: How to set range of throttle on joystick?

Greetings, BPtigers;

Would you mean having the software ignore a certain position of the joystick or to numerically have it go from 0 - 1 (Say, zero when tilted all the way back to 1 all the way forward) ?

If so, in the Teleop VI (looking at the Arcade Drive Robot Project) there is an Arcade Drive VI that will output a 1D Array into an SD Write Numeric Array VI.

You would thus need to intercept that 1D Array and make it such that the numbers go from zero to one there. For example, you could increment the values in the array by one and then halve the result. Alternatively, you could use the In Range and Coerce VI if you were simply interested in half of the joystick's range. This VI may be found here:

http://zone.ni.com/reference/en-XX/help/371361E-01/glang/in_range_and_coerce/

Cordially;

Simon P.

National Instruments
Applications Engineer
Message 2 of 3
(3,255 Views)

## Re: How to set range of throttle on joystick?

Hi BPTigers,

Required processes are only mathematical operations. Consider that your throttle values define simple array : [-1,+1]

When you add +1 to array, it becomes [0,+2], Then you should divide the result by 2. As a result, array values are like that [0,+1]

and also, if you would like to have an array which consist of [0,-1], you should multiply previous processes's result by -1.