From 7797da78f593f11882eb52cd3fd6bd7ea2cf1338 Mon Sep 17 00:00:00 2001 From: Prateek Machiraju Date: Fri, 24 Jan 2020 23:01:23 -0500 Subject: [PATCH] Add missing methods to Timed and TimedSkeleton templates (#2306) --- .../main/cpp/templates/timed/cpp/Robot.cpp | 8 ++++- .../main/cpp/templates/timed/include/Robot.h | 5 +++- .../cpp/templates/timedskeleton/cpp/Robot.cpp | 6 +++- .../templates/timedskeleton/include/Robot.h | 6 +++- .../first/wpilibj/templates/timed/Robot.java | 30 ++++++++++++++++++- .../templates/timedskeleton/Robot.java | 14 ++++++++- 6 files changed, 63 insertions(+), 6 deletions(-) diff --git a/wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp index 07d843d0c6..dfb6993bfb 100644 --- a/wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/timed/cpp/Robot.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2017-2020 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. */ @@ -63,6 +63,12 @@ void Robot::TeleopInit() {} void Robot::TeleopPeriodic() {} +void Robot::DisabledInit() {} + +void Robot::DisabledPeriodic() {} + +void Robot::TestInit() {} + void Robot::TestPeriodic() {} #ifndef RUNNING_FRC_TESTS diff --git a/wpilibcExamples/src/main/cpp/templates/timed/include/Robot.h b/wpilibcExamples/src/main/cpp/templates/timed/include/Robot.h index 09183dcae1..fe4ea1ffc6 100644 --- a/wpilibcExamples/src/main/cpp/templates/timed/include/Robot.h +++ b/wpilibcExamples/src/main/cpp/templates/timed/include/Robot.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2017-2020 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. */ @@ -20,6 +20,9 @@ class Robot : public frc::TimedRobot { void AutonomousPeriodic() override; void TeleopInit() override; void TeleopPeriodic() override; + void DisabledInit() override; + void DisabledPeriodic() override; + void TestInit() override; void TestPeriodic() override; private: diff --git a/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp index 76adfc40c0..425fa84161 100644 --- a/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2018-2020 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. */ @@ -8,6 +8,7 @@ #include "Robot.h" void Robot::RobotInit() {} +void Robot::RobotPeriodic() {} void Robot::AutonomousInit() {} void Robot::AutonomousPeriodic() {} @@ -15,6 +16,9 @@ void Robot::AutonomousPeriodic() {} void Robot::TeleopInit() {} void Robot::TeleopPeriodic() {} +void Robot::DisabledInit() {} +void Robot::DisabledPeriodic() {} + void Robot::TestInit() {} void Robot::TestPeriodic() {} diff --git a/wpilibcExamples/src/main/cpp/templates/timedskeleton/include/Robot.h b/wpilibcExamples/src/main/cpp/templates/timedskeleton/include/Robot.h index bf4dae1288..d4bcbb6e30 100644 --- a/wpilibcExamples/src/main/cpp/templates/timedskeleton/include/Robot.h +++ b/wpilibcExamples/src/main/cpp/templates/timedskeleton/include/Robot.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2018-2020 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. */ @@ -12,6 +12,7 @@ class Robot : public frc::TimedRobot { public: void RobotInit() override; + void RobotPeriodic() override; void AutonomousInit() override; void AutonomousPeriodic() override; @@ -19,6 +20,9 @@ class Robot : public frc::TimedRobot { void TeleopInit() override; void TeleopPeriodic() override; + void DisabledInit() override; + void DisabledPeriodic() override; + void TestInit() override; void TestPeriodic() override; }; diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timed/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timed/Robot.java index 9930de74ba..5974b410c3 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timed/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timed/Robot.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2017-2020 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. */ @@ -81,6 +81,13 @@ public class Robot extends TimedRobot { } } + /** + * This function is called once when teleop is enabled. + */ + @Override + public void teleopInit() { + } + /** * This function is called periodically during operator control. */ @@ -88,6 +95,27 @@ public class Robot extends TimedRobot { public void teleopPeriodic() { } + /** + * This function is called once when the robot is disabled. + */ + @Override + public void disabledInit() { + } + + /** + * This function is called periodically when disabled. + */ + @Override + public void disabledPeriodic() { + } + + /** + * This function is called once when test mode is enabled. + */ + @Override + public void testInit() { + } + /** * This function is called periodically during test mode. */ diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Robot.java index 9ec7991bcc..b4480c839f 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Robot.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2018-2020 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. */ @@ -25,6 +25,10 @@ public class Robot extends TimedRobot { public void robotInit() { } + @Override + public void robotPeriodic() { + } + @Override public void autonomousInit() { } @@ -41,6 +45,14 @@ public class Robot extends TimedRobot { public void teleopPeriodic() { } + @Override + public void disabledInit() { + } + + @Override + public void disabledPeriodic() { + } + @Override public void testInit() { }