Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Help with shooter angle closed loop (http://www.chiefdelphi.com/forums/showthread.php?t=115175)

Rodney 19-03-2013 08:20

Help with shooter angle closed loop
 
1 Attachment(s)
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.

androb4 19-03-2013 09:53

Re: Help with shooter angle closed loop
 
I would just try using PD


All times are GMT -5. The time now is 12:50.

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