# AutoBalanceCommand (YAGSL-Example API)
declaration: package: frc.robot.commands.swervedrive.auto, class: AutoBalanceCommand

Package frc.robot.commands.swervedrive.auto

# Class AutoBalanceCommand

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.robot.commands.swervedrive.auto.AutoBalanceCommand

All Implemented Interfaces:
  `edu.wpi.first.util.sendable.Sendable`

public class AutoBalanceCommand extends edu.wpi.first.wpilibj2.command.Command
Auto Balance command using a simple PID controller. Created by Team 3512 ...

## Nested Class Summary

## Nested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command

`edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior`

## Field Summary

### Fields inherited from class edu.wpi.first.wpilibj2.command.Command

`m_requirements`

## Constructor Summary

Constructors
Constructor
Description
`AutoBalanceCommand(SwerveSubsystem swerveSubsystem)`

## Method Summary

Modifier and Type
Method
Description
`void`
`end(boolean interrupted)`
The action to take when the command ends.
`void`
`execute()`
The main body of a command.
`void`
`initialize()`
The initial subroutine of a command.
`boolean`
`isFinished()`
Returns whether this command has finished.

### Methods inherited from class edu.wpi.first.wpilibj2.command.Command

`addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineWith, finallyDo, finallyDo, getInterruptionBehavior, getName, getRequirements, getSubsystem, handleInterrupt, hasRequirement, ignoringDisable, initSendable, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, runsWhenDisabled, schedule, setName, setSubsystem, unless, until, withInterruptBehavior, withName, withTimeout`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AutoBalanceCommand

public AutoBalanceCommand(SwerveSubsystem swerveSubsystem)

## Method Details

### initialize

public void initialize()
The initial subroutine of a command. Called once when the command is initially scheduled.

Overrides:
  `initialize` in class `edu.wpi.first.wpilibj2.command.Command`

### execute

public void execute()
The main body of a command. Called repeatedly while the command is scheduled. (That is, it is called repeatedly until `isFinished()`) returns true.)

Overrides:
  `execute` in class `edu.wpi.first.wpilibj2.command.Command`

### isFinished

public boolean isFinished()

Returns whether this command has finished. Once a command finishes -- indicated by this method returning true -- the scheduler will call its `end(boolean)` method.

Returning false will result in the command never ending automatically. It may still be cancelled manually or interrupted by another command. Hard coding this command to always return true will result in the command executing once and finishing immediately. It is recommended to use * `InstantCommand` for such an operation.

Overrides:
  `isFinished` in class `edu.wpi.first.wpilibj2.command.Command`
Returns:
  whether this command has finished.

### end

public void end(boolean interrupted)
The action to take when the command ends. Called when either the command finishes normally -- that is it is called when `isFinished()` returns true -- or when it is interrupted/canceled. This is where you may want to wrap up loose ends, like shutting off a motor that was being used in the command.

Overrides:
  `end` in class `edu.wpi.first.wpilibj2.command.Command`
Parameters:
  `interrupted` - whether the command was interrupted/canceled