Competition.isFieldControl Issue

My competition program is stuck on a program called Competition.isFieldControl, it says “cannot use dot operator on a type Competition.isFieldControl()//”. How can I fix it?

Please post your code, otherwise it’s very difficult for anyone to diagnose it.

Remember to wrap your code in [code] … [/code] tags to get it nicely formatted!

2 Likes
#include "robot-config.h"
/*---------------------------------------------------------------------------*/
/*                                                                           */
/*        Description: Competition template for VCS VEX V5                   */
/*                                                                           */
/*---------------------------------------------------------------------------*/

//Creates a competition object that allows access to Competition methods.
vex::competition

/*---------------------------------------------------------------------------*/
/*                          Pre-Autonomous Functions                         */
/*                                                                           */
/*  You may want to perform some actions before the competition starts.      */
/*  Do them in the following function.  You must return from this function   */
/*  or the autonomous and usercontrol tasks will not be started.  This       */
/*  function is only called once after the cortex has been powered on and    */
/*  not every time that the robot is disabled.                               */
/*---------------------------------------------------------------------------*/

void pre_auton( void ) {
  int main() {
    
    //Run the pre-autonomous function. 
    pre_auton();
    
    //Set up callbacks for autonomous and driver control periods.
    Competition.autonomous( autonomous );
    Competition.drivercontrol( usercontrol );

}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              Autonomous Task                              */
/*                                                                           */
/*  This task is used to control your robot during the autonomous phase of   */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

void autonomous( void ) {
  // ..........................................................................
  // #include "robot-config.h"

int main() {
    
    //Wait 2 seconds or 2000 milliseconds before starting the program.
	vex::task::sleep(2000);
    //Print to the screen that the program has started.
    Brain.Screen.print("Match has Started.");
    Brain.Screen.print("Autonomous will start soon.");
    
    FrontLeftDr.setVelocity(100, vex::velocityUnits::pct);
    FrontRightDr.setVelocity(100, vex::velocityUnits::pct);
    BackLeftDr.setVelocity(100, vex::velocityUnits::pct);
    BackRightDr.setVelocity(100, vex::velocityUnits::pct);
    LeftIntake.setVelocity(100, vex::velocityUnits::pct);
    RightIntake.setVelocity(100, vex::velocityUnits::pct);
    ChutePush.setVelocity(100, vex::velocityUnits::pct);
    
    
    FrontLeftDr.spin(vex::directionType::fwd);
    FrontRightDr.spin(vex::directionType::fwd);
    BackRightDr.spin(vex::directionType::fwd);
    BackLeftDr.spin(vex::directionType::fwd);
      vex::task::sleep(1500);
    LeftIntake.spin(vex::directionType::fwd);
    RightIntake.spin(vex::directionType::fwd);
	  vex::task::sleep(300);
    FrontLeftDr.spin(vex::directionType::rev);
    BackLeftDr.spin(vex::directionType::rev);
      vex::task::sleep(200);
    FrontLeftDr.spin(vex::directionType::rev);
    FrontRightDr.spin(vex::directionType::rev);
    BackRightDr.spin(vex::directionType::rev);
    BackLeftDr.spin(vex::directionType::rev);
      vex::task::sleep(1000);
    FrontRightDr.spin(vex::directionType::fwd);
    BackRightDr.spin(vex::directionType::fwd);
      vex::task::sleep(200);
    FrontLeftDr.spin(vex::directionType::fwd);
    FrontRightDr.spin(vex::directionType::fwd);
    BackRightDr.spin(vex::directionType::fwd);
    BackLeftDr.spin(vex::directionType::fwd);
      vex::task::sleep(1000);
    FrontLeftDr.spin(vex::directionType::rev);
    BackLeftDr.spin(vex::directionType::rev);
      vex::task::sleep(800);
    FrontLeftDr.spin(vex::directionType::fwd);
    FrontRightDr.spin(vex::directionType::fwd);
    BackRightDr.spin(vex::directionType::fwd);
    BackLeftDr.spin(vex::directionType::fwd);
      vex::task::sleep(2000);
    ChutePush.spin(vex::directionType::fwd);
      vex::task::sleep(2000);
    
    FrontLeftDr.stop();
    FrontRightDr.stop();
    BackRightDr.stop();
    BackLeftDr.stop();
    LeftIntake.stop();
    RightIntake.stop();
    ChutePush.stop();
    
    Controller.Screen.print("Autonomous has Ended.");
    Controller.rumble(".-.-");
    
    //Print to the brain's screen that the program has ended.
    Brain.Screen.newLine();//Move the cursor to a new line on the screen.
    Brain.Screen.print("Autonomous has Ended.");
    //Prevent main from exiting with an infinite loop.                        
    while(1) {
      vex::task::sleep(100);//Sleep the task for a short amount of time to prevent wasted resources.
    }
}
  // ..........................................................................

}

/*----------------------------------------------------------------------------*/
/*                                                                            */
/*                              User Control Task                             */
/*                                                                            */
/*  This task is used to control your robot during the user control phase of  */
/*  a VEX Competition.                                                        */
/*                                                                            */
/*  You must modify the code to add your own robot specific commands here.    */
/*----------------------------------------------------------------------------*/

void usercontrol( void ) {
  // User control code here, inside the loop
  while (1){
    // This is the main execution loop for the user control program.
    // Each time through the loop your program should update motor + servo 
    // values based on feedback from the joysticks.

    // ........................................................................
    // int main() {
    Brain.Screen.setOrigin(1,1);    
    //Display that the program has started to the screen.
    Brain.Screen.print(""); 
    
    
    //Use these variables to set the speed of the arm and claw.
    int armSpeedPCT = 100;
    int slowClawSpeedPCT = 100;
    int chuteSpeedPCT = 100;
    Brain.Screen.print("(Subbing to PewDiePie);");
        Brain.Screen.newLine();
        Brain.Screen.newLine();
        Brain.Screen.newLine();
        Brain.Screen.print("(Complete!);");
        Brain.Screen.newLine();
        Brain.Screen.newLine();
        Brain.Screen.newLine();
        Brain.Screen.newLine();
    
    
    //Create an infinite loop so that the program can pull remote control values every iteration.
    //This loop causes the program to run forever.
    while(1) {
        
        

        //Drive Control 
        //Set the left and right motor to spin forward using the controller Axis values as the velocity value.
        FrontLeftDr.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
        BackLeftDr.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
        FrontRightDr.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
        BackRightDr.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
        
        //ArmMotor
        if(Controller1.ButtonL1.pressing()) { //If button L1 is pressed...
            //...Spin the arm motor forward.
            ArmMotor.spin(vex::directionType::fwd, armSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonL2.pressing()) { //If the L2 button is pressed...
            //...Spin the arm motor backward.
            ArmMotor.spin(vex::directionType::rev, armSpeedPCT, vex::velocityUnits::pct);
        }
        else { //If the the L1 or L2 button is not pressed...
            //...Stop the arm motor.
            ArmMotor.stop(vex::brakeType::brake);
        }
         //LeftIntake Control
        if(Controller1.ButtonR1.pressing()) { //If the R1 button is pressed...
            //...Spin the LeftIntake forward.
            LeftIntake.spin(vex::directionType::fwd, slowClawSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonR2.pressing()) { //If the R2 button is pressed...
            //...Spin the LeftIntake backward.
            LeftIntake.spin(vex::directionType::rev, slowClawSpeedPCT, vex::velocityUnits::pct);
        }
        else { //If the R1 or R2 button are not pressed...        
            //...Stop the LeftIntake.
            LeftIntake.stop(vex::brakeType::brake);        
        }
         //Slow RightIntake Control
        if(Controller1.ButtonR1.pressing()) { //If the R1 button is pressed...
            //...Spin the RightIntake forward.
            RightIntake.spin(vex::directionType::fwd, slowClawSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonR2.pressing()) { //If the R2 button is pressed...
            //...Spin the RightIntake backward.
            RightIntake.spin(vex::directionType::rev, slowClawSpeedPCT, vex::velocityUnits::pct);
        }
        else { //If the R1 or R2 button are not pressed...        
            //...Stop the RightArmSlurper.
            RightIntake.stop(vex::brakeType::brake);                
        }
        //ChutePush Control
        if(Controller1.ButtonUp.pressing()) { //If the Up button is pressed...
            //...Spin the ChuteMotor forward.
            ChutePush.spin(vex::directionType::fwd, chuteSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonDown.pressing()) { //If the Down button is pressed...
            //...Spin the ChuteMotor backward.
            ChutePush.spin(vex::directionType::rev, chuteSpeedPCT, vex::velocityUnits::pct);
        }
        else { //If the Up or Down button are not pressed...        
            //...Stop the ChutePush.
            ChutePush.stop(vex::brakeType::brake);        
        }
        
		vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources.
    }

}
    // ........................................................................
 
    vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources. 
  }
}

//
// Main will set up the competition functions and callbacks.
//
int main() {
    
    //Run the pre-autonomous function. 
    pre_auton();
    
    //Set up callbacks for autonomous and driver control periods.
    Competition.autonomous( autonomous );
    Competition.drivercontrol( usercontrol );

    //Prevent main from exiting with an infinite loop.                        
    while(1) {
      vex::task::sleep(100);//Sleep the task for a short amount of time to prevent wasted resources.
    }    
       
}