Joystick Sensitivity


#1

I currently am using V5 for C++ on Robot Mesh and was wondering if there was anyway to adjust the joystick sensitivity within programs. I need to because I recently bumped up my drive speed.


#2
        leftstick = Controller1.Axis3.position( percentUnits::pct);
        leftside = leftstick * leftstick * leftstick / 10000;
        rightstick = Controller1.Axis2.position( percentUnits::pct);
        rightside = rightstick * rightstick * rightstick / 10000;
        Leftfront.spin(vex::directionType::rev, leftside, vex::velocityUnits::pct); 
        Leftback.spin(vex::directionType::rev, leftside, vex::velocityUnits::pct); 
        Rightfront.spin(vex::directionType::rev, rightside, vex::velocityUnits::pct);
        Rightback.spin(vex::directionType::rev, rightside, vex::velocityUnits::pct);       

might help


#3

Would this increase or decrease the sensitivity? Or which variable do I need to change to do that?


#4

that would make the mid-range less sensitive while keep the range intact - full power at max end.

You could use integer division for percent values, but otherwise you should cast to floating point calculations.


#5

and the C++ solution here was on VCS C++ not sure how that would translate to RMS


#6

The math changes the response curve of your input to output, so joystick-to-motor in this case. I’ve heard it called a cubic control, since you cube the input and divide it by the max output, cubed. I’m not sure if that’s the actual name or not, though.

The two curves look like this:

linear-cubed

So same min and max, with a slow ramp through the low-middle values and gradual slope increase towards the max.


#7

If you want an example in code, I did write up this example a while back. It demonstrates quadratic scaling by a one-step formula or piecewise scaling by an algorithm.