mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[cmd3] Add example and template projects for commands v3 and make hatchbot example idiomatic (#8887)
The `command3` example project contains a program that could plausibly play in the 2026 rebuilt game. It includes nested mechanisms (`Intake` has an inner `IntakeWrist` and `IntakeRoller` and is similar to the v2 superstructure concept), swerve drive with localization and path following (albeit stubbed for sake of example), opmodes and opmode-scoped commands, and command-scoped triggers. The template projects are basic skeletons. The larger template includes a basic command that just increments and prints a counter variable every time it runs. The hatchbot v3 example has been refactored to be more idiomatic: - `RobotContainer` removed - "Subsystem" names in packages, comments, and classes has been replaced with "Mechanism" - Some v2-specific comments and structures have been reworded or deleted - The Drive mechanism now provides commands for arcade drive and driving a distance, instead of exposing public methods that write directly to hardware (which broke encapsulation and made it possible to issue conflicting hardware requests)
This commit is contained in:
@@ -81,6 +81,9 @@ def build_snippets():
|
||||
java_library(
|
||||
name = folder + "-snippet",
|
||||
srcs = native.glob(["src/main/java/org/wpilib/snippets/" + folder + "/**/*.java"]),
|
||||
plugins = [
|
||||
"//epilogue-processor:plugin",
|
||||
],
|
||||
deps = [
|
||||
"//apriltag:apriltag-java",
|
||||
"//cameraserver:cameraserver-java",
|
||||
@@ -90,6 +93,7 @@ def build_snippets():
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpilibj:wpilibj-java",
|
||||
"//commandsv2:commandsv2-java",
|
||||
"//commandsv3:commandsv3-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
"//romiVendordep:romiVendordep-java",
|
||||
"//xrpVendordep:xrpVendordep-java",
|
||||
@@ -107,13 +111,19 @@ def build_templates():
|
||||
java_library(
|
||||
name = folder + "-template",
|
||||
srcs = native.glob(["src/main/java/org/wpilib/templates/" + folder + "/**/*.java"]),
|
||||
plugins = [
|
||||
"//epilogue-processor:plugin",
|
||||
],
|
||||
deps = [
|
||||
"//hal:hal-java",
|
||||
"//wpilibj:wpilibj-java",
|
||||
"//commandsv2:commandsv2-java",
|
||||
"//commandsv3:commandsv3-java",
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
"//epilogue-runtime:epilogue-java",
|
||||
"//xrpVendordep:xrpVendordep-java",
|
||||
"//wpiunits:wpiunits-java",
|
||||
],
|
||||
tags = ["wpi-example"],
|
||||
)
|
||||
@@ -123,14 +133,20 @@ def build_tests():
|
||||
wpilib_java_junit5_test(
|
||||
name = folder + "-test",
|
||||
srcs = native.glob(["src/test/java/org/wpilib/examples/" + folder + "/**/*.java"]),
|
||||
plugins = [
|
||||
"//epilogue-processor:plugin",
|
||||
],
|
||||
deps = [
|
||||
":" + folder + "-example",
|
||||
"//hal:hal-java",
|
||||
"//ntcore:ntcore-java",
|
||||
"//wpilibj:wpilibj-java",
|
||||
"//commandsv2:commandsv2-java",
|
||||
"//commandsv3:commandsv3-java",
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
"//epilogue-runtime:epilogue-java",
|
||||
"//wpiunits:wpiunits-java",
|
||||
],
|
||||
tags = ["wpi-example"],
|
||||
)
|
||||
@@ -139,14 +155,20 @@ def build_tests():
|
||||
wpilib_java_junit5_test(
|
||||
name = folder + "-test",
|
||||
srcs = native.glob(["src/test/java/org/wpilib/snippets/" + folder + "/**/*.java"]),
|
||||
plugins = [
|
||||
"//epilogue-processor:plugin",
|
||||
],
|
||||
deps = [
|
||||
":" + folder + "-snippet",
|
||||
"//hal:hal-java",
|
||||
"//ntcore:ntcore-java",
|
||||
"//wpilibj:wpilibj-java",
|
||||
"//commandsv2:commandsv2-java",
|
||||
"//commandsv3:commandsv3-java",
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
"//epilogue-runtime:epilogue-java",
|
||||
"//wpiunits:wpiunits-java",
|
||||
],
|
||||
tags = ["wpi-example"],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user