Joystick code for tournament

How can I ensure that the joystick software will work with the tournament system?

We are using robotC. If the team uses the template code, is that all they need to do?

Is there a way to ensure the team number is programmed in?

Is there a WIKI somewhere that I should read?

Sorry for the NEWBEE questions. I am afraid we will travel 5 hours to the tournament only to find out that our joystick code doesn’t work with the tournament system…


#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(15)
#pragma userControlDuration(105)
#include "Vex_Competition_Includes.c"  

/******************************************************************
* PRE_AUTON
* initialization routine
******************************************************************/
void pre_auton() {
	bStopTasksBetweenModes = true;
}

/******************************************************************
* AUTONOMOUS task
******************************************************************/
task autonomous(){

}

void updateLCD(){
	clearLCDLine(0);
	clearLCDLine(1);
	displayLCDCenteredString(0,"Barcbots Speed Demons");
	displayLCDCenteredString(1,"11101A");
}

/******************************************************************
* MAIN function
******************************************************************/
task usercontrol()
{
	updateLCD();
	startTask(driveTask);
	startTask(coneLiftTask);
	startTask(clawTask);
	startTask(mobileGoalTask);

	while(true){
		wait1Msec(TASK_DELAY);
	}
}

Once your joystick is paired with your robot, there is NO concern that the software will NOT work with the tournament system as long as you are programmed on the competition template, which it appears you are. There is NO need to have your team number programmed in other than under advanced tools, Robot C will ask you to rename your robot, there you will put in the team number that the program is associated with. For us, that is 536A through 536F.

Putting your team number in there really doesn’t actually do anything. The only way to ever see that number is through the Program or USB connections – field control can’t see it.

Use a Competition Switch to simulate field control. Make sure you can’t control your robot using anything on the joystick(s) while set to autonomous or disabled, and you have full control during driver control.

If you don’t have a Competition Switch, use the corresponding debug window in RobotC that will simulate a competition switch.

Thank you. It looks like we are ok then!

Definately. I have used these at tournaments on the skills field in the past. Works great and pretty cheap.


task usercontrol()
{
	updateLCD();
	startTask(driveTask);
	startTask(coneLiftTask);
	startTask(clawTask);
	startTask(mobileGoalTask);

	while(true){
		wait1Msec(TASK_DELAY);
	}
}

You are starting lots of tasks, but where are they ?

I didn’t include the whole code. I can put that later, after practice today.

No need to do that, just checking you were not expecting magic.

Here it is anyway.

Note: I need to learn about PIDs that myself before I can teach them so they are not using PID to position the cone lift arm, or the mobile goal lift.

Our LCD function doesn’t work at all - nothing is written to the LCD. We haven’t had a chance to debug that it.

I couldn’t paste the code, so I am attaching as a .zip file

Can I just say. Your code is incredibly well documented. I think it is the best documented program I have seen on the forum.

Thanks! I hold the kids accountable for documenting their code!