How to code In 6-motor drive using Python

Basically, we are struggling to find a way to program in the 6-motors. Also, we don’t know how to assign joystick values correctly, can we get a how to…

I would just set each motors velocity individually and tell them to spin.

Pseudocode
//set left drive velocity
leftFrontDrive.setVelocity(100, percent)
leftMiddleDrive.setVelocity(100, percent)
leftBackDrive.setVelocity(100, percent)

//set right drive velocity
rightFrontDrive.setVelocity(100, percent)
rightMiddleDrive.setVelocity(100, percent)
rightBackDrive.setVelocity(100, percent)

//spin left drive
leftFrontDrive.spin(forward)
leftMiddleDrive.spin(forward)
leftBackDrive.spin(forward)

//spin right drive
rightFrontDrive.spin(forward)
rightMiddleDrive.spin(forward)
rightBackDrive.spin(forward)

For the proper way to assign joystick values, I would just do a linear function where we set the speed to the joystick position.

Pseudocode with joystick
//set left drive velocities to controller position(-100 to 100)
leftFrontDrive.setVelocity(controller.axis1.position(), percent)
leftMiddleDrive.setVelocity(controller.axis1.position(), percent)
leftBackDrive.setVelocity(controller.axis1.position(), percent)

//set right drive velocities to controller position(-100 to 100)
rightFrontDrive.setVelocity(controller.axis3.position(), percent)
rightMiddleDrive.setVelocity(controller.axis3.position(), percent)
rightBackDrive.setVelocity(controller.axis3.position(), percent)

//spin left drive
leftFrontDrive.spin(forward)
leftMiddleDrive.spin(forward)
leftBackDrive.spin(forward)

//spin right drive
rightFrontDrive.spin(forward)
rightMiddleDrive.spin(forward)
rightBackDrive.spin(forward)

Make sure to have the motors spinning with each other and not against each other.

1 Like

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