![]() |
Two of Five encoders are giving identical values
We've got an encoder on every wheel and one for steering. We noticed that two of the five encoders return the exact same value. It is not a hardware issue, as we have isolated each one by physically unplugging them etc. It seems the software sees them as the same, even though they are declared and started separately.
In addition, we can 'control' which two mimic each other. Its always the first and the last in the code where they are declared. We verified this by rotating the declaration list, and sure enough, they followed each other - which further confirms that it has nothing to do with the hardware. Any ideas? :confused: |
Re: Two of Five encoders are giving identical values
Quote:
|
Re: Two of Five encoders are giving identical values
I was talking with Brad Miller last night, and there is a 4 encoder limit. With the newest version of WPILib though, there is an optional parameter you can pass to the constructor that will let you have more than 4 encoders.
The parameter is "EncodingType encodingType". The documentation in Encoder.cpp is pretty good in this respect and from it you will be able to figure out the side effects of initializing an encoder with the k1X or k2X flags instead of the default k4X flags. |
Re: Two of Five encoders are giving identical values
From the Programming Guide:
Quote:
Code:
//TODO: need to check for errors here |
Re: Two of Five encoders are giving identical values
Our development systems have update 3, however when we try to use the "k4X", or "k2X". The compiler returns the following error:
Quote:
|
Re: Two of Five encoders are giving identical values
Looking into this further it seems that the WPILib has added this parameter (k1X, k2X, k4X) to CouterBase.h, Encoder.cpp, and Encoder.h. However I don't see it in /ChipObject/tEncoder.h
What are we missing here?? |
Re: Two of Five encoders are giving identical values
Quote:
Code:
CounterBase::k1X |
Re: Two of Five encoders are giving identical values
Quote:
|
Re: Two of Five encoders are giving identical values
Thanks for this insight. I made the code work. When you have a second could you explain why we need to do this in our code, but the library does not have to in encoder.cpp
Thanks Julian Team 852 |
Re: Two of Five encoders are giving identical values
Quote:
Your code, however, was presumably in an object which was not inheriting from CounterBase, so the explicit references are needed so the compiler knows where to find the value for k1X, k2X, k4X, etc... |
| All times are GMT -5. The time now is 02:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi