Go to Post Playing fields outdoors in the snow and the only field faults were when you ran out of gas!...ahh the old days - ExTexan [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 06-02-2010, 18:25
michael1991j michael1991j is offline
Registered User
FRC #3139
 
Join Date: Feb 2010
Location: oxford alabama
Posts: 6
michael1991j is an unknown quantity at this point
wiring and programing our optical encoders

hello
we are trying to set up our us first optical encoders. unfortunately there is nothing in the manual that I could find on how to do this task. now I have gone though the chief Delphi forum's and found a article that explained how to set up the encoders. from what it said is that I had to hook up our encoder by getting a two three pin cable and wire them like this

ground
power
signal a

then get another cable and put signal b on the other cable on the signal slot


and then plug them into our digital side cars
now if I have this set up right would anybody know happen to know how I would program this in c++. just to have it output the angle.

thank you
  #2   Spotlight this post!  
Unread 06-02-2010, 19:23
Tom Line's Avatar
Tom Line Tom Line is online now
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,535
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: wiring and programing our optical encoders

WPILIB provides an encoder class (I believe) that can be used with the encoders.

It should count in "ticks". Not degrees. So you'll have to find out how many "ticks" are in one revolution of your encoder, and use that to convert to degrees.

In addition, the encoders are not "absolute" encoders. They do not have a zero-position that stays the same. Essentially, every time you fire up your code the zero will be in a different location. So if you are trying to use the encoders for absolute positioning, you either have to buy an absolute positioning encoder, make sure you set your mechanism in the same location every time and then zero it, or use a potentiometer suited to the application.
  #3   Spotlight this post!  
Unread 06-02-2010, 20:13
michael1991j michael1991j is offline
Registered User
FRC #3139
 
Join Date: Feb 2010
Location: oxford alabama
Posts: 6
michael1991j is an unknown quantity at this point
Re: wiring and programing our optical encoders

does my wiring look correct i do not know
  #4   Spotlight this post!  
Unread 06-02-2010, 20:41
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: wiring and programing our optical encoders

Yes it does.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #5   Spotlight this post!  
Unread 06-02-2010, 23:24
michael1991j michael1991j is offline
Registered User
FRC #3139
 
Join Date: Feb 2010
Location: oxford alabama
Posts: 6
michael1991j is an unknown quantity at this point
Re: wiring and programing our optical encoders

hmm i wonder if it is somthing am doing wrong then

this is how i stated my code:

I state this inside my main class
Encoder encoder(1, 2, true);

and then in my teleop loop
I say
float tick = encoder.GetDistance() ;

printf("tick:%4.2f /n",tick );

and what i am getting is

tick:
tick:
tick:
.... and when I move my gear box i get no input
now i did noticed there is a spot for a jumper on the digital side car on the digital input sides do i need to put a jumper in there. the probem when i do that everything become nonresponsive until i remove it so does anybody know what am i doing wrong
  #6   Spotlight this post!  
Unread 06-02-2010, 23:51
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: wiring and programing our optical encoders

try
initTeleOp(){
encoder.SetDistancePerPulse(.025); //this actually depends on your wheel size, gear ratio, encoder CPR
encoder.Start();
}


PeriodicTeleop(){
INT32 tick = encoder.GetDistance();

printf("tick:%4.2 /n",tick );

)

This should get you started
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
  #7   Spotlight this post!  
Unread 07-02-2010, 00:12
michael1991j michael1991j is offline
Registered User
FRC #3139
 
Join Date: Feb 2010
Location: oxford alabama
Posts: 6
michael1991j is an unknown quantity at this point
Re: wiring and programing our optical encoders

thank you very much I will try it
  #8   Spotlight this post!  
Unread 07-02-2010, 00:58
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: wiring and programing our optical encoders

Quote:
Originally Posted by michael1991j View Post
\now i did noticed there is a spot for a jumper on the digital side car on the digital input sides do i need to put a jumper in there. the probem when i do that everything become nonresponsive until i remove it so does anybody know what am i doing wrong
I don't know what "spot for a jumper" you're talking about. Can you describe it more fully? Your program says you have the encoder connected to DIO1 and DIO2. As long as the Digital Sidecar has good power, you shouldn't need to do anything else with the wiring.
  #9   Spotlight this post!  
Unread 07-02-2010, 02:35
michael1991j michael1991j is offline
Registered User
FRC #3139
 
Join Date: Feb 2010
Location: oxford alabama
Posts: 6
michael1991j is an unknown quantity at this point
Re: wiring and programing our optical encoders



if you look at where circled in this picture you will see a + or - in that area
  #10   Spotlight this post!  
Unread 07-02-2010, 02:43
longrange longrange is offline
Registered User
FRC #1070 (Royal Robotrons)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Woodland Hills, CA
Posts: 21
longrange is an unknown quantity at this point
Re: wiring and programing our optical encoders

Those are spare power connectors
  #11   Spotlight this post!  
Unread 07-02-2010, 12:13
michael1991j michael1991j is offline
Registered User
FRC #3139
 
Join Date: Feb 2010
Location: oxford alabama
Posts: 6
michael1991j is an unknown quantity at this point
Re: wiring and programing our optical encoders

ok so that wouldnt power the digital io you needed jumpers for moters
  #12   Spotlight this post!  
Unread 07-02-2010, 15:01
Tom Line's Avatar
Tom Line Tom Line is online now
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,535
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: wiring and programing our optical encoders

The only time that you need to worry about a jumper on the digital side car (and someone can correct me here if I'm wrong), is when you are plugging in a servo.

What you did with the jumper was to jump power straight to ground - you short circuited the entire board. You are lucky it has built in protection or you would have fried it.

Please try to read through the various controls manuals provided by First if you haven't already. They provide a great starting point for someone new at this. Also, try to use punctuation and capitalization. It's hard enough to read through the hundreds of posts - don't make it any harder!
  #13   Spotlight this post!  
Unread 07-02-2010, 15:08
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: wiring and programing our optical encoders

Quote:
Originally Posted by michael1991j View Post
if you look at where circled in this picture you will see a + or - in that area
If you connected those two pins together, you shorted power and ground. That would certainly make everything else stop working.
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
Programing+encoders =? alaskabas Programming 2 24-02-2009 20:41
Wiring Gyros and Encoders? SuspectZero Electrical 3 03-02-2008 15:30
programing the vex optical shaft encoder youngWilliam14 Programming 10 11-11-2007 16:16
Optical Encoders misterikkit Robotics Education and Curriculum 7 22-12-2003 23:13
Programming Optical Encoders GrahamS314 Programming 5 09-03-2003 08:16


All times are GMT -5. The time now is 21:26.

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