Our joysticks are overly responsive and we need to cut down the responsiveness
I have a picture but I cant attach it here’s an example
(if input is ± 22.5 from 180 set to 180
if input is ± 22.5 from -135 set to -135)
Specs.
Drive system - Holonomic
Controller - Logitech Dual action
I don’t understand how the numbers you gave relate to joysticks, but no matter.
If you want to take an input value and test to see whether it is between two other values, use the **In Range and Coerce **function.
If you want to take a value and force it to a constant only when some condition is true, a common way is to use a case block. In the “false” case, wire the value straight through the block from input to output. In the “true” case, place a constant and wire it to the output of the block, leaving the input unattached.
That should give you enough information to get started.
I bypassed all that by using a formula case although im not sure if it will work because i put a ± in it and i don’t know if LabView will recognize it
If the run arrow is broken, clicking it will tell you why. I don’t believe the formula node understands +/- or ± or any similar syntax. You probably want to look at using absolute value icon or abs() within the formula.
Greg McKaskle
we got it to work with a formula node with the following formula
if (x>=167.5 && x<=202.5) y=180;
else if (x>=-157.5 && x<=-112.5) y=-135;
else if (x>=-112.6 && x<=-67.5) y=-90;
else if (x>=-67.6 && x<=-22.5) y=-45;
else if (x>=-22.6 && x<=22.5) y=0;
else if (x>=22.6 && x<=67.5) y=45;
else if (x>=67.6 && x<=112.5) y=90;
else if (x>=112.6 && x<=157.5) y=135;
else (y=180);
If that is truly what you want, you may want to adjust your code a bit more. Try values such as 22.55 and see what you get.
If you want to output a more coarse joystick value like that, an equivalent approach with much less code is to take the angle, divide by 45, round to nearest integer, then multiply by 45. Finally, if you really can have values above 180, you can use In Range and Coerce to pin the big values back to the limits.
Greg McKaskle
If you want to tone down the responsiveness, try creating a function to map joystick values to something else. An easy one is simply squaring the joystick value, i.e. x^2 or x*x.
If you want to just limit the range, use “In Range and Coerce” like Greg suggested.
It sounds like you want a stepped function, with every step 45 degrees wide.
Why not divide by 45, round towards nearest, and then multiply back up?
(Unless, of course, you require this code to be in the formula node. I don’t know how to round within the formula node)