Go to Post I know what you mean, but swerve drive is NEVER necessary. - Cory [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 03-19-2013, 08:20 AM
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 : 03-19-2013 at 08:22 AM.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:52 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi