6 motor drivetrain Python coding

My team is using a 6 wheel, 6 motor drivetrain this year and we were having a bit of trouble programming our autonomous. We are using python in vexcode v5. I have found many posts about how to code a 6-motor drivetrain such as How do you program a 6 motor drivetrain but none of these happen to be in Python. Is there anyway that I could combine the 6 motors into one drivetrain in the way you can with 2 and 4 motor drives. If anyone has a solution to our problem, please share. Thanks!

Python code would be very similar to C++ code. Create the motors and motor groups, then the drivetrain. for example

# left motors
m1=Motor(Ports.PORT1)
m2=Motor(Ports.PORT2)
m3=Motor(Ports.PORT3)
mgl=MotorGroup(m1,m2,m3)

# right motors
m4=Motor(Ports.PORT8, True)
m5=Motor(Ports.PORT9, True)
m6=Motor(Ports.PORT10, True)      
mgr=MotorGroup(m4,m5,m6)

# IMU
g1=Inertial(Ports.PORT11)

# create drivetrain
sd=SmartDrive(mgl, mgr, g1)

sd.drive_for(FORWARD, 12, INCHES)
5 Likes

Thanks this helped out a lot

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.