A Question about Pre_Auton when using a VEXnet Competition Switch

We are using VEXcode V5 Text software , VEXnet Competition Switch and are having a problem getting our pre_auton function to run. The autonomous and the usercontrol functions seems to work well with the switch. Is there something we are missing about the competition switch? Or, an issue with the code? Or, should we develop a second program and store it in slot #2 and run it to remove the tower motors’ backlash . I have included the code for pre_auton() and int main().

Thanks in advance,
David

void pre_auton(void) {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();

// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions,

// Remove backlash from tower motors by rotating downward for 4 seconds
// Then reset the degrees on the Claw and Tower motors
RightTower.spinFor(-300,degrees,25,velocityUnits::pct, false);
LeftTower.spinFor(-300,degrees,25,velocityUnits::pct, false);
wait(4000, msec);
LeftTower.resetRotation();
RightTower.resetRotation();
Claw.resetRotation();
}


int main() {
// Set up callbacks for autonomous and driver control periods.
Competition.autonomous(autonomous);
Competition.drivercontrol(usercontrol);

// Run the pre-autonomous function.
pre_auton();

// Prevent main from exiting with an infinite loop.
while (true) {
wait(100, msec);
}
}

The intent of the preauton is for program configuration (set variables, reset encoders, etc). The competition system will not allow motors to run when the robot is disabled by the field switch.

1 Like

Hudsonville,

Thanks!! Sounds like the boys will need to have an alternate program to move the tower motors before connecting to the Competition Switch.

David

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