WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
WaitCommand.hpp
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
10#include "wpi/units/time.hpp"
11
12namespace wpi::cmd {
13/**
14 * A command that does nothing but takes a specified amount of time to finish.
15 *
16 * This class is provided by the NewCommands VendorDep
17 */
18class WaitCommand : public CommandHelper<Command, WaitCommand> {
19 public:
20 /**
21 * Creates a new WaitCommand. This command will do nothing, and end after the
22 * specified duration.
23 *
24 * @param duration the time to wait
25 */
26 explicit WaitCommand(wpi::units::second_t duration);
27
28 WaitCommand(WaitCommand&& other) = default;
29
30 WaitCommand(const WaitCommand& other) = default;
31
32 void Initialize() override;
33
34 void End(bool interrupted) override;
35
36 bool IsFinished() override;
37
38 bool RunsWhenDisabled() const override;
39
41
42 protected:
43 /// The timer used for waiting.
45
46 private:
47 wpi::units::second_t m_duration;
48};
49} // namespace wpi::cmd
A timer class.
Definition Timer.hpp:36
WaitCommand(WaitCommand &&other)=default
WaitCommand(wpi::units::second_t duration)
Creates a new WaitCommand.
WaitCommand(const WaitCommand &other)=default
void InitSendable(wpi::util::SendableBuilder &builder) override
bool IsFinished() override
void End(bool interrupted) override
wpi::Timer m_timer
The timer used for waiting.
Definition WaitCommand.hpp:44
void Initialize() override
bool RunsWhenDisabled() const override
Helper class for building Sendable dashboard representations.
Definition SendableBuilder.hpp:21
Definition CommandNiDsStadiaController.hpp:15