86 std::shared_ptr<DigitalInput> echoChannel);
170 static void UltrasonicChecker();
173 static constexpr auto kPingTime = 10_us;
176 static constexpr auto kMaxUltrasonicTime = 0.1_s;
177 static constexpr auto kSpeedOfSound = 1130_fps;
180 static std::thread m_thread;
183 static std::vector<Ultrasonic*> m_sensors;
186 static std::atomic<bool> m_automaticEnabled;
188 std::shared_ptr<DigitalOutput> m_pingChannel;
189 std::shared_ptr<DigitalInput> m_echoChannel;
190 bool m_enabled =
false;
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:35
Class to write to digital outputs.
Definition: DigitalOutput.h:25
Ultrasonic rangefinder class.
Definition: Ultrasonic.h:39
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
Ultrasonic(Ultrasonic &&)=default
static void SetAutomaticMode(bool enabling)
Turn Automatic mode on/off.
Ultrasonic(std::shared_ptr< DigitalOutput > pingChannel, std::shared_ptr< DigitalInput > echoChannel)
Create an instance of an Ultrasonic Sensor from a DigitalInput for the echo channel and a DigitalOutp...
void Ping()
Single ping to ultrasonic sensor.
Ultrasonic(int pingChannel, int echoChannel)
Create an instance of the Ultrasonic Sensor.
void SetEnabled(bool enable)
int GetEchoChannel() const
Returns the echo channel.
Ultrasonic(DigitalOutput &pingChannel, DigitalInput &echoChannel)
Create an instance of an Ultrasonic Sensor from a DigitalInput for the echo channel and a DigitalOutp...
Ultrasonic & operator=(Ultrasonic &&)=default
units::meter_t GetRange() const
Get the range from the ultrasonic sensor.
Ultrasonic(DigitalOutput *pingChannel, DigitalInput *echoChannel)
Create an instance of an Ultrasonic Sensor from a DigitalInput for the echo channel and a DigitalOutp...
bool IsRangeValid() const
Check if there is a valid range measurement.
C++ wrapper around a HAL simulator boolean value handle.
Definition: SimDevice.h:608
A move-only C++ wrapper around a HAL simulator device handle.
Definition: SimDevice.h:642
C++ wrapper around a HAL simulator double value handle.
Definition: SimDevice.h:533
Helper class for building Sendable dashboard representations.
Definition: SendableBuilder.h:21
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:19
Interface for Sendable objects.
Definition: Sendable.h:16
Definition: AprilTagPoseEstimator.h:15