SCRIPT: Spotless Apply

This commit is contained in:
PJ Reiniger
2025-11-07 19:57:21 -05:00
committed by Peter Johnson
parent c89910b7c6
commit c48b722dac
650 changed files with 1529 additions and 1545 deletions

View File

@@ -7,11 +7,11 @@ package org.wpilib.examples.addressableled;
import static org.wpilib.units.Units.Meters;
import static org.wpilib.units.Units.MetersPerSecond;
import org.wpilib.units.measure.Distance;
import org.wpilib.hardware.led.AddressableLED;
import org.wpilib.hardware.led.AddressableLEDBuffer;
import org.wpilib.hardware.led.LEDPattern;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.units.measure.Distance;
public class Robot extends TimedRobot {
private final AddressableLED m_led;

View File

@@ -4,24 +4,24 @@
package org.wpilib.examples.apriltagsvision;
import org.wpilib.vision.apriltag.AprilTagDetection;
import org.wpilib.vision.apriltag.AprilTagDetector;
import org.wpilib.vision.apriltag.AprilTagPoseEstimator;
import org.wpilib.vision.stream.CameraServer;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.CvSource;
import org.wpilib.vision.camera.UsbCamera;
import java.util.ArrayList;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.geometry.Transform3d;
import org.wpilib.networktables.IntegerArrayPublisher;
import org.wpilib.networktables.NetworkTable;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.opmode.TimedRobot;
import java.util.ArrayList;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.wpilib.vision.apriltag.AprilTagDetection;
import org.wpilib.vision.apriltag.AprilTagDetector;
import org.wpilib.vision.apriltag.AprilTagPoseEstimator;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.CvSource;
import org.wpilib.vision.camera.UsbCamera;
import org.wpilib.vision.stream.CameraServer;
/**
* This is a demo program showing the detection of AprilTags. The image is acquired from the USB

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.arcadedrive;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.util.sendable.SendableRegistry;
/**
* This is a demo program showing the use of the DifferentialDrive class. Runs the motors with

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.arcadedrivexboxcontroller;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.driverstation.XboxController;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.util.sendable.SendableRegistry;
/**
* This is a demo program showing the use of the DifferentialDrive class. Runs the motors with split

View File

@@ -5,8 +5,8 @@
package org.wpilib.examples.armsimulation;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.examples.armsimulation.subsystems.Arm;
import org.wpilib.opmode.TimedRobot;
/** This is a sample program to demonstrate the use of arm simulation with existing code. */
public class Robot extends TimedRobot {

View File

@@ -4,14 +4,12 @@
package org.wpilib.examples.armsimulation.subsystems;
import org.wpilib.examples.armsimulation.Constants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.util.Preferences;
import org.wpilib.system.RobotController;
import org.wpilib.examples.armsimulation.Constants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.simulation.BatterySim;
import org.wpilib.simulation.EncoderSim;
import org.wpilib.simulation.RoboRioSim;
@@ -20,8 +18,10 @@ import org.wpilib.smartdashboard.Mechanism2d;
import org.wpilib.smartdashboard.MechanismLigament2d;
import org.wpilib.smartdashboard.MechanismRoot2d;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.system.RobotController;
import org.wpilib.util.Color;
import org.wpilib.util.Color8Bit;
import org.wpilib.util.Preferences;
public class Arm implements AutoCloseable {
// The P gain for the PID controller that drives this arm.

View File

@@ -4,15 +4,15 @@
package org.wpilib.examples.differentialdrivebot;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.kinematics.ChassisSpeeds;
import org.wpilib.math.kinematics.DifferentialDriveKinematics;
import org.wpilib.math.kinematics.DifferentialDriveOdometry;
import org.wpilib.math.kinematics.DifferentialDriveWheelSpeeds;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.hardware.motor.PWMSparkMax;
/** Represents a differential drive style drivetrain. */
public class Drivetrain {

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.differentialdrivebot;
import org.wpilib.driverstation.XboxController;
import org.wpilib.math.filter.SlewRateLimiter;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
public class Robot extends TimedRobot {
private final XboxController m_controller = new XboxController(0);

View File

@@ -4,10 +4,9 @@
package org.wpilib.examples.differentialdriveposeestimator;
import org.wpilib.vision.apriltag.AprilTagFieldLayout;
import org.wpilib.vision.apriltag.AprilTagFields;
import org.wpilib.math.util.ComputerVisionUtil;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.estimator.DifferentialDrivePoseEstimator;
@@ -20,22 +19,23 @@ import org.wpilib.math.geometry.Translation3d;
import org.wpilib.math.kinematics.ChassisSpeeds;
import org.wpilib.math.kinematics.DifferentialDriveKinematics;
import org.wpilib.math.kinematics.DifferentialDriveWheelSpeeds;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.numbers.N2;
import org.wpilib.math.system.LinearSystem;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.system.plant.LinearSystemId;
import org.wpilib.math.util.ComputerVisionUtil;
import org.wpilib.math.util.Units;
import org.wpilib.networktables.DoubleArrayEntry;
import org.wpilib.networktables.DoubleArrayTopic;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.system.RobotController;
import org.wpilib.system.Timer;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.simulation.DifferentialDrivetrainSim;
import org.wpilib.simulation.EncoderSim;
import org.wpilib.smartdashboard.Field2d;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.system.RobotController;
import org.wpilib.system.Timer;
import org.wpilib.vision.apriltag.AprilTagFieldLayout;
import org.wpilib.vision.apriltag.AprilTagFields;
/** Represents a differential drive style drivetrain. */
public class Drivetrain {

View File

@@ -4,10 +4,10 @@
package org.wpilib.examples.differentialdriveposeestimator;
import org.wpilib.math.util.StateSpaceUtil;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.util.StateSpaceUtil;
import org.wpilib.math.util.Units;
/** This dummy class represents a global measurement sensor, such as a computer vision solution. */

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.differentialdriveposeestimator;
import org.wpilib.driverstation.XboxController;
import org.wpilib.math.filter.SlewRateLimiter;
import org.wpilib.networktables.DoubleArrayTopic;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
public class Robot extends TimedRobot {
private final NetworkTableInstance m_inst = NetworkTableInstance.getDefault();

View File

@@ -4,10 +4,10 @@
package org.wpilib.examples.digitalcommunication;
import org.wpilib.hardware.discrete.DigitalOutput;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.opmode.TimedRobot;
import java.util.Optional;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.hardware.discrete.DigitalOutput;
import org.wpilib.opmode.TimedRobot;
/**
* This is a sample program demonstrating how to communicate to a light controller from the robot

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.drivedistanceoffboard;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.opmode.TimedRobot;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.drivedistanceoffboard;
import org.wpilib.driverstation.XboxController;
import org.wpilib.examples.drivedistanceoffboard.Constants.OIConstants;
import org.wpilib.examples.drivedistanceoffboard.subsystems.DriveSubsystem;
import org.wpilib.command2.Command;
import org.wpilib.command2.Commands;
import org.wpilib.command2.button.CommandXboxController;
import org.wpilib.driverstation.XboxController;
import org.wpilib.examples.drivedistanceoffboard.Constants.OIConstants;
import org.wpilib.examples.drivedistanceoffboard.subsystems.DriveSubsystem;
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a

View File

@@ -4,17 +4,17 @@
package org.wpilib.examples.drivedistanceoffboard.subsystems;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.math.trajectory.TrapezoidProfile.State;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.system.RobotController;
import org.wpilib.system.Timer;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.examples.drivedistanceoffboard.Constants.DriveConstants;
import org.wpilib.examples.drivedistanceoffboard.ExampleSmartMotorController;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.math.trajectory.TrapezoidProfile.State;
import org.wpilib.system.RobotController;
import org.wpilib.system.Timer;
import org.wpilib.util.sendable.SendableRegistry;
public class DriveSubsystem extends SubsystemBase {
// The motors on the left side of the drive.

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.dutycycleencoder;
import org.wpilib.math.util.MathUtil;
import org.wpilib.hardware.rotation.DutyCycleEncoder;
import org.wpilib.math.util.MathUtil;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.smartdashboard.SmartDashboard;

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.elevatorexponentialprofile;
import org.wpilib.driverstation.Joystick;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.trajectory.ExponentialProfile;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
public class Robot extends TimedRobot {

View File

@@ -5,8 +5,8 @@
package org.wpilib.examples.elevatorexponentialsimulation;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.examples.elevatorexponentialsimulation.subsystems.Elevator;
import org.wpilib.opmode.TimedRobot;
/** This is a sample program to demonstrate the use of elevator simulation. */
public class Robot extends TimedRobot {

View File

@@ -4,15 +4,14 @@
package org.wpilib.examples.elevatorexponentialsimulation.subsystems;
import org.wpilib.examples.elevatorexponentialsimulation.Constants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.ElevatorFeedforward;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.trajectory.ExponentialProfile;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.system.RobotController;
import org.wpilib.examples.elevatorexponentialsimulation.Constants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.simulation.BatterySim;
import org.wpilib.simulation.ElevatorSim;
import org.wpilib.simulation.EncoderSim;
@@ -22,6 +21,7 @@ import org.wpilib.smartdashboard.Mechanism2d;
import org.wpilib.smartdashboard.MechanismLigament2d;
import org.wpilib.smartdashboard.MechanismRoot2d;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.system.RobotController;
public class Elevator implements AutoCloseable {
// This gearbox represents a gearbox containing 4 Vex 775pro motors.

View File

@@ -4,13 +4,13 @@
package org.wpilib.examples.elevatorprofiledpid;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.ElevatorFeedforward;
import org.wpilib.math.controller.ProfiledPIDController;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
public class Robot extends TimedRobot {
private static double kDt = 0.02;

View File

@@ -5,8 +5,8 @@
package org.wpilib.examples.elevatorsimulation;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.examples.elevatorsimulation.subsystems.Elevator;
import org.wpilib.opmode.TimedRobot;
/** This is a sample program to demonstrate the use of elevator simulation. */
public class Robot extends TimedRobot {

View File

@@ -4,14 +4,13 @@
package org.wpilib.examples.elevatorsimulation.subsystems;
import org.wpilib.examples.elevatorsimulation.Constants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.ElevatorFeedforward;
import org.wpilib.math.controller.ProfiledPIDController;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.system.RobotController;
import org.wpilib.examples.elevatorsimulation.Constants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.simulation.BatterySim;
import org.wpilib.simulation.ElevatorSim;
import org.wpilib.simulation.EncoderSim;
@@ -21,6 +20,7 @@ import org.wpilib.smartdashboard.Mechanism2d;
import org.wpilib.smartdashboard.MechanismLigament2d;
import org.wpilib.smartdashboard.MechanismRoot2d;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.system.RobotController;
public class Elevator implements AutoCloseable {
// This gearbox represents a gearbox containing 4 Vex 775pro motors.

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.elevatortrapezoidprofile;
import org.wpilib.driverstation.Joystick;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
public class Robot extends TimedRobot {

View File

@@ -4,14 +4,14 @@
package org.wpilib.examples.eventloop;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.event.BooleanEvent;
import org.wpilib.event.EventLoop;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.opmode.TimedRobot;
public class Robot extends TimedRobot {
public static final double SHOT_VELOCITY = 200; // rpm

View File

@@ -4,6 +4,9 @@
package org.wpilib.examples.flywheelbangbangcontroller;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.BangBangController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.numbers.N1;
@@ -11,14 +14,11 @@ import org.wpilib.math.system.LinearSystem;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.system.plant.LinearSystemId;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.system.RobotController;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.simulation.EncoderSim;
import org.wpilib.simulation.FlywheelSim;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.system.RobotController;
/**
* This is a sample program to demonstrate the use of a BangBangController with a flywheel to

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.gettingstarted;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.driverstation.XboxController;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.system.Timer;
import org.wpilib.driverstation.XboxController;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.util.sendable.SendableRegistry;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.gyro;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.util.sendable.SendableRegistry;
/**
* This is a sample program to demonstrate how to use a gyro sensor to make a robot drive straight.

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.gyromecanum;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.drive.MecanumDrive;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.drive.MecanumDrive;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.util.sendable.SendableRegistry;
/**
* This is a sample program that uses mecanum drive with a gyro sensor to maintain rotation vectors

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.hatchbotinlined;
import org.wpilib.system.DataLogManager;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.system.DataLogManager;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,6 +4,9 @@
package org.wpilib.examples.hatchbotinlined;
import org.wpilib.command2.Command;
import org.wpilib.command2.Commands;
import org.wpilib.command2.button.CommandPS4Controller;
import org.wpilib.driverstation.PS4Controller;
import org.wpilib.examples.hatchbotinlined.Constants.OIConstants;
import org.wpilib.examples.hatchbotinlined.commands.Autos;
@@ -11,9 +14,6 @@ import org.wpilib.examples.hatchbotinlined.subsystems.DriveSubsystem;
import org.wpilib.examples.hatchbotinlined.subsystems.HatchSubsystem;
import org.wpilib.smartdashboard.SendableChooser;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.command2.Command;
import org.wpilib.command2.Commands;
import org.wpilib.command2.button.CommandPS4Controller;
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.hatchbotinlined.commands;
import org.wpilib.examples.hatchbotinlined.Constants.AutoConstants;
import org.wpilib.examples.hatchbotinlined.subsystems.DriveSubsystem;
import org.wpilib.examples.hatchbotinlined.subsystems.HatchSubsystem;
import org.wpilib.command2.Command;
import org.wpilib.command2.Commands;
import org.wpilib.command2.FunctionalCommand;
import org.wpilib.examples.hatchbotinlined.Constants.AutoConstants;
import org.wpilib.examples.hatchbotinlined.subsystems.DriveSubsystem;
import org.wpilib.examples.hatchbotinlined.subsystems.HatchSubsystem;
/** Container for auto command factories. */
public final class Autos {

View File

@@ -4,13 +4,13 @@
package org.wpilib.examples.hatchbotinlined.subsystems;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.examples.hatchbotinlined.Constants.DriveConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
public class DriveSubsystem extends SubsystemBase {
// The motors on the left side of the drive.

View File

@@ -7,12 +7,12 @@ package org.wpilib.examples.hatchbotinlined.subsystems;
import static org.wpilib.hardware.pneumatic.DoubleSolenoid.Value.kForward;
import static org.wpilib.hardware.pneumatic.DoubleSolenoid.Value.kReverse;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
import org.wpilib.examples.hatchbotinlined.Constants.HatchConstants;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.examples.hatchbotinlined.Constants.HatchConstants;
import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
import org.wpilib.util.sendable.SendableBuilder;
/** A hatch mechanism actuated by a single {@link org.wpilib.hardware.pneumatic.DoubleSolenoid}. */
public class HatchSubsystem extends SubsystemBase {

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.hatchbottraditional;
import org.wpilib.system.DataLogManager;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.system.DataLogManager;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -6,6 +6,8 @@ package org.wpilib.examples.hatchbottraditional;
import static org.wpilib.driverstation.XboxController.Button;
import org.wpilib.command2.Command;
import org.wpilib.command2.button.JoystickButton;
import org.wpilib.driverstation.XboxController;
import org.wpilib.examples.hatchbottraditional.Constants.AutoConstants;
import org.wpilib.examples.hatchbottraditional.Constants.OIConstants;
@@ -19,8 +21,6 @@ import org.wpilib.examples.hatchbottraditional.subsystems.DriveSubsystem;
import org.wpilib.examples.hatchbottraditional.subsystems.HatchSubsystem;
import org.wpilib.smartdashboard.SendableChooser;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.command2.Command;
import org.wpilib.command2.button.JoystickButton;
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a

View File

@@ -4,10 +4,10 @@
package org.wpilib.examples.hatchbottraditional.commands;
import org.wpilib.command2.SequentialCommandGroup;
import org.wpilib.examples.hatchbottraditional.Constants.AutoConstants;
import org.wpilib.examples.hatchbottraditional.subsystems.DriveSubsystem;
import org.wpilib.examples.hatchbottraditional.subsystems.HatchSubsystem;
import org.wpilib.command2.SequentialCommandGroup;
/** A complex auto command that drives forward, releases a hatch, and then drives backward. */
public class ComplexAuto extends SequentialCommandGroup {

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.hatchbottraditional.commands;
import org.wpilib.examples.hatchbottraditional.subsystems.DriveSubsystem;
import org.wpilib.command2.Command;
import java.util.function.DoubleSupplier;
import org.wpilib.command2.Command;
import org.wpilib.examples.hatchbottraditional.subsystems.DriveSubsystem;
/**
* A command to drive the robot with joystick input (passed in as {@link DoubleSupplier}s). Written

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.hatchbottraditional.commands;
import org.wpilib.examples.hatchbottraditional.subsystems.DriveSubsystem;
import org.wpilib.command2.Command;
import org.wpilib.examples.hatchbottraditional.subsystems.DriveSubsystem;
public class DriveDistance extends Command {
private final DriveSubsystem m_drive;

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.hatchbottraditional.commands;
import org.wpilib.examples.hatchbottraditional.subsystems.HatchSubsystem;
import org.wpilib.command2.Command;
import org.wpilib.examples.hatchbottraditional.subsystems.HatchSubsystem;
/**
* A simple command that grabs a hatch with the {@link HatchSubsystem}. Written explicitly for

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.hatchbottraditional.commands;
import org.wpilib.examples.hatchbottraditional.subsystems.DriveSubsystem;
import org.wpilib.command2.Command;
import org.wpilib.examples.hatchbottraditional.subsystems.DriveSubsystem;
public class HalveDriveSpeed extends Command {
private final DriveSubsystem m_drive;

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.hatchbottraditional.commands;
import org.wpilib.examples.hatchbottraditional.subsystems.HatchSubsystem;
import org.wpilib.command2.InstantCommand;
import org.wpilib.examples.hatchbottraditional.subsystems.HatchSubsystem;
/** A command that releases the hatch. */
public class ReleaseHatch extends InstantCommand {

View File

@@ -4,13 +4,13 @@
package org.wpilib.examples.hatchbottraditional.subsystems;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.examples.hatchbottraditional.Constants.DriveConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.util.sendable.SendableRegistry;
public class DriveSubsystem extends SubsystemBase {
// The motors on the left side of the drive.

View File

@@ -7,11 +7,11 @@ package org.wpilib.examples.hatchbottraditional.subsystems;
import static org.wpilib.hardware.pneumatic.DoubleSolenoid.Value.kForward;
import static org.wpilib.hardware.pneumatic.DoubleSolenoid.Value.kReverse;
import org.wpilib.util.sendable.SendableBuilder;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.examples.hatchbottraditional.Constants.HatchConstants;
import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
import org.wpilib.examples.hatchbottraditional.Constants.HatchConstants;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.util.sendable.SendableBuilder;
/** A hatch mechanism actuated by a single {@link DoubleSolenoid}. */
public class HatchSubsystem extends SubsystemBase {

View File

@@ -5,8 +5,8 @@
package org.wpilib.examples.hidrumble;
import org.wpilib.driverstation.GenericHID.RumbleType;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
import org.wpilib.opmode.TimedRobot;
/** This is a demo program showing the use of GenericHID's rumble feature. */
public class Robot extends TimedRobot {

View File

@@ -4,15 +4,15 @@
package org.wpilib.examples.httpcamera;
import org.wpilib.vision.stream.CameraServer;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.CvSource;
import org.wpilib.vision.camera.HttpCamera;
import org.wpilib.opmode.TimedRobot;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.CvSource;
import org.wpilib.vision.camera.HttpCamera;
import org.wpilib.vision.stream.CameraServer;
/**
* This is a demo program showing the use of OpenCV to do vision processing. The image is acquired

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.i2ccommunication;
import java.util.Optional;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.hardware.bus.I2C;
import org.wpilib.hardware.bus.I2C.Port;
import org.wpilib.opmode.TimedRobot;
import java.util.Optional;
/**
* This is a sample program demonstrating how to communicate to a light controller from the robot

View File

@@ -4,15 +4,15 @@
package org.wpilib.examples.intermediatevision;
import org.wpilib.vision.stream.CameraServer;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.CvSource;
import org.wpilib.vision.camera.UsbCamera;
import org.wpilib.opmode.TimedRobot;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.vision.camera.CvSink;
import org.wpilib.vision.camera.CvSource;
import org.wpilib.vision.camera.UsbCamera;
import org.wpilib.vision.stream.CameraServer;
/**
* This is a demo program showing the use of OpenCV to do vision processing. The image is acquired

View File

@@ -4,6 +4,9 @@
package org.wpilib.examples.mecanumbot;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.geometry.Translation2d;
@@ -12,9 +15,6 @@ import org.wpilib.math.kinematics.MecanumDriveKinematics;
import org.wpilib.math.kinematics.MecanumDriveOdometry;
import org.wpilib.math.kinematics.MecanumDriveWheelPositions;
import org.wpilib.math.kinematics.MecanumDriveWheelSpeeds;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.hardware.motor.PWMSparkMax;
/** Represents a mecanum drive style drivetrain. */
public class Drivetrain {

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.mecanumbot;
import org.wpilib.driverstation.XboxController;
import org.wpilib.math.filter.SlewRateLimiter;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
public class Robot extends TimedRobot {
private final XboxController m_controller = new XboxController(0);

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.mecanumdrive;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.drive.MecanumDrive;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.util.sendable.SendableRegistry;
/** This is a demo program showing how to use Mecanum control with the MecanumDrive class. */
public class Robot extends TimedRobot {

View File

@@ -4,7 +4,9 @@
package org.wpilib.examples.mecanumdriveposeestimator;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.estimator.MecanumDrivePoseEstimator;
@@ -14,11 +16,9 @@ import org.wpilib.math.kinematics.ChassisSpeeds;
import org.wpilib.math.kinematics.MecanumDriveKinematics;
import org.wpilib.math.kinematics.MecanumDriveWheelPositions;
import org.wpilib.math.kinematics.MecanumDriveWheelSpeeds;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.system.Timer;
import org.wpilib.hardware.motor.PWMSparkMax;
/** Represents a mecanum drive style drivetrain. */
public class Drivetrain {

View File

@@ -4,10 +4,10 @@
package org.wpilib.examples.mecanumdriveposeestimator;
import org.wpilib.math.util.StateSpaceUtil;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.util.StateSpaceUtil;
import org.wpilib.math.util.Units;
/** This dummy class represents a global measurement sensor, such as a computer vision solution. */

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.mecanumdriveposeestimator;
import org.wpilib.driverstation.XboxController;
import org.wpilib.math.filter.SlewRateLimiter;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
public class Robot extends TimedRobot {
private final XboxController m_controller = new XboxController(0);

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.mechanism2d;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.AnalogPotentiometer;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.smartdashboard.Mechanism2d;
import org.wpilib.smartdashboard.MechanismLigament2d;
import org.wpilib.smartdashboard.MechanismRoot2d;

View File

@@ -4,10 +4,10 @@
package org.wpilib.examples.motorcontrol;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.smartdashboard.SmartDashboard;
/**

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.potentiometerpid;
import org.wpilib.math.controller.PIDController;
import org.wpilib.hardware.rotation.AnalogPotentiometer;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.AnalogPotentiometer;
import org.wpilib.math.controller.PIDController;
import org.wpilib.opmode.TimedRobot;
/**
* This is a sample program to demonstrate how to use a soft potentiometer and a PID controller to

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.quickvision;
import org.wpilib.vision.stream.CameraServer;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.vision.stream.CameraServer;
/**
* Uses the CameraServer class to automatically capture video from a USB webcam and send it to the

View File

@@ -6,6 +6,9 @@ package org.wpilib.examples.rapidreactcommandbot;
import static org.wpilib.command2.Commands.parallel;
import org.wpilib.command2.Command;
import org.wpilib.command2.button.CommandXboxController;
import org.wpilib.command2.button.Trigger;
import org.wpilib.epilogue.Logged;
import org.wpilib.examples.rapidreactcommandbot.Constants.AutoConstants;
import org.wpilib.examples.rapidreactcommandbot.Constants.OIConstants;
@@ -15,9 +18,6 @@ import org.wpilib.examples.rapidreactcommandbot.subsystems.Intake;
import org.wpilib.examples.rapidreactcommandbot.subsystems.Pneumatics;
import org.wpilib.examples.rapidreactcommandbot.subsystems.Shooter;
import org.wpilib.examples.rapidreactcommandbot.subsystems.Storage;
import org.wpilib.command2.Command;
import org.wpilib.command2.button.CommandXboxController;
import org.wpilib.command2.button.Trigger;
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.rapidreactcommandbot;
import org.wpilib.epilogue.Epilogue;
import org.wpilib.epilogue.Logged;
import org.wpilib.system.DataLogManager;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.epilogue.Epilogue;
import org.wpilib.epilogue.Logged;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.system.DataLogManager;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,21 +4,21 @@
package org.wpilib.examples.rapidreactcommandbot.subsystems;
import java.util.function.DoubleSupplier;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.NotLogged;
import org.wpilib.examples.rapidreactcommandbot.Constants.DriveConstants;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.ProfiledPIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.system.RobotController;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.examples.rapidreactcommandbot.Constants.DriveConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import java.util.function.DoubleSupplier;
import org.wpilib.util.sendable.SendableRegistry;
@Logged
public class Drive extends SubsystemBase {

View File

@@ -6,13 +6,13 @@ package org.wpilib.examples.rapidreactcommandbot.subsystems;
import static org.wpilib.examples.rapidreactcommandbot.Constants.IntakeConstants;
import org.wpilib.epilogue.Logged;
import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
import org.wpilib.examples.rapidreactcommandbot.Constants.IntakeConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.epilogue.Logged;
import org.wpilib.examples.rapidreactcommandbot.Constants.IntakeConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
@Logged
public class Intake extends SubsystemBase {

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.rapidreactcommandbot.subsystems;
import org.wpilib.epilogue.Logged;
import org.wpilib.hardware.rotation.AnalogPotentiometer;
import org.wpilib.hardware.pneumatic.Compressor;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.epilogue.Logged;
import org.wpilib.hardware.pneumatic.Compressor;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
import org.wpilib.hardware.rotation.AnalogPotentiometer;
/** Subsystem for managing the compressor, pressure sensor, etc. */
@Logged

View File

@@ -7,14 +7,14 @@ package org.wpilib.examples.rapidreactcommandbot.subsystems;
import static org.wpilib.command2.Commands.parallel;
import static org.wpilib.command2.Commands.waitUntil;
import org.wpilib.epilogue.Logged;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.examples.rapidreactcommandbot.Constants.ShooterConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.epilogue.Logged;
import org.wpilib.examples.rapidreactcommandbot.Constants.ShooterConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
@Logged
public class Shooter extends SubsystemBase {

View File

@@ -4,14 +4,14 @@
package org.wpilib.examples.rapidreactcommandbot.subsystems;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.NotLogged;
import org.wpilib.hardware.discrete.DigitalInput;
import org.wpilib.examples.rapidreactcommandbot.Constants.StorageConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.command2.button.Trigger;
import org.wpilib.epilogue.Logged;
import org.wpilib.epilogue.NotLogged;
import org.wpilib.examples.rapidreactcommandbot.Constants.StorageConstants;
import org.wpilib.hardware.discrete.DigitalInput;
import org.wpilib.hardware.motor.PWMSparkMax;
@Logged
public class Storage extends SubsystemBase {

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.romireference;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.opmode.TimedRobot;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,6 +4,9 @@
package org.wpilib.examples.romireference;
import org.wpilib.command2.Command;
import org.wpilib.command2.PrintCommand;
import org.wpilib.command2.button.Trigger;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.driverstation.Joystick;
import org.wpilib.driverstation.XboxController;
@@ -15,9 +18,6 @@ import org.wpilib.romi.OnBoardIO;
import org.wpilib.romi.OnBoardIO.ChannelMode;
import org.wpilib.smartdashboard.SendableChooser;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.command2.Command;
import org.wpilib.command2.PrintCommand;
import org.wpilib.command2.button.Trigger;
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.romireference.commands;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
import org.wpilib.command2.Command;
import java.util.function.Supplier;
import org.wpilib.command2.Command;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
public class ArcadeDrive extends Command {
private final Drivetrain m_drivetrain;

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.romireference.commands;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
import org.wpilib.command2.SequentialCommandGroup;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
public class AutonomousDistance extends SequentialCommandGroup {
/**

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.romireference.commands;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
import org.wpilib.command2.SequentialCommandGroup;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
public class AutonomousTime extends SequentialCommandGroup {
/**

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.romireference.commands;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
import org.wpilib.command2.Command;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
public class DriveDistance extends Command {
private final Drivetrain m_drive;

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.romireference.commands;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
import org.wpilib.command2.Command;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
public class DriveTime extends Command {
private final double m_duration;

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.romireference.commands;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
import org.wpilib.command2.Command;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
public class TurnDegrees extends Command {
private final Drivetrain m_drive;

View File

@@ -4,8 +4,8 @@
package org.wpilib.examples.romireference.commands;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
import org.wpilib.command2.Command;
import org.wpilib.examples.romireference.subsystems.Drivetrain;
/*
* Creates a new TurnTime command. This command will turn your robot for a

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.romireference.subsystems;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.hardware.motor.Spark;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.romi.RomiGyro;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.util.sendable.SendableRegistry;
public class Drivetrain extends SubsystemBase {
private static final double kCountsPerRevolution = 1440.0;

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.selectcommand;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.opmode.TimedRobot;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.selectcommand;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.driverstation.XboxController;
import java.util.Map;
import org.wpilib.command2.Command;
import org.wpilib.command2.PrintCommand;
import org.wpilib.command2.SelectCommand;
import java.util.Map;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.driverstation.XboxController;
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a

View File

@@ -4,6 +4,9 @@
package org.wpilib.examples.simpledifferentialdrivesimulation;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.math.geometry.Pose2d;
@@ -15,14 +18,11 @@ import org.wpilib.math.numbers.N2;
import org.wpilib.math.system.LinearSystem;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.system.plant.LinearSystemId;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.system.RobotController;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.simulation.DifferentialDrivetrainSim;
import org.wpilib.simulation.EncoderSim;
import org.wpilib.smartdashboard.Field2d;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.system.RobotController;
public class Drivetrain {
// 3 meters per second.

View File

@@ -4,6 +4,8 @@
package org.wpilib.examples.simpledifferentialdrivesimulation;
import java.util.List;
import org.wpilib.driverstation.XboxController;
import org.wpilib.math.controller.LTVUnicycleController;
import org.wpilib.math.filter.SlewRateLimiter;
import org.wpilib.math.geometry.Pose2d;
@@ -14,8 +16,6 @@ import org.wpilib.math.trajectory.TrajectoryConfig;
import org.wpilib.math.trajectory.TrajectoryGenerator;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.system.Timer;
import org.wpilib.driverstation.XboxController;
import java.util.List;
public class Robot extends TimedRobot {
private final XboxController m_controller = new XboxController(0);

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.solenoid;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.pneumatic.Compressor;
import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
import org.wpilib.hardware.pneumatic.Solenoid;
import org.wpilib.opmode.TimedRobot;

View File

@@ -4,10 +4,12 @@
package org.wpilib.examples.statespacearm;
import org.wpilib.math.util.Nat;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.LinearQuadraticRegulator;
import org.wpilib.math.estimator.KalmanFilter;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.numbers.N1;
import org.wpilib.math.numbers.N2;
import org.wpilib.math.system.LinearSystem;
@@ -15,11 +17,9 @@ import org.wpilib.math.system.LinearSystemLoop;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.system.plant.LinearSystemId;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.math.util.Nat;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
/**
* This is a sample program to demonstrate how to use a state-space controller to control an arm.

View File

@@ -4,10 +4,12 @@
package org.wpilib.examples.statespaceelevator;
import org.wpilib.math.util.Nat;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.LinearQuadraticRegulator;
import org.wpilib.math.estimator.KalmanFilter;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.numbers.N1;
import org.wpilib.math.numbers.N2;
import org.wpilib.math.system.LinearSystem;
@@ -15,11 +17,9 @@ import org.wpilib.math.system.LinearSystemLoop;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.system.plant.LinearSystemId;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.math.util.Nat;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
/**
* This is a sample program to demonstrate how to use a state-space controller to control an

View File

@@ -4,20 +4,20 @@
package org.wpilib.examples.statespaceflywheel;
import org.wpilib.math.util.Nat;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.LinearQuadraticRegulator;
import org.wpilib.math.estimator.KalmanFilter;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.numbers.N1;
import org.wpilib.math.system.LinearSystem;
import org.wpilib.math.system.LinearSystemLoop;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.system.plant.LinearSystemId;
import org.wpilib.math.util.Nat;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
/**
* This is a sample program to demonstrate how to use a state-space controller to control a

View File

@@ -4,19 +4,19 @@
package org.wpilib.examples.statespaceflywheelsysid;
import org.wpilib.math.util.Nat;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.LinearQuadraticRegulator;
import org.wpilib.math.estimator.KalmanFilter;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.numbers.N1;
import org.wpilib.math.system.LinearSystem;
import org.wpilib.math.system.LinearSystemLoop;
import org.wpilib.math.system.plant.LinearSystemId;
import org.wpilib.math.util.Nat;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.hardware.motor.PWMSparkMax;
/**
* This is a sample program to demonstrate how to use a state-space controller to control a

View File

@@ -4,12 +4,12 @@
package org.wpilib.examples.swervebot;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.math.geometry.Translation2d;
import org.wpilib.math.kinematics.ChassisSpeeds;
import org.wpilib.math.kinematics.SwerveDriveKinematics;
import org.wpilib.math.kinematics.SwerveDriveOdometry;
import org.wpilib.math.kinematics.SwerveModulePosition;
import org.wpilib.hardware.imu.OnboardIMU;
/** Represents a swerve drive style drivetrain. */
public class Drivetrain {

View File

@@ -4,10 +4,10 @@
package org.wpilib.examples.swervebot;
import org.wpilib.math.util.MathUtil;
import org.wpilib.math.filter.SlewRateLimiter;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
import org.wpilib.math.filter.SlewRateLimiter;
import org.wpilib.math.util.MathUtil;
import org.wpilib.opmode.TimedRobot;
public class Robot extends TimedRobot {
private final XboxController m_controller = new XboxController(0);

View File

@@ -4,6 +4,8 @@
package org.wpilib.examples.swervebot;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.ProfiledPIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
@@ -11,8 +13,6 @@ import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.kinematics.SwerveModulePosition;
import org.wpilib.math.kinematics.SwerveModuleState;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.hardware.motor.PWMSparkMax;
public class SwerveModule {
private static final double kWheelRadius = 0.0508;

View File

@@ -4,15 +4,15 @@
package org.wpilib.examples.swervedriveposeestimator;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.math.estimator.SwerveDrivePoseEstimator;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Translation2d;
import org.wpilib.math.kinematics.ChassisSpeeds;
import org.wpilib.math.kinematics.SwerveDriveKinematics;
import org.wpilib.math.kinematics.SwerveModulePosition;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.util.Units;
import org.wpilib.hardware.imu.OnboardIMU;
import org.wpilib.system.Timer;
/** Represents a swerve drive style drivetrain. */

View File

@@ -4,10 +4,10 @@
package org.wpilib.examples.swervedriveposeestimator;
import org.wpilib.math.util.StateSpaceUtil;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.linalg.VecBuilder;
import org.wpilib.math.util.StateSpaceUtil;
import org.wpilib.math.util.Units;
/** This dummy class represents a global measurement sensor, such as a computer vision solution. */

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.swervedriveposeestimator;
import org.wpilib.driverstation.XboxController;
import org.wpilib.math.filter.SlewRateLimiter;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
public class Robot extends TimedRobot {
private final XboxController m_controller = new XboxController(0);

View File

@@ -4,6 +4,8 @@
package org.wpilib.examples.swervedriveposeestimator;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.ProfiledPIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
@@ -11,8 +13,6 @@ import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.kinematics.SwerveModulePosition;
import org.wpilib.math.kinematics.SwerveModuleState;
import org.wpilib.math.trajectory.TrapezoidProfile;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.hardware.motor.PWMSparkMax;
public class SwerveModule {
private static final double kWheelRadius = 0.0508;

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.sysidroutine;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.opmode.TimedRobot;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,13 +4,13 @@
package org.wpilib.examples.sysidroutine;
import org.wpilib.examples.sysidroutine.Constants.OIConstants;
import org.wpilib.examples.sysidroutine.subsystems.Drive;
import org.wpilib.examples.sysidroutine.subsystems.Shooter;
import org.wpilib.command2.Command;
import org.wpilib.command2.button.CommandXboxController;
import org.wpilib.command2.button.Trigger;
import org.wpilib.command2.sysid.SysIdRoutine;
import org.wpilib.examples.sysidroutine.Constants.OIConstants;
import org.wpilib.examples.sysidroutine.subsystems.Drive;
import org.wpilib.examples.sysidroutine.subsystems.Shooter;
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a

View File

@@ -8,15 +8,15 @@ import static org.wpilib.units.Units.Meters;
import static org.wpilib.units.Units.MetersPerSecond;
import static org.wpilib.units.Units.Volts;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.system.RobotController;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.examples.sysidroutine.Constants.DriveConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import java.util.function.DoubleSupplier;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.command2.sysid.SysIdRoutine;
import java.util.function.DoubleSupplier;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.examples.sysidroutine.Constants.DriveConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.system.RobotController;
public class Drive extends SubsystemBase {
// The motors on the left side of the drive.

View File

@@ -8,16 +8,16 @@ import static org.wpilib.units.Units.Rotations;
import static org.wpilib.units.Units.RotationsPerSecond;
import static org.wpilib.units.Units.Volts;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.system.RobotController;
import org.wpilib.examples.sysidroutine.Constants.ShooterConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import java.util.function.DoubleSupplier;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.command2.sysid.SysIdRoutine;
import java.util.function.DoubleSupplier;
import org.wpilib.examples.sysidroutine.Constants.ShooterConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.controller.SimpleMotorFeedforward;
import org.wpilib.system.RobotController;
public class Shooter extends SubsystemBase {
// The motor on the shooter wheel .

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.tankdrive;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.driverstation.Joystick;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.util.sendable.SendableRegistry;
/**
* This is a demo program showing the use of the DifferentialDrive class, specifically it contains

View File

@@ -4,11 +4,11 @@
package org.wpilib.examples.tankdrivexboxcontroller;
import org.wpilib.util.sendable.SendableRegistry;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.driverstation.XboxController;
import org.wpilib.drive.DifferentialDrive;
import org.wpilib.driverstation.XboxController;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.util.sendable.SendableRegistry;
/**
* This is a demo program showing the use of the DifferentialDrive class. Runs the motors with tank

View File

@@ -5,9 +5,9 @@
package org.wpilib.examples.unittest;
import org.wpilib.driverstation.Joystick;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.examples.unittest.Constants.IntakeConstants;
import org.wpilib.examples.unittest.subsystems.Intake;
import org.wpilib.opmode.TimedRobot;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,10 +4,10 @@
package org.wpilib.examples.unittest.subsystems;
import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
import org.wpilib.examples.unittest.Constants.IntakeConstants;
import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
public class Intake implements AutoCloseable {
private final PWMSparkMax m_motor;

View File

@@ -4,9 +4,9 @@
package org.wpilib.examples.xrpreference;
import org.wpilib.opmode.TimedRobot;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.opmode.TimedRobot;
/**
* The methods in this class are called automatically corresponding to each mode, as described in

View File

@@ -4,6 +4,11 @@
package org.wpilib.examples.xrpreference;
import org.wpilib.command2.Command;
import org.wpilib.command2.InstantCommand;
import org.wpilib.command2.PrintCommand;
import org.wpilib.command2.button.JoystickButton;
import org.wpilib.command2.button.Trigger;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.driverstation.Joystick;
import org.wpilib.driverstation.XboxController;
@@ -15,11 +20,6 @@ import org.wpilib.examples.xrpreference.subsystems.Drivetrain;
import org.wpilib.smartdashboard.SendableChooser;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.xrp.XRPOnBoardIO;
import org.wpilib.command2.Command;
import org.wpilib.command2.InstantCommand;
import org.wpilib.command2.PrintCommand;
import org.wpilib.command2.button.JoystickButton;
import org.wpilib.command2.button.Trigger;
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a

Some files were not shown because too many files have changed in this diff Show More