Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## PER.rover
Interface Action

All Superinterfaces:
  java.io.Serializable

All Known Implementing Classes:
  ActionTemplate, AnalyzeRockAction, ApproachAction, CreepAction, DanceAction, DetectMotionAction, DriveToAction, FindRockAction, MoveToAction, ScanAction, SendEmailAction, SmartWanderAction, TakePanoramaAction, TurnHeadAction, TurnToAction, WallFollowAction

public interface Action
extends java.io.Serializable

Interface for all Rover "actions" -- turning, moving, etc. All actions are assumed to be "safe"; they should always avoid collisions independently (and return false if they do)!

This used to be interface Motion, but was changed to allow for non-motion-related Rover commands, such as looking for a landmark or sending a message.

Method Summary
`boolean` | `doAction(Rover r)` Tries to start the action.
`long` | `getImageUpdateTime()` Lets you know when the last image was taken by this action.
`java.awt.image.BufferedImage` | `getRecentImage()` Returns the most recent image taken by this Action.
`int` | `getReturnValue()` The return value of the Action.
`java.lang.String` | `getShortSummary()` Provides a shortened version of the summary returned by getSummary.
`java.lang.String` | `getSummary()` Provides a textual explanation of the Action, such as "turn 90 degrees"
`int` | `getTime()` How long the action will take, in milliseconds.
`int` | `getTimeRemaining()` How much time until the action finishes (in milliseconds), if it has already started.
`boolean` | `isCompleted()` Whether the action has completed.
`boolean` | `isSuccess()` Whether the action completed successfully.
`void` | `kill()` Emergency stop - end the action immediately, if it's running.

Method Detail

### doAction

    public boolean doAction(Rover r)

  Tries to start the action. Returns whether the action started.

### kill

    public void kill()

  Emergency stop - end the action immediately, if it's running.

### isSuccess

    public boolean isSuccess()

  Whether the action completed successfully. Undefined until isCompleted() returns true.

### isCompleted

    public boolean isCompleted()

  Whether the action has completed. Undefined until doAction has been called.

### getTime

    public int getTime()

  How long the action will take, in milliseconds.

### getTimeRemaining

    public int getTimeRemaining()

  How much time until the action finishes (in milliseconds), if it has already started. Undefined behavior if the action has not yet begun, or has finished.

### getReturnValue

    public int getReturnValue()

  The return value of the Action. Zero is a success. Negative implies one of this class's constants. Other values should be interpreted as appropriate.

  See Also:
    `RoverState`, `ActionConstants`

### getSummary

    public java.lang.String getSummary()

  Provides a textual explanation of the Action, such as "turn 90 degrees"

### getShortSummary

    public java.lang.String getShortSummary()

  Provides a shortened version of the summary returned by getSummary. For example, getSummary may return something like "Turn left and drive about 39 inches toward the red landmark," whereas getShortSummary might just return "Drive toward a landmark."

### getRecentImage

    public java.awt.image.BufferedImage getRecentImage()

  Returns the most recent image taken by this Action. The image will be null if the Action does not take pictures or the first picture has not yet been taken.

  Returns:
    the most recent picture taken by the Action.

### getImageUpdateTime

    public long getImageUpdateTime()

  Lets you know when the last image was taken by this action. If the Action does not take pictures or the first picture has not yet been taken, will return 0.

  Returns:
    the system time in milliseconds when the last image was taken or 0 if no images have been taken

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD