Good morning,
My students are putting their autonomous code and driver control code into the VEX competition template. The problem they are having is autonomous portion will not run at all, while the driver control portion works fine. There are no error messages being received when compiling the program.
If we use both pieces of code outside of the competition template, everything works fine, which is confusing. Any help would be appreciated. I have posted their code below:
#pragma config(Motor, port1, wheelytwo, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, wheelys, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, b1yoyo, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port4, b2cheese, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, armgear, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port6, talen, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, middlegeartwo, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, middlegearone, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port9, wheely4, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port10, wheely5, tmotorVex393_HBridge, openLoop, reversed)
#pragma platform(VEX2)
#pragma competitionControl(Competition)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "Vex_Competition_Includes.c"
void pre_auton()
{ bStopTasksBetweenModes = true;}
task autonomous()
{
clearTimer(T1);
while(time1[T1]<15000)
{
motor[wheelys] =-40;
motor[wheelytwo] =-40; // turn left
motor[wheely4] =-60;
motor[wheely5] =-60;
wait1Msec(2000);
motor[wheelys] =-50;
motor[wheelytwo] =-50; // move forward
motor[wheely4] =-50;
motor[wheely5] =-50;
wait1Msec(2500);
wait1Msec(3000);
motor[talen] = -40; // rotate claw and open
motor[armgear] =0;
wait1Msec(1000);
motor[b1yoyo]= -40;
motor[b2cheese]=- 40; // lower arm
motor[middlegearone]=-40;
motor[middlegeartwo]= -40;
wait1Msec(500);
wait1Msec(1000);
motor[talen] = -40; // rotate claw and open
motor[armgear] =0;
wait1Msec(1000);
motor[b1yoyo]= 40;
motor[b2cheese]= 40;
motor[middlegearone]=40; // raise the arm
motor[middlegeartwo]= 40;
wait1Msec(500);
wait1Msec(1000);
motor[wheelys] =50;
motor[wheelytwo] =50; // move backwards
motor[wheely4] =50;
motor[wheely5] =50;
wait1Msec(2000);
}
}
task usercontrol()
{
while (true)
{
while(vexRT[Btn7U]==0)
{
}
clearTimer(T2);
while(time1[T2]<300000)
{
{
motor[wheelys] = vexRT[Ch3];
motor[wheelytwo] = vexRT[Ch3];
motor[wheely4] = vexRT[Ch2];
motor[wheely5] = vexRT[Ch2];
}
if (vexRT[Btn7DXmtr2]==1)
{
motor[talen]=100;
}
else
{
motor[talen] = 0;
}
if(vexRT[Btn8DXmtr2]==1)
{
motor[talen] = -100;
}
else
{
motor[talen]= 0;
motor[b1yoyo]= vexRT[Ch3Xmtr2];
motor[b2cheese]= vexRT[Ch3Xmtr2];
motor[middlegearone]=vexRT[Ch2Xmtr2];
motor[middlegeartwo]=vexRT[Ch2Xmtr2];
}
if(vexRT[Btn7LXmtr2] ==1)
{
motor[armgear] = 127;
}
else
{
motor[armgear]=0;
}
if(vexRT[Btn8RXmtr2]==1)
{
motor[armgear]= -127;
}
else
{
motor[armgear]=0;
}
}
}
}
//}