Setting the Drivetrain Velocity in a VEXcode EXP C++ Project

Hello,

We are using C++ with VexCode EXP. My students are trying to code an autonomous program with drivetrains. Inserting the “setVelocity” command and then entering the % they want to use seems to have no affect on slowing the drivetrain motors down. Any suggestions? Does the “setVelocity” command only work with independent motors? Thank you.

1 Like

Hi Curt!

In VEXcode, the command is slightly different between controlling individual motor velocity and the velocity of the entire drivetrain. From your message, it sounds like you are using the setVelocity command which is only for specific motors versus the setDriveVelocity which will control the entire Drivetrain. This command will only appear in the toolbox when you have a Drivetrain configured.

Here are both of these commands for comparison

Drivetrain.setDriveVelocity(50, percent);
Motor.setVelocity(50, percent);

It’s also worth noting that the default velocity is 50%. As your students start to experiment with their velocity they can move up or down from that value in order to increase or decrease the velocity.

3 Likes

Great! This is exactly this issue we have been having. Thank you for the quick reply.

3 Likes