Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Question about QuadEncoders [C++] (http://www.chiefdelphi.com/forums/showthread.php?t=70846)

beefy1 26-12-2008 16:55

Question about QuadEncoders [C++]
 
what does the Get function in Encoder class return? detailed explaination if you can, please :)

tdlrali 26-12-2008 18:24

Re: Question about QuadEncoders [C++]
 
from Encoder.cpp:
Code:

/**
 * Gets the current count.
 * Returns the current count on the QuadEncoder.
 * @return Current count from the QuadEncoder.
 */
INT32 Encoder::Get(void)
{
        INT32 value = m_encoder->readOutput_Value(&status);
        wpi_assertCleanStatus(status);
        return value;
}

It returns the number of pulses received since the encoder was initialized or the count was reset.

Your other option is GetPeriod, which:
"Returns the period of the most recent Quad Encoder pulse in microseconds."

beefy1 27-12-2008 11:46

Re: Question about QuadEncoders [C++]
 
well, but what happened if I change the direction, will the Get function give me the duplication of ticks or maybe the distance it passed?:confused:

Daniel_LaFleur 27-12-2008 11:54

Re: Question about QuadEncoders [C++]
 
Quote:

Originally Posted by beefy1 (Post 787452)
well, but what happened if I change the direction, will the Get function give me the duplication of ticks or maybe the distance it passed?:confused:

Get Encoder does not get "ticks". It reads the number of counts from it's initialization/last reset. As the encoder turns in its forward direction it increases the encoder counts, as it turns in its reverse direction it decreases the encoder counts (even going negative).

I am not sure if GetPeriod will return a negative encoder period or not.

tdlrali 27-12-2008 12:17

Re: Question about QuadEncoders [C++]
 
No, GetPeriod will not return a negative number. It simply returns time passed between the last two pulses.

And yes, Daniel is right about the values Get() returns.


All times are GMT -5. The time now is 00:13.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi