View unanswered posts | View active topics It is currently Fri Nov 21, 2014 11:21 pm






Reply to topic  [ 8 posts ] 
Autonomous Code Fails to Run 
Author Message
Rookie

Joined: Wed Jan 11, 2012 5:22 pm
Posts: 5
Post Autonomous Code Fails to Run
Hi, I am trying to get my code for a competition to work. I am using a standard competition template, bu no matter what I put in the autonomous code section, it always skips ahead to user control. (Yes, I have removed the placeholder)

Competition is in two days, so any help would be great!


Wed Jan 11, 2012 5:25 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Autonomous Code Fails to Run
How are you starting autonomous mode? Are you using the competition switch in ROBOTC?

_________________
sudo rm -rf /


Wed Jan 11, 2012 5:50 pm
Profile
Rookie

Joined: Wed Jan 11, 2012 5:22 pm
Posts: 5
Post Re: Autonomous Code Fails to Run
Competition switch? I have the competition control set to true. If you mean the little black switch they have at competitions, I don't have that. Here's the first part of my code, the rest is just driver control stuff.

#pragma platform(VEX)
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)
#include "Vex_Competition_Includes.c"

void pre_auton(){}

task autonomous(){while(true) {motor[port2]=64; motor[port3]=64; }}


Wed Jan 11, 2012 6:35 pm
Profile
Rookie

Joined: Wed Jan 11, 2012 5:22 pm
Posts: 5
Post Re: Autonomous Code Fails to Run
I just tried running the program with the #pragma competitionControl tag set to autonomousTest, that didnt work either.


Wed Jan 11, 2012 6:42 pm
Profile
Rookie

Joined: Wed Jan 11, 2012 5:22 pm
Posts: 5
Post Re: Autonomous Code Fails to Run
Would not having either the competition switch or the Joystick-Computer link cable cause autonomous to not run? (I have no way to set the robot to autonomous mode, like they demonstrate at http://www.robotc.net/support/cortex/testing.pdf?) Is there any workaround without those two cables?


Wed Jan 11, 2012 6:52 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Autonomous Code Fails to Run
The ROBOTC competition control works just like the physical competition switch, but through software. If you do not have the USB-Serial cable to connect the joystick to the computer, and you do not want to connect the Cortex directly to the computer, this will not work. If you just want to test your autonomous, you can copy the #pragmas over to a blank page, and write out the code there. Then download that file to the robot by wire, and test it that way. When you're done, copy the code to the autonomous part of the template.

_________________
sudo rm -rf /


Wed Jan 11, 2012 10:35 pm
Profile
Rookie

Joined: Wed Jan 11, 2012 5:22 pm
Posts: 5
Post Re: Autonomous Code Fails to Run
Thanks. So what you are saying is just copy the code into a separate file and run that to test the autonomous phase, and then move it to the competition template for the final program?


Thu Jan 12, 2012 5:05 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Autonomous Code Fails to Run
Yes, the code should execute the same way. But again, make sure that your #pragmas are identical in both files, or you may have problems.

_________________
sudo rm -rf /


Fri Jan 13, 2012 1:48 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.