Go to Post a Victor is a Victor is a Victor. - Billfred [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-02-2011, 12:46
mbone206 mbone206 is offline
Registered User
FRC #0223
 
Join Date: Jan 2009
Location: New Jersey
Posts: 59
mbone206 is an unknown quantity at this point
Light sensor as shaft encoder too fast for Lab View Code?

Please help, I am a relatively new mentor, minimum experience with LABView and sensors

My team is using a fisher Price motor, connected to 5/8 inch shaft to operate an extension arm.
Extension Arm is a tube inside tube type design, they indicated they can not put limit switches to
determine if at the required extension length. They put approx 1/8 inch reflective tape on shaft and
are using Banker? QS18V6LV light sensor.

They are using LAB view. The sensor is connected the digital side card. The motor and sensor digitial input is assigned / ref num in Begin. In Teleop, the digital input refnum is wired to the digital get VI. We are using a counter, every time Digital input goes low, set low Boolean flag, when goes hi, if Boolean low flag set, increment counter then set flag to high (only add when sensor went low then high). We manually turned motor sensor/counter code worked fine. When ran motor at full speed, counter did not work. When we slow the motor down, counter worked.

At this point, we commented out the counter code and only put a Boolean LED on teleop front panel to blink every time shaft tape pass sensor. Note: Mainly the only code left is the Robot Main Code, I wanted to minimize user code being caught in any loops as possible problem. When slow, Boolean LED blink fine, correlated with the sensor LED blinking. When increase motor speed, Boolean LED looks like it would skip some flashes, but LED on sensor looked OK, did not skip. It is acting like the motor speed is going too fast for LABView to detect the sensor properly. I am surprised how slow we had to go to get it to work.

I am at a loss of how to help this team if the code can not keep up with the speed of the motor/light sensor.

Any ideals what problem is? Did any one face this problem before?

If there are any other ideals of how to keep track of this type of extension arm (they are using three extension lengths, default fully retracted, extension length 1 (middle pegs) and extension length 2 (highest pegs)) I will also like to disable motor if students trying to retract while arm fully retracted and disable motors if student tries to extend when max extension required is met. I was hoping if the counter worked and correlated to extension are, I can do this in the code. FYI: They are going to use a POT for arm angle, did not get that far.

Thanx for support

Mark
  #2   Spotlight this post!  
Unread 14-02-2011, 12:53
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Light sensor as shaft encoder too fast for Lab View Code?

There's a reason why you have an LabVIEW Encoder block. If I remember correctly, most of the robot code only gets executed every 40ms. If your sensor goes through a transition state during those 40ms, then it won't be counted.

Now I haven't looked under the cover for the encoder VI, but I would have to imagine it is using some sort of an interrupt, or is polling that digital input very quickly.

You may want to take a look at the encoder block under sensors in the WPI library. If you want to make your own, place a very quick (5ms or less) while or timed loop in your Period Tasks VI.


Do what Alan said below. I believe that will work better than what I recommended.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 14-02-2011 at 13:03.
  #3   Spotlight this post!  
Unread 14-02-2011, 12:59
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Light sensor as shaft encoder too fast for Lab View Code?

Use a built-in counter function in the WPI library. It uses the cRIO's hardware support to watch the input signal fast enough for anything you might want to throw at it. In your code, you can look to see when the counter changes value.
  #4   Spotlight this post!  
Unread 14-02-2011, 17:41
mbone206 mbone206 is offline
Registered User
FRC #0223
 
Join Date: Jan 2009
Location: New Jersey
Posts: 59
mbone206 is an unknown quantity at this point
Re: Light sensor as shaft encoder too fast for Lab View Code?

Thank You Allan, I will give it a try
  #5   Spotlight this post!  
Unread 14-02-2011, 21:10
Speeder Speeder is offline
Registered User
AKA: Mr. Don
FRC #0316 (LuNaTeCs)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Salem County, NJ
Posts: 46
Speeder will become famous soon enough
Re: Light sensor as shaft encoder too fast for Lab View Code?

Quote:
At this point, we commented out the counter code and only put a Boolean LED on teleop front panel to blink every time shaft tape pass sensor. Note: Mainly the only code left is the Robot Main Code, I wanted to minimize user code being caught in any loops as possible problem. When slow, Boolean LED blink fine, correlated with the sensor LED blinking. When increase motor speed, Boolean LED looks like it would skip some flashes, but LED on sensor looked OK, did not skip. It is acting like the motor speed is going too fast for LABView to detect the sensor properly. I am surprised how slow we had to go to get it to work.
Try putting an indicator (numeric), either in your .vi or on the dashboard. Watch the indicator to see it count up/down. You'll probably see the sensor is working fine. There is a tremendous lag between the cRio and the Classmate display. The LED cannot possibly display accurately anything other than a very slow pulse but the numeric indicator, when the screen refreshes, will show actual counts.

Don
  #6   Spotlight this post!  
Unread 14-02-2011, 21:17
BornaE's Avatar
BornaE BornaE is offline
Registered User
FRC #0842 (Formerly 39)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Gilbert, Arizona
Posts: 359
BornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant future
Re: Light sensor as shaft encoder too fast for Lab View Code?

Quote:
Originally Posted by Speeder View Post
Try putting an indicator (numeric), either in your .vi or on the dashboard. Watch the indicator to see it count up/down. You'll probably see the sensor is working fine. There is a tremendous lag between the cRio and the Classmate display. The LED cannot possibly display accurately anything other than a very slow pulse but the numeric indicator, when the screen refreshes, will show actual counts.

Don
Your information is inaccurate.

The led shows the information that it can process.
depending on the loop rate(usually maximum 100hz) you can only measure up to 50Hz which is 300rpm.
Anything faster will have to be done using the counter vi's as noted before.

Counter vi's direct the fpga to count the number of pulses. The fpga can count as fast as 50 MHz(this is not exact, but it is much much much faster than the processor without using an interrupt).
Then the processor can ask teh fpga for the count every loop and get a number back and act upon that number 100 times a second.
__________________
-Borna Emami
Team 0x27
Closed Thread


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 03:33.

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