VEXcode, motor groups and drivetrain example

It was explained pretty well, including a drawing, in the original post. Perhaps read through that again.


I’m sorry. I didn’t realize. Thanks for pointing it out.

Do you have to have a gyro for the robot to turn exactly 90 degrees? Also can you tell the drivetrain to go forward for a certain amount of inches?

Also for driving with the controller axis’s are you required to have the dead band after the axis code?

You don’t have to have a gyro, but you may need to tune the track width and wheelbase numbers if your robot is not turning correctly. In both gyro and non-gyro applications, achieving perfect 90 deg turns is probably not going to happen, +/- 2 deg is our goal, but even that is hard.

No, you don’t have to, but many teams do to stop the robot moving if the controller joysticks don’t always return to center.


Alright cool thanks for the info!

would we need to calibrate the gyro ourselves or find the gyro scales? or is it done for you already?

Where can I find information on the motor group class?

Jim M.

Found it :slight_smile:

1 Like

What is the difference between a smart drive and a drivetrain?

Smartdrives use a gyro or inertial sensor to aid in turning, normal drivetrains don’t.


Thank you for your quick response

Can motor groups be assigned to the controller via the graphical robot config in VEXcode V5 text the same way a drivetrain can? Would make life awesome for beginner programmers.

We are using motor groups to move our robot forward. (We are using drivetrain for intake.)

We have 4 motors attached to the 4 wheels.
The two left wheels motors are in one motor group and the two right wheels motors are in another motor group.

The issue we are facing is that in autonomous programming we cannot find a way make the motor move a set number of rotations and at a set speed.

motor_group wheelsLeftMain(motor1,motor4);
motor_group wheelsRightMain(motor3,motor5);

We tried-
Here the robot moves forward but does not stop at the set rotation.

We tried-
Here the motors move separately instead of together.

Please let me know what I am doing wrong.

in the first example you do not have a condition that stops the motor. Setrotation merely sets the variable that represents how many rotations the motor has gone. What you are looking for is something like this

double current = motor.rotation(rev); // motor.setRotation(0,rev); also works for this scenario
while(current + 1 >= motor.rotation(rev)){ // waits until motors have gone 1 revolution

for the second example you are using blocking commands, meaning the code doesn’t execute anything else until the command is completed. The solution here is to add ‘false’ as your last parameter. This tells the brain to not wait for the completion of the rotations before continuing with the code.


In the second example, in my code
spinFor and spinTo takes only 3 parameters.
I think it’s supposed to take 5 parameters but ours only takes 3. How do we add 2 more parameters such as -

We have the same issue with rotateTo, rotateFor etc.

the full version would include motor speed:
spinTo(distance, distanceUnits, speed/power, speed/powerUnits, true/false);


This might be a stupid question, but if the track width in the front and back is slightly different, will that affect the performance. By the way, robot does not have a gyro

Can you say what you mean by “slightly” Is that an inch or 10 inches?

An inch would not make that much difference here. I’d set the track to the average of the two and go with that.

1 Like

Essentially the front is an eighth of an inch less than the back