a simple autonomous mode question

Well I went digging through the forums which went very indepth with the autonomous mode, but right now I have a very simple question:

How (and in compliant with the rules) am I suppose to go in and out of autonomous mode. Right now, my ideal robot would be one that starts in the “user” mode, and on the press of a button, enters autonomous mode, does whatever it needs to do, and exits autonomous mode after a second press of the button.

Sorry, our team is short on time. I’ve looked throughout the forums and manuals and couldn’t find out how. Thanks in advance.

FIRST sets autonomous mode automatically at the start of your match via the Competition port on the OI. Assuming your code is in the right place, everything should be taken care of automatically.

I think what he means with right place is this are of your user_routines_fast.h file. Just call your autonmous function from here and you should be fine.



void User_Autonomous_Code(void)
  /* Initialize all PWMs and Relays when entering Autonomous mode, or else it
     will be stuck with the last values mapped from the joysticks.  Remember, 
     even when Disabled it is reading inputs from the Operator Interface. 
    pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
    pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
    relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
    relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
    relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
    relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;

  while (autonomous_mode)   /* DO NOT CHANGE! */
    if (statusflag.NEW_SPI_DATA)      /* 26.2ms loop area */
        Getdata(&rxdata);   /* DO NOT DELETE, or you will be stuck here forever! */

        /* Add your own autonomous code here. */



        Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */

Thank you both a ton, this clears a lot up for me. Good luck at competition.