mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Change C++ WaitCommand to use units (#1865)
Also remove unique_ptr usage.
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/units.h>
|
||||
|
||||
/**
|
||||
* The Constants header provides a convenient place for teams to hold robot-wide
|
||||
* numerical or bool constants. This should not be used for any other purpose.
|
||||
@@ -64,8 +66,8 @@ const double kFeederSpeed = .5;
|
||||
} // namespace ShooterConstants
|
||||
|
||||
namespace AutoConstants {
|
||||
const double kAutoTimeoutSeconds = 12;
|
||||
const double kAutoShootTimeSeconds = 7;
|
||||
constexpr auto kAutoTimeoutSeconds = 12_s;
|
||||
constexpr auto kAutoShootTimeSeconds = 7_s;
|
||||
} // namespace AutoConstants
|
||||
|
||||
namespace OIConstants {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "Robot.h"
|
||||
|
||||
OpenClaw::OpenClaw(Claw* claw)
|
||||
: frc2::CommandHelper<frc2::WaitCommand, OpenClaw>(1), m_claw(claw) {
|
||||
: frc2::CommandHelper<frc2::WaitCommand, OpenClaw>(1_s), m_claw(claw) {
|
||||
SetName("OpenClaw");
|
||||
AddRequirements({m_claw});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ class RobotContainer {
|
||||
// Assorted commands to be bound to buttons
|
||||
|
||||
// Turn to 90 degrees, with a 5 second timeout
|
||||
frc2::ParallelRaceGroup m_turnTo90 = TurnToAngle{90, &m_drive}.WithTimeout(5);
|
||||
frc2::ParallelRaceGroup m_turnTo90 =
|
||||
TurnToAngle{90, &m_drive}.WithTimeout(5_s);
|
||||
|
||||
// Stabilize the robot while driving
|
||||
frc2::PIDCommand m_stabilizeDriving{
|
||||
|
||||
@@ -36,7 +36,7 @@ class RobotContainer {
|
||||
// Three commands that do nothing; for demonstration purposes.
|
||||
frc2::InstantCommand m_instantCommand1;
|
||||
frc2::InstantCommand m_instantCommand2;
|
||||
frc2::WaitCommand m_waitCommand{5};
|
||||
frc2::WaitCommand m_waitCommand{5_s};
|
||||
|
||||
void ConfigureButtonBindings();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user