Help with v5 mecanum wheels Programming

You need to change a lot of this. Trying to set a motor more than once in a given loop will result in unpredictable behavior. Your loop here sets your motor 2-3 times per loop and potentially stops it as well.

Rather than command a motor with one stick then command it with a different stick then command it based on a button, you need to blend the sticks and buttons into a single motor command. For one way of doing holonomic drive command blending, you could take a look at the algorithm that I use in my RMS holonomic example. It looks like you’re using a slightly different control scheme than me, as I was using axes 3 and 4 for XY translation and axis 1 for Z axis rotation and you were using axes 3 and 1 for XY and a button for rotation.