Skip to content

Commit

Permalink
Update for CommandBase/Subsystem Base removal
Browse files Browse the repository at this point in the history
Works with wpilibsuite/allwpilib#5392
Bump RobotBuilder major version due to template changes outside of
update blocks
  • Loading branch information
sciencewhiz committed Jul 30, 2023
1 parent aab2945 commit bd94cb5
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/main/java/robotbuilder/RobotBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
public class RobotBuilder {

public static final int VERSION_MAJOR = 5;
public static final int VERSION_MAJOR = 6;
public static final int VERSION_MINOR = 0;

public static final String VERSION = VERSION_MAJOR + "." + VERSION_MINOR;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/export/cpp/ExportDescription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Instructions:
Defaults: "None"
Export: "RobotContainer"
Import: "\\#include \"subsystems/#class($Short_Name).h\""
ClassName: "frc2::SubsystemBase"
ClassName: "frc2::Subsystem"
PID Subsystem:
Defaults: "None"
Export: "RobotContainer"
Expand Down Expand Up @@ -348,7 +348,7 @@ Instructions:

Command:
Defaults: "Command,None"
ClassName: "frc2::CommandBase"
ClassName: "frc2::Command"
Sequential Command Group:
Defaults: "Command,None"
PID Command:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/export/cpp/RobotContainer-prototypes.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// The robot's subsystems
#foreach ($component in $components)
#if ("#type($component)" != ""
&& ("#type($component)" == "frc2::SubsystemBase"
&& ("#type($component)" == "frc2::Subsystem"
|| "#type($component)" == "frc2::PIDSubsystem"))
#class($component.getName()) #variable($component.getName());
#end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#foreach ($component in $components)
#if ("#type($component)" == "frc2::SubsystemBase" || "#type($component)" == "frc2::PIDSubsystem")
#if ("#type($component)" == "frc2::Subsystem" || "#type($component)" == "frc2::PIDSubsystem")
#foreach ($command in $commands)
#if($command.name == $component.getProperty("Default Command").value)
#set($params = $component.getProperty("Default command parameters").getValue())
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/export/cpp/SetpointCommand-includes.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

\#include "frc2/command/CommandBase.h"
\#include "frc2/command/Command.h"
\#include "frc2/command/CommandHelper.h"
\#include "subsystems/#class(${command.getProperty("Requires").getValue()}).h"
2 changes: 1 addition & 1 deletion src/main/resources/export/cpp/SetpointCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author ExampleAuthor
*/
class #class($command.name): public frc2::CommandHelper<frc2::CommandBase, #class($command.name)> {
class #class($command.name): public frc2::CommandHelper<frc2::Command, #class($command.name)> {
public:
#@autogenerated_code("constructor", " ")
#parse("${exporter_path}SetpointCommand-constructor-header.h")
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/export/cpp/Subsystem-includes.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
\#include <frc2/command/SubsystemBase.h>
\#include <frc2/command/Subsystem.h>
${helper.getImports($subsystem, "RobotMap")}
2 changes: 1 addition & 1 deletion src/main/resources/export/cpp/Subsystem.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#set($subsystem = $helper.getByName($subsystem_name, $robot))
#macro( klass $cmd )#if( "#type($cmd)" == "" )SendableSubsystemBase#elsefrc::#type($cmd)#end#end
#macro( klass $cmd )#if( "#type($cmd)" == "" )Subsystem#elsefrc::#type($cmd)#end#end
#header()
// ROBOTBUILDER TYPE: Subsystem.

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/export/cpp/Subsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author ExampleAuthor
*/
class #class($subsystem.name): public frc2::SubsystemBase {
class #class($subsystem.name): public frc2::Subsystem {
private:
// It's desirable that everything possible is private except
// for methods that implement subsystem capabilities
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/export/cpp/command-includes.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

\#include <frc2/command/CommandHelper.h>
\#include <frc2/command/CommandBase.h>
\#include <frc2/command/Command.h>

#if (${command.getProperty("Requires").getValue()} != "None")
\#include "subsystems/#class(${command.getProperty("Requires").getValue()}).h"
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/export/java/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package ${package}.commands;
#set($command = $helper.getByName($command_name, $robot))
#set($params = $command.getProperty("Parameters").getValue())
#macro( klass $cmd )#if( "#type($cmd)" == "" )CommandBase#else#type($cmd)#end#end
import edu.wpi.first.wpilibj2.command.CommandBase;
#macro( klass $cmd )#if( "#type($cmd)" == "" )Command#else#type($cmd)#end#end
import edu.wpi.first.wpilibj2.command.Command;
import java.util.function.DoubleSupplier;

#@autogenerated_code("imports", "")
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/export/java/ExportDescription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Instructions:
Import: "import ${package}.subsystems.*;"
Declaration: "private #class($Short_Name) #variable($Short_Name);"
Construction: "#variable($Short_Name) = new #class($Short_Name)();"
ClassName: "SubsystemBase"
ClassName: "Subsystem"
PID Subsystem:
Defaults: "None"
Export: "RobotContainer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#foreach ($component in $components)
#if ($helper.exportsTo("RobotContainer", $component)
&& "#type($component)" != ""
&& ("#type($component)" == "SubsystemBase"
&& ("#type($component)" == "Subsystem"
|| "#type($component)" == "PIDSubsystem"))
public final #class($component.getName()) m_#variable($component.getName()) = new #class($component.getName())();
#end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#foreach ($component in $components)
#if ($helper.exportsTo("RobotContainer", $component)
&& "#type($component)" != ""
&& ("#type($component)" == "SubsystemBase"
&& ("#type($component)" == "Subsystem"
|| "#type($component)" == "PIDSubsystem"))
#foreach ($command in $commands)
#if($command.name == $component.getProperty("Default Command").value)
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/export/java/SetpointCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#set($command = $helper.getByName($command_name, $robot))

import java.util.function.DoubleSupplier;
import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.Command;
import ${package}.Robot;
#@autogenerated_code("imports", "")
#parse("${exporter_path}Command-imports.java")
Expand All @@ -14,7 +14,7 @@
/**
*
*/
public class #class($command.name) extends CommandBase {
public class #class($command.name) extends Command {
#@autogenerated_code("variable_declarations", " ")
#parse("${exporter_path}Command-variable-declarations.java")
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/export/java/Subsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

package ${package}.subsystems;
#set($subsystem = $helper.getByName($subsystem_name, $robot))
#macro( klass $cmd )#if( "#type($cmd)" == "" ) SubsystemBase #else#type($cmd)#end#end
#macro( klass $cmd )#if( "#type($cmd)" == "" ) Subsystem #else#type($cmd)#end#end


import ${package}.commands.*;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import edu.wpi.first.wpilibj2.command.Subsystem;

#@autogenerated_code("imports", "")
#parse("${exporter_path}Subsystem-imports.java")
Expand Down

0 comments on commit bd94cb5

Please sign in to comment.