Squashed 'third_party/allwpilib_2019/' changes from e20d96ea4e..b0167e6337
32c62449be Add ArrayRef overloads to new command classes (#2216)
6190fcb237 Run wpiformat (#2218)
012d93b2bd Use an explicit stack instead of recursion when parameterizing splines (#2197)
222669dc2c Fix trapezoidal profile PID controller setpoint bug (#2210)
abe25b795b TrajectoryUtil.toPathweaverJson: Create parent directories (#2214)
354185189c Update ProjectYear to 2020 (#2212)
f14fe434a1 Add (Old) qualifier to old subsystem (#2211)
e874ba9313 Add Color classes for use with AddressableLED (#2127)
96348e835a Fix C++ SendableRegistry::AddChild() (#2207)
d91796f8d2 fix clang-format version number (#2206)
9abce8eb06 Fix subsystem LiveWindow usage (#2202)
8b4508ad53 Use default path for networktables.ini in simulation (#2205)
5b7dd186d2 Add templates for new commands for vscode plugin (#2016)
6ea13ea8f3 ntcore: Add support for local-only operation (#2204)
44bcf7fb4d Java examples: use non-static imports for constants (#2191)
c7a1dfc0bc Add SlewRateLimiter class (#2192)
a12bb447e4 Fail cmake build if python3 generate_numbers.py fails (#2203)
c4bd54ef44 Add JNI binding to suppress driver station error/warning messages (#2200)
f9a11cce5e Remove -no-module-directories flag from javadoc build (#2201)
6008671c30 Report WPILib version as part of usage reporting (#2199)
7b952d599d Add usage reporting for many new things (#2184)
93cdf68694 Add Constants.cpp for MecanumControllerCommand example (#2196)
0c6f24562f Fix bug in ULEB128 decoding (#2195)
bdc1cab013 Add support for configuring SPI Auto Stall Config (#2193)
3259cffc63 Add transform methods to Trajectory (#2187)
67b59f2b31 Minor improvements/fixes to new command framework (#2186)
1ce24a7a2f Add 2020 speed controllers (#2188)
635882a9f7 Add getter for initial pose in Trajectory (#2180)
71a22861eb Use ManagedStatic for CameraServer (#2174)
9cb69c5b46 Add a way to pass in a preconstructed value to ManagedStatic (#2175)
5e08bb28f8 Add docs and lifecycle tasks for faster dev builds (#2182)
ea4d1a39e1 Update characterization values to match real robot (#2183)
31b588d961 Fix ArmFeedforward Javadocs (#2176)
0b80d566ad Use ChipObject HMB function for LED (#2173)
f8294e689b Sim GUI: Add a bit of spacing to the analog inputs (#2170)
b78f115fcf Work around VS2019 16.4.0 bugs (#2171)
b468c51251 Change AddressableLED example to use consistent PWM port (#2168)
023c088290 Add toString() to relevant kinematics classes (#2160)
8a11d13a39 Fix C++ DutyCycleEncoder int constructor (#2166)
daa81c64a7 Minor javadoc fix in SwerveDriveKinematicsConstraint (#2167)
Change-Id: Ied6a4d039f2b95381e1d2124fcc70d52580cc165
git-subtree-dir: third_party/allwpilib_2019
git-subtree-split: b0167e6337135545e7053acb89dd5726accc7dec
diff --git a/wpilibcExamples/build.gradle b/wpilibcExamples/build.gradle
index 12279df..c6c1dff 100644
--- a/wpilibcExamples/build.gradle
+++ b/wpilibcExamples/build.gradle
@@ -6,6 +6,8 @@
apply plugin: 'edu.wpi.first.NativeUtils'
apply plugin: ExtraTasks
+evaluationDependsOn(':hal')
+
apply from: '../shared/config.gradle'
ext.examplesMap = [:]
@@ -222,6 +224,25 @@
}
apply from: 'publish.gradle'
+model {
+ tasks {
+ def c = $.components
+ project.tasks.register('buildDesktopCpp') { compileTask->
+ def systemArch = getCurrentArch()
+ c.each {
+ if (it in NativeExecutableSpec && it.name) {
+ it.binaries.each {
+ def arch = it.targetPlatform.name
+ if (arch == systemArch && it.buildType.name == 'debug') {
+ compileTask.dependsOn it.tasks.link
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
ext {
templateDirectory = new File("$projectDir/src/main/cpp/templates/")
templateFile = new File("$projectDir/src/main/cpp/templates/templates.json")
diff --git a/wpilibcExamples/src/main/cpp/commands/command2/ReplaceMeCommand2.cpp b/wpilibcExamples/src/main/cpp/commands/command2/ReplaceMeCommand2.cpp
new file mode 100644
index 0000000..e8085a1
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/command2/ReplaceMeCommand2.cpp
@@ -0,0 +1,24 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeCommand2.h"
+
+ReplaceMeCommand2::ReplaceMeCommand2() {
+ // Use addRequirements() here to declare subsystem dependencies.
+}
+
+// Called when the command is initially scheduled.
+void ReplaceMeCommand2::Initialize() {}
+
+// Called repeatedly when this Command is scheduled to run
+void ReplaceMeCommand2::Execute() {}
+
+// Called once the command ends or is interrupted.
+void ReplaceMeCommand2::End(bool interrupted) {}
+
+// Returns true when the command should end.
+bool ReplaceMeCommand2::IsFinished() { return false; }
diff --git a/wpilibcExamples/src/main/cpp/commands/command2/ReplaceMeCommand2.h b/wpilibcExamples/src/main/cpp/commands/command2/ReplaceMeCommand2.h
new file mode 100644
index 0000000..fd041fa
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/command2/ReplaceMeCommand2.h
@@ -0,0 +1,32 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandBase.h>
+#include <frc2/command/CommandHelper.h>
+
+/**
+ * An example command.
+ *
+ * <p>Note that this extends CommandHelper, rather extending CommandBase
+ * directly; this is crucially important, or else the decorator functions in
+ * Command will *not* work!
+ */
+class ReplaceMeCommand2
+ : public frc2::CommandHelper<frc2::CommandBase, ReplaceMeCommand2> {
+ public:
+ ReplaceMeCommand2();
+
+ void Initialize() override;
+
+ void Execute() override;
+
+ void End(bool interrupted) override;
+
+ bool IsFinished() override;
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/commands.json b/wpilibcExamples/src/main/cpp/commands/commands.json
index bb8cbb6..d039a73 100644
--- a/wpilibcExamples/src/main/cpp/commands/commands.json
+++ b/wpilibcExamples/src/main/cpp/commands/commands.json
@@ -12,10 +12,11 @@
"source": [
"ReplaceMeEmptyClass.cpp"
],
- "replacename": "ReplaceMeEmptyClass"
+ "replacename": "ReplaceMeEmptyClass",
+ "commandversion": 0
},
{
- "name": "Command",
+ "name": "Command (Old)",
"description": "Create a base command",
"tags": [
"command"
@@ -27,10 +28,11 @@
"source": [
"ReplaceMeCommand.cpp"
],
- "replacename": "ReplaceMeCommand"
+ "replacename": "ReplaceMeCommand",
+ "commandversion": 1
},
{
- "name": "Command Group",
+ "name": "Command Group (Old)",
"description": "Create a command group",
"tags": [
"commandgroup"
@@ -42,10 +44,11 @@
"source": [
"ReplaceMeCommandGroup.cpp"
],
- "replacename": "ReplaceMeCommandGroup"
+ "replacename": "ReplaceMeCommandGroup",
+ "commandversion": 1
},
{
- "name": "Instant Command",
+ "name": "Instant Command (Old)",
"description": "A command that runs immediately",
"tags": [
"instantcommand"
@@ -57,10 +60,11 @@
"source": [
"ReplaceMeInstantCommand.cpp"
],
- "replacename": "ReplaceMeInstantCommand"
+ "replacename": "ReplaceMeInstantCommand",
+ "commandversion": 1
},
{
- "name": "Subsystem",
+ "name": "Subsystem (Old)",
"description": "A subsystem",
"tags": [
"subsystem"
@@ -72,10 +76,11 @@
"source": [
"ReplaceMeSubsystem.cpp"
],
- "replacename": "ReplaceMeSubsystem"
+ "replacename": "ReplaceMeSubsystem",
+ "commandversion": 1
},
{
- "name": "PID Subsystem",
+ "name": "PID Subsystem (Old)",
"description": "A subsystem that runs a PID loop",
"tags": [
"pidsubsystem",
@@ -88,10 +93,11 @@
"source": [
"ReplaceMePIDSubsystem.cpp"
],
- "replacename": "ReplaceMePIDSubsystem"
+ "replacename": "ReplaceMePIDSubsystem",
+ "commandversion": 1
},
{
- "name": "Timed Command",
+ "name": "Timed Command (Old)",
"description": "A command that runs for a specified time",
"tags": [
"timedcommand"
@@ -103,10 +109,11 @@
"source": [
"ReplaceMeTimedCommand.cpp"
],
- "replacename": "ReplaceMeTimedCommand"
+ "replacename": "ReplaceMeTimedCommand",
+ "commandversion": 1
},
{
- "name": "Trigger",
+ "name": "Trigger (Old)",
"description": "A command that runs off of a trigger",
"tags": [
"trigger"
@@ -118,6 +125,215 @@
"source": [
"ReplaceMeTrigger.cpp"
],
- "replacename": "ReplaceMeTrigger"
+ "replacename": "ReplaceMeTrigger",
+ "commandversion": 1
+ },
+ {
+ "name": "Command (New)",
+ "description": "A command.",
+ "tags": [
+ "command"
+ ],
+ "foldername": "command2",
+ "headers": [
+ "ReplaceMeCommand2.h"
+ ],
+ "source": [
+ "ReplaceMeCommand2.cpp"
+ ],
+ "replacename": "ReplaceMeCommand2",
+ "commandversion": 2
+ },
+ {
+ "name": "InstantCommand (New)",
+ "description": "A command that finishes instantly.",
+ "tags": [
+ "instantcommand"
+ ],
+ "foldername": "instantcommand",
+ "headers": [
+ "ReplaceMeInstantCommand2.h"
+ ],
+ "source": [
+ "ReplaceMeInstantCommand2.cpp"
+ ],
+ "replacename": "ReplaceMeInstantCommand2",
+ "commandversion": 2
+ },
+ {
+ "name": "ParallelCommandGroup (New)",
+ "description": "A command group that runs commands in parallel, ending when all commands have finished.",
+ "tags": [
+ "parallelcommandgroup"
+ ],
+ "foldername": "parallelcommandgroup",
+ "headers": [
+ "ReplaceMeParallelCommandGroup.h"
+ ],
+ "source": [
+ "ReplaceMeParallelCommandGroup.cpp"
+ ],
+ "replacename": "ReplaceMeParallelCommandGroup",
+ "commandversion": 2
+ },
+ {
+ "name": "ParallelDeadlineGroup (New)",
+ "description": "A command group that runs commands in parallel, ending when a specific command has finished.",
+ "tags": [
+ "paralleldeadlinegroup"
+ ],
+ "foldername": "paralleldeadlinegroup",
+ "headers": [
+ "ReplaceMeParallelDeadlineGroup.h"
+ ],
+ "source": [
+ "ReplaceMeParallelDeadlineGroup.cpp"
+ ],
+ "replacename": "ReplaceMeParallelDeadlineGroup",
+ "commandversion": 2
+ },
+ {
+ "name": "ParallelRaceGroup (New)",
+ "description": "A command that runs commands in parallel, ending as soon as any command has finished.",
+ "tags": [
+ "parallelracegroup"
+ ],
+ "foldername": "parallelracegroup",
+ "headers": [
+ "ReplaceMeParallelRaceGroup.h"
+ ],
+ "source": [
+ "ReplaceMeParallelRaceGroup.cpp"
+ ],
+ "replacename": "ReplaceMeParallelRaceGroup",
+ "commandversion": 2
+ },
+ {
+ "name": "PIDCommand (New)",
+ "description": "A command that runs a PIDController.",
+ "tags": [
+ "pidcommand"
+ ],
+ "foldername": "pidcommand",
+ "headers": [
+ "ReplaceMePIDCommand.h"
+ ],
+ "source": [
+ "ReplaceMePIDCommand.cpp"
+ ],
+ "replacename": "ReplaceMePIDCommand",
+ "commandversion": 2
+ },
+ {
+ "name": "PIDSubsystem (New)",
+ "description": "A subsystem that runs a PIDController.",
+ "tags": [
+ "pidsubsystem"
+ ],
+ "foldername": "pidsubsystem2",
+ "headers": [
+ "ReplaceMePIDSubsystem2.h"
+ ],
+ "source": [
+ "ReplaceMePIDSubsystem2.cpp"
+ ],
+ "replacename": "ReplaceMePIDSubsystem2",
+ "commandversion": 2
+ },
+ {
+ "name": "ProfiledPIDCommand (New)",
+ "description": "A command that runs a ProfiledPIDController.",
+ "tags": [
+ "profiledpidcommand"
+ ],
+ "foldername": "profiledpidcommand",
+ "headers": [
+ "ReplaceMeProfiledPIDCommand.h"
+ ],
+ "source": [
+ "ReplaceMeProfiledPIDCommand.cpp"
+ ],
+ "replacename": "ReplaceMeProfiledPIDCommand",
+ "commandversion": 2
+ },
+ {
+ "name": "ProfiledPIDSubsystem (New)",
+ "description": "A subsystem that runs a ProfiledPIDController.",
+ "tags": [
+ "profiledpidsubsystem"
+ ],
+ "foldername": "profiledpidsubsystem",
+ "headers": [
+ "ReplaceMeProfiledPIDSubsystem.h"
+ ],
+ "source": [
+ "ReplaceMeProfiledPIDSubsystem.cpp"
+ ],
+ "replacename": "ReplaceMeProfiledPIDSubsystem",
+ "commandversion": 2
+ },
+ {
+ "name": "SequentialCommandGroup (New)",
+ "description": "A command group that runs commands in sequence.",
+ "tags": [
+ "sequentialcommandgroup"
+ ],
+ "foldername": "sequentialcommandgroup",
+ "headers": [
+ "ReplaceMeSequentialCommandGroup.h"
+ ],
+ "source": [
+ "ReplaceMeSequentialCommandGroup.cpp"
+ ],
+ "replacename": "ReplaceMeSequentialCommandGroup",
+ "commandversion": 2
+ },
+ {
+ "name": "Subsystem (New)",
+ "description": "A robot subsystem.",
+ "tags": [
+ "subsystem"
+ ],
+ "foldername": "subsystem2",
+ "headers": [
+ "ReplaceMeSubsystem2.h"
+ ],
+ "source": [
+ "ReplaceMeSubsystem2.cpp"
+ ],
+ "replacename": "ReplaceMeSubsystem2",
+ "commandversion": 2
+ },
+ {
+ "name": "TrapezoidProfileCommand (New)",
+ "description": "A command that executes a trapezoidal motion profile.",
+ "tags": [
+ "trapezoidprofilecommand"
+ ],
+ "foldername": "trapezoidprofilecommand",
+ "headers": [
+ "ReplaceMeTrapezoidProfileCommand.h"
+ ],
+ "source": [
+ "ReplaceMeTrapezoidProfileCommand.cpp"
+ ],
+ "replacename": "ReplaceMeTrapezoidProfileCommand",
+ "commandversion": 2
+ },
+ {
+ "name": "TrapezoidProfileSubsystem (New)",
+ "description": "A command that executes a trapezoidal motion profile.",
+ "tags": [
+ "trapezoidprofilesubsystem"
+ ],
+ "foldername": "trapezoidprofilesubsystem",
+ "headers": [
+ "ReplaceMeTrapezoidProfileSubsystem.h"
+ ],
+ "source": [
+ "ReplaceMeTrapezoidProfileSubsystem.cpp"
+ ],
+ "replacename": "ReplaceMeTrapezoidProfileSubsystem",
+ "commandversion": 2
}
]
diff --git a/wpilibcExamples/src/main/cpp/commands/instantcommand/ReplaceMeInstantCommand2.cpp b/wpilibcExamples/src/main/cpp/commands/instantcommand/ReplaceMeInstantCommand2.cpp
new file mode 100644
index 0000000..bf54a0a
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/instantcommand/ReplaceMeInstantCommand2.cpp
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeInstantCommand2.h"
+
+// NOTE: Consider using this command inline, rather than writing a subclass.
+// For more information, see:
+// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
+ReplaceMeInstantCommand2::ReplaceMeInstantCommand2() {
+ // Use addRequirements() here to declare subsystem dependencies.
+}
+
+// Called when the command is initially scheduled.
+void ReplaceMeInstantCommand2::Initialize() {}
diff --git a/wpilibcExamples/src/main/cpp/commands/instantcommand/ReplaceMeInstantCommand2.h b/wpilibcExamples/src/main/cpp/commands/instantcommand/ReplaceMeInstantCommand2.h
new file mode 100644
index 0000000..dec11c2
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/instantcommand/ReplaceMeInstantCommand2.h
@@ -0,0 +1,20 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandHelper.h>
+#include <frc2/command/InstantCommand.h>
+
+class ReplaceMeInstantCommand2
+ : public frc2::CommandHelper<frc2::InstantCommand,
+ ReplaceMeInstantCommand2> {
+ public:
+ ReplaceMeInstantCommand2();
+
+ void Initialize() override;
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/parallelcommandgroup/ReplaceMeParallelCommandGroup.cpp b/wpilibcExamples/src/main/cpp/commands/parallelcommandgroup/ReplaceMeParallelCommandGroup.cpp
new file mode 100644
index 0000000..aa99a3c
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/parallelcommandgroup/ReplaceMeParallelCommandGroup.cpp
@@ -0,0 +1,16 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeParallelCommandGroup.h"
+
+// NOTE: Consider using this command inline, rather than writing a subclass.
+// For more information, see:
+// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
+ReplaceMeParallelCommandGroup::ReplaceMeParallelCommandGroup() {
+ // Add your commands here, e.g.
+ // AddCommands(FooCommand(), BarCommand());
+}
diff --git a/wpilibcExamples/src/main/cpp/commands/parallelcommandgroup/ReplaceMeParallelCommandGroup.h b/wpilibcExamples/src/main/cpp/commands/parallelcommandgroup/ReplaceMeParallelCommandGroup.h
new file mode 100644
index 0000000..a4f9519
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/parallelcommandgroup/ReplaceMeParallelCommandGroup.h
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandHelper.h>
+#include <frc2/command/ParallelCommandGroup.h>
+
+class ReplaceMeParallelCommandGroup
+ : public frc2::CommandHelper<frc2::ParallelCommandGroup,
+ ReplaceMeParallelCommandGroup> {
+ public:
+ ReplaceMeParallelCommandGroup();
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/paralleldeadlinegroup/ReplaceMeParallelDeadlineGroup.cpp b/wpilibcExamples/src/main/cpp/commands/paralleldeadlinegroup/ReplaceMeParallelDeadlineGroup.cpp
new file mode 100644
index 0000000..1cfcfa0
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/paralleldeadlinegroup/ReplaceMeParallelDeadlineGroup.cpp
@@ -0,0 +1,21 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeParallelDeadlineGroup.h"
+
+#include <frc2/command/InstantCommand.h>
+
+// NOTE: Consider using this command inline, rather than writing a subclass.
+// For more information, see:
+// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
+ReplaceMeParallelDeadlineGroup::ReplaceMeParallelDeadlineGroup()
+ : CommandHelper(
+ // The deadline command
+ frc2::InstantCommand([] {})) {
+ // Add your commands here, e.g.
+ // AddCommands(FooCommand(), BarCommand());
+}
diff --git a/wpilibcExamples/src/main/cpp/commands/paralleldeadlinegroup/ReplaceMeParallelDeadlineGroup.h b/wpilibcExamples/src/main/cpp/commands/paralleldeadlinegroup/ReplaceMeParallelDeadlineGroup.h
new file mode 100644
index 0000000..7ecebb4
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/paralleldeadlinegroup/ReplaceMeParallelDeadlineGroup.h
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandHelper.h>
+#include <frc2/command/ParallelDeadlineGroup.h>
+
+class ReplaceMeParallelDeadlineGroup
+ : public frc2::CommandHelper<frc2::ParallelDeadlineGroup,
+ ReplaceMeParallelDeadlineGroup> {
+ public:
+ ReplaceMeParallelDeadlineGroup();
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/parallelracegroup/ReplaceMeParallelRaceGroup.cpp b/wpilibcExamples/src/main/cpp/commands/parallelracegroup/ReplaceMeParallelRaceGroup.cpp
new file mode 100644
index 0000000..f3f1d86
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/parallelracegroup/ReplaceMeParallelRaceGroup.cpp
@@ -0,0 +1,16 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeParallelRaceGroup.h"
+
+// NOTE: Consider using this command inline, rather than writing a subclass.
+// For more information, see:
+// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
+ReplaceMeParallelRaceGroup::ReplaceMeParallelRaceGroup() {
+ // Add your commands here, e.g.
+ // AddCommands(FooCommand(), BarCommand());
+}
diff --git a/wpilibcExamples/src/main/cpp/commands/parallelracegroup/ReplaceMeParallelRaceGroup.h b/wpilibcExamples/src/main/cpp/commands/parallelracegroup/ReplaceMeParallelRaceGroup.h
new file mode 100644
index 0000000..0b13b18
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/parallelracegroup/ReplaceMeParallelRaceGroup.h
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandHelper.h>
+#include <frc2/command/ParallelRaceGroup.h>
+
+class ReplaceMeParallelRaceGroup
+ : public frc2::CommandHelper<frc2::ParallelRaceGroup,
+ ReplaceMeParallelRaceGroup> {
+ public:
+ ReplaceMeParallelRaceGroup();
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/pidcommand/ReplaceMePIDCommand.cpp b/wpilibcExamples/src/main/cpp/commands/pidcommand/ReplaceMePIDCommand.cpp
new file mode 100644
index 0000000..b465b1e
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/pidcommand/ReplaceMePIDCommand.cpp
@@ -0,0 +1,25 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMePIDCommand.h"
+
+// NOTE: Consider using this command inline, rather than writing a subclass.
+// For more information, see:
+// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
+ReplaceMePIDCommand::ReplaceMePIDCommand()
+ : CommandHelper(frc2::PIDController(0, 0, 0),
+ // This should return the measurement
+ [] { return 0; },
+ // This should return the setpoint (can also be a constant)
+ [] { return 0; },
+ // This uses the output
+ [](double output) {
+ // Use the output here
+ }) {}
+
+// Returns true when the command should end.
+bool ReplaceMePIDCommand::IsFinished() { return false; }
diff --git a/wpilibcExamples/src/main/cpp/commands/pidcommand/ReplaceMePIDCommand.h b/wpilibcExamples/src/main/cpp/commands/pidcommand/ReplaceMePIDCommand.h
new file mode 100644
index 0000000..03c874c
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/pidcommand/ReplaceMePIDCommand.h
@@ -0,0 +1,19 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandHelper.h>
+#include <frc2/command/PIDCommand.h>
+
+class ReplaceMePIDCommand
+ : public frc2::CommandHelper<frc2::PIDCommand, ReplaceMePIDCommand> {
+ public:
+ ReplaceMePIDCommand();
+
+ bool IsFinished() override;
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/pidsubsystem2/ReplaceMePIDSubsystem2.cpp b/wpilibcExamples/src/main/cpp/commands/pidsubsystem2/ReplaceMePIDSubsystem2.cpp
new file mode 100644
index 0000000..0fa81a2
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/pidsubsystem2/ReplaceMePIDSubsystem2.cpp
@@ -0,0 +1,22 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMePIDSubsystem2.h"
+
+ReplaceMePIDSubsystem2::ReplaceMePIDSubsystem2()
+ : PIDSubsystem(
+ // The PIDController used by the subsystem
+ frc2::PIDController(0, 0, 0)) {}
+
+void ReplaceMePIDSubsystem2::UseOutput(double output, double setpoint) {
+ // Use the output here
+}
+
+double ReplaceMePIDSubsystem2::GetMeasurement() {
+ // Return the process variable measurement here
+ return 0;
+}
diff --git a/wpilibcExamples/src/main/cpp/commands/pidsubsystem2/ReplaceMePIDSubsystem2.h b/wpilibcExamples/src/main/cpp/commands/pidsubsystem2/ReplaceMePIDSubsystem2.h
new file mode 100644
index 0000000..6c8e344
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/pidsubsystem2/ReplaceMePIDSubsystem2.h
@@ -0,0 +1,20 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/PIDSubsystem.h>
+
+class ReplaceMePIDSubsystem2 : public frc2::PIDSubsystem {
+ public:
+ ReplaceMePIDSubsystem2();
+
+ protected:
+ void UseOutput(double output, double setpoint) override;
+
+ double GetMeasurement() override;
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/profiledpidcommand/ReplaceMeProfiledPIDCommand.cpp b/wpilibcExamples/src/main/cpp/commands/profiledpidcommand/ReplaceMeProfiledPIDCommand.cpp
new file mode 100644
index 0000000..392e643
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/profiledpidcommand/ReplaceMeProfiledPIDCommand.cpp
@@ -0,0 +1,34 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeProfiledPIDCommand.h"
+
+// NOTE: Consider using this command inline, rather than writing a subclass.
+// For more information, see:
+// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
+ReplaceMeProfiledPIDCommand::ReplaceMeProfiledPIDCommand()
+ : CommandHelper(
+ // The ProfiledPIDController that the command will use
+ frc::ProfiledPIDController<units::meter>(
+ // The PID gains
+ 0, 0, 0,
+ // The motion profile constraints
+ {0_mps, 0_mps_sq}),
+ // This should return the measurement
+ [] { return 0_m; },
+ // This should return the goal state (can also be a constant)
+ [] {
+ return frc::TrapezoidProfile<units::meter>::State{0_m, 0_mps};
+ },
+ // This uses the output and current trajectory setpoint
+ [](double output,
+ frc::TrapezoidProfile<units::meter>::State setpoint) {
+ // Use the output and setpoint here
+ }) {}
+
+// Returns true when the command should end.
+bool ReplaceMeProfiledPIDCommand::IsFinished() { return false; }
diff --git a/wpilibcExamples/src/main/cpp/commands/profiledpidcommand/ReplaceMeProfiledPIDCommand.h b/wpilibcExamples/src/main/cpp/commands/profiledpidcommand/ReplaceMeProfiledPIDCommand.h
new file mode 100644
index 0000000..d3407e8
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/profiledpidcommand/ReplaceMeProfiledPIDCommand.h
@@ -0,0 +1,20 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandHelper.h>
+#include <frc2/command/ProfiledPIDCommand.h>
+
+class ReplaceMeProfiledPIDCommand
+ : public frc2::CommandHelper<frc2::ProfiledPIDCommand<units::meter>,
+ ReplaceMeProfiledPIDCommand> {
+ public:
+ ReplaceMeProfiledPIDCommand();
+
+ bool IsFinished() override;
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/profiledpidsubsystem/ReplaceMeProfiledPIDSubsystem.cpp b/wpilibcExamples/src/main/cpp/commands/profiledpidsubsystem/ReplaceMeProfiledPIDSubsystem.cpp
new file mode 100644
index 0000000..dc27b43
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/profiledpidsubsystem/ReplaceMeProfiledPIDSubsystem.cpp
@@ -0,0 +1,27 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeProfiledPIDSubsystem.h"
+
+ReplaceMeProfiledPIDSubsystem::ReplaceMeProfiledPIDSubsystem()
+ : ProfiledPIDSubsystem(
+ // The ProfiledPIDController used by the subsystem
+ frc::ProfiledPIDController<units::meter>(
+ // The PID gains
+ 0, 0, 0,
+ // The constraints for the motion profiles
+ {0_mps, 0_mps_sq})) {}
+
+void ReplaceMeProfiledPIDSubsystem::UseOutput(
+ double output, frc::TrapezoidProfile<units::meter>::State setpoint) {
+ // Use the output and current trajectory setpoint here
+}
+
+units::meter_t ReplaceMeProfiledPIDSubsystem::GetMeasurement() {
+ // Return the process variable measurement here
+ return 0_m;
+}
diff --git a/wpilibcExamples/src/main/cpp/commands/profiledpidsubsystem/ReplaceMeProfiledPIDSubsystem.h b/wpilibcExamples/src/main/cpp/commands/profiledpidsubsystem/ReplaceMeProfiledPIDSubsystem.h
new file mode 100644
index 0000000..b382b1d
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/profiledpidsubsystem/ReplaceMeProfiledPIDSubsystem.h
@@ -0,0 +1,22 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/ProfiledPIDSubsystem.h>
+
+class ReplaceMeProfiledPIDSubsystem
+ : public frc2::ProfiledPIDSubsystem<units::meter> {
+ public:
+ ReplaceMeProfiledPIDSubsystem();
+
+ protected:
+ void UseOutput(double output,
+ frc::TrapezoidProfile<units::meter>::State setpoint) override;
+
+ units::meter_t GetMeasurement() override;
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/sequentialcommandgroup/ReplaceMeSequentialCommandGroup.cpp b/wpilibcExamples/src/main/cpp/commands/sequentialcommandgroup/ReplaceMeSequentialCommandGroup.cpp
new file mode 100644
index 0000000..3a5fadc
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/sequentialcommandgroup/ReplaceMeSequentialCommandGroup.cpp
@@ -0,0 +1,16 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeSequentialCommandGroup.h"
+
+// NOTE: Consider using this command inline, rather than writing a subclass.
+// For more information, see:
+// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
+ReplaceMeSequentialCommandGroup::ReplaceMeSequentialCommandGroup() {
+ // Add your commands here, e.g.
+ // AddCommands(FooCommand(), BarCommand());
+}
diff --git a/wpilibcExamples/src/main/cpp/commands/sequentialcommandgroup/ReplaceMeSequentialCommandGroup.h b/wpilibcExamples/src/main/cpp/commands/sequentialcommandgroup/ReplaceMeSequentialCommandGroup.h
new file mode 100644
index 0000000..5e629b8
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/sequentialcommandgroup/ReplaceMeSequentialCommandGroup.h
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandHelper.h>
+#include <frc2/command/SequentialCommandGroup.h>
+
+class ReplaceMeSequentialCommandGroup
+ : public frc2::CommandHelper<frc2::SequentialCommandGroup,
+ ReplaceMeSequentialCommandGroup> {
+ public:
+ ReplaceMeSequentialCommandGroup();
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.cpp b/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.cpp
new file mode 100644
index 0000000..5d6805a
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.cpp
@@ -0,0 +1,13 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeSubsystem2.h"
+
+ReplaceMeSubsystem2::ReplaceMeSubsystem2() {}
+
+// This method will be called once per scheduler run
+void ReplaceMeSubsystem2::Periodic() {}
diff --git a/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.h b/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.h
new file mode 100644
index 0000000..6f15f46
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.h
@@ -0,0 +1,24 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/SubsystemBase.h>
+
+class ReplaceMeSubsystem2 : public frc2::SubsystemBase {
+ public:
+ ReplaceMeSubsystem2();
+
+ /**
+ * Will be called periodically whenever the CommandScheduler runs.
+ */
+ void Periodic();
+
+ private:
+ // Components (e.g. motor controllers and sensors) should generally be
+ // declared private and exposed only through public methods.
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/trapezoidprofilecommand/ReplaceMeTrapezoidProfileCommand.cpp b/wpilibcExamples/src/main/cpp/commands/trapezoidprofilecommand/ReplaceMeTrapezoidProfileCommand.cpp
new file mode 100644
index 0000000..b8cb678
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/trapezoidprofilecommand/ReplaceMeTrapezoidProfileCommand.cpp
@@ -0,0 +1,25 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeTrapezoidProfileCommand.h"
+
+// NOTE: Consider using this command inline, rather than writing a subclass.
+// For more information, see:
+// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
+ReplaceMeTrapezoidProfileCommand::ReplaceMeTrapezoidProfileCommand()
+ : CommandHelper
+ // The profile to execute
+ (frc::TrapezoidProfile<units::meter>(
+ // The maximum velocity and acceleration of the profile
+ {5_mps, 5_mps_sq},
+ // The goal state of the profile
+ {10_m, 0_mps},
+ // The initial state of the profile
+ {0_m, 0_mps}),
+ [](frc::TrapezoidProfile<units::meter>::State state) {
+ // Use the computed intermediate trajectory state here
+ }) {}
diff --git a/wpilibcExamples/src/main/cpp/commands/trapezoidprofilecommand/ReplaceMeTrapezoidProfileCommand.h b/wpilibcExamples/src/main/cpp/commands/trapezoidprofilecommand/ReplaceMeTrapezoidProfileCommand.h
new file mode 100644
index 0000000..e9043be
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/trapezoidprofilecommand/ReplaceMeTrapezoidProfileCommand.h
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/CommandHelper.h>
+#include <frc2/command/TrapezoidProfileCommand.h>
+
+class ReplaceMeTrapezoidProfileCommand
+ : public frc2::CommandHelper<frc2::TrapezoidProfileCommand<units::meter>,
+ ReplaceMeTrapezoidProfileCommand> {
+ public:
+ ReplaceMeTrapezoidProfileCommand();
+};
diff --git a/wpilibcExamples/src/main/cpp/commands/trapezoidprofilesubsystem/ReplaceMeTrapezoidProfileSubsystem.cpp b/wpilibcExamples/src/main/cpp/commands/trapezoidprofilesubsystem/ReplaceMeTrapezoidProfileSubsystem.cpp
new file mode 100644
index 0000000..162c02f
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/trapezoidprofilesubsystem/ReplaceMeTrapezoidProfileSubsystem.cpp
@@ -0,0 +1,20 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "ReplaceMeTrapezoidProfileSubsystem.h"
+
+ReplaceMeTrapezoidProfileSubsystem::ReplaceMeTrapezoidProfileSubsystem()
+ : TrapezoidProfileSubsystem(
+ // The motion profile constraints
+ {5_mps, 5_mps_sq},
+ // The initial position of the mechanism
+ 0_m) {}
+
+void ReplaceMeTrapezoidProfileSubsystem::UseState(
+ frc::TrapezoidProfile<units::meters>::State state) {
+ // Use the current profile state here
+}
diff --git a/wpilibcExamples/src/main/cpp/commands/trapezoidprofilesubsystem/ReplaceMeTrapezoidProfileSubsystem.h b/wpilibcExamples/src/main/cpp/commands/trapezoidprofilesubsystem/ReplaceMeTrapezoidProfileSubsystem.h
new file mode 100644
index 0000000..e93f590
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/commands/trapezoidprofilesubsystem/ReplaceMeTrapezoidProfileSubsystem.h
@@ -0,0 +1,19 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <frc2/command/TrapezoidProfileSubsystem.h>
+
+class ReplaceMeTrapezoidProfileSubsystem
+ : frc2::TrapezoidProfileSubsystem<units::meters> {
+ public:
+ ReplaceMeTrapezoidProfileSubsystem();
+
+ protected:
+ void UseState(frc::TrapezoidProfile<units::meters>::State state) override;
+};
diff --git a/wpilibcExamples/src/main/cpp/examples/AddressableLED/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/AddressableLED/cpp/Robot.cpp
index 3cf84e7..3658824 100644
--- a/wpilibcExamples/src/main/cpp/examples/AddressableLED/cpp/Robot.cpp
+++ b/wpilibcExamples/src/main/cpp/examples/AddressableLED/cpp/Robot.cpp
@@ -14,7 +14,7 @@
class Robot : public frc::TimedRobot {
static constexpr int kLength = 60;
- // PWM port 0
+ // PWM port 9
// Must be a PWM header, not MXP or DIO
frc::AddressableLED m_led{9};
std::array<frc::AddressableLED::LEDData, kLength>
diff --git a/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/cpp/Constants.cpp b/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/cpp/Constants.cpp
new file mode 100644
index 0000000..0cf9b96
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/cpp/Constants.cpp
@@ -0,0 +1,25 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "Constants.h"
+
+namespace DriveConstants {
+
+const frc::MecanumDriveKinematics kDriveKinematics{
+ frc::Translation2d(kWheelBase / 2, kTrackWidth / 2),
+ frc::Translation2d(kWheelBase / 2, -kTrackWidth / 2),
+ frc::Translation2d(-kWheelBase / 2, kTrackWidth / 2),
+ frc::Translation2d(-kWheelBase / 2, -kTrackWidth / 2)};
+
+} // namespace DriveConstants
+
+namespace AutoConstants {
+
+const frc::TrapezoidProfile<units::radians>::Constraints
+ kThetaControllerConstraints{kMaxAngularSpeed, kMaxAngularAcceleration};
+
+} // namespace AutoConstants
diff --git a/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/cpp/RobotContainer.cpp b/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/cpp/RobotContainer.cpp
index c7379cb..756deaa 100644
--- a/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/cpp/RobotContainer.cpp
+++ b/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/cpp/RobotContainer.cpp
@@ -22,12 +22,6 @@
using namespace DriveConstants;
-const frc::MecanumDriveKinematics DriveConstants::kDriveKinematics{
- frc::Translation2d(kWheelBase / 2, kTrackWidth / 2),
- frc::Translation2d(kWheelBase / 2, -kTrackWidth / 2),
- frc::Translation2d(-kWheelBase / 2, kTrackWidth / 2),
- frc::Translation2d(-kWheelBase / 2, -kTrackWidth / 2)};
-
RobotContainer::RobotContainer() {
// Initialize all of your commands and subsystems here
diff --git a/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/include/Constants.h b/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/include/Constants.h
index 5f5f05f..1baa3de 100644
--- a/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/include/Constants.h
+++ b/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/include/Constants.h
@@ -83,8 +83,8 @@
constexpr double kPYController = 0.5;
constexpr double kPThetaController = 0.5;
-constexpr frc::TrapezoidProfile<units::radians>::Constraints
- kThetaControllerConstraints{kMaxAngularSpeed, kMaxAngularAcceleration};
+extern const frc::TrapezoidProfile<units::radians>::Constraints
+ kThetaControllerConstraints;
} // namespace AutoConstants
diff --git a/wpilibcExamples/src/main/cpp/examples/RamseteCommand/cpp/Constants.cpp b/wpilibcExamples/src/main/cpp/examples/RamseteCommand/cpp/Constants.cpp
new file mode 100644
index 0000000..46ffde3
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/examples/RamseteCommand/cpp/Constants.cpp
@@ -0,0 +1,13 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "Constants.h"
+
+using namespace DriveConstants;
+
+const frc::DifferentialDriveKinematics DriveConstants::kDriveKinematics(
+ kTrackwidth);
diff --git a/wpilibcExamples/src/main/cpp/examples/RamseteCommand/cpp/RobotContainer.cpp b/wpilibcExamples/src/main/cpp/examples/RamseteCommand/cpp/RobotContainer.cpp
index 71da410..33d53c6 100644
--- a/wpilibcExamples/src/main/cpp/examples/RamseteCommand/cpp/RobotContainer.cpp
+++ b/wpilibcExamples/src/main/cpp/examples/RamseteCommand/cpp/RobotContainer.cpp
@@ -18,6 +18,8 @@
#include <frc2/command/SequentialCommandGroup.h>
#include <frc2/command/button/JoystickButton.h>
+#include "Constants.h"
+
RobotContainer::RobotContainer() {
// Initialize all of your commands and subsystems here
diff --git a/wpilibcExamples/src/main/cpp/examples/RamseteCommand/include/Constants.h b/wpilibcExamples/src/main/cpp/examples/RamseteCommand/include/Constants.h
index 22564c6..649082b 100644
--- a/wpilibcExamples/src/main/cpp/examples/RamseteCommand/include/Constants.h
+++ b/wpilibcExamples/src/main/cpp/examples/RamseteCommand/include/Constants.h
@@ -32,8 +32,8 @@
constexpr bool kLeftEncoderReversed = false;
constexpr bool kRightEncoderReversed = true;
-constexpr auto kTrackwidth = 0.6_m;
-constexpr frc::DifferentialDriveKinematics kDriveKinematics(kTrackwidth);
+constexpr auto kTrackwidth = 0.69_m;
+extern const frc::DifferentialDriveKinematics kDriveKinematics;
constexpr int kEncoderCPR = 1024;
constexpr double kWheelDiameterInches = 6;
@@ -45,15 +45,15 @@
// These are example values only - DO NOT USE THESE FOR YOUR OWN ROBOT!
// These characterization values MUST be determined either experimentally or
-// theoretically for *your* robot's drive. The RobotPy Characterization
+// theoretically for *your* robot's drive. The Robot Characterization
// Toolsuite provides a convenient tool for obtaining these values for your
// robot.
-constexpr auto ks = 1_V;
-constexpr auto kv = 0.8 * 1_V * 1_s / 1_m;
-constexpr auto ka = 0.15 * 1_V * 1_s * 1_s / 1_m;
+constexpr auto ks = 0.22_V;
+constexpr auto kv = 1.98 * 1_V * 1_s / 1_m;
+constexpr auto ka = 0.2 * 1_V * 1_s * 1_s / 1_m;
// Example value only - as above, this must be tuned for your drive!
-constexpr double kPDriveVel = 0.5;
+constexpr double kPDriveVel = 8.5;
} // namespace DriveConstants
namespace AutoConstants {
diff --git a/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/cpp/Constants.cpp b/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/cpp/Constants.cpp
new file mode 100644
index 0000000..a60d803
--- /dev/null
+++ b/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/cpp/Constants.cpp
@@ -0,0 +1,15 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2019 FIRST. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project. */
+/*----------------------------------------------------------------------------*/
+
+#include "Constants.h"
+
+namespace AutoConstants {
+
+const frc::TrapezoidProfile<units::radians>::Constraints
+ kThetaControllerConstraints{kMaxAngularSpeed, kMaxAngularAcceleration};
+
+} // namespace AutoConstants
diff --git a/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/include/Constants.h b/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/include/Constants.h
index ed1f880..51b7030 100644
--- a/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/include/Constants.h
+++ b/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/include/Constants.h
@@ -103,8 +103,8 @@
//
-constexpr frc::TrapezoidProfile<units::radians>::Constraints
- kThetaControllerConstraints{kMaxAngularSpeed, kMaxAngularAcceleration};
+extern const frc::TrapezoidProfile<units::radians>::Constraints
+ kThetaControllerConstraints;
} // namespace AutoConstants
diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/include/subsystems/ExampleSubsystem.h b/wpilibcExamples/src/main/cpp/templates/commandbased/include/subsystems/ExampleSubsystem.h
index 763eafd..f6cd550 100644
--- a/wpilibcExamples/src/main/cpp/templates/commandbased/include/subsystems/ExampleSubsystem.h
+++ b/wpilibcExamples/src/main/cpp/templates/commandbased/include/subsystems/ExampleSubsystem.h
@@ -18,8 +18,6 @@
*/
void Periodic() override;
- // Subsystem methods go here.
-
private:
// Components (e.g. motor controllers and sensors) should generally be
// declared private and exposed only through public methods.