Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Stronghold2016/src/org/usfirst/frc2876/Stronghold2016/commands/AutoDriveTurn.java /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
76 lines (59 sloc)
2.45 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // RobotBuilder Version: 2.0 | |
| // | |
| // This file was generated by RobotBuilder. It contains sections of | |
| // code that are automatically generated and assigned by robotbuilder. | |
| // These sections will be updated in the future when you export to | |
| // Java from RobotBuilder. Do not put any code or make any change in | |
| // the blocks indicating autogenerated code or it will be lost on an | |
| // update. Deleting the comments indicating the section will prevent | |
| // it from being updated in the future. | |
| package org.usfirst.frc2876.Stronghold2016.commands; | |
| import edu.wpi.first.wpilibj.PIDController; | |
| import edu.wpi.first.wpilibj.PIDOutput; | |
| import edu.wpi.first.wpilibj.command.Command; | |
| import org.usfirst.frc2876.Stronghold2016.Robot; | |
| /** | |
| * | |
| */ | |
| public class AutoDriveTurn extends Command { | |
| // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS | |
| private double m_endAngle; | |
| // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS | |
| PIDController pid; | |
| // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR | |
| public AutoDriveTurn(double endAngle) { | |
| // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR | |
| // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING | |
| m_endAngle = endAngle; | |
| // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING | |
| // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES | |
| requires(Robot.driveTrain); | |
| // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES | |
| pid = new PIDController(.03, .0, .025, Robot.navX, | |
| new PIDOutput(){ | |
| public void pidWrite(double output) { | |
| Robot.driveTrain.myRobot.setLeftRightMotorOutputs(output, -output); | |
| } | |
| } | |
| ); | |
| } | |
| // Called just before this Command runs the first time | |
| protected void initialize() { | |
| pid.setSetpoint(m_endAngle); | |
| pid.enable(); | |
| } | |
| // Called repeatedly when this Command is scheduled to run | |
| protected void execute() { | |
| } | |
| // Make this return true when this Command no longer needs to run execute() | |
| protected boolean isFinished() { | |
| return true; | |
| } | |
| // Called once after isFinished returns true | |
| protected void end() { | |
| } | |
| // Called when another command which requires one or more of the same | |
| // subsystems is scheduled to run | |
| protected void interrupted() { | |
| } | |
| } |