I am coaching a team for the first time this year. We have been to one competition and have our second this weekend. We have finally got to the point of being able to run autonomous but we have the program messed up. I have two errors that I can’t figure out. If anyone can lend some assistance we would appreciate it!
You are showing errors in the competition template. You should have two tasks in the code you wrote with the same names, these are normally setup for you when you create a new competition file. Something like this
// User control code here, inside the loop
// 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.
UserControlCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
Are you compiling the correct file?
Can you post your code so we can see what’s going on?
I attached the actual programs. I have three, I think these are the three that I am using. The program with the errors is not the one I am trying to compile. The program works fine with the remote attached to the robot but when we try to use the VEXnet keys it has the VEXnet and Game LED flashing red. Competition Programnew.c (3.71 KB)
So you placed that function in the file that was attached in post #4, no typos or anything?
You mentioned three programs, not sure what you meant by that. You should have one program (the one you attached was called Competition Programnew.c) this includes one file called “Vex_Competition_Includes.c” that has the main task and the competition control code - do not change Vex_Competition_Includes.c or try and compile that included file, it will give errors. The code in Vex_Competition_Includes.c will call the function pre_auton() when it first initializes and then start either usercontrol() or autonomous() tasks as necessary. So what is the third program you are referring to?
When I add the pre_auton function back into the code you attached I do not get any warnings other than the usual one about UserControlCodePlaceholderForTesting and AutonomousCodePlaceholderForTesting, you can ignore these. There should not be a warning about pre_auton unless you have deleted that call from the Vex_Competition_Includes.c file for some reason, it should be near the top.
// Master CPU will not let competition start until powered on for at least 2-seconds
Again, you really should not mess with this file as it’s a system file and is used in all ROBOTC competition template based programs.
If you have white keys then check firmware versions are all correct (cortex, joystick and both keys) if they are not working.
I feel like you are still trying to compile Vex_Competition_Includes.c, you don’t need to do that, only compile your competition code file. It also looks like Vex_Competition_Includes.c has been messed with as I don’t see the prototype for the pre_auton function above the usercontrol prototype. Normally the top of this file would look like…
Can you post the program file you have of mine with no errors. When I paste the auton you posted into the file it gave me several more errors. I am working on updating the keys now. I already had the joystick and cortex updated that is why I believe its the keys.
I am using the newest version 4.X. I understand the difference now between the two programs. Thanks for clearing that up. So the program I need to compile is competition programnew. the error it has is a yellow X that says:
Attached is a standard Vex_Competition_Includes.c from a clean copy of ROBOTC V4.27.
On my system this is in the folder.
C:\Program Files (x86)\Robomatter Inc\ROBOTC Development Environment 4.X\Includes
Compare with what you have and replace if you feel it’s necessary.
When compiling your source file you will still normally see two warnings.
File ".\SourceFile002.c" compiled on Jan 09 2015 09:26:19
*Warning*:Unreferenced function 'UserControlCodePlaceholderForTesting'
*Warning*:Unreferenced function 'AutonomousCodePlaceholderForTesting'
But that’s ok, you can generally ignore warnings anyway.
In fact. the warning about pre_auton you could probably also ignore, it just worries me that other things in the competition template may have been changed. Is there any chance this is a special version just for PLTW?
Alternative, just delete the pre_auton function (ie. back to what you started with) and that warning will go away, in which case your original problem was just compiling the competition includes file when that’s not necessary. Vex_Competition_Includes.c (5.74 KB)
Thanks for all your help. I think that the program is working properly now. The flashing LED’s I have are for GAME and VEXnet but they are not on the controller they are on the cortex. Both the cortex and controller are updated. Is this what happens when the keys are needing the update?