WPILibC++ 2024.3.2
frc::sim::DutyCycleEncoderSim Class Reference

Class to control a simulated duty cycle encoder. More...

#include <frc/simulation/DutyCycleEncoderSim.h>

Public Member Functions

 DutyCycleEncoderSim (const DutyCycleEncoder &encoder)
 Constructs from a DutyCycleEncoder object. More...
 
 DutyCycleEncoderSim (int channel)
 Constructs from a digital input channel. More...
 
double Get ()
 Get the position in turns. More...
 
void Set (units::turn_t turns)
 Set the position in turns. More...
 
double GetDistance ()
 Get the distance. More...
 
void SetDistance (double distance)
 Set the distance. More...
 
double GetAbsolutePosition ()
 Get the absolute position. More...
 
void SetAbsolutePosition (double position)
 Set the absolute position. More...
 
double GetDistancePerRotation ()
 Get the distance per rotation for this encoder. More...
 
bool IsConnected ()
 Get if the encoder is connected. More...
 
void SetConnected (bool isConnected)
 Set if the encoder is connected. More...
 

Detailed Description

Class to control a simulated duty cycle encoder.

Constructor & Destructor Documentation

◆ DutyCycleEncoderSim() [1/2]

frc::sim::DutyCycleEncoderSim::DutyCycleEncoderSim ( const DutyCycleEncoder encoder)
explicit

Constructs from a DutyCycleEncoder object.

Parameters
encoderDutyCycleEncoder to simulate

◆ DutyCycleEncoderSim() [2/2]

frc::sim::DutyCycleEncoderSim::DutyCycleEncoderSim ( int  channel)
explicit

Constructs from a digital input channel.

Parameters
channeldigital input channel

Member Function Documentation

◆ Get()

double frc::sim::DutyCycleEncoderSim::Get ( )

Get the position in turns.

Returns
The position.

◆ GetAbsolutePosition()

double frc::sim::DutyCycleEncoderSim::GetAbsolutePosition ( )

Get the absolute position.

Returns
The absolute position

◆ GetDistance()

double frc::sim::DutyCycleEncoderSim::GetDistance ( )

Get the distance.

Returns
The distance.

◆ GetDistancePerRotation()

double frc::sim::DutyCycleEncoderSim::GetDistancePerRotation ( )

Get the distance per rotation for this encoder.

Returns
The scale factor that will be used to convert rotation to useful units.

◆ IsConnected()

bool frc::sim::DutyCycleEncoderSim::IsConnected ( )

Get if the encoder is connected.

Returns
true if the encoder is connected.

◆ Set()

void frc::sim::DutyCycleEncoderSim::Set ( units::turn_t  turns)

Set the position in turns.

Parameters
turnsThe position.

◆ SetAbsolutePosition()

void frc::sim::DutyCycleEncoderSim::SetAbsolutePosition ( double  position)

Set the absolute position.

Parameters
positionThe absolute position

◆ SetConnected()

void frc::sim::DutyCycleEncoderSim::SetConnected ( bool  isConnected)

Set if the encoder is connected.

Parameters
isConnectedWhether or not the sensor is connected.

◆ SetDistance()

void frc::sim::DutyCycleEncoderSim::SetDistance ( double  distance)

Set the distance.

Parameters
distanceThe distance.

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