Create an 8 motor drivetrain using VEXcode blocks

yesterday I posted about how to create a 3 motor motorgroup using blocks and switch statements.

so lets make an 8 motor drivetrain in VEXcode blocks using a similar technique.

way back I built a testbed drive, at one point it had 20 motors mounted for stress testing the V5 brain and batteries.

At the moment it’s configured as an 8 motor drive with mecanum wheels. For this example I’ll ignore that it has mecanums and just treat as a standard 4 wheel drive.

The C++ code I would usually use to configure the motors would be

vex::motor m_lf1(  PORT1, vex::gearSetting::ratio36_1, true );
vex::motor m_lf2(  PORT3, vex::gearSetting::ratio36_1);

vex::motor m_lb1(  PORT2, vex::gearSetting::ratio36_1, true );
vex::motor m_lb2( PORT11, vex::gearSetting::ratio36_1 );

vex::motor m_rf1( PORT10, vex::gearSetting::ratio36_1 );
vex::motor m_rf2(  PORT8, vex::gearSetting::ratio36_1, true );

vex::motor m_rb1(  PORT9, vex::gearSetting::ratio36_1 );
vex::motor m_rb2( PORT20, vex::gearSetting::ratio36_1, true );

There are two motors for each wheel.

Initially lets setup a 4 motor drive in blocks using the first motor on each wheel. Configuration would look like this.

Motors on ports 1, 2, 9 and 10 have been configured, the drive has the down arrow selected, this will set left motors to be reversed and match my usual C++ configuration.

Now we create the four additional motors and a controller, reverse flag is set on the motors as needed.

drivetrain is configured as tank control on the controller.

VEXcode drivetrain naming is very consistent, two motor groups have been created for left and right sides, left_drive_smart and right_drive_smart.

Now we add this code in a switch block.

left_drive_smart._motors.append(motor_3)
left_drive_smart._motors.append(motor_11)
right_drive_smart._motors.append(motor_8)
right_drive_smart._motors.append(motor_20)

build and run, 8 motor drive works as intended.

9 Likes

Would this same strategy work for a 6 motor drivetrain if I were to remove two of those motors from the switch block?

If so, if I were to use the “Drive forward ‘x’ inches block” for a program would it drive using all motors?

2 Likes

yes

yes as long as all the gearing etc. was consistent

All it’s doing is adding additional motors to the motor groups that the drivetrain is controlling.

4 Likes