Go to Post This year it is what it is and, at some point, we will all find out what that is, specifically. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #61   Spotlight this post!  
Unread 11-02-2013, 18:48
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.

Quote:
Originally Posted by Ether View Post
To understand why, you have to do the math.

Using the "period" method, like Mark posted earlier in this thread, the FPGA samples the sensor at 153KHz and records the elapsed time between pulses with a 1MHz clock. For a one-per-rev sensor (like yours) on a wheel spinning at, say, 2000 rpm, that gives you a very accurate and hi resolution signal. See attachment.

The "count" method is very accurate for high speeds with high counts-per-rev sensors like a 360CP encoder. But for a one-per-rev sensor like yours, it's not very good. At a wheel speed of 2000 rpm and sampling every 20ms, you don't get enough counts to accurately determine what the speed is. Sometimes you'll get 1 count, and sometimes you'll get *no* counts. You can't convert that into a useable speed signal.
See attachment.


Do you have a good method to use the period method with desired rpm
__________________
Think Outside The Frame
Reply With Quote
  #62   Spotlight this post!  
Unread 11-02-2013, 18:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,128
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: Photosensor as encoder for bang bang.

Quote:
Originally Posted by Bunniy View Post
Do you have a good method to use the period method with desired rpm
I would recommend the method suggested in posts 17, 25, 26, 53, 58, and 60. Hopefully Mark can help you with the details. I am not a LabVIEW guru.

The only thing I'd change in what Mark posted is to set the FPGA samples to "1" instead of "5" for a one-per-rev sensor.




Last edited by Ether : 11-02-2013 at 18:56.
Reply With Quote
  #63   Spotlight this post!  
Unread 11-02-2013, 19:16
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.

Quote:
Originally Posted by Ether View Post
I would recommend the method suggested in posts 17, 25, 26, 53, 58, and 60. Hopefully Mark can help you with the details. I am not a LabVIEW guru.

The only thing I'd change in what Mark posted is to set the FPGA samples to "1" instead of "5" for a one-per-rev sensor.



Its just that i have tried multiple times and i really want someone to tell me how the entire periodic task and begin should look. Considering im using a photosensor and only one tick per rev. Because i just want to get my wheel to be at a certain rpm with a push of a button and i have been trying to do this for 5 days now and no luck.
__________________
Think Outside The Frame

Last edited by Bunniy : 11-02-2013 at 19:26.
Reply With Quote
  #64   Spotlight this post!  
Unread 11-02-2013, 19:45
MysterE's Avatar
MysterE MysterE is offline
FRC Team #3337
AKA: Coach Eiland
FRC #3337 (Panthrobotics)
Team Role: Coach
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Baton Rouge
Posts: 510
MysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond repute
Send a message via AIM to MysterE
Re: Photosensor as encoder for bang bang.

Hi everyone,

I just wanted to say thank you for all of the help that you all have been giving our programmer. He is working solo on this and is learning much of it without local support. We are slowly making progress and appreciate all of your efforts.
__________________
Coach. D. Eiland
Head Coach - Team #3337
Panthrobotics (Woodlawn HS)
2016: Bayou Regional WFFA Winner
2016: Rocket City Regional Judges Award
2015: Bayou Spirit Award, Bayou Chairman's Award, Bayou Dean's List Finalist (Danielle Massey), Bayou Volunteer of the Year Award
2014: Bayou Dean's List Finalist (Witni Widmeier)
2011: Bayou Regional Winner | Judges Award
2010: Rookie Inspiration Award
Reply With Quote
  #65   Spotlight this post!  
Unread 11-02-2013, 20:54
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.

Quote:
Originally Posted by billbo911 View Post
When I first saw the code I was surprised at how familiar it looked, then I realized, I posted it last year.

Mark, would replacing the "Reset Counter" with a feedback loop and subtracting the previous count from the current count be a more stable option?

Both the IIR filter and the slew rate limiter were placed in this code as ways to compensate for other issues.

The slew rate limiter really is only needed when using a Jaguar. The current limiting circuit in the Jag can trip if the start up current is too high. If using a Talon or Victor, this entire block of code can be bypassed or completely removed.

Honestly, the IIR filter shouldn't be used. It introduces lag into the control. I put it in there as a way to smooth out the RPM signal. I believe the main reason the signal was noisy was due to the use of a "wait" loop instead of a timed loop in the original version. In addition, we were using "Get Rate" in the original version. "Get Rate" is an instantaneous measurement that is inherently noisy. This version uses a count divided by time to determine RPM, which is a much cleaner approach. This filter can be bypassed by setting the filter strength to "0", or just deleting that section of code.

The "360" is the number of ticks per revolution of the encoder it was designed to be used with. If the encoder is just a couple of lines on a wheel and an optical sensor, the this value needs to reflect the number of lines.

