My Autonomous Code

How does this autonomous code look for the new V5 robot game?
Any mistakes or recommendations.

int main() {

//Print Variables For The Memes

float TimeVal = 0 ;
float LeftMotorPow = 0 ;
float LeftMotor2Pow = 0 ;
float RightMotorPow = 0 ;
float RightMotor2Pow = 0 ;
float BCMotorPow = 0 ;
float FMMotorPow = 0 ;

void(drive) {

vex::brain Brain;
vex::motor RightMotor (vex::PORT2 vex::gearSetting::ratio18_1,true);
vex::motor LeftMotor (vex::PORT1 vex::gearSetting::ratio18_1,false);
vex::motor RightMotor2 (vex::PORT4 vex::gearSetting::ratio18_1,true);
vex::motor LeftMotor2 (vex::PORT3 vex::gearSetting::ratio18_1,false);
vex::drivetrain dt(LeftMotor, RightMotor, LeftMotor2, RightMotor2, 319.1764, 292.1, vex::distanceUnits::mm);

using namespace vex;

int main(void) {
dt.setVelocity(30,vex::velocityUnits::pct)

dt.driveFor(vex::directionType::fwd,60,vex::distanceUnits::in);

vex::sleep(1);

dt.driveFor(vex::directionType::rev,34,vex::distanceUnits::in);

vex::sleep(1)

dt.setVelocity(10,vex::velocityUnits::pct);

dt.turnFor(vex::turnType::right,atan(52/22)*180/3.141592,vex::rotationUnits::deg);

vex::sleep(1);

dt.setVelocity(21,vex::velocityUnits::pct);

dt.driveFor(vex::directionType::fwd,sqrt(24*24+48*48),vex::distanceUnits::in);

dt.stop(vex::brakeType::coast);

}
}
}

It looks like you were working from my Dead Reckoning example program on Robot Mesh Studio. There were some issues with how you used copy-paste, though. If you’re going to use copy-paste you need to make sure you replace your main function, as here you’ve added the example’s main function inside of the template’s main function. On Robot Mesh Studio, you can click the options wheel at the top right and click “Copy Project” to copy a public project into a private version for you to edit.

As for how to use it for autonomous, check out the example I did for using our Competition Template. To make this into your autonomous code in a competition template, you would paste the motor and drivetrain commands into the


autonomous

function.