during a match, our robot sometimes when it takes a hit there is a slight period of pause then the joystick axis flip(x changes to y and vice versa). We would love for someone to weigh in because we are kinda stumped on why this is happening.
If X and Y are changing, then it’s not the joystick axis that’s changing, that’s your drive motors inversion changing. If your drivetrain normally has the right side inverted, then it goes back to normal, then a “forward” (-Y) command from the joystick will result in both sides of your drivetrain going clockwise, resulting in the robot turning to the right.
What motors/controllers are you using?
I’d love to say it’s a hardware problem, but I suspect software. Have someone who did not write the code follow it carefully.
If you are using nonpersistent inversion settings on your motor controllers, losing power for a moment (like when you take a hit) could cause them to reset. Check your wiring, and consider burning settings to flash.
This worked! See my reply here to a team with the same issue – should clean up my answer there but in short I tested this by mapping out which directions the robot would go if the right motors (which are inverted in code) were going the wrong way and it lines up with the “rotated joystick” thing. Ran the robot with flashed values and tested by removing configuration from the code and it worked correctly. Thanks! Programming/electrical issues mid-match - #23 by noah_s