dLife Home Page

dlife.robot.aibo
Class AiboHeadEffector

java.lang.Object
  extended by java.util.Observable
      extended by dlife.robot.Device
          extended by dlife.robot.aibo.AiboHeadEffector

public class AiboHeadEffector
extends Device

An AiboHeadEffector allows control of the pan, tilt and nod of the Aibo's head. When started up an AiboHeadEffector sends a message to the Aibo to start the head control service. The AiboHeadEffector then connects to that service and communicates directly with it.

Version:
May 11, 2009
Author:
Nate Mitchell & Alex Diehl, Grant Braught, Jun 21, 2010

Field Summary
static int HEAD_CONTROL_PORT
          The port on which the Aibo Head Remote Control service listens for connections.
 
Fields inherited from class dlife.robot.Device
DEFAULT_GUI_UPDATE_DELAY, DEFAULT_READ_DELAY, myRobot, readCount
 
Constructor Summary
AiboHeadEffector(Aibo newAibo)
          Create a new AiboHeadEffector.
 
Method Summary
 void center()
          Centers the AIBO's head.
protected  DeviceDisplay[] createGUIObjects()
          Build the GUI for this AiboHeadEffector.
 void freeze()
          Does nothing.
 float getCenterNod()
          Get center nod.
 float getCenterPan()
          Get center pan.
 float getCenterTilt()
          Get center tilt.
 float getMaxNod()
          Get max nod.
 float getMaxPan()
          Get max pan.
 float getMaxTilt()
          Get max tilt.
 float getMinNod()
          Get min nod.
 float getMinPan()
          Get min pan.
 float getMinTilt()
          Get min tilt.
 float getNod()
          Get the current nod.
 float getPan()
          Get the current pan.
 float getSentNod()
          Get the last nod value that was sent to the Aibo.
 float getSentPan()
          Get the last pan value that was sent to the Aibo.
 float getSentTilt()
          Get the last tilt value that was sent to the Aibo.
 float getTilt()
          Get the current tilt.
 void nod(float newNod)
          Send a nod command to the Head Control.
 void pan(float newPan)
          Send a pan command to the Head Control.
 void panTilt(float newPan, float newTilt)
          Send a combination pan-tilt command.
 void panTiltNod(float newPan, float newTilt, float newNod)
          Send a combination pan-tilt-nod command.
 void readStateFromRobot()
          Updates the pan, tilt and nod values in this effector based upon what is returned in the Aibo's world state.
 void shutDown()
          Shutdown the AiboHeadEffector.
 void startUp()
          Startup the AiboHeadEffector.
 void tilt(float newTilt)
          Send a tilt command to the Head Control.
 
Methods inherited from class dlife.robot.Device
getAutoRead, getGUI, getGUIUpdateDelay, getReadDelay, getRobot, getSensorReadCount, getSensorReadRate, setAutoRead, setGUIUpdateDelay, setReadDelay, setRobot, startAutoReadTimer, stopAutoReadTimer
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEAD_CONTROL_PORT

public static final int HEAD_CONTROL_PORT
The port on which the Aibo Head Remote Control service listens for connections.

See Also:
Constant Field Values
Constructor Detail

AiboHeadEffector

public AiboHeadEffector(Aibo newAibo)
Create a new AiboHeadEffector.

Parameters:
newAibo - the instance of Aibo that should be used to initialize the Head Control.
Method Detail

startUp

public void startUp()
Startup the AiboHeadEffector. This includes making sure that the Head Remote Control service is running on the Aibo and then connecting to it.

Overrides:
startUp in class Device

shutDown

public void shutDown()
Shutdown the AiboHeadEffector. This closes the connection to the Head Remote Control service and sends the command to the Aibo to stop the service.

Overrides:
shutDown in class Device

createGUIObjects

protected DeviceDisplay[] createGUIObjects()
Build the GUI for this AiboHeadEffector.

Specified by:
createGUIObjects in class Device
Returns:
an array of DeviceDisplay subclass objects that make up the GUI for this Device.

freeze

public void freeze()
Does nothing.

Specified by:
freeze in class Device

readStateFromRobot

public void readStateFromRobot()
Updates the pan, tilt and nod values in this effector based upon what is returned in the Aibo's world state.

Specified by:
readStateFromRobot in class Device

getSentPan

public float getSentPan()
Get the last pan value that was sent to the Aibo. This value may be different than the value returned from getPan when the head is in motion or because of imprecise positioning or noise in the joint sensor.

Returns:
the last pan value sent.

getSentTilt

public float getSentTilt()
Get the last tilt value that was sent to the Aibo. This value may be different than the value returned from getTilt when the head is in motion or because of imprecise positioning or noise in the joint sensor.

Returns:
the last tilt value sent.

getSentNod

public float getSentNod()
Get the last nod value that was sent to the Aibo. This value may be different than the value returned from getNod when the head is in motion or because of imprecise positioning or noise in the joint sensor.

Returns:
the last nod value sent.

getMaxPan

public float getMaxPan()
Get max pan.

Returns:
the max pan.

getMinPan

public float getMinPan()
Get min pan.

Returns:
the min pan.

getCenterPan

public float getCenterPan()
Get center pan.

Returns:
the center pan.

getMaxNod

public float getMaxNod()
Get max nod.

Returns:
the max nod.

getMinNod

public float getMinNod()
Get min nod.

Returns:
the min nod.

getCenterNod

public float getCenterNod()
Get center nod. Not center of the range but centered on robot.

Returns:
the center nod.

getMaxTilt

public float getMaxTilt()
Get max tilt.

Returns:
the max tilt.

getMinTilt

public float getMinTilt()
Get min tilt.

Returns:
the min tilt.

getCenterTilt

public float getCenterTilt()
Get center tilt. Not center of the range but centered on robot.

Returns:
the center tilt.

getPan

public float getPan()
Get the current pan.

Returns:
the current pan.

getNod

public float getNod()
Get the current nod.

Returns:
the current nod.

getTilt

public float getTilt()
Get the current tilt.

Returns:
the current tilt.

pan

public void pan(float newPan)
Send a pan command to the Head Control. The pan values must be in the range -1 (left) to 1 (right). Values outside that range are bounded to the range.

Parameters:
newPan - the pan value.

tilt

public void tilt(float newTilt)
Send a tilt command to the Head Control. The tilt values must be in the range -1 (down) to 0 (vertical). Values outside that range are bounded to the range.

Parameters:
newTilt - the tilt value.

nod

public void nod(float newNod)
Send a nod command to the Head Control. The nod values must be in the range 0 (level) to 1 (up). Values outside that range are bounded to the range.

Parameters:
newNod - the nod value.

center

public void center()
Centers the AIBO's head.


panTilt

public void panTilt(float newPan,
                    float newTilt)
Send a combination pan-tilt command.

Parameters:
newPan - the pan value (-1 to 1)
newTilt - the tilt value (-1 to 1)

panTiltNod

public void panTiltNod(float newPan,
                       float newTilt,
                       float newNod)
Send a combination pan-tilt-nod command.

Parameters:
newPan - the pan value (-1 to 1)
newTilt - the tilt value (-1 to 1)
newNod - the nod value (0 to 1)

dLife Home Page