View Single Post
  #2   Spotlight this post!  
Unread 13-01-2013, 17:39
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Velocity PID for Frisbee shooter

Quote:
Originally Posted by team3039 View Post
Okay so this year, we're going to try to incorporate a PID loop to ensure that our shooter is spinning at the speed we want it to with little tolerance.

We're using a photoelectric sensor as a gear tooth counter, to calculate the RPM the shooter wheel is spinning. how can we convert this to %?

I've looked at the Velocity PID vi from The Fighting Pi (http://www.fightingpi.org/Resources/Controls.shtml), but I have no idea how to tune the PID loop, or how to integrate it in our system. Some help would be appreciated.
The first thing you need to do is make sure your desired controlled wheel speed (the "setpoint") occurs at a motor voltage sufficiently less than the lowest sustained voltage you expect the battery to drop to while you're spinning the shooter wheel. Otherwise, your controller won't have the necessary oomph to get to the setpoint.

Since the accuracy of control is only as good as the accuracy of your speed sensor reading (the "process variable"), you need to consider how you are going to measure speed.

Are you going to count the gear teeth and then divide by the elapsed time? If so, your speed accuracy percent is limited to +/- one tooth count divided by the number of counts. So you need a lot of counts to get good accuracy. Do the math and determine what this accuracy is, and if it is acceptable. Also, how are you going to get elapsed time? Are you going to assume that your 10 ms loop runs precisely at 10ms? If so, and you are using LabVIEW, you better be using a LabVIEW "timed loop" and not a "wait". Or you could read the actual elapsed time instead of assuming it is a fixed value.

Or perhaps you are going to let the FPGA measure the elapsed time between gear tooth detections (using a microsecond timer). If so, the percent speed accuracy will be no better than the accuracy of the gear tooth spacings divided by the nominal spacing.

If you are running your control loop at 10ms, and your sensor is capable of providing an updated speed at this rate, and your shooter wheel has sufficient inertia, there's a good chance that a simple bang-bang controller will provide the necessary speed control. In a nutshell, a bang-bang controller works like this. If using this type of control, make sure your motor controller is set for coast, not brake.

As for your question about converting raw sensor values to speed:

- if you are dividing counts by elapsed time, then the speed is given by

rpm = counts/numberOfTeethOnGear/elapsedTimeInSeconds*60

- if your are measuring the elapsed time between counts, then the speed is given by

rpm = 1/numberOfTeethOnGear/elapsedTimeInSeconds*60


Reply With Quote