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;
188 hal::SimDevice m_simDevice;
189 hal::SimBoolean m_simRangeValid;
190 hal::SimDouble m_simRange;
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.
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: AprilTagFieldLayout.h:22