Package edu.tufts.hrilab.unity
Class UnityAgent
java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.unity.UnityAgent
- Direct Known Subclasses:
UnityPR2,UnitySpaceStation
Routes agent-specific messages from UnityComponent to and from TRADE services.
-
Field Summary
FieldsFields inherited from class edu.tufts.hrilab.diarc.DiarcComponent
executionLoopCycleTime, shouldRunExecutionLoop -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<org.apache.commons.cli.Option>Override this method to define command line options available in sub-class.protected voidMessage received when an agent is connected to Unity to/from DIARC socket.getResponse(Message msg) Send a message to Unity and await a response.protected voidprotected voidAgent listens to a message spoken by an agent in Unity.protected voidparseArgs(org.apache.commons.cli.CommandLine cmdLine) Override this method to parse command line args in the sub-class.protected voidRoute a message received from the Unity socket server to the appropriate method that matches the named action.protected voidsendMessage(Message msg) Send a message to Unity via the unitySendMessage TRADE service that proxies messages to the Unity socket server.booleanTRADE service used by the UnityComponent when message received from Unity socket server.Methods inherited from class edu.tufts.hrilab.diarc.DiarcComponent
createInstance, createInstance, createInstance, createInstance, executionLoop, getMyGroupConstraints, getMyGroups, getMyService, getMyServices, init, main, shutdown, shutdownComponent
-
Field Details
-
agent
-
isConnected
public boolean isConnected
-
-
Constructor Details
-
UnityAgent
public UnityAgent()
-
-
Method Details
-
additionalUsageInfo
Description copied from class:DiarcComponentOverride this method to define command line options available in sub-class. This should be paired with a parseArgs implementation.- Overrides:
additionalUsageInfoin classDiarcComponent- Returns:
-
parseArgs
protected void parseArgs(org.apache.commons.cli.CommandLine cmdLine) Description copied from class:DiarcComponentOverride this method to parse command line args in the sub-class. Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.- Overrides:
parseArgsin classDiarcComponent
-
route
Route a message received from the Unity socket server to the appropriate method that matches the named action.- Parameters:
msg- - Message originating from Unity to route to method.
-
listen
Agent listens to a message spoken by an agent in Unity. All "listen" messages will contain the following: actor = listener arguments[0] = speaker arguments[1] = message- Parameters:
msg- - Message with action "listen".
-
listen
-
connected
Message received when an agent is connected to Unity to/from DIARC socket. All "connected" messages will contain the following: actor = connected agent- Parameters:
msg- - Message with action "connected".
-
sendMessage
Send a message to Unity via the unitySendMessage TRADE service that proxies messages to the Unity socket server.- Parameters:
msg- - Message to send to Unity as the agent.
-
getResponse
Send a message to Unity and await a response. All responses are stored in flat String Lists for now.- Parameters:
msg- - Message to send to Unity.
-
unityReceiveMessage
TRADE service used by the UnityComponent when message received from Unity socket server. If not intended for this instance of agent, ignore message.- Parameters:
msg- - Message received from Unity.
-