WPILibC++ 2025.0.0-alpha-1-9-ga2beb75
DutyCycleEncoderSim.h
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
7#include <hal/SimDevice.h>
8#include <units/angle.h>
9
10namespace frc {
11
12class DutyCycleEncoder;
13
14namespace sim {
15
16/**
17 * Class to control a simulated duty cycle encoder.
18 */
20 public:
21 /**
22 * Constructs from a DutyCycleEncoder object.
23 *
24 * @param encoder DutyCycleEncoder to simulate
25 */
26 explicit DutyCycleEncoderSim(const DutyCycleEncoder& encoder);
27
28 /**
29 * Constructs from a digital input channel.
30 *
31 * @param channel digital input channel
32 */
33 explicit DutyCycleEncoderSim(int channel);
34
35 /**
36 * Get the position.
37 *
38 * @return The position.
39 */
40 double Get();
41
42 /**
43 * Set the position.
44 *
45 * @param value The position.
46 */
47 void Set(double value);
48
49 /**
50 * Get if the encoder is connected.
51 *
52 * @return true if the encoder is connected.
53 */
55
56 /**
57 * Set if the encoder is connected.
58 *
59 * @param isConnected Whether or not the sensor is connected.
60 */
61 void SetConnected(bool isConnected);
62
63 private:
64 hal::SimDouble m_simPosition;
65 hal::SimBoolean m_simIsConnected;
66};
67
68} // namespace sim
69} // namespace frc
Class for supporting duty cycle/PWM encoders, such as the US Digital MA3 with PWM Output,...
Definition: DutyCycleEncoder.h:26
Class to control a simulated duty cycle encoder.
Definition: DutyCycleEncoderSim.h:19
DutyCycleEncoderSim(int channel)
Constructs from a digital input channel.
void SetConnected(bool isConnected)
Set if the encoder is connected.
void Set(double value)
Set the position.
double Get()
Get the position.
DutyCycleEncoderSim(const DutyCycleEncoder &encoder)
Constructs from a DutyCycleEncoder object.
bool IsConnected()
Get if the encoder is connected.
C++ wrapper around a HAL simulator boolean value handle.
Definition: SimDevice.h:611
C++ wrapper around a HAL simulator double value handle.
Definition: SimDevice.h:536
Definition: AprilTagDetector_cv.h:11