hi. I wanted to mount two V4 Quad Encoder into our tower takeover bot as i do not want to use the integrated motor encoder. I am using VCS C++ pro
Are you looking for something like this?: https://help.vexcodingstudio.com/#pro/namespacevex/classvex_1_1encoder/encoder
This is for three wire.
i thought that would be for a normal encoder not a quadrature encoder
I will premise this with I have nothing with me to verify my theory, and I am not C++ programmer by trade, but this is what I think:
Refers to the Optical Shaft Encoder
Is the output from the V5 Motor for rotation
Is for the Potentiometer
The Integrated Encoder does not work with V5 unless I missed something.
If that is not what you are looking for I might be mis-understanding what you are asking for.
oh alright Thank you!
I actually posted about this a while ago, but I never got a response. I had trouble with defining the encoder, since it uses two wires rather than one. This gave me really weird values when i printed it to the brain.
Do you have your code to share and the results?
Yikes, just went to check out the documentation for VCS to try to help you out.
It is terrible. I had to zoom out to be able to view the list in Firefox, and the documentation is so unhelpful.
It appears as though
encoder(triport::port &port) only takes one port as a paramiter.
triport::port is actually a group of ports or not, I can’t tell. the documentation does not define it.
Actually, looking at the RMS documentation (which does define
triport), it’s the same thing.
How I think it works is that you are supposed to provide the left port, and it will automatically set up the next port to the right.
This is why you are only supposed to use “odd” ports (A, C, E, F) as the first port.
When you tell it to use port A, it will set up port A and B.
@Kselva20 you might have had your problem because you had the left port starting on an “even” port, or the 2nd port was not right next to the first.
The only reason we didn’t define it better in our docs is the device configuration panel in Robot Mesh Studio automatically reserves the next port when you set up a multi-port device, and won’t let you try to define a multi-port device when it would span an invalid pair of ports. So setting one up on A, C, E, or G automatically reserves B, D, F, or H and you can’t pick them as devices for B, D, F, or H.
Oh wow I was not aware of this. I am actually really happy and appreciate the help very much. However, I actually tried to define both ports being used for the encoder as two separate ones and did not get an error for declaring the second port as another encoder. I tried changing the wires on the two ports, and it still printed out weird values to the brain. It would jump from 21 to 300 randomly. Idk, but this definitely helps, and I will experiment tomorrow. Thank you so much for the help.
So will the ports be reserved automatically in both VCS and VEXcode? @theol0403
Yeah, just define one encoder, and provide the leftmost (highest) port.
Yes, it works the same in VCS and VEXcode.
It’s possible your encoder is broken, but I will let you experiment.
Thanks for the Help!