Control Problems

That is also what I got from looking at the default code. I cannot check why since it will be a few days before I see the bot again. Maybe our team simply switched the left and right motor wires?

To figure out why though, go through the debug process of checking front to back how things are used. Check the joystick direction as Mark indicated. When we calibrated our joysticks x was not backward. Check if the pwm outputs used in the code for left are really wired to the left motors. Etc.

I’d also move the pwm assignment to after the if statement. Otherwise, there will be an additional cycle delay in your response, since the pwm will reflect the old value from the if statement.

The my_y value could be defined as an unsigned character (8 bits) instead of int. It’s not essential, but it is good practice to match variable types.

unsigned char my_y;

if (p3_sw_trig==1) {
    my_y = p2_y;
else {
    my_y = 127;
pwm02 = my_y;

We verified this yesterday during testing. Y forward is 255 and X left is 255.

This shoudl fix your problem:
pwm13 = pwm14 = Limit_Mix(2000 - p1_y - p1_x + 381);
pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);

I had the same problem, and figured out the answer by simply setting up a table with actual and desired values using the dashboard viewer. I have tried this on our robot and it works. Le t me know if it doesn’t work out for you.

I’d also have to recommend moving to different PWMs if there is anyway possible, those are flaky, since they’re generated in software rather than hardware, any code lag disrupts them, quite unreliable.