package edu.stuy.commands;

import static edu.stuy.RobotMap.*;
import edu.stuy.Robot;
import edu.wpi.first.wpilibj.command.PIDCommand;

/**
 *
 */
public class DrivetrainRotateCommand extends PIDCommand {

    private double degrees;

    public DrivetrainRotateCommand(double deg) {
        super(DRIVE_ROTATE_P, DRIVE_ROTATE_I, DRIVE_ROTATE_D);
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(Robot.drivetrain);
        degrees = deg;
        getPIDController().setContinuous();
        getPIDController().setInputRange(0, 360);
        getPIDController().setOutputRange(-1, 1);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        Robot.drivetrain.resetGyro();
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        Robot.drivetrain.tankDrive(1.0, -1.0);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return Math.abs((Robot.drivetrain.getGyroAngle() % 360) - degrees) <= DRIVETRAIN_ROTATE_THRESHOLD_DEGREES;
    }

    // Called once after isFinished returns true
    protected void end() {
        Robot.drivetrain.stop();
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }

    @Override
    protected double returnPIDInput() {
        return Robot.drivetrain.getGyroAngle() % 360;
    }

    @Override
    protected void usePIDOutput(double output) {
        Robot.drivetrain.arcadeDrive(0, output);
    }
}

@@ -885,55 +885,8 @@
 ) %7B%0A
-        Robot.drivetrain.tankDrive(1.0, -1.0);%0A
     
@@ -1033,46 +1033,23 @@
 abs(
-(Robot.drivetrain.getGyroAngle() %25 360
+returnPIDInput(
 ) - 
@@ -1436,22 +1436,29 @@
         
-return
+double temp =
  Robot.d
@@ -1489,16 +1489,162 @@
  %25 360;%0A
+ %0A        // Ensure that our gyro value is in the range %5B0, 360).%0A        if (temp %3C 0) %7B%0A            temp += 360;%0A        %7D%0A        return temp;%0A
     %7D%0A%0A 
@@ -1701,24 +1701,72 @@
 e output) %7B%0A
+        // Use arcade drive for easier rotation%0A
         Robo

Add an angle checker to prevent negative angles, as well as adding comments