-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from NicoletFEAR/Duluth-Thursday
Duluth thursday
- Loading branch information
Showing
14 changed files
with
312 additions
and
41 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
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
52 changes: 52 additions & 0 deletions
52
Steamworks/src/org/usfirst/frc/team4786/robot/commands/DriveArc.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,52 @@ | ||
package org.usfirst.frc.team4786.robot.commands; | ||
|
||
import org.usfirst.frc.team4786.robot.Robot; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
|
||
/** | ||
* | ||
*/ | ||
public class DriveArc extends Command { | ||
|
||
private double horizontalDist, theta; | ||
|
||
/** | ||
* @param horizontalDist - Distance between start and end points measured along a line perpendicular to the starting orientation. Negative turns left, positive turns right. | ||
* @param theta - Angle in degrees between start and end orientations. | ||
*/ | ||
public DriveArc(double horizontalDist, double theta) { | ||
// Use requires() here to declare subsystem dependencies | ||
// eg. requires(chassis); | ||
requires(Robot.driveTrain); | ||
this.horizontalDist = horizontalDist; | ||
this.theta = theta; | ||
} | ||
|
||
// Called just before this Command runs the first time | ||
protected void initialize() { | ||
Robot.driveTrain.driveArcInit(horizontalDist, theta); | ||
} | ||
|
||
// 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() { | ||
//This is called instead of a special "driveArcIsFinished()" because it will do the same thing | ||
return Robot.driveTrain.driveToPositionIsFinished(); | ||
} | ||
|
||
// Called once after isFinished returns true | ||
protected void end() { | ||
//This is called instead of a special "driveArcEnd()" because it will do the same thing | ||
Robot.driveTrain.driveToPositionEnd(); | ||
} | ||
|
||
// Called when another command which requires one or more of the same | ||
// subsystems is scheduled to run | ||
protected void interrupted() { | ||
end(); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
Steamworks/src/org/usfirst/frc/team4786/robot/commands/DriveArcSpeed.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,47 @@ | ||
package org.usfirst.frc.team4786.robot.commands; | ||
|
||
import org.usfirst.frc.team4786.robot.Robot; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
|
||
/** | ||
* | ||
*/ | ||
public class DriveArcSpeed extends Command { | ||
|
||
private double leftSpeed, rightSpeed, time; | ||
|
||
public DriveArcSpeed(double leftSpeed, double rightSpeed, double time) { | ||
// Use requires() here to declare subsystem dependencies | ||
// eg. requires(chassis); | ||
requires(Robot.driveTrain); | ||
this.leftSpeed = leftSpeed; | ||
this.rightSpeed = rightSpeed; | ||
this.time = time; | ||
} | ||
|
||
// Called just before this Command runs the first time | ||
protected void initialize() { | ||
Robot.driveTrain.driveArcSpeedInit(leftSpeed, rightSpeed); | ||
} | ||
|
||
// 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 timeSinceInitialized() > time; | ||
} | ||
|
||
// Called once after isFinished returns true | ||
protected void end() { | ||
Robot.driveTrain.driveArcSpeedEnd(); | ||
} | ||
|
||
// Called when another command which requires one or more of the same | ||
// subsystems is scheduled to run | ||
protected void interrupted() { | ||
end(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Steamworks/src/org/usfirst/frc/team4786/robot/commands/DriveArcYTurns.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,30 @@ | ||
package org.usfirst.frc.team4786.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj.command.CommandGroup; | ||
|
||
/** | ||
* | ||
*/ | ||
public class DriveArcYTurns extends CommandGroup { | ||
|
||
public DriveArcYTurns() { | ||
// Add Commands here: | ||
// e.g. addSequential(new Command1()); | ||
// addSequential(new Command2()); | ||
// these will run in order. | ||
|
||
// To run multiple commands at the same time, | ||
// use addParallel() | ||
// e.g. addParallel(new Command1()); | ||
// addSequential(new Command2()); | ||
// Command1 and Command2 will run in parallel. | ||
|
||
// A command group will require all of the subsystems that each member | ||
// would require. | ||
// e.g. if Command1 requires chassis, and Command2 requires arm, | ||
// a CommandGroup containing them would require both the chassis and the | ||
// arm. | ||
addSequential(new DriveArc(2, 20)); | ||
addSequential(new DriveArc(2, -20)); | ||
} | ||
} |
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
Oops, something went wrong.