|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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());
}
|
|
#4
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||||
|
|||||
|
Re: problems with multiple encoders, please help!
Code:
printf("%d %d\n", front.Get(), back.Get());
|
|
#8
|
||||
|
||||
|
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
|
|||||
|
|||||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |