WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
DutyCycleEncoderSim.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
8
9namespace wpi {
10
12
13namespace sim {
14
15/**
16 * Class to control a simulated duty cycle encoder.
17 */
19 public:
20 /**
21 * Constructs from a DutyCycleEncoder object.
22 *
23 * @param encoder DutyCycleEncoder to simulate
24 */
25 explicit DutyCycleEncoderSim(const DutyCycleEncoder& encoder);
26
27 /**
28 * Constructs from a digital input channel.
29 *
30 * @param channel digital input channel
31 */
32 explicit DutyCycleEncoderSim(int channel);
33
34 /**
35 * Get the position.
36 *
37 * @return The position.
38 */
39 double Get();
40
41 /**
42 * Set the position.
43 *
44 * @param value The position.
45 */
46 void Set(double value);
47
48 /**
49 * Get if the encoder is connected.
50 *
51 * @return true if the encoder is connected.
52 */
54
55 /**
56 * Set if the encoder is connected.
57 *
58 * @param isConnected Whether or not the sensor is connected.
59 */
60 void SetConnected(bool isConnected);
61
62 private:
63 wpi::hal::SimDouble m_simPosition;
64 wpi::hal::SimBoolean m_simIsConnected;
65};
66
67} // namespace sim
68} // namespace wpi
Class for supporting duty cycle/PWM encoders, such as the US Digital MA3 with PWM Output,...
Definition DutyCycleEncoder.hpp:24
C++ wrapper around a HAL simulator boolean value handle.
Definition SimDevice.hpp:244
C++ wrapper around a HAL simulator double value handle.
Definition SimDevice.hpp:169
void SetConnected(bool isConnected)
Set if the encoder is connected.
DutyCycleEncoderSim(int channel)
Constructs from a digital input channel.
void Set(double value)
Set the position.
double Get()
Get the position.
bool IsConnected()
Get if the encoder is connected.
DutyCycleEncoderSim(const DutyCycleEncoder &encoder)
Constructs from a DutyCycleEncoder object.
Definition CTREPCMSim.hpp:13
Definition CvSource.hpp:15