Loading [MathJax]/extensions/tex2jax.js
WPILibC++
2025.3.2
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
Enumerations
a
b
c
d
e
f
h
i
l
m
n
o
p
r
s
t
u
v
Enumerator
a
b
c
f
h
i
k
l
m
o
p
s
t
u
w
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
Enumerator
a
b
c
f
i
k
m
o
p
r
s
v
Related Symbols
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Typedefs
a
b
c
d
e
f
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Enumerations
a
c
e
h
m
n
p
r
s
t
u
w
Enumerator
c
h
i
m
n
p
u
w
Macros
_
a
c
d
e
f
g
h
i
j
k
l
m
n
p
r
s
t
u
v
w
x
▼
WPILibC++
LICENSE
Deprecated List
Todo List
►
Topics
►
Namespaces
►
Concepts
►
Classes
▼
Files
▼
File List
►
cameraserver
►
debugging
►
fmt
►
frc
►
frc
►
frc
▼
frc
►
counter
►
drive
►
event
►
internal
►
livewindow
►
motorcontrol
►
shuffleboard
▼
simulation
►
AddressableLEDSim.h
►
ADIS16448_IMUSim.h
►
ADIS16470_IMUSim.h
►
ADXL345Sim.h
►
ADXL362Sim.h
►
ADXRS450_GyroSim.h
►
AnalogEncoderSim.h
►
AnalogGyroSim.h
►
AnalogInputSim.h
►
AnalogOutputSim.h
►
AnalogTriggerSim.h
►
BatterySim.h
►
BuiltInAccelerometerSim.h
►
CallbackStore.h
►
CTREPCMSim.h
►
DCMotorSim.h
►
DifferentialDrivetrainSim.h
►
DigitalPWMSim.h
►
DIOSim.h
►
DoubleSolenoidSim.h
►
DriverStationSim.h
►
DutyCycleEncoderSim.h
►
DutyCycleSim.h
►
ElevatorSim.h
►
EncoderSim.h
►
FlywheelSim.h
►
GenericHIDSim.h
►
JoystickSim.h
►
LinearSystemSim.h
►
PneumaticsBaseSim.h
►
PowerDistributionSim.h
►
PWMSim.h
►
RelaySim.h
►
REVPHSim.h
►
RoboRioSim.h
►
SendableChooserSim.h
►
SharpIRSim.h
►
SimDeviceSim.h
►
SimHooks.h
►
SingleJointedArmSim.h
►
SolenoidSim.h
►
SPIAccelerometerSim.h
►
UltrasonicSim.h
►
smartdashboard
►
sysid
►
util
►
AddressableLED.h
►
ADIS16448_IMU.h
►
ADIS16470_IMU.h
►
ADXL345_I2C.h
►
ADXL345_SPI.h
►
ADXL362.h
►
ADXRS450_Gyro.h
►
Alert.h
►
AnalogAccelerometer.h
►
AnalogEncoder.h
►
AnalogGyro.h
►
AnalogInput.h
►
AnalogOutput.h
►
AnalogPotentiometer.h
►
AnalogTrigger.h
►
AnalogTriggerOutput.h
►
AnalogTriggerType.h
►
AsynchronousInterrupt.h
►
BuiltInAccelerometer.h
►
CAN.h
►
Compressor.h
►
CompressorConfigType.h
►
Counter.h
►
CounterBase.h
►
DataLogManager.h
►
DigitalGlitchFilter.h
►
DigitalInput.h
►
DigitalOutput.h
►
DigitalSource.h
►
DMA.h
►
DMASample.h
►
DoubleSolenoid.h
►
DriverStation.h
►
DSControlWord.h
►
DutyCycle.h
►
DutyCycleEncoder.h
►
Encoder.h
►
Errors.h
►
Filesystem.h
►
GenericHID.h
►
I2C.h
►
IterativeRobotBase.h
►
Joystick.h
►
LEDPattern.h
►
MotorSafety.h
►
Notifier.h
►
PneumaticHub.h
►
PneumaticsBase.h
►
PneumaticsControlModule.h
►
PneumaticsModuleType.h
►
PowerDistribution.h
►
Preferences.h
►
PWM.h
►
Relay.h
►
Resource.h
►
RobotBase.h
►
RobotController.h
►
RobotState.h
►
RuntimeType.h
►
ScopedTracer.h
►
SensorUtil.h
►
SerialPort.h
►
Servo.h
►
SharpIR.h
►
Solenoid.h
►
SPI.h
►
SynchronousInterrupt.h
►
Threads.h
►
TimedRobot.h
►
Timer.h
►
TimesliceRobot.h
►
Tracer.h
►
Ultrasonic.h
►
Watchdog.h
WPIErrors.mac
WPIWarnings.mac
►
frc
►
frc
►
frc2
►
frc2
►
generated
►
generated
►
generated
►
hal
►
networktables
►
thirdparty
►
thirdparty
►
thirdparty
►
units
►
vision
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpimath
►
wpinet
cscore.h
►
cscore_c.h
►
cscore_cpp.h
►
cscore_cv.h
cscore_oo.h
►
cscore_raw.h
►
cscore_runloop.h
ntcore.h
►
ntcore_c.h
►
ntcore_cpp.h
►
ntcore_test.h
►
WPILibVersion.h
debugging.hpp
►
pb.h
►
pb_common.h
►
pb_decode.h
►
pb_encode.h
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
AnalogInputSim.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 <memory>
8
9
#include "
frc/simulation/CallbackStore.h
"
10
11
namespace
frc
{
12
13
class
AnalogInput
;
14
15
namespace
sim {
16
17
/**
18
* Class to control a simulated analog input.
19
*/
20
class
AnalogInputSim
{
21
public
:
22
/**
23
* Constructs from an AnalogInput object.
24
*
25
* @param analogInput AnalogInput to simulate
26
*/
27
explicit
AnalogInputSim
(
const
AnalogInput
& analogInput);
28
29
/**
30
* Constructs from an analog input channel number.
31
*
32
* @param channel Channel number
33
*/
34
explicit
AnalogInputSim
(
int
channel);
35
36
/**
37
* Register a callback on whether the analog input is initialized.
38
*
39
* @param callback the callback that will be called whenever the analog input
40
* is initialized
41
* @param initialNotify if true, the callback will be run on the initial value
42
* @return the CallbackStore object associated with this callback
43
*/
44
[[nodiscard]]
45
std::unique_ptr<CallbackStore>
RegisterInitializedCallback
(
46
NotifyCallback
callback,
bool
initialNotify);
47
48
/**
49
* Check if this analog input has been initialized.
50
*
51
* @return true if initialized
52
*/
53
bool
GetInitialized
()
const
;
54
55
/**
56
* Change whether this analog input has been initialized.
57
*
58
* @param initialized the new value
59
*/
60
void
SetInitialized
(
bool
initialized);
61
62
/**
63
* Register a callback on the number of average bits.
64
*
65
* @param callback the callback that will be called whenever the number of
66
* average bits is changed
67
* @param initialNotify if true, the callback will be run on the initial value
68
* @return the CallbackStore object associated with this callback
69
*/
70
[[nodiscard]]
71
std::unique_ptr<CallbackStore>
RegisterAverageBitsCallback
(
72
NotifyCallback
callback,
bool
initialNotify);
73
74
/**
75
* Get the number of average bits.
76
*
77
* @return the number of average bits
78
*/
79
int
GetAverageBits
()
const
;
80
81
/**
82
* Change the number of average bits.
83
*
84
* @param averageBits the new value
85
*/
86
void
SetAverageBits
(
int
averageBits);
87
88
/**
89
* Register a callback on the amount of oversampling bits.
90
*
91
* @param callback the callback that will be called whenever the oversampling
92
* bits are changed
93
* @param initialNotify if true, the callback will be run on the initial value
94
* @return the CallbackStore object associated with this callback
95
*/
96
[[nodiscard]]
97
std::unique_ptr<CallbackStore>
RegisterOversampleBitsCallback
(
98
NotifyCallback
callback,
bool
initialNotify);
99
100
/**
101
* Get the amount of oversampling bits.
102
*
103
* @return the amount of oversampling bits
104
*/
105
int
GetOversampleBits
()
const
;
106
107
/**
108
* Change the amount of oversampling bits.
109
*
110
* @param oversampleBits the new value
111
*/
112
void
SetOversampleBits
(
int
oversampleBits);
113
114
/**
115
* Register a callback on the voltage.
116
*
117
* @param callback the callback that will be called whenever the voltage is
118
* changed
119
* @param initialNotify if true, the callback will be run on the initial value
120
* @return the CallbackStore object associated with this callback
121
*/
122
[[nodiscard]]
123
std::unique_ptr<CallbackStore>
RegisterVoltageCallback
(
124
NotifyCallback
callback,
bool
initialNotify);
125
126
/**
127
* Get the voltage.
128
*
129
* @return the voltage
130
*/
131
double
GetVoltage
()
const
;
132
133
/**
134
* Change the voltage.
135
*
136
* @param voltage the new value
137
*/
138
void
SetVoltage
(
double
voltage);
139
140
/**
141
* Register a callback on whether the accumulator is initialized.
142
*
143
* @param callback the callback that will be called whenever the accumulator
144
* is initialized
145
* @param initialNotify if true, the callback will be run on the initial value
146
* @return the CallbackStore object associated with this callback
147
*/
148
[[nodiscard]]
149
std::unique_ptr<CallbackStore>
RegisterAccumulatorInitializedCallback
(
150
NotifyCallback
callback,
bool
initialNotify);
151
152
/**
153
* Check if the accumulator has been initialized.
154
*
155
* @return true if initialized
156
*/
157
bool
GetAccumulatorInitialized
()
const
;
158
159
/**
160
* Change whether the accumulator has been initialized.
161
*
162
* @param accumulatorInitialized the new value
163
*/
164
void
SetAccumulatorInitialized
(
bool
accumulatorInitialized);
165
166
/**
167
* Register a callback on the accumulator value.
168
*
169
* @param callback the callback that will be called whenever the accumulator
170
* value is changed
171
* @param initialNotify if true, the callback will be run on the initial value
172
* @return the CallbackStore object associated with this callback
173
*/
174
[[nodiscard]]
175
std::unique_ptr<CallbackStore>
RegisterAccumulatorValueCallback
(
176
NotifyCallback
callback,
bool
initialNotify);
177
178
/**
179
* Get the accumulator value.
180
*
181
* @return the accumulator value
182
*/
183
int64_t
GetAccumulatorValue
()
const
;
184
185
/**
186
* Change the accumulator value.
187
*
188
* @param accumulatorValue the new value
189
*/
190
void
SetAccumulatorValue
(int64_t accumulatorValue);
191
192
/**
193
* Register a callback on the accumulator count.
194
*
195
* @param callback the callback that will be called whenever the accumulator
196
* count is changed
197
* @param initialNotify if true, the callback will be run on the initial value
198
* @return the CallbackStore object associated with this callback
199
*/
200
[[nodiscard]]
201
std::unique_ptr<CallbackStore>
RegisterAccumulatorCountCallback
(
202
NotifyCallback
callback,
bool
initialNotify);
203
204
/**
205
* Get the accumulator count.
206
*
207
* @return the accumulator count.
208
*/
209
int64_t
GetAccumulatorCount
()
const
;
210
211
/**
212
* Change the accumulator count.
213
*
214
* @param accumulatorCount the new count.
215
*/
216
void
SetAccumulatorCount
(int64_t accumulatorCount);
217
218
/**
219
* Register a callback on the accumulator center.
220
*
221
* @param callback the callback that will be called whenever the accumulator
222
* center is changed
223
* @param initialNotify if true, the callback will be run on the initial value
224
* @return the CallbackStore object associated with this callback
225
*/
226
[[nodiscard]]
227
std::unique_ptr<CallbackStore>
RegisterAccumulatorCenterCallback
(
228
NotifyCallback
callback,
bool
initialNotify);
229
230
/**
231
* Get the accumulator center.
232
*
233
* @return the accumulator center
234
*/
235
int
GetAccumulatorCenter
()
const
;
236
237
/**
238
* Change the accumulator center.
239
*
240
* @param accumulatorCenter the new center
241
*/
242
void
SetAccumulatorCenter
(
int
accumulatorCenter);
243
244
/**
245
* Register a callback on the accumulator deadband.
246
*
247
* @param callback the callback that will be called whenever the accumulator
248
* deadband is changed
249
* @param initialNotify if true, the callback will be run on the initial value
250
* @return the CallbackStore object associated with this callback
251
*/
252
[[nodiscard]]
253
std::unique_ptr<CallbackStore>
RegisterAccumulatorDeadbandCallback
(
254
NotifyCallback
callback,
bool
initialNotify);
255
256
/**
257
* Get the accumulator deadband.
258
*
259
* @return the accumulator deadband
260
*/
261
int
GetAccumulatorDeadband
()
const
;
262
263
/**
264
* Change the accumulator deadband.
265
*
266
* @param accumulatorDeadband the new deadband
267
*/
268
void
SetAccumulatorDeadband
(
int
accumulatorDeadband);
269
270
/**
271
* Reset all simulation data for this object.
272
*/
273
void
ResetData
();
274
275
private
:
276
int
m_index;
277
};
20
class
AnalogInputSim
{
…
};
278
}
// namespace sim
279
}
// namespace frc
CallbackStore.h
frc::AnalogInput
Analog input class.
Definition
AnalogInput.h:32
frc::sim::AnalogInputSim
Class to control a simulated analog input.
Definition
AnalogInputSim.h:20
frc::sim::AnalogInputSim::RegisterAccumulatorValueCallback
std::unique_ptr< CallbackStore > RegisterAccumulatorValueCallback(NotifyCallback callback, bool initialNotify)
Register a callback on the accumulator value.
frc::sim::AnalogInputSim::RegisterAverageBitsCallback
std::unique_ptr< CallbackStore > RegisterAverageBitsCallback(NotifyCallback callback, bool initialNotify)
Register a callback on the number of average bits.
frc::sim::AnalogInputSim::GetAccumulatorDeadband
int GetAccumulatorDeadband() const
Get the accumulator deadband.
frc::sim::AnalogInputSim::GetAverageBits
int GetAverageBits() const
Get the number of average bits.
frc::sim::AnalogInputSim::GetInitialized
bool GetInitialized() const
Check if this analog input has been initialized.
frc::sim::AnalogInputSim::SetAccumulatorCount
void SetAccumulatorCount(int64_t accumulatorCount)
Change the accumulator count.
frc::sim::AnalogInputSim::RegisterAccumulatorDeadbandCallback
std::unique_ptr< CallbackStore > RegisterAccumulatorDeadbandCallback(NotifyCallback callback, bool initialNotify)
Register a callback on the accumulator deadband.
frc::sim::AnalogInputSim::GetAccumulatorCenter
int GetAccumulatorCenter() const
Get the accumulator center.
frc::sim::AnalogInputSim::GetVoltage
double GetVoltage() const
Get the voltage.
frc::sim::AnalogInputSim::GetOversampleBits
int GetOversampleBits() const
Get the amount of oversampling bits.
frc::sim::AnalogInputSim::RegisterAccumulatorCenterCallback
std::unique_ptr< CallbackStore > RegisterAccumulatorCenterCallback(NotifyCallback callback, bool initialNotify)
Register a callback on the accumulator center.
frc::sim::AnalogInputSim::SetVoltage
void SetVoltage(double voltage)
Change the voltage.
frc::sim::AnalogInputSim::SetAccumulatorInitialized
void SetAccumulatorInitialized(bool accumulatorInitialized)
Change whether the accumulator has been initialized.
frc::sim::AnalogInputSim::RegisterInitializedCallback
std::unique_ptr< CallbackStore > RegisterInitializedCallback(NotifyCallback callback, bool initialNotify)
Register a callback on whether the analog input is initialized.
frc::sim::AnalogInputSim::SetInitialized
void SetInitialized(bool initialized)
Change whether this analog input has been initialized.
frc::sim::AnalogInputSim::GetAccumulatorCount
int64_t GetAccumulatorCount() const
Get the accumulator count.
frc::sim::AnalogInputSim::RegisterOversampleBitsCallback
std::unique_ptr< CallbackStore > RegisterOversampleBitsCallback(NotifyCallback callback, bool initialNotify)
Register a callback on the amount of oversampling bits.
frc::sim::AnalogInputSim::RegisterAccumulatorCountCallback
std::unique_ptr< CallbackStore > RegisterAccumulatorCountCallback(NotifyCallback callback, bool initialNotify)
Register a callback on the accumulator count.
frc::sim::AnalogInputSim::GetAccumulatorValue
int64_t GetAccumulatorValue() const
Get the accumulator value.
frc::sim::AnalogInputSim::AnalogInputSim
AnalogInputSim(const AnalogInput &analogInput)
Constructs from an AnalogInput object.
frc::sim::AnalogInputSim::SetAccumulatorValue
void SetAccumulatorValue(int64_t accumulatorValue)
Change the accumulator value.
frc::sim::AnalogInputSim::RegisterVoltageCallback
std::unique_ptr< CallbackStore > RegisterVoltageCallback(NotifyCallback callback, bool initialNotify)
Register a callback on the voltage.
frc::sim::AnalogInputSim::SetAccumulatorCenter
void SetAccumulatorCenter(int accumulatorCenter)
Change the accumulator center.
frc::sim::AnalogInputSim::SetAccumulatorDeadband
void SetAccumulatorDeadband(int accumulatorDeadband)
Change the accumulator deadband.
frc::sim::AnalogInputSim::AnalogInputSim
AnalogInputSim(int channel)
Constructs from an analog input channel number.
frc::sim::AnalogInputSim::GetAccumulatorInitialized
bool GetAccumulatorInitialized() const
Check if the accumulator has been initialized.
frc::sim::AnalogInputSim::SetOversampleBits
void SetOversampleBits(int oversampleBits)
Change the amount of oversampling bits.
frc::sim::AnalogInputSim::SetAverageBits
void SetAverageBits(int averageBits)
Change the number of average bits.
frc::sim::AnalogInputSim::ResetData
void ResetData()
Reset all simulation data for this object.
frc::sim::AnalogInputSim::RegisterAccumulatorInitializedCallback
std::unique_ptr< CallbackStore > RegisterAccumulatorInitializedCallback(NotifyCallback callback, bool initialNotify)
Register a callback on whether the accumulator is initialized.
frc::sim::NotifyCallback
std::function< void(std::string_view, const HAL_Value *)> NotifyCallback
Definition
CallbackStore.h:14
frc
Definition
CAN.h:11
hal::HAL_HandleEnum::AnalogInput
@ AnalogInput
frc
simulation
AnalogInputSim.h
Generated on Mon Mar 17 2025 23:50:34 for WPILibC++ by
1.12.0