Class DiarcComponent

java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
Direct Known Subclasses:
AgentModel, BeliefComponent, CachedParserComponent, ChangeMapComponent, DialogueComponent, ElevatorBoardingComponent, ExplorationComponent, FetchDockingComponent, FloorCalculatorComponent, Forklift, ForkliftPython, GoalManagerImpl, HybridParserComponent, LidarDoorComponent, ListenerComponent, LLMComponent, LLMNLComponent, LLMParserComponent, MapComponent, MaryTTSComponent, MockArmComponent, MockCR800Component, MockKolverComponent, MockMoveBaseComponent, MockMoveItComponent, MockNaoComponent, MockOnRobotScrewingComponent, MockPLCComponent, MockPR2Component, MockScaleComponent, MockSpotComponent, MockSpotNavGraphComponent, MockTemiV3Component, MockTFComponent, MockUnitySpaceStationImpl, MockUnitySpaceStationSimulationImpl, MockVisionComponent, MockYumiComponent, MoveBaseComponent, MoveItComponent, NaoComponent, NormComponent, NovelRunComponent, OpenTTSComponent, PathPlannerComponent, PatternMatchingParser, PolycraftComponent, PolycraftRLComponent, PR2BaseComponent, PragmaticsComponent, ReferenceResolutionComponent, RequestFromHumanComponent, RosVisionComponent, ScaleComponent, SimpleNLGComponent, SimSpeechProductionComponent, SimSpeechRecognitionComponent, SimulationBasedPlanning, Sphinx4Component, SupermarketComponent, TestGeneric, TFComponent, TLDLParserComponent, TRADEServiceGui, UIComponent, UnityAgent, UnityComponent, UnitySpaceStationLLM, VideoReceiveComponent, VideoSendComponent, VisionComponent

public abstract class DiarcComponent extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected long
    Execution loop time (in milliseconds).
    protected org.slf4j.Logger
    DIARC Component logger.
    protected boolean
    Flag used to start execution loop thread.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<org.apache.commons.cli.Option>
    Command line options available in sub-class.
    static final <T extends DiarcComponent>
    T
    createInstance(Class<T> clazz, String args)
    Convenience method to pass all args as a single String, and automatically registers with TRADE.
    static final <T extends DiarcComponent>
    T
    createInstance(Class<T> clazz, String[] args)
    Convenience method to automatically register with TRADE.
    static final <T extends DiarcComponent>
    T
    createInstance(Class<T> clazz, String[] args, boolean registerWithTrade)
    Factory method to create a DIARC component instance, parseArgs, init, and finally register as with TRADE.
    static final <T extends DiarcComponent>
    T
    createInstance(Class<T> clazz, String args, boolean registerWithTrade)
    Convenience method to pass all args as a single String, and optionally registers with TRADE.
    protected void
    This is where any code that needs to be called repeatedly in a dedicated thread should live.
    ai.thinkingrobots.trade.TRADEServiceConstraints
    Return DIARC component groups as a TRADEServiceConstraint instance, which can be further modified.
    Return DIARC component groups.
    ai.thinkingrobots.trade.TRADEServiceInfo
    getMyService(String serviceName, Class<?>... argTypes)
    Get a TRADEServiceInfo instance for one of the services provides by this DIARC Component.
    Collection<ai.thinkingrobots.trade.TRADEServiceInfo>
    Get all services offered by this component.
    protected void
    Perform any component initialization.
    static final void
    main(String[] args)
    Main method to allow starting of a single DIARC component from the command line.
    protected void
    parseArgs(org.apache.commons.cli.CommandLine cmdLine)
    Called directly after construction to pass runtime values that will override default values.
    final void
    Main entrypoint for component shutdown logic.
    protected void
    Any component that needs particular shutdown logic needs to override this method and

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      protected org.slf4j.Logger log
      DIARC Component logger.
    • shouldRunExecutionLoop

      protected boolean shouldRunExecutionLoop
      Flag used to start execution loop thread. False by default.
    • executionLoopCycleTime

      protected long executionLoopCycleTime
      Execution loop time (in milliseconds).
  • Constructor Details

    • DiarcComponent

      protected DiarcComponent()
  • Method Details

    • init

      protected void init()
      Perform any component initialization. This should not be used for setting local fields to default values as was the case in DIARC. This method is called after the constructor, and after parseArgs. Setting default values should be done in field declaration or in the constructor.
    • parseArgs

      protected void parseArgs(org.apache.commons.cli.CommandLine cmdLine)
      Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.zs
      Parameters:
      cmdLine -
    • additionalUsageInfo

      protected List<org.apache.commons.cli.Option> additionalUsageInfo()
      Command line options available in sub-class. This should be paired with a parseArgs implementation.
      Returns:
    • executionLoop

      protected void executionLoop()
      This is where any code that needs to be called repeatedly in a dedicated thread should live. It is not called by default and you must set shouldRunExecutionLoop to true in your constructor.
    • shutdownComponent

      protected void shutdownComponent()
      Any component that needs particular shutdown logic needs to override this method and
    • shutdown

      public final void shutdown()
      Main entrypoint for component shutdown logic. This is automatically triggered by the Java shutdown hook (i.e., ctrl-C).
    • getMyGroups

      public List<String> getMyGroups()
      Return DIARC component groups. This is a shallow copy.
      Returns:
    • getMyGroupConstraints

      public ai.thinkingrobots.trade.TRADEServiceConstraints getMyGroupConstraints()
      Return DIARC component groups as a TRADEServiceConstraint instance, which can be further modified.
      Returns:
    • getMyServices

      public Collection<ai.thinkingrobots.trade.TRADEServiceInfo> getMyServices()
      Get all services offered by this component.
      Returns:
    • getMyService

      public ai.thinkingrobots.trade.TRADEServiceInfo getMyService(String serviceName, Class<?>... argTypes)
      Get a TRADEServiceInfo instance for one of the services provides by this DIARC Component.
      Parameters:
      serviceName -
      argTypes -
      Returns:
    • createInstance

      public static final <T extends DiarcComponent> T createInstance(Class<T> clazz, String[] args, boolean registerWithTrade)
      Factory method to create a DIARC component instance, parseArgs, init, and finally register as with TRADE.
      Type Parameters:
      T -
      Parameters:
      clazz - class to be instantiated (must extend DiarcComponent)
      args - command line arguments
      registerWithTrade - true/false whether to register with TRADE
      Returns:
    • createInstance

      public static final <T extends DiarcComponent> T createInstance(Class<T> clazz, String[] args)
      Convenience method to automatically register with TRADE.
      Type Parameters:
      T -
      Parameters:
      clazz - class to be instantiated (must extend DiarcComponent)
      args - command line arguments
      Returns:
    • createInstance

      public static final <T extends DiarcComponent> T createInstance(Class<T> clazz, String args)
      Convenience method to pass all args as a single String, and automatically registers with TRADE.
      Type Parameters:
      T -
      Parameters:
      clazz - class to be instantiated (must extend DiarcComponent)
      args - command line arguments
      Returns:
    • createInstance

      public static final <T extends DiarcComponent> T createInstance(Class<T> clazz, String args, boolean registerWithTrade)
      Convenience method to pass all args as a single String, and optionally registers with TRADE.
      Type Parameters:
      T -
      Parameters:
      clazz - class to be instantiated (must extend DiarcComponent)
      args - command line arguments
      registerWithTrade - true/false whether to register with TRADE
      Returns:
    • main

      public static final void main(String[] args)
      Main method to allow starting of a single DIARC component from the command line.
      Parameters:
      args -