We recently went to a vex competition in Syracuse, Utah during the tournament are robot kept shorting out in the middle of all our matches. At first we thought it was our vex net keys than we swapped them out and used another teams vex net keys the same problem happened then we swapped our controllers the problem still occurred one of the tournament directors told us that it was our motors kept shutting off because they were working to hard to move our robot which our robot was the lightest one at the competition and also after the tournament we went on the course without plugging the controllers into the arena and drove it around for 30 minutes then we drove it on carpet which was pulling one of my teammates who was on a chair with wheels on it who probably weighed about 145 pounds and yet we still couldn’t get it to repeat itself. It seemed like every time we plugged the competition cord into the controller we would loose connection in the middle of the match i have attached our code we used robot C for our program and yes we have an autonomous program also this problem was not occurring when we were at the Hailey, Idaho Vex robotics tournament i was just wondering could it be that the arena had a bug when they were downloading the software for the competition.
#pragma config(Sensor, in1, armPot, sensorPotentiometer)
#pragma config(Sensor, in2, LCD, sensorReflection)
#pragma config(Sensor, dgtl1, btn1, sensorTouch)
#pragma config(Sensor, dgtl2, btn2, sensorTouch)
#pragma config(Sensor, dgtl3, btn3, sensorTouch)
#pragma config(Sensor, dgtl4, btn4, sensorTouch)
#pragma config(Sensor, dgtl5, btn5, sensorTouch)
#pragma config(Sensor, dgtl6, rightEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl8, leftEncoder, sensorQuadEncoder)
#pragma config(Motor, port2, rightMotor, tmotorNormal, openLoop)
#pragma config(Motor, port4, rightTilt, tmotorNormal, openLoop)
#pragma config(Motor, port5, leftTilt, tmotorNormal, openLoop)
#pragma config(Motor, port6, tread, tmotorNormal, openLoop)
#pragma config(Motor, port7, leftMotor, tmotorNormal, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
// *!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#pragma autonomousDuration(20)
#pragma userControlDuration(200)
#include "Vex_Competition_Includes.c" //Main competition background code...do not modify!
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Pre-Autonomous Functions
// You may want to perfrom some actions before the copetition starts. Do them in the following function.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void pre_auton()
{
SensorValue[rightEncoder] = 0;
SensorValue[leftEncoder] = 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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 roboto specific commands here.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool tiltDone;
bool forwardDone;
bool reverseDone;
void clearBools()
{
tiltDone=false;
forwardDone=false;
reverseDone=false;
}
void armUp(int angle)
{
if(SensorValue[armPot] < angle)
{
motor[rightTilt] = 100;
motor[leftTilt] = 100;
}
else
{
motor[rightTilt] = 0;
motor[leftTilt] = 0;
tiltDone= true;
}
}
void moveForward(int Distance, int speed)
{
if(SensorValue[rightEncoder] < Distance )
{
motor[rightMotor] = speed;
motor[leftMotor] = speed;
}
else
{
motor[rightMotor] = 0;
motor[leftMotor] = 0;
forwardDone = true;
}
}
void moveRevers(int Distance, int speed)
{
if(SensorValue[rightEncoder] > 0 )
{
motor[rightMotor] = -speed;
motor[leftMotor] = -speed;
}
else
{
motor[rightMotor] = 0;
motor[leftMotor] = 0;
reverseDone = true;
}
}
void score(int forwardDistance, int angle, int scoreingTime, int reversDistance, int speed)
{
SensorValue[rightEncoder] = 0;
wait10Msec(10);
//*********************************
// Move In to Place
//*********************************
ClearTimer(T1);
while(!forwardDone || !tiltDone)
{
armUp(angle);
moveForward(forwardDistance,speed);
if(time1[T1] > 5000)
{
forwardDone = true;
tiltDone = true;
motor[leftMotor] = 0;
motor[rightMotor] = 0;
}
}
//*********************************
// DUMP
//*********************************
clearBools();
int i=0;
while(i < scoreingTime)
{
armUp(angle);
motor[tread] = -127;
wait1Msec(1);
i++;
}
motor[tread] = 0;
//*********************************
// Go Back HOME
//*********************************
clearBools();
while(!reverseDone)
{
moveRevers(reversDistance,speed);//(distance, speed)
}
}
void gather(int waitTime)
{
motor[tread] = 127;
motor[rightMotor] = 80;
motor[leftMotor] = 80;
wait1Msec(waitTime); //
motor[tread] = 0;
motor[rightMotor] = -80;
motor[leftMotor] = -81;
wait1Msec(waitTime);
motor[rightMotor] = 0;
motor[leftMotor] = 0;
}
task autonomous()
{
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;
while(true)
{
if(SensorValue[btn1] ==1)
{
// Gather Balls and come back home
gather(2000);//(waitTime)
}
if(SensorValue[btn2]==1)
{
// Scores in the 20" goal in the isolation zone and then returns back
score(600,23,2500,700,100); // forwardDistance, angle, scoreingTime, reversDistance, speed)
}
if(SensorValue[btn3]==1)
{
// Scores in the 11" goal in the isolation zone and then returns back
score(600,15,2500,600,100); // forwardDistance, angle, scoreingTime, reversDistance, speed)
}
if(SensorValue[btn4]==1)
{
// Scores in the 11" goal in the interaction zone and then returns back
score(0,15,2000,0,100); // forwardDistance, angle, scoreingTime, reversDistance, speed)
}
if(SensorValue[btn5]==1)
{
// Scores in the 30" goal in the interaction zone and then returns back
score(1015,29,4000,700,100); // forwardDistance, angle, scoreingTime, reversDistance, speed)
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// User Cntorl Task
// This task is used to contorl your robot during the user control phase of a VEXx Competition.
// You must modify the code to add your own robot specific commands here.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
task usercontrol()
{
while(true)
{
motor[tread] = 0;
if (vexRT[Btn6U])
{
motor[tread] = 100;
}
if (vexRT[Btn6D])
{
motor[tread] = -100;
}
if (!vexRT[Btn6U] && !vexRT[Btn6D])
{
motor[tread] = 0;
}
if (vexRT[Btn5U])
{
motor[rightTilt] = 127;
motor[leftTilt] = 127;
}
if (vexRT[Btn5D])
{
motor[rightTilt] = -127;
motor[leftTilt] = -127;
}
if (!vexRT[Btn5U] && !vexRT[Btn5D])
{
motor[rightTilt] = 0;
motor[leftTilt] = 0;
}
motor[rightMotor] = 0;
motor[rightMotor] = vexRT[Ch2];
motor[leftMotor] = 0;
motor[leftMotor] = vexRT[Ch3];
}
}