We are having problems with our code

We are having issues with our code. We currently have an x-drive chases and we have these voids for our autonomous program. We are currently wondering if there is any way we could increase the velocity of the motor when these voids run.

void a_moveyaxis(float dist) {
float rot = 0.0825 * dist;
motorLF.rotateFor(directionType::fwd, rot, rotationUnits::rev, false);
motorLB.rotateFor(directionType::rev, rot, rotationUnits::rev, false);
motorRF.rotateFor(directionType::fwd, rot, rotationUnits::rev, false);
motorRB.rotateFor(directionType::rev, rot, rotationUnits::rev, true);
}

void a_movexaxis (float dist) {
float rot = 0.0825 * dist;
motorLF.rotateFor(directionType::fwd, rot, rotationUnits::rev, false);
motorLB.rotateFor(directionType::fwd, rot, rotationUnits::rev, false);
motorRF.rotateFor(directionType::rev, rot, rotationUnits::rev, false);
motorRB.rotateFor(directionType::rev, rot, rotationUnits::rev, true);
}

setVelocity method beforehand or use the overload of rotateFor that allows you to specify velocity.

Are you using Robot Mesh Studio or VEXcode? If this is on Robot Mesh Studio, you can see the documentation of the motor class here. An example of setVelocity being used can be found here.

1 Like

We are using vexcode. Is there a significant difference between the way you set the velocity between the two codes?

Not for these methods, no.

So when would we set the setVelocity line because we have a section of our code that is a group of functions like these and i am a little confused as to where this line would be located.

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