How to customize the robot driver

My robot used the drivetrain in V5code before, and there was a problem that it could not modify the speed of forward and rotation. Now I want to use V5code Pro to write a code that uses 4 motor drives, how should I write。

The easy way to do this is to actually configure a drive train, but I wouldn’t recommend that.

To program a 4 motor drive (Im guessing it’s a tank drive) you need to first add your motors in the top right ports bar. Make sure they are all reversed in the right direction to have them spinning forward with a positive velocity. Then, you can set the right side’s velocity to the right joysticks y value, and the left sides velocity to the left joysticks y value.


Do you mean this??
driveLB.spin(reverse, Controller1.Axis3.value(), percent);
driveLF.spin(reverse, Controller1.Axis3.value(), percent);
driveRB.spin(reverse, Controller1.Axis2.value(), percent);
driveRF.spin(reverse, Controller1.Axis2.value(), percent);

But this way the robot can’t turn while moving

Have you tested it yet? The left and right side should spin independently, so It should work.

1 Like