Go to Post While grandmothers are pretty cool, I would be hesitant in letting them determine what is and is not a robot. - Kellen Hill [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 29-01-2011, 13:35
shoffing's Avatar
shoffing shoffing is offline
WINriver C++
AKA: Steve Hoffing
FRC #1647
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Shamong, New Jersey, America
Posts: 10
shoffing is an unknown quantity at this point
Trackers Returning True All the Time

We have our line trackers correctly calibrated, and the lights change. In our code, we print the value of the trackers to the driver station's user message box. Every time it prints out three 1's, even though the tracker lights are changing. We have all 3 trackers declared correctly, as well as their solenoid counterparts which need to be set to True at the beginning. Can someone provide us with code that will get the values from the trackers and print them to the user message area? Our trackers are called trackerL, trackerM, and trackerR. They are declared as Digital Inputs, and we use pointers to declare them. Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 29-01-2011, 16:07
davidalln's Avatar
davidalln davidalln is offline
World's Worst Coder
AKA: David Allen
FRC #2415 (The Westminster Wiredcats)
Team Role: Programmer
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Atlanta, GA
Posts: 108
davidalln is on a distinguished road
Send a message via AIM to davidalln
Re: Trackers Returning True All the Time

This means that your wiring is wrong. Make sure that the PWMs are created correctly and plugged into the Digital I/O ports on the Sidecar.
__________________
SANTOSH ANDREW DECKER RICK WYNNIE SEAN DEREK MATT
(alamo (semis), p'tree (CHAMPS!), nc (CHAMPS!), newton (quarters))


Best four years of my life. Thanks to everyone who made it happen.
Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2011, 06:57
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Trackers Returning True All the Time

This is where I'd typically use the lamp post technique.

You grab someone on the team and explain why the system should work. If they are knowledgable of electrical and programming, this is a true review of your system. But often, as you are explaining how it works, you will find your own mistake. So, in reality, if an expert isn't around, many times a less experienced member will work, perhaps even an inanimate object such as a lamp post.

In this case, follow the wires from the left sensor back to the breakout. Make sure the breakout has power LEDs on too. Check the channel and area on the breakout make sense. Then follow the cable from the breakout to the cRIO module in slot four.

It may also be useful to remove the sensor and print the digital input signal when it is connected to the ground and to the 5V pin. This will help cut the problem in half -- Is it on this side or that side of this connection?

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 31-01-2011, 13:41
shoffing's Avatar
shoffing shoffing is offline
WINriver C++
AKA: Steve Hoffing
FRC #1647
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Shamong, New Jersey, America
Posts: 10
shoffing is an unknown quantity at this point
Re: Trackers Returning True All the Time

Thanks for the replies, we think we found the problem. We got voltage readings from the trackers and the results were surprising. I'm not 100% sure about the precise voltages, but I think they were giving us something like 0.35 volts when they were on the line, and 0.75 volts when they were off the line. The electrical lead tried to explain why this might be the problem, but it went right over my head. He hooked up a resistor to the simple circuit he had and the voltages then changed to 0.35 when they were on and 18 when they were off. We're hoping that the reason it wasn't working was because there was such a minor difference in voltage between the 2 states.

The one thing that really bugs me (as well as our electrical subteam) is that there wasn't a single bit of documentation stating that we might need a resistor to get the trackers to work. I looked through the programming forum, and from what it looks like we were the only team experiencing this problem. Are any of you guys using a resistor with your trackers? If so, how did you realize that you needed to?

I'll get back to you guys tonight after we see if this fixed it.
__________________
---
Team 1647's Software "thing" for 2011
Death-Spin autonomous mode is my favorite.
Reply With Quote
  #5   Spotlight this post!  
Unread 31-01-2011, 15:39
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Trackers Returning True All the Time

You shouldn't need a resistor unless you wired it incorrectly. The light sensor output is an open-collector. So if you connect it to a digital input channel which is internally pulled-up (i.e. it has a built-in resistor), it should just work.
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 31-01-2011, 16:26
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: Trackers Returning True All the Time

Yeah, no resistor is necessary.

You said you declared them as Digital Inputs. Did you then have them connected to Digital Inputs on the Digital Sidecar? Only the signal wire should be used; the power and ground come from a 20A circuit on the Power Distribution board.

If you didn't connect them to the proper pins (e.g. miswiring them to the Digital Sidecar ground instead of signal), you wouldn't have been able to read their state. A disconnected Digital Input always reads as true.
Reply With Quote
  #7   Spotlight this post!  
Unread 31-01-2011, 18:06
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Re: Trackers Returning True All the Time

Quote:
Originally Posted by Alan Anderson View Post
You said you declared them as Digital Inputs. Did you then have them connected to Digital Inputs on the Digital Sidecar? Only the signal wire should be used; the power and ground come from a 20A circuit on the Power Distribution board.
Don't mean to thread steal, but I have an exact setup here. However, the line tracker flashes true and then stays false.
I have calibrated the sensors already.
Any suggestions?
__________________
Reply With Quote
  #8   Spotlight this post!  
Unread 01-02-2011, 14:57
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Trackers Returning True All the Time

Quote:
Originally Posted by Greg McKaskle View Post
This is where I'd typically use the lamp post technique.

You grab someone on the team and explain why the system should work. If they are knowledgable of electrical and programming, this is a true review of your system. But often, as you are explaining how it works, you will find your own mistake. So, in reality, if an expert isn't around, many times a less experienced member will work, perhaps even an inanimate object such as a lamp post.
Never heard of it as the lamp post technique, I always heard about this as the 'Rubber Duck Debugging' technique. So carry a rubber duck in your pocket.

P.S. In the future, source code of what you're trying to do is welcomed.
Reply With Quote
  #9   Spotlight this post!  
Unread 18-03-2011, 16:14
AlDee AlDee is offline
Registered User
FRC #1099
 
Join Date: Mar 2011
Location: Connecticut
Posts: 31
AlDee is an unknown quantity at this point
Re: Trackers Returning True All the Time

Quote:
Originally Posted by shoffing View Post
Thanks for the replies, we think we found the problem. We got voltage readings from the trackers and the results were surprising. I'm not 100% sure about the precise voltages, but I think they were giving us something like 0.35 volts when they were on the line, and 0.75 volts when they were off the line. The electrical lead tried to explain why this might be the problem, but it went right over my head. He hooked up a resistor to the simple circuit he had and the voltages then changed to 0.35 when they were on and 18 when they were off. We're hoping that the reason it wasn't working was because there was such a minor difference in voltage between the 2 states.

The one thing that really bugs me (as well as our electrical subteam) is that there wasn't a single bit of documentation stating that we might need a resistor to get the trackers to work. I looked through the programming forum, and from what it looks like we were the only team experiencing this problem. Are any of you guys using a resistor with your trackers? If so, how did you realize that you needed to?

I'll get back to you guys tonight after we see if this fixed it.
Sounds like your wiring is off. I will try to explain in simple terms.

The signal output pin of the sensor is a transistor used as a switch which effectively connects the pin to ground. Under normal circumstances, it would require a "pullup" resistor to a positive voltage so that it can pull down to ground when it is activated. (Does that make sense? In Active state it pulls the signal to ground, in off state the resistor would pull the signal to positive.)

As I've learned from poking around this forum, the digital side car doesn't need a pullup because it has this functionality built in. Just connect the signal directly to the signal input on the digital sidecar.

Now the fact that your reading 18V troubles me. I'm guessing you chose to use the 24V supply, and it sounds like your electrical lead chose to tie a pullup to the higher voltage. I'm not sure what the input signal limit is but a high voltage like that might cause damage. If you were going to use a pullup at all, it should be to the 5V, but it's not neccessary.

I agree, the wiring could have been better documented, But here is what I've gathered on the sensor wiring:

The sensors can either be powered by 12 or 24V. If 24, you need to go through a solenoid breakout, supply it from the 24V ouput, and then supply the sensor power through a solenoid output. (requires programming to turn on the sensors) Or you can splice the power lines together and feed them through a 20 amp breaker, just make sure battery voltage doesn't dip below 10.4V.

The signal outputs should each go to a Digital input on the sidecar, no pullup needed. Lastly, check the configuration of the digital inputs on the driver station. They can be configured to run pull-up, pull-down, or floating input. make sure the are set to pull-up.

I tested ours and the readings are .7V when it's on the tape, and 4.0 V when it's on the carpet.

Good Luck!
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 15:07.

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