FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Joystick Programming

Hey, I am having difficulty programming a function on a joystick that we have. First, the joystick we are using is the Logitech Extreme 3D Pro which is the one with a rotating joystick. We are using a single motor as our shooter motor and we wanted program a function in our joystick that would limit the speed of that motor. I am familiar with doing this using a button but in our case we are looking to use the turnable knob that most joysticks have (the one with + and - sign). So far this might be a little confusing so an example is if I set that knob at a certain position, even if I press fully forward on the joystick, the motor won't be able to go over a certain speed thus creating a speed limiter. If I change the position of this knob, it would then increase or decrease the limit at which the motor spins. We found that axis 4 was the axis used for this knob. If anyone can help me do this in LV it would be much appreciated.

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

Hey nickcvet89,

You should just be able to use the joystick VI's to get the axis value. You can then use that axis value in your code either as a maximum value or a scale factor. You will need to scale the joystick value to the motor speed range. At its simplest I think you could just divide by 127 and set that as the maximum speed of the motor.

joystick.png

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 3
(2,942 Views)

Just remember that the middle of the dial range is 0, and it can go both positive and negative, so you'll probably want to scale the dial value to prevent negative values.  The "In Range and Coerce" function is useful for setting a limit.

0 Kudos
Message 3 of 3
(2,942 Views)