Vex V5 6 Motor Drive Train

I’m new to c++ and am wondering if I have this code configured properly. There isn’t ant driving code as of right now, I’m just trying to see if it’s set up right.

//All Motors

vex::motor RightFront = vex::motor( vex::PORT20, false);

vex::motor RightMiddle = vex::motor( vex::PORT19, false);

vex::motor RightBack = vex::motor( vex::PORT18, false);

vex::motor LeftFront = vex::motor( vex::PORT1, false);

vex::motor LeftMiddle = vex::motor( vex::PORT2, false);

vex::motor LeftBack = vex::motor( vex::PORT3, false);

//Grouping

vex::motor_group Right = vex::motor_group(RightFront, RightMiddle, RightBack);

vex::motor_group Left = vex::motor_group(LeftFront, LeftMiddle, LeftBack);

//Constants

const int wheelTravel = 12;

const int trackWidth = 16;

const int wheelBase = 16;

const double gearRatio = 4.2;

//Drivetrain

vex::drivetrain RoboDrive = vex::drivetrain(Left, Right, wheelTravel, trackWidth, wheelBase, distanceUnits::in, gearRatio);

//Controller

vex::controller Controller1 = vex::controller();

1 Like

Looks about right. I would change Left and Right to be LeftSide and RightSide, helps readability.

https://www.robotmesh.com/studio/content/docs/vexv5-cpp//html/classvex_1_1drivetrain.html#a0d9df3a05c979137a5f7e39e53d198fb

That’s some documentation on drivetrain API, for anyone reading this wanting to know how to configure it, plus decent explanations

1 Like

The most up to date API reference is available here:
https://api.vexcode.cloud/v5/abstract/class/classvex_1_1drivetrain

3 Likes

Wow I never even saw that, thank you