View unanswered posts | View active topics It is currently Wed Aug 20, 2014 8:41 pm






Reply to topic  [ 10 posts ] 
VRC Competition 
Author Message
Rookie

Joined: Fri Oct 09, 2009 9:21 am
Posts: 28
Post VRC Competition
I see in the sample programs there is a competetion template. Are there any directions anywere on how to use it?

Also with Easyc, you could put in jumpers to run either autonomous or driver control to test each out, does Robot C have anything like this?

Thanks,
Jon T

_________________
Jon Thompson
Coach - Twisted Bots
VRC 177


Fri Oct 09, 2009 9:28 am
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 602
Post Re: VRC Competition
Hi Jon,

There's a whole "Competition Control" section of the help documentation included with ROBOTC. Here's a link to the web version:
http://www.robotc.net/ifi_webhelp/scr/f ... ontrol.htm

Also, the VEX Competition documentation has a whole section on programming, specifically explaining how to use the templates:
http://www.vexrobotics.com/docs/vex-ele ... 082008.zip

They didn't seem to post it this year, so I found the link to last year's documenation.

Hope this helps. Please let us know if you need anything else.

- Tim

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Fri Oct 09, 2009 12:35 pm
Profile
Rookie

Joined: Fri Oct 09, 2009 9:21 am
Posts: 28
Post Re: VRC Competition
We've now tried the template.
The autonomous runs, but the teleop doesn't.
Any ideas what we are doing wrong?

Thanks,
Jon T
VRC 177

_________________
Jon Thompson
Coach - Twisted Bots
VRC 177


Sun Oct 11, 2009 5:31 pm
Profile
Rookie

Joined: Fri Oct 09, 2009 9:21 am
Posts: 28
Post Re: VRC Competition
After downloading the Master code, user control now works.

For the template included in Robot c v 1.7, it isn't obvious to me where to put the user control code. I ended up commenting out everything that is there and adding my own always true loop. It seem like most of the code is written for an lcd screen or something?

Thanks,
Jon T
VRC 177

_________________
Jon Thompson
Coach - Twisted Bots
VRC 177


Sun Oct 11, 2009 8:42 pm
Profile
Rookie

Joined: Sun Oct 11, 2009 7:01 pm
Posts: 4
Post Re: VRC Competition
Hey Jon,

Are you using crystals or VEXnet?


Mon Oct 12, 2009 6:25 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 602
Post Re: VRC Competition
The VEXnet requires a hardware switcher in order to test competition modes. You can see the hardware switcher here:

http://www.vexrobotics.com/vex-competitions.shtml
P/N: 276-2335 VEXnet Competition Switch $19.99 ea

We're working on a ROBOTC Update that will let you emulate this over the Orange serial cable plugging into the VEXnet transmitter. This should be available in a few days.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Tue Oct 13, 2009 11:38 am
Profile
Rookie

Joined: Fri Oct 09, 2009 9:21 am
Posts: 28
Post Re: VRC Competition
We have ordered the VEXNet, but it hasn't arrived yet. We have the switch but it does no good without VEXNet. We are using v1.70 hoping that the VEXNet arrives before our competition. Currently we are using crystals.

Do all the following lines from the template have to do with the VEXNet or what? Where exactly would I put our code?

//User control code here, inside the loop

clearLCDLine(0);
clearLCDLine(1);
displayLCDPos(0, 0);
displayNextLCDString("Teleop ");
++nTeleopCycles;
displayNextLCDNumber(nTeleopCycles, 4);

for (nTime = 0; true; ++nTime)
{
displayLCDPos(1, 0);
if (bIfiRobotDisabled)
displayNextLCDString("Disable ");
else
displayNextLCDString("Enable ");
displayNextLCDNumber(nTime / 600, 2);
displayNextLCDChar(':');
displayNextLCDNumber((nTime / 10) % 60, -2);
displayNextLCDChar('.');
displayNextLCDNumber(nTime % 10, 1);
wait1Msec(100);
}


Thanks,
Jon T
VRC 177

_________________
Jon Thompson
Coach - Twisted Bots
VRC 177


Wed Oct 14, 2009 1:26 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 602
Post Re: VRC Competition
You're programming in the wrong file. You need to place the includes file into the ROBOTC Includes directory.

The file you want to use looks more like this:

Code:
#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c"   //Main competition background code...do not modify!

/////////////////////////////////////////////////////////////////////////////////////////
//
//                          Pre-Autonomous Functions
//
// You may want to perform some actions before the competition starts. Do them in the
// following function.
//
/////////////////////////////////////////////////////////////////////////////////////////

void pre_auton()
{
   // All activities that occur before the competition starts
   // Example: clearing encoders, setting servo positions, ...
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 Autonomous Task
//
// This task is used to control your robot during the autonomous phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task autonomous()
{
  // .....................................................................................
  // Insert user code here.
  // .....................................................................................

   AuonomousCodePlaceholderForTesting();  // Remove this function call once you have "real" code.
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 Autonomous Task
//
// This task is used to control your robot during the autonomous phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task usercontrol()
{
   // User control code here, inside the loop

   while (true)
   {
     // 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.
   }
}

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Thu Oct 15, 2009 10:01 am
Profile
Rookie

Joined: Fri Oct 09, 2009 9:21 am
Posts: 28
Post Re: VRC Competition
Success!!!

We were able to install VEXNet and get Autonomous and Driver control to work last night.

We installed the VEX WiFi Master Code Ver 8 from here:

http://www.vexrobotics.com/vex-robotics-downloads.shtml

We then downloaded and installed Vex Competition Includes.c and the Vex Competition Template.c into RobotC v 1.7 from this thread:

viewtopic.php?f=11&t=1877

We then updated VEX User Code firmware with the latest version found in RobotC v 1.7.

Next we added our autonomous and driver control to the new competition template and downloaded it to the robot.

Next we turned the VEX off and on.

We installed the cable from the Vex Competition switch.

Using the competion switch toggle between autonomous & operator control mode and enable/disable the modes.

We did find that you had to run autonomous (at least for a short time) to run driver control.

Jon T

_________________
Jon Thompson
Coach - Twisted Bots
VRC 177


Fri Oct 16, 2009 10:21 am
Profile
Rookie

Joined: Fri Oct 09, 2009 9:21 am
Posts: 28
Post Re: VRC Competition
I've now upgraded to 1.97 and everything is pretty much working. I have 2 questions though.

1) When we run the competition template, the autonomous stops at 20 seconds, but the driver control runs well past 2:00. Is this normal?

2) The robot light is always red, never green. I don't know if this is a RobotC issue or a VEX issue?

Thanks,

_________________
Jon Thompson
Coach - Twisted Bots
VRC 177


Wed Oct 21, 2009 1:30 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 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.