This repository has been archived by the owner on Jan 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding final changes from competition
- Loading branch information
1 parent
95e4d80
commit a1b7de0
Showing
6 changed files
with
63 additions
and
17 deletions.
There are no files selected for viewing
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
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
46 changes: 46 additions & 0 deletions
46
FRC_Robot2.0/src/org/usfirst/frc/team2557/robot/autonomous/GyroDrive_cmd.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.usfirst.frc.team2557.robot.autonomous; | ||
|
||
import org.usfirst.frc.team2557.robot.RobotMap; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
|
||
/** | ||
* | ||
*/ | ||
public class GyroDrive_cmd extends Command { | ||
|
||
public double _turn, _angle; | ||
public GyroDrive_cmd(double angle, double turn) { | ||
// Use requires() here to declare subsystem dependencies | ||
// eg. requires(chassis); | ||
_angle = angle; | ||
_turn = turn; | ||
} | ||
|
||
// Called just before this Command runs the first time | ||
protected void initialize() { | ||
// RobotMap.navX.reset(); | ||
} | ||
|
||
// Called repeatedly when this Command is scheduled to run | ||
protected void execute() { | ||
RobotMap.robotDrive.arcadeDrive(0,_turn); | ||
} | ||
|
||
// Make this return true when this Command no longer needs to run execute() | ||
protected boolean isFinished() { | ||
return RobotMap.navX.getAngle() >_angle - 5 && RobotMap.navX.getAngle() < _angle + 5; | ||
} | ||
|
||
// Called once after isFinished returns true | ||
protected void end() { | ||
RobotMap.robotDrive.arcadeDrive(0,0); | ||
RobotMap.euler.reset(); | ||
RobotMap.navX.reset(); | ||
} | ||
|
||
// Called when another command which requires one or more of the same | ||
// subsystems is scheduled to run | ||
protected void interrupted() { | ||
} | ||
} |
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
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
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