Help with competition coding template.


#1

Hi my kids are having an issue with their code, and I cant see to figure out whats wrong. Heres there code:

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

//Creates a competition object that allows access to Competition methods.
vex::competition 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 ) {
  // All activities that occur before the competition starts
  // Example: clearing encoders, setting servo positions, ...


}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              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 ) {
  // ..........................................................................
  // Insert autonomous user code here.
  // ..........................................................................

}

/*----------------------------------------------------------------------------*/
/*                                                                            */
/*                              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 ) {
 int armSpeedPCT = 50;
    
    
    //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.
        Left.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
        Right.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
        Lefter.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
         Righter.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
        //Arm Control
        if(Controller1.ButtonUp.pressing()) { //If button up is pressed...
            //...Spin the arm motor forward.
            Arm.spin(vex::directionType::fwd, armSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonDown.pressing()) { //If the down button is pressed...
            //...Spin the arm motor backward.
            Arm.spin(vex::directionType::rev, armSpeedPCT, vex::velocityUnits::pct);
        }
        else { //If the the up or down button is not pressed...
            //...Stop the arm motor.
            Arm.stop(vex::brakeType::brake);
        }
        
    }
    
}


and our console error:

13:35:57 – info – tar ‘1 Competition Template blue.vex’ succesfully extracted to: /Users/student/
13:36:05 – info – changed directory: /Users/student/Library/Application Support/VEX Coding Studio/sdk/user/
13:36:05 – info – /Users/student/Library/Application Support/VEX Coding Studio/sdk/user/
13:36:05 – info – file removed: /Users/student/Library/Application Support/VEX Coding Studio/sdk/user/cxx.o
13:36:05 – info – clang version 5.0.1 (tags/RELEASE_501/final)
Target: thumbv7-none–eabi
Thread model: posix
InstalledDir: /Applications/VEX Coding Studio.app/Contents/Resources/app.nw/node_modules/@modkit/modkit-compiler-binaries-osx/clang/bin
“/Applications/VEX Coding Studio.app/Contents/Resources/app.nw/node_modules/@modkit/modkit-compiler-binaries-osx/clang/bin/clang” -cc1 -triple armv7-none–eabi -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name cxx_entry.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -nostdsysteminc -target-cpu generic -target-feature +soft-float-abi -target-feature -fp-only-sp -target-feature -d16 -target-feature +vfp3 -target-feature -fp16 -target-feature -vfp4 -target-feature -fp-armv8 -target-feature +neon -target-feature -crypto -target-feature +strict-align -target-abi aapcs -mfloat-abi soft -target-linker-version 351.4 -v -dwarf-column-info -debugger-tuning=gdb -ffunction-sections -fdata-sections -coverage-notes-file /Users/student/Library/Application Support/VEX Coding Studio/sdk/user/cxx.gcno -nostdinc++ -resource-dir /Applications/VEX Coding Studio.app/Contents/Resources/app.nw/node_modules/@modkit/modkit-compiler-binaries-osx/clang/lib/clang/5.0.1 -D _LIBCPP_HAS_NO_EXCEPTIONS -D _LIBCPP_HAS_NO_THREADS -D VexV5 -I . -I …/clang/7.0.0/include -I …/vexv5/include -I …/vexv5/gcc/include -I …/vexv5/gcc/include/c++/4.9.3 -I …/vexv5/gcc/include/c++/4.9.3/arm-none-eabi/armv7-ar/thumb -I …/modkit -internal-isystem /Applications/VEX Coding Studio.app/Contents/Resources/app.nw/node_modules/@modkit/modkit-compiler-binaries-osx/clang/lib/clang/5.0.1/include -internal-isystem include -Os -Wno-unknown-attributes -Werror=return-type -Wall -std=gnu++11 -fdeprecated-macro -fdebug-compilation-dir /Users/student/Library/Application Support/VEX Coding Studio/sdk/user -ferror-limit 19 -fmessage-length 0 -fallow-half-arguments-and-returns -fno-rtti -fshort-enums -fno-signed-char -fno-threadsafe-statics -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o cxx.o -x c++ cxx_entry.cpp
clang -cc1 version 5.0.1 based upon LLVM 5.0.1 default target x86_64-apple-darwin16.7.0
ignoring nonexistent directory “/Applications/VEX Coding Studio.app/Contents/Resources/app.nw/node_modules/@modkit/modkit-compiler-binaries-osx/clang/lib/clang/5.0.1/include”
ignoring nonexistent directory “include”
ignoring nonexistent directory “/Applications/VEX Coding Studio.app/Contents/Resources/app.nw/node_modules/@modkit/modkit-compiler-binaries-osx/clang/lib/clang/5.0.1/include”
#include “…” search starts here:
#include <…> search starts here:
.
…/clang/7.0.0/include
…/vexv5/include
…/vexv5/gcc/include
…/vexv5/gcc/include/c++/4.9.3
…/vexv5/gcc/include/c++/4.9.3/arm-none-eabi/armv7-ar/thumb
…/modkit
End of search list.
13:36:05 – info – make process failed with return code: 1


#2

Bumping to the top


#3

Thanks, figured it out :smiley:


#4

Where is “main” ?


#5

ya thats what they deleted, I didnt notice it till I sat with them and watched what they did. They have a separate code that handles just driving, and they copied and pasted it into their comp code, without noticing they deleted the bottom section. We’re coming from RobotC so its still a steep learning curve for us.

They got it and started working on their auton mode for our competition this Saturday :-).