Open OviedoRobotics opened 4 years ago
You may not be able to change the size of the dead-zone, but you can always rescale the output range to whatever you want.
Since the output from the dead-band code is continuous from -1 to +1, there are no flat spots. So you can simply do the following to start your motors at 5%
if (raw > 0) scaled = Range.scale(raw, 0, 1, 0.05, 1.0); else scaled = Range.scale(raw, 0, -1, -0.05, -1);
But... a better approach would be to use encoders and RUN_USING_ENCODER to let the motor controller regulate the speed from 0 - 100% You get much better low speed control by using the encoders. Ignoring Rev 5.3 :(
@gearsincorg yes rescaling is possible but nonetheless annoying. Note that deadzone is totally separate from minimum speed for movement.
I have some Xbox 360 controllers than need a 0.2 dead zone, but the SDK preset is 0.15. However I discovered the "standard Android gamepad" preset is 0.2 so I'm using that :)
interesting, I haven't noticed any deadzoning, so we had to implement our own software deadzones. The problems we had without dead zones, is one joystick might be slightly off 0.0, and not activate the zeropowerbehavior, hence we'd sometimes curve when stopping
@David10238 Logitech F310 deadzone preset is 0.06, Xbox is 0.15, and standard Android is 0.20
And note, all of the functions are available in the Gamepad object to the robot controller. So unless one really digs into it, it is very easy to mistake that you are setting the joystick dead zone when in reality you are setting an unused variable. Is there any reason to not send the raw values to the robot controller and do the dead zone code down there so teams can have the flexibility it customize it?
And I guess I haven’t tested outside of v5.3 using matrix 12v, but with v5.3 and matrix 12v if I set to below 0.05 the robot won’t move using run with encoders. I am using gobilda 19.2 motors with 1:1 drive ratio.
It appears the joystick dead zone code is executed on the drivers station. This should be changed to sending the raw values down to the robot controller and allow the OpMode to set the dead zone. This will allow teams to set custom dead zones, for instance if our joystick has particularly bad or good dead zone. It will also allow teams to scale the range they want instead of 0-1.0 hard coded in the SDK. For instance our robot doesn’t move until 0.05 power, so why have 5% range dedicated to unusable range?