In the default code the autonomous mode depends on a variable(autonomous_mode). Logically, it should turn the autonomous mode on or off.
I’d really like to know if there is a built-in timer( to decide if it’s autonomous mode or not), or should I include my own?
also, there should be some way to activate the autonomous mode(and the robot itself, too) after the robot was turned on(after all, the team is supposed to be away from the robot, so we can’t make it start right after it is turned on). What i’d like to know is do I need to devise my own way or is there on in the default mode?
I’ve been working on the Edubot to get some experience with this, and that is entirely autonomous. When the robot turns on, if the code is loaded correctly, it should automatically start running the autonomous program, as far as I’m aware. That doesn’t involve anything special. (I think… someone verify?) I don’t know how the robot changes from autonomous to regular mode.
If you want to do a timer, I found a white-paper on innovationfirst.com, i believe, and it was very helpful. It’s kind of complicated, or at least it was to me, but I’m new at all this.
The way many teams do it is to use the Competition Port and set the Autonomous Mode by a flip of a switch that way. That’s the way it happens at the competition. References for this are in the OI Reference Guide.:
http://www.ifirobotics.com/docs/oi-ref-guide-2005-revnc0-1-12-05.pdf, see page 11.
You can also easily do it by having your program check a switch on the OI (like the trigger on a joystick) to turn the autonomous bit on when it is pressed.
The autonomous_mode variable is controlled by the part of the default code which communicates with the master CPU. It reflects the state of one of the pins on the competition port on the OI. Your software should never try to change its value. The FIRST field hardware will take care of it for you.
The usual way to enter autonomous mode for testing is to physically connect a switch to the appropriate pins on the competition port. See the Competiton Port Pinout Guide documentation for details.
Last year I programmed a switch on the OI (not the dongle) to send the robot into autonomous mode. The drivers used this during the Thursday practice rounds so we could test more than 2 routines per round. This was quite useful since we had over a dozen auto routines and we wanted to test them on the actual field (which is always different than any other field).