This is my 3rd year robotics, and first for Robotc, and i cant seem to make autonomous work for field control. I have a basic program, and it wont work.
Looking at your code, you have a few items that seem problematic; these are definitely not the things that are causing you problems, but I thought I’d point them out.
The MoGo motor is never turning off; you turn it on to 127, and after 3 seconds (1000 + 2000) you set it to -127, and then it stays on at -127 forever (until the end of the 15 second auton) because you never tell it to stop. You need
motor[port7] = 0;
both when it’s moving at +127 and when it’s at -127. Also, it’s not great to switch your motors quickly from full-forward to full-back. So even if you did want your MoGo motor on the whole time, it’s good practice to set it to 0, have a very small wait command, and then turn it to full-backward.
For the chassis, you’re also never turning it off; it will drive forward at full throttle until the end of the 15 seconds. You need 4 more lines of code wherever it is you want the chassis to stop (I assume it’s right after the wait 2000ms line):
motor[portXX] = 0;
Again, these are not the things that are causing your “doesn’t work” problem, but I thought I’d point them out.
Does your program include this stuff from the competition template?:
// This code is for the VEX cortex platform
#pragma platform(VEX2)
// Select Download method as "competition"
#pragma competitionControl(Competition)
//Main competition background code...do not modify!
#include "Vex_Competition_Includes.c"
Also, when you say:
What exactly are you using for the field control? There are a few options, like a real field, or the VexNet competition switch (that black square with the switches that you plug your controller into), or the one of the emulators built into RobotC?