WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::Tachometer Class Reference

Tachometer for getting rotational velocity from a device. More...

#include <wpi/counter/Tachometer.hpp>

Inheritance diagram for wpi::Tachometer:
wpi::util::Sendable wpi::util::SendableHelper< Tachometer >

Public Member Functions

 Tachometer (int channel, EdgeConfiguration configuration)
 Constructs a new tachometer.
 Tachometer (Tachometer &&)=default
Tachometeroperator= (Tachometer &&)=default
 ~Tachometer () override=default
void SetEdgeConfiguration (EdgeConfiguration configuration)
 Sets the configuration for the channel.
wpi::units::hertz_t GetFrequency () const
 Gets the tachometer frequency.
wpi::units::second_t GetPeriod () const
 Gets the tachometer period.
int GetEdgesPerRevolution () const
 Gets the number of edges per revolution.
void SetEdgesPerRevolution (int edges)
 Sets the number of edges per revolution.
wpi::units::turns_per_second_t GetRevolutionsPerSecond () const
 Gets the current tachometer revolutions per second.
wpi::units::revolutions_per_minute_t GetRevolutionsPerMinute () const
 Gets the current tachometer revolutions per minute.
bool GetStopped () const
 Gets if the tachometer is stopped.
void SetMaxPeriod (wpi::units::second_t maxPeriod)
 Sets the maximum period before the tachometer is considered stopped.
Public Member Functions inherited from wpi::util::Sendable
virtual constexpr ~Sendable ()=default
Public Member Functions inherited from wpi::util::SendableHelper< Tachometer >
constexpr SendableHelper (const SendableHelper &rhs)=default
constexpr SendableHelperoperator= (const SendableHelper &rhs)=default

Protected Member Functions

void InitSendable (wpi::util::SendableBuilder &builder) override
 Initializes this Sendable object.
Protected Member Functions inherited from wpi::util::SendableHelper< Tachometer >
constexpr ~SendableHelper ()

Detailed Description

Tachometer for getting rotational velocity from a device.

The Tachometer class measures the time between digital pulses to determine the rotation velocity of a mechanism. Examples of devices that could be used with the tachometer class are a hall effect sensor, break beam sensor, or optical sensor detecting tape on a shooter wheel. Unlike encoders, this class only needs a single digital input.

Constructor & Destructor Documentation

◆ Tachometer() [1/2]

wpi::Tachometer::Tachometer ( int channel,
EdgeConfiguration configuration )

Constructs a new tachometer.

Parameters
channelThe DIO Channel.
configurationEdge configuration

◆ Tachometer() [2/2]

wpi::Tachometer::Tachometer ( Tachometer && )
default

◆ ~Tachometer()

wpi::Tachometer::~Tachometer ( )
overridedefault

Member Function Documentation

◆ GetEdgesPerRevolution()

int wpi::Tachometer::GetEdgesPerRevolution ( ) const

Gets the number of edges per revolution.

Returns
Edges per revolution.

◆ GetFrequency()

wpi::units::hertz_t wpi::Tachometer::GetFrequency ( ) const

Gets the tachometer frequency.

Returns
Current frequency.

◆ GetPeriod()

wpi::units::second_t wpi::Tachometer::GetPeriod ( ) const

Gets the tachometer period.

Returns
Current period.

◆ GetRevolutionsPerMinute()

wpi::units::revolutions_per_minute_t wpi::Tachometer::GetRevolutionsPerMinute ( ) const

Gets the current tachometer revolutions per minute.

SetEdgesPerRevolution must be set with a non 0 value for this to work.

Returns
Current RPM.

◆ GetRevolutionsPerSecond()

wpi::units::turns_per_second_t wpi::Tachometer::GetRevolutionsPerSecond ( ) const

Gets the current tachometer revolutions per second.

SetEdgesPerRevolution must be set with a non 0 value for this to work.

Returns
Current RPS.

◆ GetStopped()

bool wpi::Tachometer::GetStopped ( ) const

Gets if the tachometer is stopped.

Returns
True if the tachometer is stopped.

◆ InitSendable()

void wpi::Tachometer::InitSendable ( wpi::util::SendableBuilder & builder)
overrideprotectedvirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements wpi::util::Sendable.

◆ operator=()

Tachometer & wpi::Tachometer::operator= ( Tachometer && )
default

◆ SetEdgeConfiguration()

void wpi::Tachometer::SetEdgeConfiguration ( EdgeConfiguration configuration)

Sets the configuration for the channel.

Parameters
configurationThe channel configuration.

◆ SetEdgesPerRevolution()

void wpi::Tachometer::SetEdgesPerRevolution ( int edges)

Sets the number of edges per revolution.

Parameters
edgesEdges per revolution.

◆ SetMaxPeriod()

void wpi::Tachometer::SetMaxPeriod ( wpi::units::second_t maxPeriod)

Sets the maximum period before the tachometer is considered stopped.

Parameters
maxPeriodThe max period.

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