mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[build] Apply spotless for java formatting (#1768)
Update checkstyle config to be compatible with spotless. Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
@@ -6,11 +6,10 @@ package edu.wpi.first.wpilibj.templates.commandbased;
|
||||
|
||||
/**
|
||||
* The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean
|
||||
* constants. This class should not be used for any other purpose. All constants should be
|
||||
* declared globally (i.e. public static). Do not put anything functional in this class.
|
||||
* constants. This class should not be used for any other purpose. All constants should be declared
|
||||
* globally (i.e. public static). Do not put anything functional in this class.
|
||||
*
|
||||
* <p>It is advised to statically import this class (or one of its inner classes) wherever the
|
||||
* constants are needed, to reduce verbosity.
|
||||
*/
|
||||
public final class Constants {
|
||||
}
|
||||
public final class Constants {}
|
||||
|
||||
@@ -12,8 +12,7 @@ import edu.wpi.first.wpilibj.RobotBase;
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {
|
||||
}
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
|
||||
@@ -34,8 +34,8 @@ public class Robot extends TimedRobot {
|
||||
* This function is called every robot packet, no matter the mode. Use this for items like
|
||||
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
|
||||
*
|
||||
* <p>This runs after the mode specific periodic functions, but before
|
||||
* LiveWindow and SmartDashboard integrated updating.
|
||||
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
|
||||
* SmartDashboard integrated updating.
|
||||
*/
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
@@ -46,20 +46,14 @@ public class Robot extends TimedRobot {
|
||||
CommandScheduler.getInstance().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called once each time the robot enters Disabled mode.
|
||||
*/
|
||||
/** This function is called once each time the robot enters Disabled mode. */
|
||||
@Override
|
||||
public void disabledInit() {
|
||||
}
|
||||
public void disabledInit() {}
|
||||
|
||||
@Override
|
||||
public void disabledPeriodic() {
|
||||
}
|
||||
public void disabledPeriodic() {}
|
||||
|
||||
/**
|
||||
* This autonomous runs the autonomous command selected by your {@link RobotContainer} class.
|
||||
*/
|
||||
/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
|
||||
@Override
|
||||
public void autonomousInit() {
|
||||
m_autonomousCommand = m_robotContainer.getAutonomousCommand();
|
||||
@@ -70,12 +64,9 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during autonomous.
|
||||
*/
|
||||
/** This function is called periodically during autonomous. */
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
}
|
||||
public void autonomousPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void teleopInit() {
|
||||
@@ -88,12 +79,9 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during operator control.
|
||||
*/
|
||||
/** This function is called periodically during operator control. */
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
}
|
||||
public void teleopPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void testInit() {
|
||||
@@ -101,10 +89,7 @@ public class Robot extends TimedRobot {
|
||||
CommandScheduler.getInstance().cancelAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during test mode.
|
||||
*/
|
||||
/** This function is called periodically during test mode. */
|
||||
@Override
|
||||
public void testPeriodic() {
|
||||
}
|
||||
public void testPeriodic() {}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ import edu.wpi.first.wpilibj.templates.commandbased.subsystems.ExampleSubsystem;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
|
||||
/**
|
||||
* This class is where the bulk of the robot should be declared. Since Command-based is a
|
||||
* This class is where the bulk of the robot should be declared. Since Command-based is a
|
||||
* "declarative" paradigm, very little robot logic should actually be handled in the {@link Robot}
|
||||
* periodic methods (other than the scheduler calls). Instead, the structure of the robot
|
||||
* (including subsystems, commands, and button mappings) should be declared here.
|
||||
* periodic methods (other than the scheduler calls). Instead, the structure of the robot (including
|
||||
* subsystems, commands, and button mappings) should be declared here.
|
||||
*/
|
||||
public class RobotContainer {
|
||||
// The robot's subsystems and commands are defined here...
|
||||
@@ -22,25 +22,19 @@ public class RobotContainer {
|
||||
|
||||
private final ExampleCommand m_autoCommand = new ExampleCommand(m_exampleSubsystem);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The container for the robot. Contains subsystems, OI devices, and commands.
|
||||
*/
|
||||
/** The container for the robot. Contains subsystems, OI devices, and commands. */
|
||||
public RobotContainer() {
|
||||
// Configure the button bindings
|
||||
configureButtonBindings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to define your button->command mappings. Buttons can be created by
|
||||
* Use this method to define your button->command mappings. Buttons can be created by
|
||||
* instantiating a {@link GenericHID} or one of its subclasses ({@link
|
||||
* edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then passing it to a
|
||||
* {@link edu.wpi.first.wpilibj2.command.button.JoystickButton}.
|
||||
* edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then passing it to a {@link
|
||||
* edu.wpi.first.wpilibj2.command.button.JoystickButton}.
|
||||
*/
|
||||
private void configureButtonBindings() {
|
||||
}
|
||||
|
||||
private void configureButtonBindings() {}
|
||||
|
||||
/**
|
||||
* Use this to pass the autonomous command to the main {@link Robot} class.
|
||||
|
||||
@@ -7,9 +7,7 @@ package edu.wpi.first.wpilibj.templates.commandbased.commands;
|
||||
import edu.wpi.first.wpilibj.templates.commandbased.subsystems.ExampleSubsystem;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
|
||||
/**
|
||||
* An example command that uses an example subsystem.
|
||||
*/
|
||||
/** An example command that uses an example subsystem. */
|
||||
public class ExampleCommand extends CommandBase {
|
||||
@SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"})
|
||||
private final ExampleSubsystem m_subsystem;
|
||||
@@ -27,18 +25,15 @@ public class ExampleCommand extends CommandBase {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
}
|
||||
public void initialize() {}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
}
|
||||
public void execute() {}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
}
|
||||
public void end(boolean interrupted) {}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
||||
@@ -7,12 +7,8 @@ package edu.wpi.first.wpilibj.templates.commandbased.subsystems;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class ExampleSubsystem extends SubsystemBase {
|
||||
/**
|
||||
* Creates a new ExampleSubsystem.
|
||||
*/
|
||||
public ExampleSubsystem() {
|
||||
|
||||
}
|
||||
/** Creates a new ExampleSubsystem. */
|
||||
public ExampleSubsystem() {}
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
|
||||
@@ -7,13 +7,12 @@ package edu.wpi.first.wpilibj.templates.oldcommandbased;
|
||||
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.
|
||||
* 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() {
|
||||
}
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
package edu.wpi.first.wpilibj.templates.oldcommandbased;
|
||||
|
||||
/**
|
||||
* This class is the glue that binds the controls on the physical operator
|
||||
* interface to the commands and command groups that allow control of the robot.
|
||||
* This class is the glue that binds the controls on the physical operator interface to the commands
|
||||
* and command groups that allow control of the robot.
|
||||
*/
|
||||
public class OI {
|
||||
//// CREATING BUTTONS
|
||||
|
||||
@@ -13,10 +13,9 @@ import edu.wpi.first.wpilibj.templates.oldcommandbased.commands.ExampleCommand;
|
||||
import edu.wpi.first.wpilibj.templates.oldcommandbased.subsystems.ExampleSubsystem;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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 {
|
||||
@@ -27,8 +26,8 @@ public class Robot extends TimedRobot {
|
||||
SendableChooser<Command> m_chooser = new SendableChooser<>();
|
||||
|
||||
/**
|
||||
* This function is run when the robot is first started up and should be
|
||||
* used for any initialization code.
|
||||
* This function is run when the robot is first started up and should be used for any
|
||||
* initialization code.
|
||||
*/
|
||||
@Override
|
||||
public void robotInit() {
|
||||
@@ -39,25 +38,21 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called every robot packet, no matter the mode. Use
|
||||
* this for items like diagnostics that you want ran during disabled,
|
||||
* autonomous, teleoperated and test.
|
||||
* This function is called every robot packet, no matter the mode. Use this for items like
|
||||
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
|
||||
*
|
||||
* <p>This runs after the mode specific periodic functions, but before
|
||||
* LiveWindow and SmartDashboard integrated updating.
|
||||
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
|
||||
* SmartDashboard integrated updating.
|
||||
*/
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
}
|
||||
public void robotPeriodic() {}
|
||||
|
||||
/**
|
||||
* This function is called once each time the robot enters Disabled mode.
|
||||
* You can use it to reset any subsystem information you want to clear when
|
||||
* the robot is disabled.
|
||||
* This function is called once each time the robot enters Disabled mode. You can use it to reset
|
||||
* any subsystem information you want to clear when the robot is disabled.
|
||||
*/
|
||||
@Override
|
||||
public void disabledInit() {
|
||||
}
|
||||
public void disabledInit() {}
|
||||
|
||||
@Override
|
||||
public void disabledPeriodic() {
|
||||
@@ -65,15 +60,14 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
|
||||
/**
|
||||
* This autonomous (along with the chooser code above) shows how to select
|
||||
* between different autonomous modes using the dashboard. The sendable
|
||||
* chooser code works with the Java SmartDashboard. If you prefer the
|
||||
* LabVIEW Dashboard, remove all of the chooser code and uncomment the
|
||||
* getString code to get the auto name from the text box below the Gyro
|
||||
* This autonomous (along with the chooser code above) shows how to select between different
|
||||
* autonomous modes using the dashboard. The sendable chooser code works with the Java
|
||||
* SmartDashboard. If you prefer the LabVIEW Dashboard, remove all of the chooser code and
|
||||
* uncomment the getString code to get the auto name from the text box below the Gyro
|
||||
*
|
||||
* <p>You can add additional auto modes by adding additional commands to the
|
||||
* chooser code above (like the commented example) or additional comparisons
|
||||
* to the switch structure below with additional strings & commands.
|
||||
* <p>You can add additional auto modes by adding additional commands to the chooser code above
|
||||
* (like the commented example) or additional comparisons to the switch structure below with
|
||||
* additional strings & commands.
|
||||
*/
|
||||
@Override
|
||||
public void autonomousInit() {
|
||||
@@ -92,9 +86,7 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during autonomous.
|
||||
*/
|
||||
/** This function is called periodically during autonomous. */
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
Scheduler.getInstance().run();
|
||||
@@ -111,18 +103,13 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during operator control.
|
||||
*/
|
||||
/** This function is called periodically during operator control. */
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
Scheduler.getInstance().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during test mode.
|
||||
*/
|
||||
/** This function is called periodically during test mode. */
|
||||
@Override
|
||||
public void testPeriodic() {
|
||||
}
|
||||
public void testPeriodic() {}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
package edu.wpi.first.wpilibj.templates.oldcommandbased;
|
||||
|
||||
/**
|
||||
* The RobotMap is a mapping from the ports sensors and actuators are wired into
|
||||
* to a variable name. This provides flexibility changing wiring, makes checking
|
||||
* the wiring easier and significantly reduces the number of magic numbers
|
||||
* floating around.
|
||||
* The RobotMap is a mapping from the ports sensors and actuators are wired into to a variable name.
|
||||
* This provides flexibility changing wiring, makes checking the wiring easier and significantly
|
||||
* reduces the number of magic numbers floating around.
|
||||
*/
|
||||
public class RobotMap {
|
||||
// For example to map the left and right motors, you could define the
|
||||
|
||||
@@ -7,9 +7,7 @@ package edu.wpi.first.wpilibj.templates.oldcommandbased.commands;
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import edu.wpi.first.wpilibj.templates.oldcommandbased.Robot;
|
||||
|
||||
/**
|
||||
* An example command. You can replace me with your own command.
|
||||
*/
|
||||
/** An example command. You can replace me with your own command. */
|
||||
public class ExampleCommand extends Command {
|
||||
public ExampleCommand() {
|
||||
// Use requires() here to declare subsystem dependencies
|
||||
@@ -18,13 +16,11 @@ public class ExampleCommand extends Command {
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
@Override
|
||||
protected void initialize() {
|
||||
}
|
||||
protected void initialize() {}
|
||||
|
||||
// Called repeatedly when this Command is scheduled to run
|
||||
@Override
|
||||
protected void execute() {
|
||||
}
|
||||
protected void execute() {}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
@Override
|
||||
@@ -34,12 +30,10 @@ public class ExampleCommand extends Command {
|
||||
|
||||
// Called once after isFinished returns true
|
||||
@Override
|
||||
protected void end() {
|
||||
}
|
||||
protected void end() {}
|
||||
|
||||
// Called when another command which requires one or more of the same
|
||||
// subsystems is scheduled to run
|
||||
@Override
|
||||
protected void interrupted() {
|
||||
}
|
||||
protected void interrupted() {}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,11 @@ package edu.wpi.first.wpilibj.templates.oldcommandbased.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||
|
||||
/**
|
||||
* An example subsystem. You can replace with me with your own subsystem.
|
||||
*/
|
||||
/** An example subsystem. You can replace with me with your own subsystem. */
|
||||
public class ExampleSubsystem extends Subsystem {
|
||||
// Put methods for controlling this subsystem
|
||||
// here. Call these from Commands.
|
||||
|
||||
|
||||
@Override
|
||||
protected void initDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
|
||||
@@ -7,13 +7,12 @@ package edu.wpi.first.wpilibj.templates.robotbaseskeleton;
|
||||
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.
|
||||
* 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() {
|
||||
}
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
|
||||
@@ -10,25 +10,19 @@ import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
|
||||
/**
|
||||
* The VM is configured to automatically run this class. 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.
|
||||
* The VM is configured to automatically run this class. 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 RobotBase {
|
||||
public void robotInit() {
|
||||
}
|
||||
public void robotInit() {}
|
||||
|
||||
public void disabled() {
|
||||
}
|
||||
public void disabled() {}
|
||||
|
||||
public void autonomous() {
|
||||
}
|
||||
public void autonomous() {}
|
||||
|
||||
public void teleop() {
|
||||
}
|
||||
public void teleop() {}
|
||||
|
||||
public void test() {
|
||||
}
|
||||
public void test() {}
|
||||
|
||||
private volatile boolean m_exit;
|
||||
|
||||
|
||||
@@ -6,11 +6,10 @@ package edu.wpi.first.wpilibj.templates.romicommandbased;
|
||||
|
||||
/**
|
||||
* The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean
|
||||
* constants. This class should not be used for any other purpose. All constants should be
|
||||
* declared globally (i.e. public static). Do not put anything functional in this class.
|
||||
* constants. This class should not be used for any other purpose. All constants should be declared
|
||||
* globally (i.e. public static). Do not put anything functional in this class.
|
||||
*
|
||||
* <p>It is advised to statically import this class (or one of its inner classes) wherever the
|
||||
* constants are needed, to reduce verbosity.
|
||||
*/
|
||||
public final class Constants {
|
||||
}
|
||||
public final class Constants {}
|
||||
|
||||
@@ -12,8 +12,7 @@ import edu.wpi.first.wpilibj.RobotBase;
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {
|
||||
}
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
|
||||
@@ -34,8 +34,8 @@ public class Robot extends TimedRobot {
|
||||
* This function is called every robot packet, no matter the mode. Use this for items like
|
||||
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
|
||||
*
|
||||
* <p>This runs after the mode specific periodic functions, but before
|
||||
* LiveWindow and SmartDashboard integrated updating.
|
||||
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
|
||||
* SmartDashboard integrated updating.
|
||||
*/
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
@@ -46,20 +46,14 @@ public class Robot extends TimedRobot {
|
||||
CommandScheduler.getInstance().run();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called once each time the robot enters Disabled mode.
|
||||
*/
|
||||
/** This function is called once each time the robot enters Disabled mode. */
|
||||
@Override
|
||||
public void disabledInit() {
|
||||
}
|
||||
public void disabledInit() {}
|
||||
|
||||
@Override
|
||||
public void disabledPeriodic() {
|
||||
}
|
||||
public void disabledPeriodic() {}
|
||||
|
||||
/**
|
||||
* This autonomous runs the autonomous command selected by your {@link RobotContainer} class.
|
||||
*/
|
||||
/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
|
||||
@Override
|
||||
public void autonomousInit() {
|
||||
m_autonomousCommand = m_robotContainer.getAutonomousCommand();
|
||||
@@ -70,12 +64,9 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during autonomous.
|
||||
*/
|
||||
/** This function is called periodically during autonomous. */
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
}
|
||||
public void autonomousPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void teleopInit() {
|
||||
@@ -88,12 +79,9 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during operator control.
|
||||
*/
|
||||
/** This function is called periodically during operator control. */
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
}
|
||||
public void teleopPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void testInit() {
|
||||
@@ -101,10 +89,7 @@ public class Robot extends TimedRobot {
|
||||
CommandScheduler.getInstance().cancelAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during test mode.
|
||||
*/
|
||||
/** This function is called periodically during test mode. */
|
||||
@Override
|
||||
public void testPeriodic() {
|
||||
}
|
||||
public void testPeriodic() {}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ import edu.wpi.first.wpilibj.templates.romicommandbased.subsystems.RomiDrivetrai
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
|
||||
/**
|
||||
* This class is where the bulk of the robot should be declared. Since Command-based is a
|
||||
* This class is where the bulk of the robot should be declared. Since Command-based is a
|
||||
* "declarative" paradigm, very little robot logic should actually be handled in the {@link Robot}
|
||||
* periodic methods (other than the scheduler calls). Instead, the structure of the robot
|
||||
* (including subsystems, commands, and button mappings) should be declared here.
|
||||
* periodic methods (other than the scheduler calls). Instead, the structure of the robot (including
|
||||
* subsystems, commands, and button mappings) should be declared here.
|
||||
*/
|
||||
public class RobotContainer {
|
||||
// The robot's subsystems and commands are defined here...
|
||||
@@ -22,25 +22,19 @@ public class RobotContainer {
|
||||
|
||||
private final ExampleCommand m_autoCommand = new ExampleCommand(m_romiDrivetrain);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The container for the robot. Contains subsystems, OI devices, and commands.
|
||||
*/
|
||||
/** The container for the robot. Contains subsystems, OI devices, and commands. */
|
||||
public RobotContainer() {
|
||||
// Configure the button bindings
|
||||
configureButtonBindings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to define your button->command mappings. Buttons can be created by
|
||||
* Use this method to define your button->command mappings. Buttons can be created by
|
||||
* instantiating a {@link GenericHID} or one of its subclasses ({@link
|
||||
* edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then passing it to a
|
||||
* {@link edu.wpi.first.wpilibj2.command.button.JoystickButton}.
|
||||
* edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then passing it to a {@link
|
||||
* edu.wpi.first.wpilibj2.command.button.JoystickButton}.
|
||||
*/
|
||||
private void configureButtonBindings() {
|
||||
}
|
||||
|
||||
private void configureButtonBindings() {}
|
||||
|
||||
/**
|
||||
* Use this to pass the autonomous command to the main {@link Robot} class.
|
||||
|
||||
@@ -7,9 +7,7 @@ package edu.wpi.first.wpilibj.templates.romicommandbased.commands;
|
||||
import edu.wpi.first.wpilibj.templates.romicommandbased.subsystems.RomiDrivetrain;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
|
||||
/**
|
||||
* An example command that uses an example subsystem.
|
||||
*/
|
||||
/** An example command that uses an example subsystem. */
|
||||
public class ExampleCommand extends CommandBase {
|
||||
@SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"})
|
||||
private final RomiDrivetrain m_subsystem;
|
||||
@@ -27,18 +25,15 @@ public class ExampleCommand extends CommandBase {
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
}
|
||||
public void initialize() {}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
}
|
||||
public void execute() {}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
}
|
||||
public void end(boolean interrupted) {}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
|
||||
@@ -26,9 +26,7 @@ public class RomiDrivetrain extends SubsystemBase {
|
||||
// Set up the differential drive controller
|
||||
private final DifferentialDrive m_diffDrive = new DifferentialDrive(m_leftMotor, m_rightMotor);
|
||||
|
||||
/**
|
||||
* Creates a new RomiDrivetrain.
|
||||
*/
|
||||
/** Creates a new RomiDrivetrain. */
|
||||
public RomiDrivetrain() {
|
||||
// DifferentialDrive defaults to having the right side flipped
|
||||
// We don't need to do this because the Romi has accounted for this
|
||||
|
||||
@@ -7,13 +7,12 @@ package edu.wpi.first.wpilibj.templates.romitimed;
|
||||
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.
|
||||
* 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() {
|
||||
}
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
|
||||
@@ -9,10 +9,9 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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 {
|
||||
@@ -24,8 +23,8 @@ public class Robot extends TimedRobot {
|
||||
private final RomiDrivetrain m_drivetrain = new RomiDrivetrain();
|
||||
|
||||
/**
|
||||
* This function is run when the robot is first started up and should be
|
||||
* used for any initialization code.
|
||||
* This function is run when the robot is first started up and should be used for any
|
||||
* initialization code.
|
||||
*/
|
||||
@Override
|
||||
public void robotInit() {
|
||||
@@ -35,27 +34,24 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called every robot packet, no matter the mode. Use
|
||||
* this for items like diagnostics that you want ran during disabled,
|
||||
* autonomous, teleoperated and test.
|
||||
* This function is called every robot packet, no matter the mode. Use this for items like
|
||||
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
|
||||
*
|
||||
* <p>This runs after the mode specific periodic functions, but before
|
||||
* LiveWindow and SmartDashboard integrated updating.
|
||||
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
|
||||
* SmartDashboard integrated updating.
|
||||
*/
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
}
|
||||
public void robotPeriodic() {}
|
||||
|
||||
/**
|
||||
* This autonomous (along with the chooser code above) shows how to select
|
||||
* between different autonomous modes using the dashboard. The sendable
|
||||
* chooser code works with the Java SmartDashboard. If you prefer the
|
||||
* LabVIEW Dashboard, remove all of the chooser code and uncomment the
|
||||
* getString line to get the auto name from the text box below the Gyro
|
||||
* This autonomous (along with the chooser code above) shows how to select between different
|
||||
* autonomous modes using the dashboard. The sendable chooser code works with the Java
|
||||
* SmartDashboard. If you prefer the LabVIEW Dashboard, remove all of the chooser code and
|
||||
* uncomment the getString line to get the auto name from the text box below the Gyro
|
||||
*
|
||||
* <p>You can add additional auto modes by adding additional comparisons to
|
||||
* the switch structure below with additional strings. If using the
|
||||
* SendableChooser make sure to add them to the chooser code above as well.
|
||||
* <p>You can add additional auto modes by adding additional comparisons to the switch structure
|
||||
* below with additional strings. If using the SendableChooser make sure to add them to the
|
||||
* chooser code above as well.
|
||||
*/
|
||||
@Override
|
||||
public void autonomousInit() {
|
||||
@@ -66,9 +62,7 @@ public class Robot extends TimedRobot {
|
||||
m_drivetrain.resetEncoders();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during autonomous.
|
||||
*/
|
||||
/** This function is called periodically during autonomous. */
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
switch (m_autoSelected) {
|
||||
@@ -82,45 +76,27 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called once when teleop is enabled.
|
||||
*/
|
||||
/** This function is called once when teleop is enabled. */
|
||||
@Override
|
||||
public void teleopInit() {
|
||||
}
|
||||
public void teleopInit() {}
|
||||
|
||||
/**
|
||||
* This function is called periodically during operator control.
|
||||
*/
|
||||
/** This function is called periodically during operator control. */
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
}
|
||||
public void teleopPeriodic() {}
|
||||
|
||||
/**
|
||||
* This function is called once when the robot is disabled.
|
||||
*/
|
||||
/** This function is called once when the robot is disabled. */
|
||||
@Override
|
||||
public void disabledInit() {
|
||||
}
|
||||
public void disabledInit() {}
|
||||
|
||||
/**
|
||||
* This function is called periodically when disabled.
|
||||
*/
|
||||
/** This function is called periodically when disabled. */
|
||||
@Override
|
||||
public void disabledPeriodic() {
|
||||
}
|
||||
public void disabledPeriodic() {}
|
||||
|
||||
/**
|
||||
* This function is called once when test mode is enabled.
|
||||
*/
|
||||
/** This function is called once when test mode is enabled. */
|
||||
@Override
|
||||
public void testInit() {
|
||||
}
|
||||
public void testInit() {}
|
||||
|
||||
/**
|
||||
* This function is called periodically during test mode.
|
||||
*/
|
||||
/** This function is called periodically during test mode. */
|
||||
@Override
|
||||
public void testPeriodic() {
|
||||
}
|
||||
public void testPeriodic() {}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,7 @@ public class RomiDrivetrain {
|
||||
// Set up the differential drive controller
|
||||
private final DifferentialDrive m_diffDrive = new DifferentialDrive(m_leftMotor, m_rightMotor);
|
||||
|
||||
/**
|
||||
* Creates a new RomiDrivetrain.
|
||||
*/
|
||||
/** Creates a new RomiDrivetrain. */
|
||||
public RomiDrivetrain() {
|
||||
// DifferentialDrive defaults to having the right side flipped
|
||||
// We don't need to do this because the Romi has accounted for this
|
||||
|
||||
@@ -7,13 +7,12 @@ package edu.wpi.first.wpilibj.templates.timed;
|
||||
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.
|
||||
* 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() {
|
||||
}
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
|
||||
@@ -9,10 +9,9 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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 {
|
||||
@@ -22,8 +21,8 @@ public class Robot extends TimedRobot {
|
||||
private final SendableChooser<String> m_chooser = new SendableChooser<>();
|
||||
|
||||
/**
|
||||
* This function is run when the robot is first started up and should be
|
||||
* used for any initialization code.
|
||||
* This function is run when the robot is first started up and should be used for any
|
||||
* initialization code.
|
||||
*/
|
||||
@Override
|
||||
public void robotInit() {
|
||||
@@ -33,27 +32,24 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called every robot packet, no matter the mode. Use
|
||||
* this for items like diagnostics that you want ran during disabled,
|
||||
* autonomous, teleoperated and test.
|
||||
* This function is called every robot packet, no matter the mode. Use this for items like
|
||||
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
|
||||
*
|
||||
* <p>This runs after the mode specific periodic functions, but before
|
||||
* LiveWindow and SmartDashboard integrated updating.
|
||||
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
|
||||
* SmartDashboard integrated updating.
|
||||
*/
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
}
|
||||
public void robotPeriodic() {}
|
||||
|
||||
/**
|
||||
* This autonomous (along with the chooser code above) shows how to select
|
||||
* between different autonomous modes using the dashboard. The sendable
|
||||
* chooser code works with the Java SmartDashboard. If you prefer the
|
||||
* LabVIEW Dashboard, remove all of the chooser code and uncomment the
|
||||
* getString line to get the auto name from the text box below the Gyro
|
||||
* This autonomous (along with the chooser code above) shows how to select between different
|
||||
* autonomous modes using the dashboard. The sendable chooser code works with the Java
|
||||
* SmartDashboard. If you prefer the LabVIEW Dashboard, remove all of the chooser code and
|
||||
* uncomment the getString line to get the auto name from the text box below the Gyro
|
||||
*
|
||||
* <p>You can add additional auto modes by adding additional comparisons to
|
||||
* the switch structure below with additional strings. If using the
|
||||
* SendableChooser make sure to add them to the chooser code above as well.
|
||||
* <p>You can add additional auto modes by adding additional comparisons to the switch structure
|
||||
* below with additional strings. If using the SendableChooser make sure to add them to the
|
||||
* chooser code above as well.
|
||||
*/
|
||||
@Override
|
||||
public void autonomousInit() {
|
||||
@@ -62,9 +58,7 @@ public class Robot extends TimedRobot {
|
||||
System.out.println("Auto selected: " + m_autoSelected);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called periodically during autonomous.
|
||||
*/
|
||||
/** This function is called periodically during autonomous. */
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
switch (m_autoSelected) {
|
||||
@@ -78,45 +72,27 @@ public class Robot extends TimedRobot {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called once when teleop is enabled.
|
||||
*/
|
||||
/** This function is called once when teleop is enabled. */
|
||||
@Override
|
||||
public void teleopInit() {
|
||||
}
|
||||
public void teleopInit() {}
|
||||
|
||||
/**
|
||||
* This function is called periodically during operator control.
|
||||
*/
|
||||
/** This function is called periodically during operator control. */
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
}
|
||||
public void teleopPeriodic() {}
|
||||
|
||||
/**
|
||||
* This function is called once when the robot is disabled.
|
||||
*/
|
||||
/** This function is called once when the robot is disabled. */
|
||||
@Override
|
||||
public void disabledInit() {
|
||||
}
|
||||
public void disabledInit() {}
|
||||
|
||||
/**
|
||||
* This function is called periodically when disabled.
|
||||
*/
|
||||
/** This function is called periodically when disabled. */
|
||||
@Override
|
||||
public void disabledPeriodic() {
|
||||
}
|
||||
public void disabledPeriodic() {}
|
||||
|
||||
/**
|
||||
* This function is called once when test mode is enabled.
|
||||
*/
|
||||
/** This function is called once when test mode is enabled. */
|
||||
@Override
|
||||
public void testInit() {
|
||||
}
|
||||
public void testInit() {}
|
||||
|
||||
/**
|
||||
* This function is called periodically during test mode.
|
||||
*/
|
||||
/** This function is called periodically during test mode. */
|
||||
@Override
|
||||
public void testPeriodic() {
|
||||
}
|
||||
public void testPeriodic() {}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,12 @@ 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.
|
||||
* 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() {
|
||||
}
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
|
||||
@@ -7,55 +7,43 @@ 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
|
||||
* 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.
|
||||
* This function is run when the robot is first started up and should be used for any
|
||||
* initialization code.
|
||||
*/
|
||||
@Override
|
||||
public void robotInit() {
|
||||
}
|
||||
public void robotInit() {}
|
||||
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
}
|
||||
public void robotPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void autonomousInit() {
|
||||
}
|
||||
public void autonomousInit() {}
|
||||
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
}
|
||||
public void autonomousPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void teleopInit() {
|
||||
}
|
||||
public void teleopInit() {}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
}
|
||||
public void teleopPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void disabledInit() {
|
||||
}
|
||||
public void disabledInit() {}
|
||||
|
||||
@Override
|
||||
public void disabledPeriodic() {
|
||||
}
|
||||
public void disabledPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void testInit() {
|
||||
}
|
||||
public void testInit() {}
|
||||
|
||||
@Override
|
||||
public void testPeriodic() {
|
||||
}
|
||||
|
||||
public void testPeriodic() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user