Coding In PROS drivetrain

void opcontrol() {
	pros::Controller master(pros::E_CONTROLLER_MASTER);
	pros::MotorGroup left_mg({-1, 2, 3});    // Creates a motor group with forwards ports 1 & 3 and reversed port 2
	pros::MotorGroup right_mg({4, -5, 6});  // Creates a motor group with forwards port 5 and reversed ports 4 & 6


	while (true) {
		pros::lcd::print(0, "%d %d %d", (pros::lcd::read_buttons() & LCD_BTN_LEFT) >> 2,
		                 (pros::lcd::read_buttons() & LCD_BTN_CENTER) >> 1,
		                 (pros::lcd::read_buttons() & LCD_BTN_RIGHT) >> 0);  // Prints status of the emulated screen LCDs

		// Arcade control scheme
		int dir = master.get_analog(ANALOG_LEFT_Y);    // Gets amount forward/backward from left joystick
		int turn = master.get_analog(ANALOG_RIGHT_X);  // Gets the turn left/right from right joystick
		left_mg.move(dir - turn);                      // Sets left motor voltage
		right_mg.move(dir + turn);                     // Sets right motor voltage
		pros::delay(20);                               // Run for 20 ms then update

So this is my program in vex PROS so my wheels they move barely but when I unplug two motors all then the wheels move so i have switched if its reversed or not many times but it isnt working so i did the same program in vex blocks it works can someone figure my problem out. Thanks

Your robot is likely experiencing motor fight, which happens when motors in the same group are trying to spin in opposite directions and stalling each other out.

The symptoms you described—the wheels moving barely but working when some motors are unplugged—are classic signs that one or more motors are fighting the others.

To fix this, follow these steps:

  1. Check your port signs: In PROS, a negative number reverses the motor. Your code contradicts your comments:
    • Left Group: Your code {-1, 2, 3} reverses Port 1, but your comment says Port 2 should be reversed.
    • Right Group: Your code {4, -5, 6} reverses Port 5, but your comment says Ports 4 and 6 should be reversed.
  2. Test motors one by one: Use the Devices Menu on the V5 Brain to manually spin each motor. Note which direction is “forward” for each specific port on your physical chassis.
  3. Correct the code: Update your MotorGroup initializers so that every motor on the left side spins the same way, and every motor on the right side spins the same way.
  4. System debugging: If you are still unsure, unplug all motors except one in a group. If it moves the right way, plug in the second. If the group then “locks up” or makes a humming sound, the motor you just added needs its sign changed in the code.