mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[examples] Prepare for RobotInit deprecation by updating examples (#6623)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
@@ -17,14 +17,13 @@ import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||
public class Robot extends TimedRobot {
|
||||
private Command m_autonomousCommand;
|
||||
|
||||
private RobotContainer m_robotContainer;
|
||||
private final RobotContainer m_robotContainer;
|
||||
|
||||
/**
|
||||
* 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 = new RobotContainer();
|
||||
|
||||
@@ -11,10 +11,9 @@ import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||
public class Robot extends TimedRobot {
|
||||
private Command m_autonomousCommand;
|
||||
|
||||
private RobotContainer m_robotContainer;
|
||||
private final RobotContainer m_robotContainer;
|
||||
|
||||
@Override
|
||||
public void robotInit() {
|
||||
public Robot() {
|
||||
m_robotContainer = new RobotContainer();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import edu.wpi.first.wpilibj.internal.DriverStationModeThread;
|
||||
|
||||
/** Educational robot base class. */
|
||||
public class EducationalRobot extends RobotBase {
|
||||
public void robotInit() {}
|
||||
public EducationalRobot() {}
|
||||
|
||||
public void disabled() {}
|
||||
|
||||
@@ -34,8 +34,6 @@ public class EducationalRobot extends RobotBase {
|
||||
|
||||
@Override
|
||||
public void startCompetition() {
|
||||
robotInit();
|
||||
|
||||
DriverStationModeThread modeThread = new DriverStationModeThread();
|
||||
|
||||
int event = WPIUtilJNI.createEvent(false, false);
|
||||
|
||||
@@ -14,8 +14,7 @@ public class Robot extends EducationalRobot {
|
||||
* 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() {}
|
||||
|
||||
/** This function is run when the robot is enabled. */
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,7 @@ import edu.wpi.first.wpilibj.internal.DriverStationModeThread;
|
||||
* package after creating this project, you must also update the build.gradle file in the project.
|
||||
*/
|
||||
public class Robot extends RobotBase {
|
||||
public void robotInit() {}
|
||||
public Robot() {}
|
||||
|
||||
public void disabled() {}
|
||||
|
||||
@@ -29,8 +29,6 @@ public class Robot extends RobotBase {
|
||||
|
||||
@Override
|
||||
public void startCompetition() {
|
||||
robotInit();
|
||||
|
||||
DriverStationModeThread modeThread = new DriverStationModeThread();
|
||||
|
||||
int event = WPIUtilJNI.createEvent(false, false);
|
||||
|
||||
@@ -17,14 +17,13 @@ import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||
public class Robot extends TimedRobot {
|
||||
private Command m_autonomousCommand;
|
||||
|
||||
private RobotContainer m_robotContainer;
|
||||
private final RobotContainer m_robotContainer;
|
||||
|
||||
/**
|
||||
* 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 = new RobotContainer();
|
||||
|
||||
@@ -12,7 +12,7 @@ import edu.wpi.first.wpilibj.internal.DriverStationModeThread;
|
||||
|
||||
/** Educational robot base class. */
|
||||
public class EducationalRobot extends RobotBase {
|
||||
public void robotInit() {}
|
||||
public EducationalRobot() {}
|
||||
|
||||
public void disabled() {}
|
||||
|
||||
@@ -34,8 +34,6 @@ public class EducationalRobot extends RobotBase {
|
||||
|
||||
@Override
|
||||
public void startCompetition() {
|
||||
robotInit();
|
||||
|
||||
DriverStationModeThread modeThread = new DriverStationModeThread();
|
||||
|
||||
int event = WPIUtilJNI.createEvent(false, false);
|
||||
|
||||
@@ -14,8 +14,7 @@ public class Robot extends EducationalRobot {
|
||||
* 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() {}
|
||||
|
||||
/** This function is run when the robot is enabled. */
|
||||
@Override
|
||||
|
||||
@@ -26,8 +26,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() {
|
||||
m_chooser.setDefaultOption("Default Auto", kDefaultAuto);
|
||||
m_chooser.addOption("My Auto", kCustomAuto);
|
||||
SmartDashboard.putData("Auto choices", m_chooser);
|
||||
|
||||
@@ -24,8 +24,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() {
|
||||
m_chooser.setDefaultOption("Default Auto", kDefaultAuto);
|
||||
m_chooser.addOption("My Auto", kCustomAuto);
|
||||
SmartDashboard.putData("Auto choices", m_chooser);
|
||||
|
||||
@@ -17,8 +17,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() {}
|
||||
|
||||
@Override
|
||||
public void robotPeriodic() {}
|
||||
|
||||
@@ -38,14 +38,7 @@ public class Robot extends TimesliceRobot {
|
||||
|
||||
// Total usage: 5 ms (robot) + 2 ms (controller 1) + 2 ms (controller 2)
|
||||
// = 9 ms -> 90% allocated
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is run when the robot is first started up and should be used for any
|
||||
* initialization code.
|
||||
*/
|
||||
@Override
|
||||
public void robotInit() {
|
||||
m_chooser.setDefaultOption("Default Auto", kDefaultAuto);
|
||||
m_chooser.addOption("My Auto", kCustomAuto);
|
||||
SmartDashboard.putData("Auto choices", m_chooser);
|
||||
|
||||
@@ -34,13 +34,6 @@ public class Robot extends TimesliceRobot {
|
||||
// 9 ms / 10 ms -> 90% allocated
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 robotPeriodic() {}
|
||||
|
||||
|
||||
@@ -17,14 +17,13 @@ import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||
public class Robot extends TimedRobot {
|
||||
private Command m_autonomousCommand;
|
||||
|
||||
private RobotContainer m_robotContainer;
|
||||
private final RobotContainer m_robotContainer;
|
||||
|
||||
/**
|
||||
* 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 = new RobotContainer();
|
||||
|
||||
@@ -12,7 +12,7 @@ import edu.wpi.first.wpilibj.internal.DriverStationModeThread;
|
||||
|
||||
/** Educational robot base class. */
|
||||
public class EducationalRobot extends RobotBase {
|
||||
public void robotInit() {}
|
||||
public EducationalRobot() {}
|
||||
|
||||
public void disabled() {}
|
||||
|
||||
@@ -34,8 +34,6 @@ public class EducationalRobot extends RobotBase {
|
||||
|
||||
@Override
|
||||
public void startCompetition() {
|
||||
robotInit();
|
||||
|
||||
DriverStationModeThread modeThread = new DriverStationModeThread();
|
||||
|
||||
int event = WPIUtilJNI.createEvent(false, false);
|
||||
|
||||
@@ -14,8 +14,7 @@ public class Robot extends EducationalRobot {
|
||||
* 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() {}
|
||||
|
||||
/** This function is run when the robot is enabled. */
|
||||
@Override
|
||||
|
||||
@@ -26,8 +26,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() {
|
||||
m_chooser.setDefaultOption("Default Auto", kDefaultAuto);
|
||||
m_chooser.addOption("My Auto", kCustomAuto);
|
||||
SmartDashboard.putData("Auto choices", m_chooser);
|
||||
|
||||
Reference in New Issue
Block a user