Bang-Bang is a simple control system. A comparison of the current RPM to the desired RPM. If the current is at or above the desired value, then turn off the motor. If it is below, turn the motor on at full power. Anything else in the loop just clutters the process.
Question can you tell me or show me a code which uses a photosensor with a bang bang when it only has one tick per revolution
__________________
Think Outside The Frame
Reply With Quote
  #66   Spotlight this post!  
Unread 12-02-2013, 01:43
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,387
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Photosensor as encoder for bang bang.

Quote:
Originally Posted by Bunniy View Post
Question can you tell me or show me a code which uses a photosensor with a bang bang when it only has one tick per revolution
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.

Below is a picture of the "Period" control.
Attached Thumbnails
Click image for larger version

Name:	Bang-Bang period.jpg
Views:	35
Size:	84.7 KB
ID:	13951  
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist

Last edited by billbo911 : 12-02-2013 at 09:31. Reason: Bad math. Thanks Ether.
Reply With Quote
  #67   Spotlight this post!  
Unread 12-02-2013, 18:27
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 do have the mini cim attached directly to the wheel. I am using a wheel like this http://www.andymark.com/product-p/am-0970.htm

Now i was able to make a small part of the wheel white so the photosensor has something to recognize. My question is how big should the mark actually be on the wheel for the photosensor to recognize it in a well fashioned time?
__________________
Think Outside The Frame
Reply With Quote
  #68   Spotlight this post!  
Unread 12-02-2013, 18:30
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,128
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: Photosensor as encoder for bang bang.

Quote:
Originally Posted by Bunniy View Post
I do have the mini cim attached directly to the wheel. I am using a wheel like this http://www.andymark.com/product-p/am-0970.htm

Now i was able to make a small part of the wheel white so the photosensor has something to recognize. My question is how big should the mark actually be on the wheel for the photosensor to recognize it in a well fashioned time?
Please post a picture of the wheel showing the white mark. The shape and sharpness of the mark is important.


Reply With Quote
  #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
  #70   Spotlight this post!  
Unread 12-02-2013, 18:47
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.

Quote:
Originally Posted by Ether View Post
Please post a picture of the wheel showing the white mark. The shape and sharpness of the mark is important.


Here is what it mainly looks like but with tape. i cant get the angle wuth the way our shootter is
Attached Thumbnails
Click image for larger version

Name:	IMG_0014ooga.jpg
Views:	15
Size:	67.8 KB
ID:	13957  
__________________
Think Outside The Frame
Reply With Quote
  #71   Spotlight this post!  
Unread 12-02-2013, 20:08
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,128
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: Photosensor as encoder for bang bang.

Quote:
Originally Posted by Bunniy View Post
I am using what you told me
Did you read the post very carefully? Specifically, did you follow these instructions:
Quote:
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

Reply With Quote
  #72   Spotlight this post!  
Unread 12-02-2013, 20:43
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.

Quote:
Originally Posted by Ether View Post
Did you read the post very carefully? Specifically, did you follow these instructions:



yes so i should set the number of samples to average as 1 with a 1 tick per revolution
__________________
Think Outside The Frame
Reply With Quote
  #73   Spotlight this post!  
Unread 12-02-2013, 20:56
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,128
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: Photosensor as encoder for bang bang.

Quote:
Originally Posted by Bunniy View Post
yes
Post your code.


Reply With Quote
  #74   Spotlight this post!  
Unread 12-02-2013, 22:45
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.

OMG i finally got it. The encoder reset was my problem. Everything works Perfectly. Thank you everyone
__________________
Think Outside The Frame
Reply With Quote
  #75   Spotlight this post!  
Unread 12-02-2013, 23:51
MysterE's Avatar
MysterE MysterE is offline
FRC Team #3337
AKA: Coach Eiland
FRC #3337 (Panthrobotics)
Team Role: Coach
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Baton Rouge
Posts: 510
MysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond reputeMysterE has a reputation beyond repute
Send a message via AIM to MysterE
Re: Photosensor as encoder for bang bang.

Nothing better than watching a student finally 'getting it'. Thanks, Ether, Billbo, and anyone else for their help.

Gotta love CD.
__________________
Coach. D. Eiland
Head Coach - Team #3337
Panthrobotics (Woodlawn HS)
2016: Bayou Regional WFFA Winner
2016: Rocket City Regional Judges Award
2015: Bayou Spirit Award, Bayou Chairman's Award, Bayou Dean's List Finalist (Danielle Massey), Bayou Volunteer of the Year Award
2014: Bayou Dean's List Finalist (Witni Widmeier)
2011: Bayou Regional Winner | Judges Award
2010: Rookie Inspiration Award
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 05:02.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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