diff --git a/wpilibcExamples/src/main/cpp/templates/templates.json b/wpilibcExamples/src/main/cpp/templates/templates.json index 147eb85487..089ea161ae 100644 --- a/wpilibcExamples/src/main/cpp/templates/templates.json +++ b/wpilibcExamples/src/main/cpp/templates/templates.json @@ -17,6 +17,15 @@ "foldername": "timed", "gradlebase": "cpp" }, + { + "name": "Timed Skeleton (Advanced)", + "description": "Skeleton (stub) code for TimedRobot", + "tags": [ + "Timed", "Skeleton" + ], + "foldername": "timedskeleton", + "gradlebase": "cpp" + }, { "name": "Command Robot", "description": "Command style", diff --git a/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp new file mode 100644 index 0000000000..76adfc40c0 --- /dev/null +++ b/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp @@ -0,0 +1,23 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 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. */ +/*----------------------------------------------------------------------------*/ + +#include "Robot.h" + +void Robot::RobotInit() {} + +void Robot::AutonomousInit() {} +void Robot::AutonomousPeriodic() {} + +void Robot::TeleopInit() {} +void Robot::TeleopPeriodic() {} + +void Robot::TestInit() {} +void Robot::TestPeriodic() {} + +#ifndef RUNNING_FRC_TESTS +int main() { return frc::StartRobot(); } +#endif diff --git a/wpilibcExamples/src/main/cpp/templates/timedskeleton/include/Robot.h b/wpilibcExamples/src/main/cpp/templates/timedskeleton/include/Robot.h new file mode 100644 index 0000000000..bf4dae1288 --- /dev/null +++ b/wpilibcExamples/src/main/cpp/templates/timedskeleton/include/Robot.h @@ -0,0 +1,24 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 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. */ +/*----------------------------------------------------------------------------*/ + +#pragma once + +#include + +class Robot : public frc::TimedRobot { + public: + void RobotInit() override; + + void AutonomousInit() override; + void AutonomousPeriodic() override; + + void TeleopInit() override; + void TeleopPeriodic() override; + + void TestInit() override; + void TestPeriodic() override; +}; diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/templates.json b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/templates.json index 138971357b..430da80da1 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/templates.json +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/templates.json @@ -19,6 +19,16 @@ "gradlebase": "java", "mainclass": "Main" }, + { + "name": "Timed Skeleton (Advanced)", + "description": "Skeleton (stub) code for TimedRobot", + "tags": [ + "Timed", "Skeleton" + ], + "foldername": "timedskeleton", + "gradlebase": "java", + "mainclass": "Main" + }, { "name": "Command Robot", "description": "Command style", diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Main.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Main.java new file mode 100644 index 0000000000..6a895ba70a --- /dev/null +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Main.java @@ -0,0 +1,29 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 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. */ +/*----------------------------------------------------------------------------*/ + +package edu.wpi.first.wpilibj.templates.timedskeleton; + +import edu.wpi.first.wpilibj.RobotBase; + +/** + * Do NOT add any static variables to this class, or any initialization at all. + * Unless you know what you are doing, do not modify this file except to + * change the parameter class to the startRobot call. + */ +public final class Main { + private Main() { + } + + /** + * Main initialization function. Do not perform any initialization here. + * + *

If you change your main robot class, change the parameter type. + */ + public static void main(String... args) { + RobotBase.startRobot(Robot::new); + } +} 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 new file mode 100644 index 0000000000..9ec7991bcc --- /dev/null +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/timedskeleton/Robot.java @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 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. */ +/*----------------------------------------------------------------------------*/ + +package edu.wpi.first.wpilibj.templates.timedskeleton; + +import edu.wpi.first.wpilibj.TimedRobot; + +/** + * 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.gradle file in the + * project. + */ +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() { + } + + @Override + public void autonomousInit() { + } + + @Override + public void autonomousPeriodic() { + } + + @Override + public void teleopInit() { + } + + @Override + public void teleopPeriodic() { + } + + @Override + public void testInit() { + } + + @Override + public void testPeriodic() { + } + +}