RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::RotationSensor Class Referencefinal

V5 Rotation Sensor. Reads continuous (multi-turn) angle. More...

#include <RotationSensor.hpp>

Inheritance diagram for rz::RotationSensor:
rz::Device rz::Sensor< Angle > rz::Component

Classes

struct  Config

Public Member Functions

 RotationSensor (std::uint8_t port)
 RotationSensor (std::uint8_t port, Config config)
bool connected () const override
Public Member Functions inherited from rz::Device
std::uint8_t port () const noexcept
bool deviceConnected () const noexcept
 Whether this tick's read succeeded.
std::uint32_t deviceEpoch () const noexcept
 Increments on every (re)connection.
Public Member Functions inherited from rz::Component
 Component (const Component &)=delete
Component & operator= (const Component &)=delete
 Component (Component &&)=delete
Component & operator= (Component &&)=delete
virtual ~Component ()
std::string_view name () const noexcept
 Used in log and error messages.
Public Member Functions inherited from rz::Sensor< Angle >
 Sensor ()=default
Sensor & operator= (const Sensor &)=delete
virtual ~Sensor ()=default
Angle get ()
 The current reading. The last good value while disconnected.
Angle delta ()
 Change since the previous snapshot (covers several ticks if nobody read in between).

Protected Member Functions

Angle raw () const override
 This tick's reading from the source; the last good value while disconnected. May restart after a reconnect.
std::uint32_t epoch () const override
 Increments every time the source reconnects. Readings across a reconnect are not comparable.
Protected Member Functions inherited from rz::Device
 Device (std::uint8_t port, std::string_view kind)
 ~Device () override
virtual void onConnect ()
 Applies configuration. Called when the device first connects and after every reconnect.
Protected Member Functions inherited from rz::Component
 Component (std::string_view name)

Additional Inherited Members

Static Public Member Functions inherited from rz::Device
static void validatePorts ()
 Throws std::runtime_error if two devices are constructed on the same port.
Static Public Member Functions inherited from rz::Component
static Task runAll ()
 Runs the loop of every component constructed so far, in construction order, until cancelled. rz::robot runs it; tests without rz::robot run it alongside their script.

Detailed Description

V5 Rotation Sensor. Reads continuous (multi-turn) angle.

Constructor & Destructor Documentation

◆ RotationSensor() [1/2]

rz::RotationSensor::RotationSensor ( std::uint8_t port)
inlineexplicit

◆ RotationSensor() [2/2]

rz::RotationSensor::RotationSensor ( std::uint8_t port,
Config config )

Member Function Documentation

◆ connected()

bool rz::RotationSensor::connected ( ) const
inlinenodiscardoverridevirtual

Implements rz::Sensor< Angle >.

◆ epoch()

std::uint32_t rz::RotationSensor::epoch ( ) const
inlinenodiscardoverrideprotectedvirtual

Increments every time the source reconnects. Readings across a reconnect are not comparable.

Reimplemented from rz::Sensor< Angle >.

◆ raw()

Angle rz::RotationSensor::raw ( ) const
nodiscardoverrideprotectedvirtual

This tick's reading from the source; the last good value while disconnected. May restart after a reconnect.

Implements rz::Sensor< Angle >.


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