Go to Post Meh, that's nothing a freshman with a drill press and a dremel can't fix... - Chad987 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-10-2011, 03:10 PM
xinchi.he's Avatar
xinchi.he xinchi.he is offline
Registered User
AKA: Xinchi He
FRC #1209
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Tulsa,OK
Posts: 9
xinchi.he is an unknown quantity at this point
Send a message via MSN to xinchi.he
Have problem on getting analog values from lane tracking sensor

Hi everyone. I am new here. Here I met with a problem for sensors. My professor would like to use the analog sensor to receive the brightness of the black and white which means I should get values with a range from 0 to 700 whatever. But I couldn't find the method to access it. Anyone could help??

THXX!!!!!!

************************************************** *************************
We are not using the digital sensor that provided by FIRST, instead we use our analog sensor which should plug to the analog side card. Is there a method that in java that could access to the analog value it returns??

Last edited by xinchi.he : 02-10-2011 at 04:49 PM. Reason: Add information
Reply With Quote
  #2   Spotlight this post!  
Unread 02-10-2011, 04:06 PM
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Have problem on getting analog values from lane tracking sensor

the line tracking sensors as found in the kop are not analog, they are simply digital inputs that return true or false. You can customize the threshold on them, but you can't get more detail unfortunately.
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #3   Spotlight this post!  
Unread 02-10-2011, 04:35 PM
xinchi.he's Avatar
xinchi.he xinchi.he is offline
Registered User
AKA: Xinchi He
FRC #1209
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Tulsa,OK
Posts: 9
xinchi.he is an unknown quantity at this point
Send a message via MSN to xinchi.he
Re: Have problem on getting analog values from lane tracking sensor

Quote:
Originally Posted by byteit101 View Post
the line tracking sensors as found in the kop are not analog, they are simply digital inputs that return true or false. You can customize the threshold on them, but you can't get more detail unfortunately.
Thanks a lot! But we are not using the digital sensor that provided by FIRST, instead we use our analog sensor which should plug to the analog side card. Is there a method that in java that could access to the analog value it returns??

Thanks!!!!
Reply With Quote
  #4   Spotlight this post!  
Unread 02-12-2011, 06:03 AM
michael714's Avatar
michael714 michael714 is offline
Registered User
FRC #3863 (Pantherbotics)
Team Role: Teacher
 
Join Date: Apr 2006
Rookie Year: 2007
Location: Newbury Park, CA
Posts: 46
michael714 is on a distinguished road
Re: Have problem on getting analog values from lane tracking sensor

If you have an analog sensor, just plug it into the one of the analog ports on the analog breakout. If your sensor provides an analog value, you could just use GetAnalogIn() (you can find more in the WPI lib reference or the java docs).

Aside from that, you should really be using the provided line sensors. It looks like there will not be a strong contrast in colors between the line and the carpet. However, the line is reflective and the included line sensors work perfectly even from 6 to 12 inches high!
Reply With Quote
  #5   Spotlight this post!  
Unread 02-12-2011, 09:23 AM
eddie12390's Avatar
eddie12390 eddie12390 is offline
Registered User
AKA: Eddie
FRC #3260 (SHARP)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Pittsburgh
Posts: 285
eddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of light
Re: Have problem on getting analog values from lane tracking sensor

1. Import AnalogChannel

2. Use this is to initialize the sensor:

Code:
AnalogChannel color = new AnalogChannel(channel number);
3. Use this to read the value:

Code:
System.out.println(color.getValue());
That'll probably take a ton of testing to figure out what darkness is what but you'll get there with enough work.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-12-2011, 11:34 AM
DCRich DCRich is offline
Mentor
FRC #2180 (Zero Gravity)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2006
Location: Steinert H.S., Hamilton NJ
Posts: 21
DCRich is an unknown quantity at this point
Re: Have problem on getting analog values from lane tracking sensor

Quote:
Originally Posted by xinchi.he View Post
Hi everyone. I am new here. Here I met with a problem for sensors. My professor would like to use the analog sensor to receive the brightness of the black and white which means I should get values with a range from 0 to 700 whatever. But I couldn't find the method to access it. Anyone could help??

THXX!!!!!!

************************************************** *************************
We are not using the digital sensor that provided by FIRST, instead we use our analog sensor which should plug to the analog side card. Is there a method that in java that could access to the analog value it returns??

Note that the Analog input channels are -10 v to +10 v voltages outside that range will be over-range and may not read correctly.

The default IR sensors put out 1 v low and 12 volt high so they are not true digital signals. If you run 12 v into the GPIO lines it will look digital but it is over the max input value and could cause the line to fail. You should check the voltage and make a divider to drop the signal levels down to the 5 v level required.
Reply With Quote
  #7   Spotlight this post!  
Unread 02-12-2011, 11:45 AM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
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: Have problem on getting analog values from lane tracking sensor

Quote:
Originally Posted by DCRich View Post
The default IR sensors put out 1 v low and 12 volt high so they are not true digital signals.
The default lane-tracking sensors are just NPN switches (hi/lo impedance). They are not intended to source any voltage.

Hook it up as follows:

brown wire to +24volts (solenoid breakout)
blue wire to ground
White wire to a DIO input

The internal pullup on the DIO provides the voltage. The switch just shorts out the voltage (provided by the pullup) to provide the digital hi/lo signal.



Last edited by Ether : 02-12-2011 at 11:57 AM.
Reply With Quote
  #8   Spotlight this post!  
Unread 02-12-2011, 02:38 PM
garyk garyk is offline
Programming Mentor: 668, 972, 2643
FRC #0668 (Apes of Wrath)
Team Role: Mentor
 
Join Date: Dec 2006
Rookie Year: 2005
Location: Santa Clara (Silicon Valley) Calif.
Posts: 87
garyk is a jewel in the roughgaryk is a jewel in the roughgaryk is a jewel in the roughgaryk is a jewel in the rough
Re: Have problem on getting analog values from lane tracking sensor

Quote:
Originally Posted by Ether View Post
The default lane-tracking sensors are just NPN switches (hi/lo impedance). They are not intended to source any voltage.

Hook it up as follows:

brown wire to +24volts (solenoid breakout)
blue wire to ground
White wire to a DIO input

The internal pullup on the DIO provides the voltage. The switch just shorts out the voltage (provided by the pullup) to provide the digital hi/lo signal.

The KOP optical sensors are part number 42EF-D1MNAK-a2. The paper data sheet and the plastic bag in which they come says they require 11 - 30 VDC. We have then running fine on 12V from the power distribution board. There's no reason to hook them to 24V. You should save the 24V for the cRIO and the pneumatic solenoids.
__________________

Silicon Valley Regional 2005, 2006 972
Silicon Valley Regional 2007 668 Xerox Creativity Award
Championship Event 2007 668
Portland Regional 2008 668
Silicon Valley Regional 2008 668, 972
Beta Test Team 2008 668 (with 100 & 254)
Silicon Valley Regional 2009 668 Regional Chairman's Award; 2643
Sacramento Regional 2009 668 Winning Alliance (thanks, 1717 & 2473!), 2010 Winning Alliance 3256
CalGames 2006, 2007, 2008, 2009, 2010, 2011 Field Tech
NorCal FTC Regional 2008, 2009 Inspector
Championship Event 2009
San Diego, Silicon Valley Regionals; Champ. Event 2010 668, 2643, 3256
Silicon Valley, Madera Regional 2012 2643
WRRF Programming Instructor 2006-2015
Regional Woodie Flowers Award 2014 2643 Utah Regional

Reply With Quote
  #9   Spotlight this post!  
Unread 02-12-2011, 02:41 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
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: Have problem on getting analog values from lane tracking sensor

Quote:
Originally Posted by garyk View Post
The KOP optical sensors are part number 42EF-D1MNAK-a2. The paper data sheet and the plastic bag in which they come says they require 11 - 30 VDC. We have then running fine on 12V from the power distribution board. There's no reason to hook them to 24V.
Do a little searching in the forums and you'll see why I said to use 24V.


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 08:26 AM.

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