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

V5 Inertial Sensor, read as a heading, counterclockwise positive seen from above (ENU). More...

#include <InertialSensor.hpp>

Inheritance diagram for rz::InertialSensor:
rz::Device rz::Sensor< Rotation > rz::Component

Public Member Functions

 InertialSensor (std::uint8_t port)
bool connected () const override
bool calibrating () const
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< Rotation >
 Sensor ()=default
Sensor & operator= (const Sensor &)=delete
virtual ~Sensor ()=default
Rotation get ()
 The current reading. The last good value while disconnected.
Rotation delta ()
 Change since the previous snapshot (covers several ticks if nobody read in between).

Protected Member Functions

Rotation 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
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 Inertial Sensor, read as a heading, counterclockwise positive seen from above (ENU).

The sensor finds which way is up while calibrating, so it can be mounted in any of its six orientations.

Calibration starts automatically when the sensor connects (and again after a reconnect) and takes about two seconds. While calibrating, connected() is false and delta() is zero.

Constructor & Destructor Documentation

◆ InertialSensor()

rz::InertialSensor::InertialSensor ( std::uint8_t port)
explicit

Member Function Documentation

◆ calibrating()

bool rz::InertialSensor::calibrating ( ) const
nodiscard

◆ connected()

bool rz::InertialSensor::connected ( ) const
nodiscardoverridevirtual

◆ epoch()

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

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

Reimplemented from rz::Sensor< Rotation >.

◆ raw()

Rotation rz::InertialSensor::raw ( ) const
nodiscardoverrideprotectedvirtual

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

Implements rz::Sensor< Rotation >.


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