|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
dlife.robot.aibo.WorldState
public class WorldState
The WorldState class is a threaded data structure that constantly filters through the streaming output from the Aibo's WorldStateSerializer. The constructor makes a connection that opens the WorldState port to start the streaming. Once the port is open, the run method continuously reads the sensor data and stores the latest readings in the appropriate array.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static int |
WORLD_STATE_PORT
The standard port on which the Aibo runs its World State Serializer. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
WorldState(Aibo aibo)
Create a WorldState object for the provided Aibo. |
|
| Method Summary | |
|---|---|
protected String |
buttonsString()
Converts the button array to a readable string |
void |
clear()
Will empty out a WorldState structure by setting all values to 0 and the model name to "". |
void |
connect()
Send the command to the Aibo to start up its World State Serializer, connect to it and start reading the data that it is sending. |
void |
disconnect()
Stop reading the Aibo's sensor data from the World State Serializer, disconnect from the World State Serializer and ask the Aibo to shutdown its Serializer. |
protected String |
dutiesString()
Converts the duties array to a readable string |
float |
getButton_pawLFront()
Returns the float value of the left front paw button |
float |
getButton_pawLRear()
Returns the float value of the left rear paw button |
float |
getButton_pawRFront()
Returns the float value of the right front paw button |
float |
getButton_pawRRear()
Returns the float value of the right rear paw button |
float |
getButton(int index)
Accessor that returns a requested value from the button array |
float |
getButtonBackF()
Returns the float value of the front back button |
float |
getButtonBackM()
Returns the float value of the middle back button |
float |
getButtonBackR()
Returns the float value of the rear back button |
float |
getButtonChin()
Returns the float value of the chin button |
float |
getButtonHead()
Returns the float value of the head button |
float |
getDuty(int index)
Accessor that returns a requested value from the duties array |
long |
getFrame()
Accessor that returns the frame of the Aibo |
float |
getHeadNod()
Get the Aibo's head nod. |
float |
getHeadPan()
Get the Aibo's head pan. |
float |
getHeadTilt()
Get the Aibo's head tilt. |
float |
getJoint(int index)
Returns the specific joint information requested through the index input |
String |
getModelName()
Accessor that returns the model name of the Aibo |
float |
getPID(int index)
Accessor that returns a requested value from the pid array |
float |
getSensor(int index)
Accessor that returns a requested value from the sensor array |
float |
getSensorAccelFB()
Returns the float value of the front to back accelerometer |
float |
getSensorAccelRL()
Returns the float value of the right to left accelerometer |
float |
getSensorAccelUD()
Returns the float value of the up and down accelerometer |
float |
getSensorBattery()
Returns the float value of the battery sensor |
float |
getSensorCurrent()
Returns the float value of the current sensor |
float |
getSensorIRChest()
Returns the float value of the chest IR sensor |
float |
getSensorIRFar()
Returns the float value of the far IR sensor |
float |
getSensorIRNear()
Returns the float value of the near IR sensor |
float |
getSensorPower()
Returns the float value of the power sensor |
float |
getSensorTemperature()
Returns the float value of the temperature sensor |
float |
getSensorVoltage()
Returns the float value of the voltage sensor |
long |
getTimestamp()
Accessor that returns the current timestamp |
void |
parseStream(DataInputStream fromServer)
Parses a data stream of information on sensors, joints, and buttons based on the Tekkotsu data stream format. |
protected String |
pidString()
Converts the pid array to a readable string |
char |
readChar(InputStream in)
Returns a single character read from the input stream supplied |
long |
readUnsignedInt(InputStream in)
Returns a long containing an unsigned int read in from the input stream |
void |
run()
Read data from the Aibo's World State Serializer in a continuous loop until the done flag is set. |
void |
scalePIDs()
|
protected String |
sensorsString()
Converts the sensor array to a readable string |
void |
setDone()
Shut down the read loop for this WorldState object. |
String |
toString()
Returns a string representation of the WorldState, combining all other methods converting the arrays to strings |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int WORLD_STATE_PORT
| Constructor Detail |
|---|
public WorldState(Aibo aibo)
aibo - the Aibo on which to start and connect to the World State
Serializer| Method Detail |
|---|
public void clear()
public void connect()
public void disconnect()
public void setDone()
public long getTimestamp()
public String getModelName()
public long getFrame()
public float getPID(int index)
index - the desired index of the array to retrieve
public float getSensor(int index)
index - the desired index of the array to retrieve
public float getButton(int index)
index - the desired index of the array to retrieve
public float getDuty(int index)
index - the desired index of the array to retrieve
protected String pidString()
protected String dutiesString()
protected String sensorsString()
protected String buttonsString()
public String toString()
toString in class Threadpublic float getButton_pawLFront()
public float getButton_pawRFront()
public float getButton_pawLRear()
public float getButton_pawRRear()
public float getSensorBattery()
public float getSensorTemperature()
public float getSensorPower()
public float getSensorVoltage()
public float getSensorCurrent()
public float getButtonChin()
public float getButtonHead()
public float getButtonBackF()
public float getButtonBackM()
public float getButtonBackR()
public float getSensorAccelFB()
public float getSensorAccelRL()
public float getSensorAccelUD()
public float getJoint(int index)
index - an integer that determines which joint information is
returned
public float getHeadPan()
public float getHeadTilt()
public float getHeadNod()
public float getSensorIRNear()
public float getSensorIRFar()
public float getSensorIRChest()
public void scalePIDs()
public void parseStream(DataInputStream fromServer)
fromServer - the data stream containing component informationpublic void run()
run in interface Runnablerun in class Thread
public char readChar(InputStream in)
throws IOException
in - the input stream to be read from
IOException
public long readUnsignedInt(InputStream in)
throws IOException
in - an input stream of bits
IOException
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||