Help with shooter angle closed loop

My team has been having a little difficulty with the accuracy of our shooter angle.

Our shooter angle has a bit of a knock back when we fire a disk, and just the ‘P’ loop was not enough to move the shooter that couple degrees back to position. I tried getting a ‘PI’ loop and now the slightest of bump will cause our angle to go unstable.



float bias = 1.1932;         
float brads = 0;
float cop2axis = (copjoy.GetRawAxis(2));  //this is the co-pilot joystick that is controlling the angle.

if (ds->GetDigitalIn(7) == true) {
	if (cop2axis > 0.15){
		potsetpoint = potsetpoint + .0001;
		last = true;
		randomtimer.Start();
	}
	if (cop2axis < -0.15){
		potsetpoint = potsetpoint - .0001;
		last = true;
		randomtimer.Start();
	}
	if (randomtimer.Get() >= 0.1){
		last = false;
		randomtimer.Stop();
	}
	
	float potdiff = (abs(potsetpoint - anglepot.GetVoltage()));
				
	brads = (anglepot.GetVoltage()*50);
	if (potdiff <=.02000){
				
	bias = ((bias * cos(brads))/128);
	potset = potset + bias;
			
	}else {
	if (potsetpoint < anglepot.GetVoltage()){
		potset = ((potsetpoint-anglepot.GetVoltage())*3.5);
	}
	if (potsetpoint > anglepot.GetVoltage()){
	potset = ((potsetpoint-anglepot.GetVoltage())*4);
	}
        }
		if (potset>=1){
			potset= 1;
		}
		if (potset<=-1){
			potset= -1;
		}
		angle.Set(potset*-1);

also, my code was adapted from the attached pdf file.

If I’m missing any info, please post below.

Feedback_controls_1 Jim Zondag.pdf (248 KB)


Feedback_controls_1 Jim Zondag.pdf (248 KB)

I would just try using PD