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!