How to code 6-wheel drivetrain in v5python

I’m trying to code a six-wheel drivetrain in Python. I can’t find a reliable way to make 6 wheels drive for a set amount of turns.
Code:

all_wheels = [L1, L2, L3, R1, R2, R3]
for i in all_wheels:
i.spin_for(FORWARD, 3, TURNS, wait=False)

If I chain multiple together, it causes problems because the previous one hasn’t finished.

I’m the coder for out team, but I don’t know how to code, so here’s a workaround I found:

  1. In the robot configuration tab, set up a “ghost” drivetrain with 4 random motors.
  2. Set up 2 motor groups of 2 motors each, one for the left and one for the right. Then configure the remaining two motors and label them for left and right
  3. Configure the controller using the “ghost drivetrain” to whichever style you wish on the joysticks
  4. Turn on expert mode and go to the robot configuration tab
  5. Find the 2 motor groups that you declared, and add the remaining motors into them
  6. In the “ghost drivetrain”, go to where it delcares each side of the drivetrain and replace it with the two motor groups from earlier.
  7. Do a victory dance
    There! You coded a 6 motor drivetrain with almost 0 programming experience!

if you are coding in text, create a left and right motor group with three motors each. i can upload an example (warning, bad but working code) if you want.

1 Like

How do I make a motor group with more than 2? Is it just a list or a Vex function?

from what ive tried, the vex website doesnt show you how, but this is the code i have:

vex::motor motorLWheel0(0);
vex::motor motorLWheel10(10);
vex::motor motorLWheel11(11);
vex::motor_group motorL(motorLWheel0, motorLWheel10, motorLWheel11);

vex::motor motorRWheel9(9, true);
vex::motor motorRWheel18(18, true);
vex::motor motorRWheel19(19, true);
vex::motor_group motorR(motorRWheel9, motorRWheel18, motorRWheel19);```
3 Likes

You have to type it out near the top iirc

Instead of using the GUI to make your drive train, you will have to make your smart drive yourself. Do a search on VEX Forums for making a smartdrive, thats what we used:

3 motor group for left and right
Program your inertial sensor like normal

Inside your code, type out the smart drive code:

SupaDrive = SmartDrive(LgM, RgM, InerT, 300, 320, 320, MM, 3)
# So SmartDrive(Left Motor Group, Right Motor Group, Inertial Sensor,  WheelTravel, TrackWidth, WheelBase, MM, 3)

the 3 numbers are defaulted 300, 320, 320, because thats what the Hero bot size is set too. the MM is just saying your measuring in MM, and the 3 at the end is what gear ratio you are using for your drive. If you do a 4 motor drivetrain straight to wheels, that number is default to 1, I had my kids measure out how far the robot travels 24 inches if they are doing gear ratios, and raise it up that way since gear ratios is still kinda hard to grasp.

Hope that helps

Update: Thanks for the replies, but none of them ended up working perfectly for me.
I figured out that I can create a custom motorgroup. For people who need this in the future:

  • Add 3 normal motors for the left side and 3 for the right
def autonomous():

# Motor definitions are in "VEXcode Generated Robot Configuration" at the top;
# I used L1, L2, L3 and R1, R2, R3

    # Init motorgroups
    motorsL = MotorGroup(L1, L2, L3)
    motorsR = MotorGroup(R1, R2, R3)
    
    # Drive forward for 3 turns
    motorsL.spin_for(FORWARD, 3, TURNS, wait=False)
    motorsR.spin_for(FORWARD, 3, TURNS)

    # Turn right
    motorsL.spin_for(FORWARD, 3, TURNS, wait=False)
    motorsR.spin_for(REVERSE, 3, TURNS)

You’ll have to figure out how long a spin is. Also, you can use degrees instead of turns if you want.