Robot wigging out!

We have spent the last few days debugging our driver control program. We finally have what we want working then we disconnect from the computer and try to practice with it disconnected. We turn the cortex on and then all the motors are turned on, vexnet is not connected and the only way to get the robot back is to install the firmware again and redownload the program. Works fine connected to the computer, then try it again and it wigs out once again. I am at a loss of what to do to fix this. I’m 99% sure it is not the program. I attached the program anyways.

 
#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, I2C_1,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Sensor, I2C_2,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Sensor, I2C_3,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Sensor, I2C_4,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Motor,  port1,           leftMotor1,    tmotorVex393HighSpeed_HBridge, openLoop, reversed, encoderPort, I2C_1)
#pragma config(Motor,  port2,           leftMotor2n3,  tmotorVex393HighSpeed_MC29, openLoop, reversed)
#pragma config(Motor,  port3,           lowIntake,     tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port4,           highIntake,    tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port5,           shooterMotor1, tmotorVex393_MC29, openLoop, encoderPort, I2C_4)
#pragma config(Motor,  port6,           shooterMotor2, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           shooterMotor3, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port8,           distanceControlMotor, tmotorVex269_MC29, PIDControl, reversed, encoderPort, I2C_3)
#pragma config(Motor,  port9,           rightMotor2n3, tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor,  port10,          rightMotor1,   tmotorVex393HighSpeed_HBridge, openLoop, encoderPort, I2C_2)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*
motor port 1 - left drive motor 1 - with IME connected to I2C port on microcontroller
motor port 2 - left drive motor 2 split with left drive motor 3(middle gear wire reversed)
motor port 3 - low intake motor
motor port 4 - high intake motor
motor port 5 - to port A on power expander - shooter motor 1 - with IME connected to distanc eControlMotor IME
motor port 6 - to port B on power expander - shooter motor 2
motor port 7 - to port C on power expander - shooter motor 3
motor port 8 - to port D on power expander - distance control motor - with IME connected to rightMotor1 IME
motor port 9 - right drive motor 2 split with right drive motor 3(middle gear wire reversed)
motor port 10 - right drive motor 1 - with IME connected to leftMotor1 IME
*/
int home = 1;
int zone1 = 0;
int zone2 = 0;
int zone3 = 0;
int count = 0;

task powerPresetDistance()
{

	slaveMotor(port2, port1); //motors in port 2 will follow port 1
	slaveMotor(port9, port10);//motors in port 9 will follow port 10
	slaveMotor(port6, port5);//motors in port 6 will follow port 5
	slaveMotor(port7, port5);//motors in port 7 will also follow port 5

	resetMotorEncoder(distanceControlMotor);

	while(1)
	{
		if(vexRT[Btn8LXmtr2] == 1) //home
		{
			home = 1;
			zone1 = 0;
			zone2 = 0;
			zone3 = 0;
			count = 0;
		}
		if(vexRT[Btn8UXmtr2] == 1)//zone 1
		{
			home = 0;
			zone1 = 1;
			zone2 = 0;
			zone3 = 0;
			count = 2000; //needs changed
		}
		if(vexRT[Btn8RXmtr2] == 1)//zone 2
		{
			home = 0;
			zone1 = 0;
			zone2 = 1;
			zone3 = 0;
			count = 1250; //needs changed
		}
		if(vexRT[Btn8DXmtr2] == 1)//zone 3
		{
			home = 0;
			zone1 = 0;
			zone2 = 0;
			zone3 = 1; 
			count = 500; //needs changed
		}
		if(home == 1 && getMotorEncoder(distanceControlMotor) > count) //power to hgetMotorEncoder(distanceControlMotor) > countome position
		{
			home = 0;
			while(getMotorEncoder(distanceControlMotor) > count)
			{
				motor[distanceControlMotor] = 63;
			}
			motor[distanceControlMotor] = 0;
		}

		if(zone1 == 1 && getMotorEncoder(distanceControlMotor) < count)//power to zone1 position
		{
			zone1 = 0;
			while(getMotorEncoder(distanceControlMotor) < count)
			{
				motor[distanceControlMotor] = -63;
			}
			motor[distanceControlMotor] = 0;
		}

		if(zone1 == 1 && getMotorEncoder(distanceControlMotor) > count)//power to zone1 position
		{
			zone1 = 0;
			while(getMotorEncoder(distanceControlMotor) > count)
			{
				motor[distanceControlMotor] = 63;
			}
			motor[distanceControlMotor] = 0;
		}
		if(zone2 == 1 && getMotorEncoder(distanceControlMotor) < count)//power to zone2 position
		{
			zone2 = 0;
			while(getMotorEncoder(distanceControlMotor) < count)
			{
				motor[distanceControlMotor] = -63;
			}
			motor[distanceControlMotor] = 0;
		}
		if(zone2 == 1 && getMotorEncoder(distanceControlMotor) > count)//power to zone2 position
		{
			zone2 = 0;
			while(getMotorEncoder(distanceControlMotor) > count)
			{
				motor[distanceControlMotor] = 63;
			}
			motor[distanceControlMotor] = 0;
		}
		if(zone3 == 1 && getMotorEncoder(distanceControlMotor) < count)//power to zone2 position
		{
			zone3 = 0;
			while(getMotorEncoder(distanceControlMotor) < count)
			{
				motor[distanceControlMotor] = -63;
			}
			motor[distanceControlMotor] = 0;
		}
		if(zone3 == 1 && getMotorEncoder(distanceControlMotor) > count)//power to zone2 position
		{
			zone3 = 0;
			while(getMotorEncoder(distanceControlMotor) > count)
			{
				motor[distanceControlMotor] = 63;
			}
			motor[distanceControlMotor] = 0;
		}



	}
}


task main()
{

	slaveMotor(port2, port1); //motors in port 2 will follow port 1
	slaveMotor(port9, port10);//motors in port 9 will follow port 10
	slaveMotor(port6, port5);//motors in port 6 will follow port 5
	slaveMotor(port7, port5);//motors in port 7 will also follow port 5

	startTask(powerPresetDistance);

	float speedController = 1;
	while(1 == 1)
	{
		//drivetrain control 	                  -------------------------------
		motor[leftMotor1] = vexRT[Ch3]*speedController;
		motor[rightMotor1] = vexRT[Ch2]*speedController;

		//intake control                       --------------------------------
		if(vexRT[Btn5UXmtr2] == 1)
		{
			motor[lowIntake] = 127;
			motor[highIntake] = 127;
		}
		else if(vexRT[Btn5DXmtr2] == 1)
		{
			motor[lowIntake] = -127;
			motor[highIntake] = -127;
		}
		else
		{
			motor[lowIntake] = 0;
			motor[highIntake] = 0;
		}

		//shooter control                       ------------------------------------
		if(vexRT[Btn6UXmtr2] == 1)
		{
			motor[shooterMotor1] = 127;
		}
		else
		{
			motor[shooterMotor1] = 0;
		}

		//shooter power                          ------------------------------------
		//if(vexRT[Btn7U] == 1)
		//{
		//	motor[distanceControlMotor] = 127;
		//}
		//else if(vexRT[Btn7D] == 1)
		//{
		//	motor[distanceControlMotor] = -127;
		//}
		//else
		//{
		//	motor[distanceControlMotor] = 0;
		//}



		//controls drivetrain max power            ----------------------------------
		if(vexRT[Btn6U] == 1)
		{
			speedController = 1;
		}
		if(vexRT[Btn6D] == 1)
		{
			speedController = .5;
		}

	}


}


Wigs out how? Drives by itself at random? Won’t connect at all?

Have you tried a very simple program? Just the joystick to the drive motors?

It is good practice to put in a wait of a few milliseconds at the end of your loop to help with the task management so each task goes through like you want.

Does setting slaveMotor in both the task and main mess things up? I have not used that function before. I doubt it is causing issues but you never know…

I figured it out. The master firmware on robotc was bad for some reason. I downloaded the firmware upgrade utility and only load the master firmware from there, then only downloaded the robotc firmware. Is the master firmware from robotc 4.50 bad for everyone?

Master firmware included with V4.50 is fine.