Tachometer

class wpilib.Tachometer(channel: SupportsInt | SupportsIndex, configuration: wpilib._wpilib.EdgeConfiguration)

Bases: Sendable

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.

Constructs a new tachometer.

Parameters:
  • channel – The DIO Channel.

  • configuration – Edge configuration

getEdgesPerRevolution() int

Gets the number of edges per revolution.

Returns:

Edges per revolution.

getFrequency() wpimath.units.hertz

Gets the tachometer frequency.

Returns:

Current frequency.

getPeriod() wpimath.units.seconds

Gets the tachometer period.

Returns:

Current period.

getRevolutionsPerMinute() wpimath.units.revolutions_per_minute

Gets the current tachometer revolutions per minute.

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

Returns:

Current RPM.

getRevolutionsPerSecond() wpimath.units.turns_per_second

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

Gets if the tachometer is stopped.

Returns:

True if the tachometer is stopped.

setEdgeConfiguration(configuration: wpilib._wpilib.EdgeConfiguration) None

Sets the configuration for the channel.

Parameters:

configuration – The channel configuration.

setEdgesPerRevolution(edges: SupportsInt | SupportsIndex) None

Sets the number of edges per revolution.

Parameters:

edges – Edges per revolution.

setMaxPeriod(maxPeriod: wpimath.units.seconds) None

Sets the maximum period before the tachometer is considered stopped.

Parameters:

maxPeriod – The max period.