[commands] Add Commands v3 framework (#6518)

The framework fundamentally relies on the continuation API added in Java 21 (which is currently internal to the JDK). Continuations allow for call stacks to be saved to the heap and resumed later.

The async framework allows command bodies to be written in an imperative style. However, an async command will need to be actively cooperative and periodically call coroutine.yield() in loops to yield control back to the command scheduler to let it process other commands.

There are also some other additions like priority levels (as opposed to a blanket yes/no for ignoring incoming commands), factories requiring names be provided for commands, and the scheduler tracking all running commands and not just the highest-level groups. However, those changes aren't unique to an async framework, and could just as easily be used in a traditional command framework.
This commit is contained in:
Sam Carlberg
2025-10-10 16:47:22 -04:00
committed by GitHub
parent 33f91589b4
commit b37e2d9343
77 changed files with 12259 additions and 3 deletions

View File

@@ -51,6 +51,7 @@ write_source_files(
"//wpilibj:write_wpilibj",
"//wpilibjExamples:write_example_project_list",
"//wpilibNewCommands:write_wpilib_new_commands",
"//commandsv3:write_commandsv3",
"//wpimath:write_wpimath",
"//wpiunits:write_wpiunits",
"//wpiutil:write_wpiutil",
@@ -100,6 +101,7 @@ publish_all(
"//wpigui:wpigui-cpp_publish.publish",
"//wpilibNewCommands:wpilibNewCommands-cpp_publish.publish",
"//wpilibNewCommands:wpilibNewCommands-java_publish.publish",
"//commandsv3:commandsv3-java_publish.publish",
"//wpilibc:wpilibc-cpp_publish.publish",
"//wpilibcExamples:commands_publish.publish",
"//wpilibcExamples:examples_publish.publish",