Package edu.tufts.hrilab.diarc
Class DiarcComponent
java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
- Direct Known Subclasses:
AgentModel,ASRWebsocketComponent,AvaComponent,AvaDisplayComponent,AvaGuiProvider,AvaMediaProvider,AvaStatisticsManagerComponent,BeliefComponent,CachedNLGComponent,CachedParserComponent,CallHelloComponent,DialogueComponent,ExplorationComponent,FrontEndConfigurationComponent,GoalManagerComponent,HybridNLGComponent,HybridParserComponent,IHMCComponent,KioskGoalManager,LidarDoorComponent,ListenerComponent,LLMComponent,LLMNLGComponent,LLMParserComponent,LLMServiceProvider,LLMServiceProvider,MapComponent,MaryTTSComponent,MockArmComponent,MockAvaComponent,MockHumanAgent,MockMoveBaseComponent,MockMoveItComponent,MockNaoComponent,MockPR2Component,MockScaleComponent,MockSpotComponent,MockTemiV3Component,MockTFComponent,MockUnityPR2Component,MockUnitySpaceStationComponent,MockVisionComponent,MockYumiComponent,NaoComponent,NormComponent,NovelRunComponent,OpenTTSComponent,PathPlannerComponent,PatternMatchingParser,PickAndPlaceLLM,PolycraftComponent,PolycraftRLComponent,PragmaticsComponent,PrintHelloComponent,ReferenceResolutionComponent,RequestFromHumanComponent,RLActionManager,ScaleComponent,SimpleNLGComponent,SimSpeechProductionComponent,SimSpeechRecognitionComponent,SimulationBasedPlanning,SpaceStationPatternMatcher,Sphinx4Component,SpotComponent,StreamingTTSComponent,SupermarketAgent,SupermarketComponent,TemplatedNLG,TLDLParserComponent,TradeServiceComponent,TRADEServiceGui,UnityAgentComponent,UnityComponent,UnitySpaceStationLLM,UnitySpaceStationNLGComponent,WhisperComponent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longExecution loop time (in milliseconds).protected org.slf4j.LoggerDIARC Component logger.protected booleanFlag used to start execution loop thread. -
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 voidMoved location where the shutdown hook is attached out of the default constructor.static final <T extends DiarcComponent>
TcreateInstance(Class<T> clazz, boolean registerWithTrade, boolean addShutdownHook, String... args) Factory method to create a DIARC component instance, parseArgs, init, and finally register as with TRADE.static final <T extends DiarcComponent>
TcreateInstance(Class<T> clazz, boolean registerWithTrade, String... args) Convenience method to optionally register with TRADE, and automatically add a shutdown hook.static final <T extends DiarcComponent>
TcreateInstance(Class<T> clazz, String... args) Convenience method to automatically register with TRADE, and add a shutdown hook.protected voidThis is where any code that needs to be called repeatedly in a dedicated thread should live.ai.thinkingrobots.trade.TRADEServiceConstraintsReturn DIARC component groups as a TRADEServiceConstraint instance, which can be further modified.Return DIARC component groups.ai.thinkingrobots.trade.TRADEServiceInfogetMyService(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 voidinit()Perform any component initialization.static final voidMain method to allow starting of a single DIARC component from the command line.protected voidparseArgs(org.apache.commons.cli.CommandLine cmdLine) Override this method to parse command line args in the sub-class.protected voidfinal voidshutdown()Main entrypoint for component shutdown logic.protected voidAny component that needs particular shutdown logic needs to override this method and
-
Field Details
-
log
protected org.slf4j.Logger logDIARC Component logger. -
shouldRunExecutionLoop
protected boolean shouldRunExecutionLoopFlag used to start execution loop thread. False by default. -
executionLoopCycleTime
protected long executionLoopCycleTimeExecution 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. -
postRegistrationInit
protected void postRegistrationInit() -
parseArgs
protected void parseArgs(org.apache.commons.cli.CommandLine cmdLine) Override 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.- Parameters:
cmdLine-
-
additionalUsageInfo
Override this method to define 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. -
attachShutdownHook
protected void attachShutdownHook()Moved location where the shutdown hook is attached out of the default constructor. DiarcConfiguration attaches the same hook for all inner DiarcConponents, so this should only be attached internally for standalone components. -
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
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
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, boolean registerWithTrade, boolean addShutdownHook, String... args) 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)registerWithTrade- true/false whether to register with TRADEaddShutdownHook- whether this class should automatically register a shutdown hookargs- command line arguments- Returns:
-
createInstance
public static final <T extends DiarcComponent> T createInstance(Class<T> clazz, boolean registerWithTrade, String... args) Convenience method to optionally register with TRADE, and automatically add a shutdown hook.- Type Parameters:
T-- Parameters:
clazz- class to be instantiated (must extend DiarcComponent)args- command line arguments- Returns:
-
createInstance
Convenience method to automatically register with TRADE, and add a shutdown hook.- Type Parameters:
T-- Parameters:
clazz- class to be instantiated (must extend DiarcComponent)args- command line arguments- Returns:
-
main
Main method to allow starting of a single DIARC component from the command line.- Parameters:
args-
-