LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
okapi::ADIEncoder Class Reference

#include <adiEncoder.hpp>

Inheritance diagram for okapi::ADIEncoder:
okapi::ContinuousRotarySensor okapi::RotarySensor okapi::ControllerInput< double >

Public Member Functions

 ADIEncoder (std::uint8_t iportTop, std::uint8_t iportBottom, bool ireversed=false)
 An encoder in an ADI port.
 
 ADIEncoder (std::tuple< std::uint8_t, std::uint8_t, std::uint8_t > iports, bool ireversed=false)
 An encoder in an ADI port.
 
virtual double get () const override
 Get the current sensor value.
 
virtual std::int32_t reset () override
 Reset the sensor to zero.
 
virtual double controllerGet () override
 Get the sensor value for use in a control loop.
 
- Public Member Functions inherited from okapi::RotarySensor
virtual ~RotarySensor ()
 

Protected Attributes

pros::c::ext_adi_encoder_t enc
 

Detailed Description

Definition at line 12 of file adiEncoder.hpp.

Constructor & Destructor Documentation

◆ ADIEncoder() [1/2]

okapi::ADIEncoder::ADIEncoder ( std::uint8_t  iportTop,
std::uint8_t  iportBottom,
bool  ireversed = false 
)

An encoder in an ADI port.

auto enc = ADIEncoder('A', 'B', false);
auto reversedEnc = ADIEncoder('A', 'B', true);
pros::c::ext_adi_encoder_t enc
Parameters
iportTopThe "top" wire from the encoder with the removable cover side up. This must be in port 1, 3, 5, or 7 (A, C, E, or G).
iportBottomThe "bottom" wire from the encoder. This must be in port 2, 4, 6, or 8 (B, D, F, or H).
ireversedWhether the encoder is reversed.

◆ ADIEncoder() [2/2]

okapi::ADIEncoder::ADIEncoder ( std::tuple< std::uint8_t, std::uint8_t, std::uint8_t >  iports,
bool  ireversed = false 
)

An encoder in an ADI port.

auto enc = ADIEncoder({1, 'A', 'B'}, false);
auto reversedEnc = ADIEncoder({1, 'A', 'B'}, true);
Parameters
iportsThe ports the encoder is plugged in to in the order {smart port, top port, bottom port}. The smart port is the smart port number ([1, 21]). The top port is the "top" wire from the encoder with the removable cover side up. This must be in port 1, 3, 5, or 7 (A, C, E, or G). The bottom port is the "bottom" wire from the encoder. This must be in port 2, 4, 6, or 8 (B, D, F, or H).
ireversedWhether the encoder is reversed.

Member Function Documentation

◆ controllerGet()

virtual double okapi::ADIEncoder::controllerGet ( )
overridevirtual

Get the sensor value for use in a control loop.

This method might be automatically called in another thread by the controller.

Returns
the current sensor value, or PROS_ERR on a failure.

Implements okapi::ControllerInput< double >.

◆ get()

virtual double okapi::ADIEncoder::get ( ) const
overridevirtual

Get the current sensor value.

Returns
the current sensor value, or PROS_ERR on a failure.

Implements okapi::RotarySensor.

◆ reset()

virtual std::int32_t okapi::ADIEncoder::reset ( )
overridevirtual

Reset the sensor to zero.

Returns
1 on success, PROS_ERR on fail

Implements okapi::ContinuousRotarySensor.

Member Data Documentation

◆ enc

pros::c::ext_adi_encoder_t okapi::ADIEncoder::enc
protected

Definition at line 71 of file adiEncoder.hpp.


The documentation for this class was generated from the following file: