Class CmdWaltzTurn

java.lang.Object
trclib.archive.CmdWaltzTurn
All Implemented Interfaces:
TrcRobot.RobotCommand

public class CmdWaltzTurn extends Object implements TrcRobot.RobotCommand
This class implements a waltz turn command sequence. It is useful for avoiding a pushing match with our opponent. If our opponent is trying to engage a pushing match with us, the driver can push a button and cause the robot to pivot left or right 180 degrees and continue on with the robot driving in reverse.
  • Field Details

  • Constructor Details

    • CmdWaltzTurn

      public CmdWaltzTurn(TrcDriveBase driveBase, TrcPidDrive pidDrive)
      Constructor: Create an instance of the object.
      Parameters:
      driveBase - specifies the drive base object.
      pidDrive - specifies the PID drive object to be used for PID controlled drive.
  • Method Details

    • start

      public void start(boolean clockwiseTurn, boolean driveInverted)
      This method is called to start the command sequence doing a clockwise or counter-clockwise waltz turn.
      Parameters:
      clockwiseTurn - specifies true for a clockwise turn, false for counter-clockwise turn.
      driveInverted - specifies the current inverted drive state of the robot.
    • isActive

      public boolean isActive()
      This method checks if the current RobotCommand is running.
      Specified by:
      isActive in interface TrcRobot.RobotCommand
      Returns:
      true if the command is running, false otherwise.
    • cancel

      public void cancel()
      This method cancels the command if it is active.
      Specified by:
      cancel in interface TrcRobot.RobotCommand
    • cmdPeriodic

      public boolean cmdPeriodic(double elapsedTime)
      This method must be called periodically by the caller to drive the command sequence forward.
      Specified by:
      cmdPeriodic in interface TrcRobot.RobotCommand
      Parameters:
      elapsedTime - specifies the elapsed time in seconds since the start of the robot mode.
      Returns:
      true if the command sequence is completed, false otherwise.