Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   significance of encoder function getRaw() (http://www.chiefdelphi.com/forums/showthread.php?t=113197)

The_Colonel 10-02-2013 15:52

significance of encoder function getRaw()
 
Does anybody know what the value being returned by getRaw() actually signifies? and how is it distinct from get()?

Ether 10-02-2013 16:03

Re: significance of encoder function getRaw()
 
Quote:

Originally Posted by The_Colonel (Post 1231077)
Does anybody know what the value being returned by getRaw() actually signifies? and how is it distinct from get()?

Look at the file "Encoder.java" in the WPILib source code folder installed on your development computer.

Search for get() and getRaw() and look at the comment section preceding each method.



joelg236 10-02-2013 16:06

Re: significance of encoder function getRaw()
 
Code:

/**
 * Read the current counter value.
 * Read the value at this instant. It may still be running, so it reflects the current value. Next
 * time it is read, it might have a different value.
 */
public int get() {
    return m_counter.readOutput_Value();
}

and

Code:

/**
 * Gets the raw value from the encoder.
 * The raw value is the actual count unscaled by the 1x, 2x, or 4x scale
 * factor.
 * @return Current raw count from the encoder
 */
public int getRaw() {
    int value;
    if (m_counter != null) {
        value = m_counter.get();
    } else {
        value = m_encoder.readOutput_Value();
    }
    return value;
}

getRaw() is unscaled for the encoder type (quadrature, 2x, 1x, etc.).


All times are GMT -5. The time now is 09:52.

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