Go to Post Oh yes - and thanks for giving us kids our dreams. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Electrical
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 19-01-2009, 17:09
comwiz7's Avatar
comwiz7 comwiz7 is offline
Registered User
AKA: Joey
FRC #1323 (Madtown Robotics 1323)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Madera
Posts: 66
comwiz7 will become famous soon enoughcomwiz7 will become famous soon enough
Send a message via MSN to comwiz7
Digital I/O Dilemma

We attempted to wire the encoder but have not been able to get any feedback from it using the dashboard.

I split two PWM cables and connected the two power wires to the power wire on the encoder and the same with the ground. I connected the Channel A wire on the encoder to the white wire on one PWM and the Channel B wire to the white wire on the other PWM.

http://farm4.static.flickr.com/3315/...121d52.jpg?v=0

I connected one PWM to Digital I/O 3 and the other to Digital I/O 4.

I initialized it in the programming like this:
Code:
Encoder encoder1;
encoder1(4, 3, 4, 4, 0);
The SLOT 4 spot on the dashboard (picture linked below) sporadically changes colors and I'm not sure if it is even supposed to do that but we can't get any feedback on the ports of the encoder. I'm sure I've done something wrong as I have never worked with an encoder before. However, I can't get it to react to something as simple as a limit switch either.

http://farm4.static.flickr.com/3521/...b122de.jpg?v=0
  #2   Spotlight this post!  
Unread 19-01-2009, 18:26
jee7s jee7s is offline
Texan FIRSTer, ex-frc2789, ex-frc41
AKA: Jeffrey Erickson
FRC #6357
 
Join Date: Nov 2007
Rookie Year: 1997
Location: Dripping Springs, TX
Posts: 313
jee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond repute
Re: Digital I/O Dilemma

Well, I wouldn't be all that surprised by that flickering.

Since your dashboard is updating pretty fast (as fast as you get packets) and the encoder state changes once per 'tick', the value of the encoder ports should change state quickly enough to make the dashboard display a flickering or "both 0 and 1" state on the GPIO port. That's a matter of how slowly your eyes and monitor react.

The information you are really after is the number of ticks that have occurred, which is in the FPGA. To get this value, you first have to set the distance per tick, then call Encoder::GetDistance(). The distance per tick defaults to 1.0, so without modification, Encoder::GetDistance returns number of ticks.

Your call would look like this:
Code:
float dist = encoder1.GetDistance();
Then, to view this on your dashboard, add the distance to the user bytes of the packet, and parse them out in LabVIEW. This takes a bit of inspection, but is possible. Alternately, use dprintf to display the distance, and open a console to the cRIO to monitor the count.

-Jeff Erickson, FRC 41
  #3   Spotlight this post!  
Unread 19-01-2009, 23:22
comwiz7's Avatar
comwiz7 comwiz7 is offline
Registered User
AKA: Joey
FRC #1323 (Madtown Robotics 1323)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Madera
Posts: 66
comwiz7 will become famous soon enoughcomwiz7 will become famous soon enough
Send a message via MSN to comwiz7
Re: Digital I/O Dilemma

Quote:
Well, I wouldn't be all that surprised by that flickering.
It would make sense for the inputs of the encoders to flicker, but every single input flickers, even if nothing is plugged into it. It is seemingly random. I couldn't even get a limit switch to work properly.

I added this line of code to the teleoperated loop:
Code:
dashboard.Printf("Distance: %f\n", encoder1.GetDistance());
On the dashboard it always says "Distance: 0.0000000" no matter what I do with the encoder.
  #4   Spotlight this post!  
Unread 20-01-2009, 08:01
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,076
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Digital I/O Dilemma

The initialization code you posted will not work.

Either do:

Code:
Encoder encoder1(4, 3, 4, 4, 0);
or do:

Code:
Encoder *encoder1;
encoder1 = new Encoder(4, 3, 4, 4, 0);
  #5   Spotlight this post!  
Unread 20-01-2009, 08:18
Woodie Flowers Award
JDNovak JDNovak is offline
Mentor
AKA: John Novak
FRC #0016 (Bomb Squad)
Team Role: Engineer
 
Join Date: Jan 2005
Rookie Year: 1996
Location: Mountain Home, AR
Posts: 52
JDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond reputeJDNovak has a reputation beyond repute
Post Re: Digital I/O Dilemma

Be sure to start the encoder or it won't count. I spent an hour remembering this last night. . .

Encoder1->Start();

I test them by getting the value and printing to the console.

signed mouseXPosition = Encoder1->Get();

printf("MouseX %d\r\n", mouseXPosition);

You can view the console output by right right clicking on the connection to the cRIO and selecting Target Tools / Target Console. This will display all printed data until a reboot.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bumper Dilemma IndySam Rules/Strategy 11 18-01-2007 16:47
07 Kit Wheel Bearings Dilemma sonofdad123 Kit & Additional Hardware 12 16-01-2007 23:03
Fundraising dilemma Temp Fundraising 13 20-03-2006 10:39
Digital Caliper as a Digital Readout on Small Mill sanddrag Technical Discussion 9 13-10-2005 22:51
FIRST 2002: Prisoner's Dilemma archiver 2001 1 24-06-2002 04:00


All times are GMT -5. The time now is 09:35.

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