View Single Post
  #1   Spotlight this post!  
Unread 19-03-2013, 08:20
Rodney's Avatar
Rodney Rodney is offline
Programmer...ish...
FRC #1243 (Swartz Creek Dragons)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Swartz Creek Mi.
Posts: 8
Rodney is an unknown quantity at this point
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.

Code:
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.
Attached Files
File Type: pdf Feedback_controls_1 Jim Zondag.pdf (248.1 KB, 11 views)
__________________
Rodney Dennings
Team #1243 Programmer

Last edited by Rodney : 19-03-2013 at 08:22.
Reply With Quote