Switching from PROS to VEXcode, having problems

I have been using PROS for a while, and I like it. However, there were some things that bugged me about it, so I decided to try switching to VEXcode because it seemed to have most of the advantages of PROS while solving some of my problems, too. I converted all of my code to VEXcode, but when I run the program the robot moves noticeably slower, and seems less responsive as well. I don’t know why this is, but I am wondering if it has to do with the way I am setting the motor power. In PROS, I used this method to set the motor power of the drive:

void Drive::setPower(int leftPower, int rightPower)
  motorLF = leftPower;
  motorLB = leftPower;
  motorRF = rightPower;
  motorRB = rightPower;

In VEXcode, this was the only way I found to do the equivalent: (but let me know if there is a better way)

void Drive::setPower(int leftPower, int rightPower)
  motorLF.spin(vex::directionType::fwd, leftPower, vex::velocityUnits::pct);
  motorLB.spin(vex::directionType::fwd, leftPower, vex::velocityUnits::pct);
  motorRF.spin(vex::directionType::fwd, rightPower, vex::velocityUnits::pct);
  motorRB.spin(vex::directionType::fwd, rightPower, vex::velocityUnits::pct); 

Another thing that might be a problem is the way I get joystick values. This is an example of a method I have to get the value of axis 1:

int Joystick::joy1()
  return joystick.Axis1.position(vex::percentUnits::pct);

I’m used to PROS which uses values of -127 to 127, so maybe I made an error using vex::velocityUnits::pct? Just to make sure I was getting the right joystick values I tried to display the values to the brain screen, but I couldn’t figure out how because it appears that std::to_string() doesn’t exist in VEXcode. I don’t know if my problem is in my code or if it is inherent to VEXcode, but I would appreciate any help. Thanks!

I’m pretty sure you can do setVelocity on the motors.

Today I tried switching it to setVelocity() but it had no effect. I ran some tests, too, and the robot is clearly moving slower than with the PROS code. Not only that, but the update rate seems to be much slower. I can flick the joystick forward quickly and the robot barely even responds, but with the PROS program it responds much more quickly. Is anyone else having this problem?

Did you set gear ratios correctly when creating the motor instances ?

If you want to just have open loop control, ie. no pid in the motor, use the spin command and send voltage rather than rpm or percent, see the headers (right click on spin, go to definition) for that info.


Make sure you delay in every single loop you have.
If you don’t, you can starve the CPU and prevent other tasks from running.
The standard is

while(true) {
  // do stuff
  pros::delay(20); // or vex::sleep

@jpearman, I’ll try your suggestion tomorrow. @theol0403, I do have a vex::sleep() statement at the end of the while loop. It was originally set to 20 milliseconds, but I tried changing it to 5 milliseconds and it actually seemed to improve the time it takes the robot to respond to a change in joystick position. However, it was still noticeably slower than with the PROS program. Maybe @jpearman’s suggestion will fix this too.

make sure to declare your velocity before hand and if your calling drive you want to have it set up similar to this

void drive {

LeftMotor.setVelocity( 50, vex::velocityUnits::pct );
RightMotor.setVelocity( 50, vex::velocityUnits::pct );


Leftmotor.spin(vex::directionType::fwd, leftPower, vex::velocityUnits::pct);
Rightmotor.spin(vex::directionType::fwd, leftPower, vex::velocityUnits::pct);




I don’t think this is true.
You don’t have to set any velocity beforehand, just set power to the motors.
Correct me if I am wrong, I have never used VEXcode, but I have never seen this done and it seems very unnecessary.

1 Like

vex code has its advantages but i have currently not found another way of changing the power of motors I went based off the example programs so in my suggestion you could declare them as a variable

I tried @jpearman’s suggestion of using voltage to control the motors open-loop. It did seem to work a lot better, but I couldn’t find what the max voltage is. I would have done more tests to get an idea of what value represents full power, but then VEXcode decided to stop compiling even though I didn’t alter the code. I’m currently trying to fix this problem, but in the meantime, does anyone know what the max voltage is?

Twice asked today, it’s 12V (12000mV)
(that is -12V to +12V)


Is it possible to re-install the vexv5 firmware onto a brain that you have used pros with?
My team is debating on whether or not we should switch to pros for one of our robots and we want to make sure we can go back to vexcode.

There is no need to do this, the vexos (the V5 firmware) does not need to change. In fact, you can have both PROS and VEXcode (and RobotMesh) programs all on the V5 brain at the same time.