Robot Deadzone/deadband code?

I am working on robotmesh code for a VEXIQ robot. In my block code everything works but I need a deadzone for the drive since it creeps when nothing is touching the controller. I cannot find a block for that, and have tried to make an alternative to no avail.
Any suggestions?

1 Like

Try following the calibrate the joystick, that cures most of our problems…

1 Like

Ok i know this is not block code but i don’t have robot mesh studio so here it is in c++
int leftstick;
int rightstick;
int deadband = 10; //tune this deadband to get whatever you want
int rightmotorspeed;
int leftmotorspeed;
int main() {
while(1) {
rightstick = controller1.Axis3.position(pct); //right stick variable equals the right stick position
leftstick = controller1.Axis2.position(pct); //right stick variable equals the right stick position

if(rightstick>deadband){rightstick=rightmotorspeed;} //then make whatever your motor speed to be that

wait i forgot something, you would need to do 2 more if else statements for if it is a negative value or you could use a “or” to make it be “if(rightstick > deadband or rightstick < -deadband)”

There is a deadband setting for the joystick. Look in under sensors, it’s the last block in the list.



thats a lot easier than actually having to code it out

I wound up doing some custom block code to do it before I saw the responses. I did not see the deadband block. BUT… I made a drive function since I did not see a tank drive block. so when the code started it set variables to the stick values on the controller. then the tank drive function was called. In that function I did an IF, Else if that said if the ABS was <= 7 then power down motors; else move motors with the variables values of the sticks. Thanks though! I need to figure why I was not seeing the deadband block and find an easy way to do tank drive.

1 Like

Well if I put my glasses on and realize that my screen was not maxed and scroll down all the way… I might see it all!
But… in the process I learned to do it another way.