Encoder¶
Class Documentation¶
-
class
compLib.Encoder.
Encoder
¶ Class used to read the encoders
-
static
clear
(port: int)¶ Reset encoder position to 0
- Parameters
port – Port, which the motor is connected to. Between 1 and 4
- Raises
IndexError
-
static
clear_all
()¶ Reset all encoder positions to 0
-
static
handle_wrap
(raw_value, port)¶ Handle overflow and underflow of int for encoders.
- Parameters
raw_value – Raw value which was read on port
port – Port, which the motor is connected to. Between 1 and 4
- Raises
IndexError
- Returns
Current encoder position
-
static
read
(port: int) → int¶ Read encoder from a specified port
- Parameters
port – Port, which the motor is connected to. Between 1 and 4
- Raises
IndexError
- Returns
Current encoder position
-
static
read_all
()¶ Read all encoders at once. This is faster than read as it only uses one SPI call for all encoders!
- Returns
Tuple of all current encoder positions
-
static
read_all_raw
()¶ Read all encoders at once. This is faster than read_raw as it only uses one SPI call for all encoders!
- Returns
Tuple of all current raw encoder positions
-
static
read_raw
(port: int) → int¶ Read raw encoder from a specified port. Will not be reset to 0 at start.
- Parameters
port – Port, which the motor is connected to. Between 1 and 4
- Raises
IndexError
- Returns
Current encoder position
-
static