FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead 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.

0 Kudos
Message 1 of 3
(4,695 Views)

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
0 Kudos
Message 2 of 3
(3,222 Views)

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.

i hope, that would help you.

example.png

0 Kudos
Message 3 of 3
(3,222 Views)