Package frc.robot.commands
Class DriveStraight
java.lang.Object
edu.wpi.first.wpilibj2.command.CommandBase
frc.robot.commands.DriveStraight
- All Implemented Interfaces:
edu.wpi.first.wpilibj.Sendable,edu.wpi.first.wpilibj2.command.Command
public class DriveStraight
extends edu.wpi.first.wpilibj2.command.CommandBase
Drives the robot in a straight line.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DriveStraight(double Inches, double Speed)Drives the robot in a straight line. -
Method Summary
Modifier and Type Method Description doubleconvertToTicks(double inches)voidend(boolean interrupted)voidexecute()voidinitialize()booleanisFinished()Methods inherited from class edu.wpi.first.wpilibj2.command.CommandBase
addRequirements, getName, getRequirements, getSubsystem, initSendable, setName, setSubsystem, withNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DriveStraight
public DriveStraight(double Inches, double Speed)Drives the robot in a straight line.- Parameters:
Inches- Distance forwards or backwards in inches.Speed- Speed at which the bot travels (0 to 1).
-
-
Method Details
-
initialize
public void initialize() -
execute
public void execute() -
isFinished
public boolean isFinished() -
end
public void end(boolean interrupted) -
convertToTicks
public double convertToTicks(double inches)- Parameters:
inches- Inches to convert.- Returns:
- The equivalent distance in ticks.
-