Four motor drive train in VEX C++

Hi all,

My team is new to Vex. We are trying to make a four motor drive train with two motors on each side controlled by two joy sticks, one for the left two motors and one for the right two motors. We can’t figure out how this could work. Even when programming spin commands for all four motors, we can only get one on each side to work. We were wondering if anyone had code for this type of four motor drive already or a fix they’d be willing to share. Thanks!

The type of drivetrain and control scheme you describe is quite common, so someone will probably be able to help you. However, it is difficult to evaluate or resolve any programming problems you are having without seeing your code. If you copy and paste your code in a reply (wrapped in the [code] … [/code] tags) then we can be of far more help.

2 Likes

You should be able to just set both motors on a side to the corresponding joystick. This value does need to be constantly updated, make sure it’s in a loop of sorts.

1 Like

Here this code should work

FrontLeft.Spin(fwd, Controller.Axis3.position(), pct);
FrontRight.Spin(fwd, Controller.Axis2.position(), pct);
BackLeft.Spin(fwd, Controller.Axis3.position(), pct);
BackRight.Spin(fwd, Controller.Axis2.position(), pct);

The way each line is structured is like this,
Motor.function[in this case spin](direction, velocity, velocityUnits);
The Controller.Axis3.position() determines the numerical value of the position of the joystick. So as the joystick is moved positively the motor value will move positively.

If this is your code already, remember to make sure motors are plugged into the right ports, and make sure you have the correct port setup. Hope this helps!

2 Likes

This sort of control is generally called tank drive, while everything on one joystick is generally called arcade control.

1 Like