RoboJDETM v2.0

com.ridgesoft.robotics.behaviors
Class GoToBehavior

java.lang.Object
  extended by com.ridgesoft.robotics.behaviors.AbstractBehavior2
      extended by com.ridgesoft.robotics.behaviors.GoToBehavior
All Implemented Interfaces:
Behavior, Behavior2, NavigatorListener

public class GoToBehavior
extends AbstractBehavior2
implements NavigatorListener

Implements a behavior that will cause a robot to strive to navigate to a particular x, y location when the behavior is enabled.

See Also:
BehaviorArbiter

Field Summary
 
Fields inherited from class com.ridgesoft.robotics.behaviors.AbstractBehavior2
mEnabled, mIsActive, mListener
 
Constructor Summary
GoToBehavior(Navigator navigator, float x, float y, boolean enabled)
          Constructs a GoToBehavior object.
 
Method Summary
 void navigationOperationTerminated(boolean completed)
          Listener method that enables this behavior to listen for termination of commands it issues to the navigator.
 boolean poll()
          This method is invoked at regular intervals to determine if the behavior desires to control the robot.
 void setDestination(float x, float y)
          Sets the goal (x, y destination) of this behavior.
 
Methods inherited from class com.ridgesoft.robotics.behaviors.AbstractBehavior2
setActive, setEnabled, setListener
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

GoToBehavior

public GoToBehavior(Navigator navigator,
                    float x,
                    float y,
                    boolean enabled)
Constructs a GoToBehavior object.

Parameters:
navigator - the robot's navigator
x - the x coordinate of the point to go to
y - the y coordinate of the point to go to
enabled - initial enabled state of the behavior
Method Detail

navigationOperationTerminated

public void navigationOperationTerminated(boolean completed)
Listener method that enables this behavior to listen for termination of commands it issues to the navigator.

Specified by:
navigationOperationTerminated in interface NavigatorListener
Parameters:
completed - true if the operation completed, false otherwise

poll

public boolean poll()
This method is invoked at regular intervals to determine if the behavior desires to control the robot.

If active, this method will also instruct the robot to destination.

Specified by:
poll in interface Behavior
Specified by:
poll in class AbstractBehavior2
Returns:
true if the wants control of the robot, otherwise false

setDestination

public void setDestination(float x,
                           float y)
Sets the goal (x, y destination) of this behavior.

Parameters:
x - the x coordinate of the point to go to
y - the y coordinate of the point to go to

RoboJDETM v2.0

Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com