86 std::shared_ptr<DigitalInput> echoChannel);
165 static void UltrasonicChecker();
168 static constexpr auto kPingTime = 10_us;
171 static constexpr auto kMaxUltrasonicTime = 0.1_s;
172 static constexpr auto kSpeedOfSound = 1130_fps;
175 static std::thread m_thread;
178 static std::vector<Ultrasonic*> m_sensors;
181 static std::atomic<bool> m_automaticEnabled;
183 std::shared_ptr<DigitalOutput> m_pingChannel;
184 std::shared_ptr<DigitalInput> m_echoChannel;
185 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
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:610
A move-only C++ wrapper around a HAL simulator device handle.
Definition: SimDevice.h:644
C++ wrapper around a HAL simulator double value handle.
Definition: SimDevice.h:535
Definition: SendableBuilder.h:18
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