From b1bfec3129571edf9ded69f8f543c7814ea53243 Mon Sep 17 00:00:00 2001 From: Jade Date: Mon, 29 Jul 2024 10:26:27 +0800 Subject: [PATCH] Remove robotInit in favour of Robot constructor (#607) See https://github.com/wpilibsuite/allwpilib/issues/6845 --- src/main/resources/export/cpp/CommandBasedRobot.cpp | 2 +- src/main/resources/export/cpp/CommandBasedRobot.h | 2 +- src/main/resources/export/java/RobotTemplate.java | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/resources/export/cpp/CommandBasedRobot.cpp b/src/main/resources/export/cpp/CommandBasedRobot.cpp index c9541bc0..79ab1bfb 100644 --- a/src/main/resources/export/cpp/CommandBasedRobot.cpp +++ b/src/main/resources/export/cpp/CommandBasedRobot.cpp @@ -8,7 +8,7 @@ \#include \#include -void Robot::RobotInit() { +Robot::Robot() { EnableLiveWindowInTest(true); HAL_Report(HALUsageReporting::kResourceType_Framework, HALUsageReporting::kFramework_RobotBuilder); diff --git a/src/main/resources/export/cpp/CommandBasedRobot.h b/src/main/resources/export/cpp/CommandBasedRobot.h index a114a92e..5d46640a 100644 --- a/src/main/resources/export/cpp/CommandBasedRobot.h +++ b/src/main/resources/export/cpp/CommandBasedRobot.h @@ -9,7 +9,7 @@ class Robot : public frc::TimedRobot { public: - void RobotInit() override; + Robot(); void RobotPeriodic() override; void DisabledInit() override; void DisabledPeriodic() override; diff --git a/src/main/resources/export/java/RobotTemplate.java b/src/main/resources/export/java/RobotTemplate.java index ecb23be3..a96ab789 100644 --- a/src/main/resources/export/java/RobotTemplate.java +++ b/src/main/resources/export/java/RobotTemplate.java @@ -14,7 +14,7 @@ * The VM is configured to automatically run this class, and to call the * functions corresponding to each mode, as described in the TimedRobot * documentation. If you change the name of this class or the package after - * creating this project, you must also update the build.properties file in + * creating this project, you must also update the build.properties file in * the project. */ public class Robot extends TimedRobot { @@ -27,8 +27,7 @@ public class Robot extends TimedRobot { * This function is run when the robot is first started up and should be * used for any initialization code. */ - @Override - public void robotInit() { + public Robot() { // Instantiate our RobotContainer. This will perform all our button bindings, and put our // autonomous chooser on the dashboard. m_robotContainer = RobotContainer.getInstance(); @@ -115,4 +114,4 @@ public void testInit() { public void testPeriodic() { } -} \ No newline at end of file +}