Go to Post More teams will want to join, peers who are not on the team will understand the program better, television will become interested in FIRST again, sponsors will be easier to get, cancer will be cured, the Israelis and Palestineians will live in harmony, and we will have world peace. - Andy Baker [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

 
Reply
 
Thread Tools Rate Thread Display Modes
  #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
  #2   Spotlight this post!  
Unread 19-03-2013, 09:53
androb4's Avatar
androb4 androb4 is offline
..is trying to take this year off.
AKA: Andrew A.
no team
Team Role: Alumni
 
Join Date: Feb 2010
Rookie Year: 2003
Location: Houston, TX
Posts: 220
androb4 is a splendid one to beholdandrob4 is a splendid one to beholdandrob4 is a splendid one to beholdandrob4 is a splendid one to beholdandrob4 is a splendid one to beholdandrob4 is a splendid one to beholdandrob4 is a splendid one to behold
Re: Help with shooter angle closed loop

I would just try using PD
__________________
FRC 441 Mentor 2012-2015
FRC 441 Alumni 2009-2012
FTC 4673 Alumni 2011-2012
FRC 1484 Alumni 2006-2008

Reply With Quote
Reply


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 12:50.

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