In-Built RobotC PID for Flywheels

Hi,

I am a member of the 14X Robotics Team and we are trying to use the in-built PID feature that comes with RobotC. We are trying to use the PID to control the speed of the flywheels. When the wheels start up, they go to the correct speed. However, if we do not launch a ball for about 2 to 3 seconds, it decreases speed. We are estimating that it decreases to about half speed. Once we launch a ball, it jolts back up for a few seconds and then goes back down. This pattern consistently continues. I would appreciate if anyone has any ideas for how to stop the speed from decreasing.

That sounds like unusual behavior, perhaps you could post the code so we can understand how your flywheel is being controlled.

	
#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, I2C_1,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign )
#pragma config(Sensor, I2C_2,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign )
#pragma config(Motor,  port1,           rightshooter1, tmotorVex393HighSpeed_HBridge, openLoop)
#pragma config(Motor,  port2,           rightshooter2, tmotorVex393HighSpeed_MC29, PIDControl, encoderPort, I2C_1)
#pragma config(Motor,  port9,           leftshooter2,  tmotorVex393HighSpeed_MC29, PIDControl, reversed, encoderPort, I2C_2)
#pragma config(Motor,  port10,          leftshooter1,  tmotorVex393HighSpeed_HBridge, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

slaveMotor(rightshooter1, rightshooter2);
	slaveMotor(leftshooter1, leftshooter2);

		int shooterspeed;
		float shooterfactor;

		if(vexRT[Btn8RXmtr2] ==1) {
			shooterspeed = shooterfactor;
			shooterfactor += .005;
			if (shooterfactor > 70) {
				shooterspeed = 71;
			}
			motor[rightshooter1] = motor[leftshooter1] = shooterspeed;
			motor[leftshooter2] = motor[rightshooter2] = shooterspeed;
		}

		else if(vexRT[Btn8UXmtr2] ==1) {
			shooterspeed = shooterfactor;
			shooterfactor += .01;
			if (shooterfactor > 50) {
				shooterspeed = 51;
			}
			motor[rightshooter1] = motor[leftshooter1] = shooterspeed;
			motor[leftshooter2] = motor[rightshooter2] = shooterspeed;
		}

		else if(vexRT[Btn8LXmtr2] ==1) {
			shooterspeed = shooterfactor;
			shooterfactor += .01;
			if (shooterfactor > 44) {
				shooterspeed = 45;
			}
			motor[rightshooter1] = motor[leftshooter1] = shooterspeed;
			motor[leftshooter2] = motor[rightshooter2] = shooterspeed;
		}

		else if(vexRT[Btn8DXmtr2] == 1) {

			shooterspeed = shooterfactor;
			shooterfactor += .01;
			if (shooterfactor > 29) {
				shooterspeed = 30;
			}

			motor[rightshooter1] = motor[leftshooter1] = shooterspeed;
			motor[leftshooter2] = motor[rightshooter2] = shooterspeed;
		}


		else {
			shooterfactor = 0;
			motor[rightshooter1] = motor[leftshooter1] = 0;
			motor[rightshooter2] = motor[leftshooter2] = 0;
		}
	}
}

Hi,

I am the programmer for the 14X Robotics Team and what I just posted is our code.