V5 Enabled When Plugged into Arena and Classroom Competition Switch

  1. last week

    techteacher3

    Nov 5 Wichita, KS 2036
    Edited last week by techteacher3

    I am a MS Teacher trying to get V5 to work!! Our V5 equipment continues to run even when hooked up to the arena during a tournament and when hooked up to the regular classroom competition switch. We make sure we have the robots OFF, then plug in, then turn robots and controllers on. We make sure we only tether to Controller 1. And it is not the Classroom Competition Switch or its cord as I just tested it with a V4 robot and it works just fine. This is one example of our code in the competition template.

    Also our autonomous does not run, but that might be another issue.

    Also we have experienced our controllers suddenly switching where Controller 1 becomes Controller 2 etc.--but that was only one robot--and might also be another issue.

    #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 ) {

    LeftWheel.setStopping(brakeType::brake);
    RightWheel.setStopping(brakeType::brake);

    FrontFlip.startRotateFor(1161,rotationUnits::deg,50,velocityUnits::pct);
    LeftWheel.startRotateFor(576,rotationUnits::deg,50,velocityUnits::pct);
    RightWheel.startRotateFor(-596,rotationUnits::deg,50,velocityUnits::pct);
    while(LeftWheel.isSpinning()||RightWheel.isSpinning())

    {}

    }

    /*----------------------------------------------------------------------------*/
    /* */
    /* 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){
    LeftWheel.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
    RightWheel.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);

    if(Controller2.ButtonL1.pressing()) { //If button up is pressed...
    CascadeLift.spin(vex::directionType::rev,50, vex::velocityUnits::pct);
    }
    else if(Controller2.ButtonL2.pressing()) { //If the down button is pressed...

    CascadeLift.spin(vex::directionType::fwd,50, vex::velocityUnits::pct);
    }
    else { //If the the up or down button is not pressed...

    CascadeLift.stop(vex::brakeType::hold);
    }


    FrontFlip.spin(vex::directionType::fwd, Controller2.Axis2.value(), vex::velocityUnits::pct);
    }
    // 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.

    // ........................................................................
    // Insert user code here. This is where you use the joystick values to
    // update your motors, etc.
    // ........................................................................

    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.
    }

    }

  2. What competition switch are you using? Is it the alliance splitter or the manual?

  3. techteacher3

    Nov 5 Wichita, KS 2036

    It is this one. https://www.vexrobotics.com/vexedr/products/competition-products/276-2335.html

  4. I don't see anything obviously wrong with your code, though the lack of indentation makes it a bit hard to read. (You can wrap code in code tags on the forum consisting of the word code between square brackets [ ] at the start and the word /code between another set of square brackets [ ] at the end, like this, and it will preserve indentation.)

    The first thing I would do is make sure that they are running the right program. It seems silly, but I've seen a lot of silly things in the years I've been doing VEX and it never hurts to check. Given that the code above shouldn't do anything without a competition switch but seems to always run driver, I'm leaning towards "wrong program being run" as our likely culprit. You can add something obvious in your program like writing text to the LCD in the main function to make sure the program you think is being run is actually being run.

    Next thing I would double check is that your firmware is up to date, which is v1.0.2.

    If you're sure the right program is being run and the firmware is up to date, that's when I would do a sanity check by trying a competition program someone else has written to make sure it's not your code. I can't provide any examples for VCS, but I could provide one from Robot Mesh Studio if you end up needing one (which would also rule out configuration problems with your installation of VCS).

  5. jpearman

    Nov 6 Moderator, ROBOTC Tech Support, V5 Beta Moderator Los Angeles 8888

    @techteacher3 I am a MS Teacher trying to get V5 to work!!

    @John TYler I can't provide any examples for VCS

    Here is a link to a VCS test competition program I posted a few weeks ago.
    https://www.vexforum.com/index.php/34799-how-to-test-the-competition-switch-with-v5-competition-iscompet/p1#p281789

  6. techteacher3

    Nov 6 Wichita, KS 2036

    Not running the wrong program, we have firmware v1.0.2. I don't think it's a coding issue now. On one of the robots, we figured out the controllers randomly switched on us again and if they plug into controller 2 instead of controller 1 the competition switch works fine. The kids did not switch this around--I stuck the labels on the equipment myself. I do not know what happened--their code is the same--each controller has the same buttons/joysticks working exactly as the code was written--they just switched! It's some sort of controller problem. Can you update a controller? Is there even such a thing? I don't know what's wrong with the other two robots yet.

  7. sankeydd

    Nov 9 Event Partner

    You can update the controller, plug it into the brain with a smart cord. I'm not sure if it prompts you to do so, but I do remember updating the controller.

  8. sazrocks

    Nov 9 Arizona 2114V

    Pretty sure it prompts you.

 

or Sign Up to reply!