Go to Post Don't get mad, learn, and get even. - Eric O [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 03-02-2009, 12:00
Mike Mahar Mike Mahar is offline
Registered User
FRC #0138
 
Join Date: Jan 2007
Location: Amherst, NH
Posts: 64
Mike Mahar will become famous soon enough
Trouble Reading Drivers Station Digital Inputs

I'm finding that reading the drivers station digital inputs is unreliable. Our switch panel isn't ready yet so I am tying the signal pin of port 8 directly to the +5 pin. This should avoid the lack of a pull up or pull down problem on the digital inputs.

I'm using the iterativeRobot class. When I call the drivers station method
Code:
value = m_ds->GetDigitalIn(8);
I usually get a one value returned but sometimes I get a zero.

I notice that IterativeRobot class is synchronized to the drivers station packet. But the DriversStation access methods all do a GetData() call. It looks like GetData does a wait for a new packet although the comment says that it doesn't.

Has anyone seen this?
Reply With Quote
  #2   Spotlight this post!  
Unread 03-02-2009, 19:44
Maxpower57's Avatar
Maxpower57 Maxpower57 is offline
Fabuloso
AKA: Maxwell V.
FRC #2574 (RoboHuskie)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: St. Anthony, MN
Posts: 53
Maxpower57 will become famous soon enoughMaxpower57 will become famous soon enough
Send a message via AIM to Maxpower57
Re: Trouble Reading Drivers Station Digital Inputs

Quote:
Originally Posted by Mike Mahar View Post
I'm finding that reading the drivers station digital inputs is unreliable. Our switch panel isn't ready yet so I am tying the signal pin of port 8 directly to the +5 pin. This should avoid the lack of a pull up or pull down problem on the digital inputs.

I'm using the iterativeRobot class. When I call the drivers station method
Code:
value = m_ds->GetDigitalIn(8);
I usually get a one value returned but sometimes I get a zero.

I notice that IterativeRobot class is synchronized to the drivers station packet. But the DriversStation access methods all do a GetData() call. It looks like GetData does a wait for a new packet although the comment says that it doesn't.

Has anyone seen this?
we had this problem too. the problem is that the driverStation reads the switch as a 1 if the signal has a + voltage and a 0 otherwise. which sounds nice except if it is disconnected, it bounces back and forth between 1 and 0 (blame cosmic rays)

the fix is (sort of) easy, though a little unprofessional
attach a ground wire with a 150ohm-ish resistor(thats what we used) to the signal pin, and have the switch connect the positive pin as normal
this wil cause the voltage to always be negative if the switch is disconnected, and when it is connected, mostly positive

you might want to play around with the resistor ohms to get a good mix


hope that helped
__________________

Last edited by Maxpower57 : 03-02-2009 at 19:47.
Reply With Quote
  #3   Spotlight this post!  
Unread 03-02-2009, 21:44
Mike Mahar Mike Mahar is offline
Registered User
FRC #0138
 
Join Date: Jan 2007
Location: Amherst, NH
Posts: 64
Mike Mahar will become famous soon enough
Re: Trouble Reading Drivers Station Digital Inputs

Quote:
Originally Posted by Maxpower57 View Post
we had this problem too. the problem is that the driverStation reads the switch as a 1 if the signal has a + voltage and a 0 otherwise. which sounds nice except if it is disconnected, it bounces back and forth between 1 and 0 (blame cosmic rays)

the fix is (sort of) easy, though a little unprofessional
attach a ground wire with a 150ohm-ish resistor(thats what we used) to the signal pin, and have the switch connect the positive pin as normal
this wil cause the voltage to always be negative if the switch is disconnected, and when it is connected, mostly positive

you might want to play around with the resistor ohms to get a good mix


hope that helped
Alas, this is not the problem. I'm getting the variable results when the signal is tied to +5. Not just when the switch is open. Tying the signal to +5 should always be a 1. I understand the use of a pull-up/pull_down resister and we will use one when we wire up or control panel. Hard wiring the signal to +5 is what we are doing now, however and we're still getting the problem.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-02-2009, 23:37
nathanww nathanww is offline
Hacker
FRC #1678 (Citrus Circuits)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2007
Location: Davis, CA
Posts: 224
nathanww is just really nicenathanww is just really nicenathanww is just really nicenathanww is just really nice
Re: Trouble Reading Drivers Station Digital Inputs

This does seem a LOT like the flaoting value problem some teams have experienced--you might want to do a continuity test and make sure the current is actuall getting through everything

You could also use a purely software approach to the problem, though it's a bit hack-ish. Since this is apparently a rare event, you could design a "buffering" system, where you keep track of not only the bit that you are feeding into your system but also a few before and after it. In other words, with the circuit closed, this would normally look like:

111 1 111

Where the value is the middle was the one you were feeding to anything that needed that value. Obviously with the circuit open, this should look like

000 0 000

But if you have an occasionally occurring 0, this could look like

111 0 111

In this case, it's fairly trivial for the algorithm to "bridge the gap" and change the 0 to a 1. Your millage will vary depending on how often you get a 0, so you'll probably need to figure out what kind of ratio of 1s to 0s you need for your system to work reliably without losing short periods where the circuit is actually open.
__________________
Get yer robot source code here!
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
using digital inputs from the driver station SL8 NI LabVIEW 2 04-02-2009 15:53
Programming Digital Inputs from Driver Station spooncwru Programming 8 01-02-2009 13:14
reading multiple digital inputs angelkat Programming 2 25-01-2009 00:22
Using driver station digital inputs Japper FRC Control System 6 19-01-2009 20:01
Reading NES controller from digital inputs bear24rw Programming 10 07-04-2007 01:17


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

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