public class AgentJim extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AgentJim.TeamSide
Represents a side that the agent plays on.
|
Modifier and Type | Field and Description |
---|---|
private AgentData |
agentData |
private static Logger |
logger |
private StringBuilder |
output
Used for accumulating all of the agent's standard output text
|
private int |
sceneGraphPlayer |
private org.apache.commons.net.tftp.TFTPClient |
tftpClient |
private String |
tftpIP |
private int |
tftpPort |
private WorldModel |
worldModel |
Constructor and Description |
---|
AgentJim(AgentData agentData,
String tftpIP,
int tftpPort)
Constructor used when we want to attach to an running Jim agent
connected to the server on address
serverAddress . |
Modifier and Type | Method and Description |
---|---|
void |
connectToServer() |
void |
disconnectFromServer() |
private void |
executeRubyScript(String script)
Invokes executing of ruby script on special TFTP server.
|
AgentData |
getAgentData() |
int |
getSceneGraphPlayer() |
StringBuilder |
getStdout()
Returns the string builder used for accumulating all of the agent's
standard output text.
|
InetSocketAddress |
getTFTPAddress() |
String |
getTftpIP() |
int |
getTftpPort() |
WorldModel |
getWorldModel() |
void |
invokeMove(String move) |
void |
invokePlanChange(String planName)
Makes the agent change its planner.
|
void |
invokeReplan()
Makes the agent reload all its ruby scripts, which will cause a replan
|
void |
invokeRestart()
Deprecated.
|
void |
invokeXMLReload()
Makes the agent reload all its XML moves (doesn't reload annotations)
|
boolean |
isConnectedToServer() |
private void |
sendFile(String saveFileAs,
InputStream inputStream)
Sends a file to remote TFTP server.
|
void |
setSceneGraphPlayer(int sceneGraphPlayer) |
void |
setWorldModel(WorldModel model) |
String |
toString()
Returns a string that is used as a unique identifier of the agent
in the AgentManager class.
|
private static Logger logger
private StringBuilder output
private int sceneGraphPlayer
private WorldModel worldModel
private AgentData agentData
private org.apache.commons.net.tftp.TFTPClient tftpClient
private int tftpPort
private String tftpIP
public AgentJim(AgentData agentData, String tftpIP, int tftpPort)
serverAddress
.
This is especially useful when debugging, because we don't have to
run new instance of agent everytime we want to use testcase. We can
simply run agent in shell and by this constructor treat is like a
regular runned agent.agentData
- public StringBuilder getStdout()
public AgentData getAgentData()
public int getTftpPort()
public String getTftpIP()
public InetSocketAddress getTFTPAddress()
public boolean isConnectedToServer()
public void connectToServer()
public void disconnectFromServer()
public void invokePlanChange(String planName) throws IOException
planName
- the class name of the new plan (NOT the ruby file name)IOException
- on failed communication with the agent's TFTP serverpublic void invokeXMLReload() throws IOException
IOException
- on failed communication with the agent's TFTP serverpublic void invokeReplan() throws IOException
IOException
- on failed communication with the agent's TFTP server@Deprecated public void invokeRestart() throws IOException
Doesn't do anything.
CommunicationThread (a class in the agent that this method relies on) is deprecated, so I assume that this is as well.
IOException
public void invokeMove(String move) throws IOException
IOException
private void sendFile(String saveFileAs, InputStream inputStream) throws IOException
host
- Remote TFTP server.saveFileAs
- Determines how file on remote TFTP server will be
saved.inputStream
- Input stream of data.IOException
private void executeRubyScript(String script) throws IOException
script
- UTF-8 String text to be executed on server side.IOException
public String toString()
public int getSceneGraphPlayer()
public void setSceneGraphPlayer(int sceneGraphPlayer)
public void setWorldModel(WorldModel model)
public WorldModel getWorldModel()