Class TurnToRotation

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.robot.subsystems.swerve.util.TurnToRotation
All Implemented Interfaces:
Sendable

public class TurnToRotation extends Command
This command will turn the robot to a specified angle.
  • Constructor Details

    • TurnToRotation

      public TurnToRotation(Swerve swerve, double angle, boolean isRelative)
      Turns robot to specified angle. Uses absolute rotation on field.
      Parameters:
      swerve - Swerve subsystem
      angle - Requested angle to turn to
      isRelative - Whether the angle is relative to the current angle: true = relative, false = absolute
    • TurnToRotation

      public TurnToRotation(Swerve swerve, Supplier<Rotation2d> angle, boolean isRelative)
      Turns robot to specified angle. Uses absolute rotation on field.
      Parameters:
      swerve - Swerve subsystem
      angle - Supplier that provides the requested angle to turn to
      isRelative - Whether the angle is relative to the current angle: true = relative, false = absolute
  • Method Details

    • initialize

      public void initialize()
      Overrides:
      initialize in class Command
    • execute

      public void execute()
      Overrides:
      execute in class Command
    • end

      public void end(boolean interrupt)
      Overrides:
      end in class Command
    • isFinished

      public boolean isFinished()
      Overrides:
      isFinished in class Command