View Single Post
  #69   Spotlight this post!  
Unread 12-02-2013, 18:33
Bunniy's Avatar
Bunniy Bunniy is offline
The Only Programmer
FRC #3337 (Panthrobotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Baton Rouge
Posts: 37
Bunniy is an unknown quantity at this point
Re: Photosensor as encoder for bang bang.

I'll do my best. Sorry to have been away all day, it's build season and I was mentoring two teams today. Barely had time for lunch and got home an hour ago.

OK, 1 tick per revolution is REALLY LOW, so expect it to yield less than optimal results, though not unmanageable.
I searched the thread, but couldn't find any mention of the motor you are using, nor the wheel type. So, I'm going to make an assumption here that it will be a CIM driven direct drive shooter.

Let's assume you are getting a maximum of 5000 RPM. That means 83.3 RPS. If you gather a count sample 10 times a second, you will only see a maximum of 8.33 counts. So, 8, or 9. Miss just one count and your error is +- 625 RPM.
Therefore, you can only adjust your RPM in 625 RPM steps as well. That is not very much control.

So, that tells us using the period approach should be quite a bit better. With only 1 cycle per revolution, you don't need to worry about inaccuracies in the pulse positioning caused in manufacturing.

So, looking at the example Mark gave in post #2, the "Begin.vi" sets up the timer to average 5 counts. With the "Period" example I gave previously, it reads the samples every 20+ ms. If you use his "Begin.vi" and my Period.vi in your periodic tasks, you would only need to set the average to 2 counts. (Ether pointed out in a PM, there is no need to average with a single count encoder, so leave it at the default of 1.) Now when you feed a value into the control, it needs to be in the form of the period desired.

For example:
3000 RPM = (3000/60) = 50 RPS, therefore the period desired is 1/50 or .02 seconds.


I am having trouble. I am using what you told me but my motor is not getting any value except for 0
__________________
Think Outside The Frame
Reply With Quote