programming

How do you program the robot controller for autonomus mode

Well there are a few threads out there for you to search on, even a whitepaper. You really should search before you ask a broad question like how to program Autonomous mode. The innovation FIRST site also has information on it in the programming reference.

However, The key bits for you to use in your program: From Innovation First

6.3. PB_Mode – Competition, Autonomous, and User
PB_Mode is a byte accessible through the SERIN command. The Competition Mode, Autonomous
Mode, and User Mode are all available in this byte. The Default Code already contains all the code
needed to use these modes.
Competition Mode
Bit 7 of the PB_mode byte (aliased as comp_mode below) indicates the status of the Competition
Control, either Enabled or Disabled. This indicates the starting and stopping of rounds at the
competitions. Comp_mode is indicated by a solid “Disabled” LED on the Operator Interface.
Comp_mode = 1 for Enabled, 0 for Disabled.
Autonomous Mode
Bit 6 of the PB_mode byte (aliased as auton_mode below) indicates the status of the Autonomous Mode,
either Autonomous or Normal. This indicates when the robot must run on its own programming. When
in Autonomous Mode, all OI analog inputs are set to 127 and all OI switch inputs are set to 0 (zero).
Auton_mode is indicated by a blinking “Disabled” LED on the Operator Interface.
Auton_mode = 1 for Autonomous, 0 for Normal.
Autonomous Mode can be turned ON by setting the RC to Team 0 (zero) and power cycling the RC unit.
User Mode
Bit 5 of the PB_mode byte (aliased as user_display_mode below) indicates when the user selects the
“User Mode” on the OI. PB_mode.bit5 is set to 1 in “User Mode”. When the user selects channel, team
number, or voltage, PB_mode.bit5 is set to 0. When in “User Mode”, the eight Robot Feedback LED
are turned OFF and the Out 8 – Out 15 of the PBACIS processor are sent to the OI multi-segment
display.
Note: “User Mode” is identified by the letter “u” in the left digit (for 4 digit OI’s)
Note: “User Mode” is identified by decimal places on the right two digits (for 3 digit OI’s)

Autonomous _Mode Example: This example shows portions of the code that reference PB_Mode. The Perform
Operations Section below uses aliases based on PB_Mode bits to execute different sections of code.
'---------- Declare Miscellaneous Variables -------------------------------------------------
PB_mode VAR byte
'---------- Aliases for the Pbasic Mode Byte (PB_mode) --------------------------------------
comp_mode VAR PB_mode.bit7
auton_mode VAR PB_mode.bit6
user_display_mode VAR PB_mode.bit5
'========== PERFORM OPERATIONS section ======================================================
if auton_mode = 1 then do_autonomous_stuff
'Insert your normal driver mode code here
goto end_of_autonomous
do_autonomous_stuff:
'Insert your autonomous mode code here
end_of_autonomous:

Wouldn’t it be easier just to like, write out psecudo (sp?) code, and then implement it then? Because if you just write it out, it’ll cause more problems. But to write automonous mode code, just refer to Matt’s post.