View Single Post
  #5   Spotlight this post!  
Unread 05-07-2016, 14:04
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 216
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: Good way to bring shooter to exact speed?

Quote:
Originally Posted by ThaddeusMaximus View Post
I've a terrible memory. As a wise Shia LaBeouf said, "Just Do It": Make sure there's no safety hazards with the shooter running at full blast and try something

I could be wrong but with at 15000 PPR encoder and 5000 RPM, we were using a H0 somewhere in the thousands...
Is this generally how you would do it?
Code:
            #define self.last up top
            ....

            self.difference = 3200 - self.encoder.getRate() #3200 is the target RPM
            self.averageDiff = ((self.last + self.difference)/2)*.0000005 #Finds difference and averages then multiplies gain
            self.totalSpeed+=self.averageDiff #Adds it to the PWM speed
            self.last = self.difference #Gets ready for the next time
            self.speedShooter=self.totalSpeed #Sets the speed
__________________
#Python4Life
Reply With Quote