Go to Post and the only thing i see as a disadvantage to those long hours of hard work is a little less time to spend with my girlfriend - h1n1is4pigs [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 12-02-2009, 21:32
robself705's Avatar
robself705 robself705 is offline
Team Leader / Mechanical
AKA: Rob Self
FRC #0706 (Cyberhawks)
Team Role: Mechanical
 
Join Date: Nov 2008
Rookie Year: 2009
Location: Arrowhead High School Wisconsin
Posts: 72
robself705 is a name known to allrobself705 is a name known to allrobself705 is a name known to allrobself705 is a name known to allrobself705 is a name known to allrobself705 is a name known to all
problems with multiple encoders, please help!

we're using a total of 4 encoders on our robot, 2 for steering, and 1 for a turret. but when any more than 1 encoder is defined, only the one that is defined first works. here is a sample of some code that only read one of the encoders in teleoperated mode

Encoder front(1,2);
Encoder back(3,4);

while (1)
{
printf("%d %d\n", front.Get(), back.Get());
}

front.Get gives back a value when we turn the encoder but back.get does not, we've checked the wiring a hundred times, any help would be greatly appreciated
  #2   Spotlight this post!  
Unread 12-02-2009, 21:52
Wylie99998 Wylie99998 is offline
Registered User
FRC #0871
 
Join Date: Oct 2007
Location: ny
Posts: 12
Wylie99998 is an unknown quantity at this point
Re: problems with multiple encoders, please help!

um well can u send ur actual code maybe ur instantiating them incorrectly. btw if u made them pointers u must use the -> operator instead of the . operator and also u have to have a line somewhere starting the counting ( ex back->Start();
  #3   Spotlight this post!  
Unread 12-02-2009, 22:00
dboisvert dboisvert is offline
Registered User
AKA: Dan Boisvert
FRC #2405 (Divided by Zero)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Michigan
Posts: 57
dboisvert is an unknown quantity at this point
Re: problems with multiple encoders, please help!

Code:
Encoder front(1,2);
Encoder back(3,4);

while (1)
{
printf("%d %d\n", front->Get(), back->Get());
}
That should do the trick
  #4   Spotlight this post!  
Unread 12-02-2009, 22:06
robself705's Avatar
robself705 robself705 is offline
Team Leader / Mechanical
AKA: Rob Self
FRC #0706 (Cyberhawks)
Team Role: Mechanical
 
Join Date: Nov 2008
Rookie Year: 2009
Location: Arrowhead High School Wisconsin
Posts: 72
robself705 is a name known to allrobself705 is a name known to allrobself705 is a name known to allrobself705 is a name known to allrobself705 is a name known to allrobself705 is a name known to all
Re: problems with multiple encoders, please help!

we tried it with the pointers and we had the same result, one encoder worked while the other did nothing. if we didnt initiate them properly than either it wouldnt compile or both of them wouldnt run, right?
  #5   Spotlight this post!  
Unread 12-02-2009, 22:11
Wylie99998 Wylie99998 is offline
Registered User
FRC #0871
 
Join Date: Oct 2007
Location: ny
Posts: 12
Wylie99998 is an unknown quantity at this point
Re: problems with multiple encoders, please help!

hmm the fact that one is running is odd.. have u checked on a volt meter if the sensor is sending back pulses?
  #6   Spotlight this post!  
Unread 12-02-2009, 23:46
reversed_rocker's Avatar
reversed_rocker reversed_rocker is offline
Alumni
AKA: Ken Condon
FRC #0706 (Cyberhawks)
Team Role: College Student
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Hartland
Posts: 69
reversed_rocker is on a distinguished road
Re: problems with multiple encoders, please help!

yeah we took an oscilliscope to all of the encoders and all of them are sending back pulses. whats especially weird is that if you comment out the first encoder, the second encoder gives data back. but if you have both encoders running at the same time, only the one that's defined first will send back data
  #7   Spotlight this post!  
Unread 13-02-2009, 00:22
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: problems with multiple encoders, please help!

Code:
printf("%d %d\n", front.Get(), back.Get());
Shouldn't you be using the %f format specification instead of %d? I thought encoders returned floating point values.
  #8   Spotlight this post!  
Unread 13-02-2009, 00:56
reversed_rocker's Avatar
reversed_rocker reversed_rocker is offline
Alumni
AKA: Ken Condon
FRC #0706 (Cyberhawks)
Team Role: College Student
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Hartland
Posts: 69
reversed_rocker is on a distinguished road
Re: problems with multiple encoders, please help!

thats problably true, but i dont see how that would cause only one encoder to give back values
  #9   Spotlight this post!  
Unread 13-02-2009, 01:00
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: problems with multiple encoders, please help!

It would cause the printf() to report the values incorrectly. If that's the only thing making you think the encoders aren't working right, the encoders might actually not be misbehaving at all.
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
Can anyone help with encoders Chris11246 NI LabVIEW 2 06-02-2009 15:28
Multiple Robots, Please Help Zyik Control System 3 17-02-2008 20:43
Please help me with my Camera problems! Ianuser Programming 2 10-02-2007 21:17
Need help with shaft encoders edthegeek Control System 9 23-11-2006 15:08
Problems with PID- PLEASE HELP!!! thinkpad Programming 12 10-02-2005 00:18


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

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