Quote:
Originally Posted by ThaddeusMaximus
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