public CommandGrammarBuilder(MainController.State state, ObjectLibrary lib) { this.strings = new List<string>(); switch (state) { case MainController.State.waiting: this.grammar = buildWaitingGrammar(); break; case MainController.State.start: this.grammar = buildStartGrammar(lib); break; case MainController.State.learn: this.grammar = null; break; case MainController.State.find: this.grammar = buildFindGrammar(); break; case MainController.State.confirmation: this.grammar = buildConfGrammar(); break; case MainController.State.getName: this.grammar = buildGetNameGrammar(); break; case MainController.State.getProperties: this.grammar = buildGetPropertiesGrammar(); break; } }
public NavigationController(MainController main, NaoController nao, ObjectLibrary lib) { this.stopped = false; this.nao = nao; this.lib = lib; this.main = main; }
public MainController(MainWindow window) { this.window = window; this.nao = new NaoController(NAO_IP, this); this.thriftTransport = new TSocket(SERVER_IP, 9090); thriftTransport.Open(); TProtocol protocol = new TBinaryProtocol(thriftTransport); this.thriftClient = new Rpc.Client(protocol); this.lib = new ObjectLibrary(this, this.thriftClient, MainController.OBJECT_LIB_PATH); this.updateThread = new Thread(this.lib.updatePointClouds); this.updateThread.Start(); this.nav = new NavigationController(this, nao, lib); this.navThread = null; switchStates(State.waiting); }
private Grammar buildStartGrammar(ObjectLibrary lib) { this.prefix = "nao"; GrammarBuilder builder = new GrammarBuilder("nao"); Choices topLevel = new Choices(); topLevel.Add("identify known objects"); this.strings.Add("identify known objects"); topLevel.Add("learn unknown objects"); this.strings.Add("learn unknown objects"); string[] properties = lib.getProperties().ToArray(); if (properties.Length != 0) { GrammarBuilder propertyGrammar = new GrammarBuilder("find all"); propertyGrammar.Append(new Choices(properties)); propertyGrammar.Append("objects"); topLevel.Add(propertyGrammar); this.strings.Add("find all {" + toString(properties) + "} objects"); } string[] identifiers = lib.getIdentifiers().ToArray(); if (identifiers.Length != 0) { GrammarBuilder identifierGrammar = new GrammarBuilder("locate"); identifierGrammar.Append(new Choices(identifiers)); topLevel.Add(identifierGrammar); this.strings.Add("locate {" + toString(identifiers) + "}"); } builder.Append(topLevel); return new Grammar(builder); }