Class UnityAgent

java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.unity.UnityAgent
Direct Known Subclasses:
UnityPR2, UnitySpaceStation

public class UnityAgent extends DiarcComponent
Routes agent-specific messages from UnityComponent to and from TRADE services.
  • Field Details

    • agent

      public String agent
    • isConnected

      public boolean isConnected
  • Constructor Details

    • UnityAgent

      public UnityAgent()
  • Method Details

    • additionalUsageInfo

      protected List<org.apache.commons.cli.Option> additionalUsageInfo()
      Description copied from class: DiarcComponent
      Command line options available in sub-class. This should be paired with a parseArgs implementation.
      Overrides:
      additionalUsageInfo in class DiarcComponent
      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 class DiarcComponent
    • route

      protected void route(Message msg)
      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

      protected void listen(Message msg)
      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

      protected void listen(Utterance input)
    • connected

      protected void connected(Message msg)
      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

      protected void sendMessage(Message msg)
      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

      public List<String> getResponse(Message msg)
      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

      public boolean unityReceiveMessage(Message msg)
      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.