WPILibC++ 2025.0.0-alpha-1-9-ga2beb75
UltrasonicSim.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/length.h>
9
10namespace frc {
11
12class Ultrasonic;
13
14namespace sim {
15
16/**
17 * Class to control a simulated {@link Ultrasonic}.
18 */
20 public:
21 /**
22 * Constructor.
23 *
24 * @param ultrasonic The real ultrasonic to simulate
25 */
26 explicit UltrasonicSim(const Ultrasonic& ultrasonic);
27
28 /**
29 * Constructor.
30 *
31 * @param ping unused.
32 * @param echo the ultrasonic's echo channel.
33 */
34 UltrasonicSim(int ping, int echo);
35
36 /**
37 * Sets if the range measurement is valid.
38 *
39 * @param valid True if valid
40 */
41 void SetRangeValid(bool valid);
42
43 /**
44 * Sets the range measurement.
45 *
46 * @param range The range.
47 */
48 void SetRange(units::inch_t range);
49
50 private:
51 hal::SimBoolean m_simRangeValid;
52 hal::SimDouble m_simRange;
53};
54
55} // namespace sim
56} // namespace frc
Ultrasonic rangefinder class.
Definition: Ultrasonic.h:39
Class to control a simulated Ultrasonic.
Definition: UltrasonicSim.h:19
UltrasonicSim(int ping, int echo)
Constructor.
void SetRange(units::inch_t range)
Sets the range measurement.
void SetRangeValid(bool valid)
Sets if the range measurement is valid.
UltrasonicSim(const Ultrasonic &ultrasonic)
Constructor.
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