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>
Command line options available in sub-class.protected void
Message 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 void
protected void
Agent listens to a message spoken by an agent in Unity.protected void
parseArgs
(org.apache.commons.cli.CommandLine cmdLine) Called directly after construction to pass runtime values that will override default values.protected void
Route a message received from the Unity socket server to the appropriate method that matches the named action.protected void
sendMessage
(Message msg) Send a message to Unity via the unitySendMessage TRADE service that proxies messages to the Unity socket server.boolean
TRADE 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:DiarcComponent
Command line options available in sub-class. This should be paired with a parseArgs implementation.- Overrides:
additionalUsageInfo
in classDiarcComponent
- Returns:
-
parseArgs
protected void parseArgs(org.apache.commons.cli.CommandLine cmdLine) Description copied from class:DiarcComponent
Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.zs- Overrides:
parseArgs
in 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.
-