Class TurnToCommand

  • All Implemented Interfaces:
    Sendable, Command

    public class TurnToCommand
    extends CommandBase
    A command for making drivetrains turn to a specific heading.
    • Constructor Detail

      • TurnToCommand

        public TurnToCommand​(AbstractDriveTrain driveTrain,
                             Rotation2d fieldRelativeAngle,
                             Rotation2d epsilon)
        Create a new TurnToCommand
        Parameters:
        driveTrain - DriveTrain to control
        fieldRelativeAngle - Desired heading (field-relative)
        epsilon - Rotational epsilon
      • TurnToCommand

        public TurnToCommand​(AbstractDriveTrain driveTrain,
                             Rotation2d angle,
                             Rotation2d epsilon,
                             boolean fieldRelative)
        Create a new TurnToCommand
        Parameters:
        driveTrain - DriveTrain to control
        angle - Desired heading
        epsilon - Rotational epsilon
        fieldRelative - Is the desired heading field-relative?
      • TurnToCommand

        public TurnToCommand​(AbstractDriveTrain driveTrain,
                             Rotation2d fieldRelativeAngle,
                             Rotation2d epsilon,
                             double speedCap)
        Create a new TurnToCommand
        Parameters:
        driveTrain - DriveTrain to control
        fieldRelativeAngle - Desired heading (field-relative)
        epsilon - Rotational epsilon
        speedCap - Maximum speed as a percent
      • TurnToCommand

        public TurnToCommand​(AbstractDriveTrain driveTrain,
                             Rotation2d angle,
                             Rotation2d epsilon,
                             double speedCap,
                             boolean fieldRelative)
        Create a new TurnToCommand
        Parameters:
        driveTrain - DriveTrain to control
        angle - Desired heading
        epsilon - Rotational epsilon
        speedCap - Maximum speed as a percent
        fieldRelative - Is the desired heading field-relative?
    • Method Detail

      • initialize

        public void initialize()
      • execute

        public void execute()
      • end

        public void end​(boolean interrupted)
      • isFinished

        public boolean isFinished()