mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[developerRobot] Add an OpModeRobot instance to DeveloperRobot (#8891)
You can switch to it just by switching Main.java
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
|
// Open Source Software; you can modify and/or share it under the terms of
|
||||||
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
package wpilib.robot;
|
||||||
|
|
||||||
|
import org.wpilib.opmode.Autonomous;
|
||||||
|
import org.wpilib.opmode.PeriodicOpMode;
|
||||||
|
|
||||||
|
@Autonomous
|
||||||
|
public class DefaultAutoMode extends PeriodicOpMode {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final OpRobot robot;
|
||||||
|
|
||||||
|
public DefaultAutoMode(OpRobot robot) {
|
||||||
|
this.robot = robot;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void periodic() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
|
// Open Source Software; you can modify and/or share it under the terms of
|
||||||
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
package wpilib.robot;
|
||||||
|
|
||||||
|
import org.wpilib.driverstation.DefaultUserControls;
|
||||||
|
import org.wpilib.opmode.PeriodicOpMode;
|
||||||
|
import org.wpilib.opmode.Teleop;
|
||||||
|
|
||||||
|
@Teleop
|
||||||
|
public class DefaultTeleMode extends PeriodicOpMode {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final OpRobot robot;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final DefaultUserControls userControls;
|
||||||
|
|
||||||
|
public DefaultTeleMode(OpRobot robot, DefaultUserControls userControls) {
|
||||||
|
this.robot = robot;
|
||||||
|
this.userControls = userControls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void periodic() {}
|
||||||
|
}
|
||||||
16
developerRobot/src/main/java/wpilib/robot/OpRobot.java
Normal file
16
developerRobot/src/main/java/wpilib/robot/OpRobot.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
|
// Open Source Software; you can modify and/or share it under the terms of
|
||||||
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
package wpilib.robot;
|
||||||
|
|
||||||
|
import org.wpilib.driverstation.DefaultUserControls;
|
||||||
|
import org.wpilib.driverstation.UserControlsInstance;
|
||||||
|
import org.wpilib.framework.OpModeRobot;
|
||||||
|
|
||||||
|
/** This is a dev program for testing OpModeRobot. */
|
||||||
|
@UserControlsInstance(DefaultUserControls.class)
|
||||||
|
public class OpRobot extends OpModeRobot {
|
||||||
|
/** Called once at the beginning of the robot program. */
|
||||||
|
public OpRobot() {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user