WPILibC++ 2023.4.3-108-ge5452e3
|
Tachometer for getting rotational speed from a device. More...
#include <frc/counter/Tachometer.h>
Public Member Functions | |
Tachometer (DigitalSource &source) | |
Constructs a new tachometer. More... | |
Tachometer (std::shared_ptr< DigitalSource > source) | |
Constructs a new tachometer. More... | |
~Tachometer () override | |
Tachometer (Tachometer &&)=default | |
Tachometer & | operator= (Tachometer &&)=default |
units::hertz_t | GetFrequency () const |
Gets the tachometer frequency. More... | |
units::second_t | GetPeriod () const |
Gets the tachometer period. More... | |
int | GetEdgesPerRevolution () const |
Gets the number of edges per revolution. More... | |
void | SetEdgesPerRevolution (int edges) |
Sets the number of edges per revolution. More... | |
units::turns_per_second_t | GetRevolutionsPerSecond () const |
Gets the current tachometer revolutions per second. More... | |
units::revolutions_per_minute_t | GetRevolutionsPerMinute () const |
Gets the current tachometer revolutions per minute. More... | |
bool | GetStopped () const |
Gets if the tachometer is stopped. More... | |
int | GetSamplesToAverage () const |
Gets the number of sample to average. More... | |
void | SetSamplesToAverage (int samples) |
Sets the number of samples to average. More... | |
void | SetMaxPeriod (units::second_t maxPeriod) |
Sets the maximum period before the tachometer is considered stopped. More... | |
void | SetUpdateWhenEmpty (bool updateWhenEmpty) |
Sets if to update when empty. More... | |
Public Member Functions inherited from wpi::Sendable | |
virtual | ~Sendable ()=default |
virtual void | InitSendable (SendableBuilder &builder)=0 |
Initializes this Sendable object. More... | |
Public Member Functions inherited from wpi::SendableHelper< Tachometer > | |
SendableHelper (const SendableHelper &rhs)=default | |
SendableHelper (SendableHelper &&rhs) | |
SendableHelper & | operator= (const SendableHelper &rhs)=default |
SendableHelper & | operator= (SendableHelper &&rhs) |
Protected Member Functions | |
void | InitSendable (wpi::SendableBuilder &builder) override |
Initializes this Sendable object. More... | |
Protected Member Functions inherited from wpi::SendableHelper< Tachometer > | |
SendableHelper ()=default | |
~SendableHelper () | |
Tachometer for getting rotational speed from a device.
The Tachometer class measures the time between digital pulses to determine the rotation speed 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.
|
explicit |
Constructs a new tachometer.
source | The source. |
|
explicit |
Constructs a new tachometer.
source | The source. |
|
override |
|
default |
int frc::Tachometer::GetEdgesPerRevolution | ( | ) | const |
Gets the number of edges per revolution.
units::hertz_t frc::Tachometer::GetFrequency | ( | ) | const |
Gets the tachometer frequency.
units::second_t frc::Tachometer::GetPeriod | ( | ) | const |
Gets the tachometer period.
units::revolutions_per_minute_t frc::Tachometer::GetRevolutionsPerMinute | ( | ) | const |
Gets the current tachometer revolutions per minute.
SetEdgesPerRevolution must be set with a non 0 value for this to work.
units::turns_per_second_t frc::Tachometer::GetRevolutionsPerSecond | ( | ) | const |
Gets the current tachometer revolutions per second.
SetEdgesPerRevolution must be set with a non 0 value for this to work.
int frc::Tachometer::GetSamplesToAverage | ( | ) | const |
Gets the number of sample to average.
bool frc::Tachometer::GetStopped | ( | ) | const |
Gets if the tachometer is stopped.
|
overrideprotectedvirtual |
|
default |
void frc::Tachometer::SetEdgesPerRevolution | ( | int | edges | ) |
Sets the number of edges per revolution.
edges | Edges per revolution. |
void frc::Tachometer::SetMaxPeriod | ( | units::second_t | maxPeriod | ) |
Sets the maximum period before the tachometer is considered stopped.
maxPeriod | The max period. |
void frc::Tachometer::SetSamplesToAverage | ( | int | samples | ) |
Sets the number of samples to average.
samples | Samples to average. |
void frc::Tachometer::SetUpdateWhenEmpty | ( | bool | updateWhenEmpty | ) |
Sets if to update when empty.
updateWhenEmpty | True to update when empty. |