[TeamTalk 319]: [855] trunk/TeamTalk: 1) Fixed hard-coded tool ordering dependency in pendecoder.

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Sun Oct 21 13:24:27 EDT 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071021/d839b719/attachment-0001.html
-------------- next part --------------
Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractDecoderTool.java
===================================================================
--- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractDecoderTool.java	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractDecoderTool.java	2007-10-21 17:24:26 UTC (rev 855)
@@ -4,6 +4,7 @@
   
   protected MapCanvas canvas;
   protected String tooltip;
+  public int index;
   
   protected AbstractDecoderTool(MapCanvas canvas, String name, String tooltip) {
     super(canvas, name);

Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java
===================================================================
--- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java	2007-10-21 17:24:26 UTC (rev 855)
@@ -59,6 +59,11 @@
   protected TaskStatus goal_status;
   
   /**
+   * certainly boolean
+   */
+  protected boolean certainty = true;
+  
+  /**
    * last known good position and orientation of robot (in centimeters and radians)
    * when the uncertainty about the robots position and orientation reach some threashhold
    * we just keep showing this last known good postition
@@ -151,6 +156,16 @@
   }
   
   /**
+   * set certainty
+   */
+  public boolean setCertainty(boolean certainty) {
+      if(!certainty) System.err.println("uncertain robot location");
+      boolean what_was = certainty;
+      certainty = this.certainty;
+      return what_was;
+  }
+  
+  /**
    * bots are iconified as triangles
    * makes an isocelese triangle, length 80cm, width 48cm, as an
    * AWT Shape
@@ -205,7 +220,7 @@
         } else {
             g.setColor(unselected_color);
         }
-        if(alpha > 0.5F) g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5F));
+        if(!certainty) g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5F));
         g.fill(arrow);
     }
     
@@ -230,7 +245,7 @@
     myG.scale(at.getScaleX(), at.getScaleY()); //recover screen's scale, i.e. don't zoom text
     
     //draw the label background
-    if(alpha < 0.01F) myG.setFont(uncertainFont);
+    if(!certainty) myG.setFont(uncertainFont);
     Rectangle2D labelBackground = myG.getFontMetrics().getStringBounds(name, myG);
     myG.setColor(labelBackgroundColor);
     myG.fill(labelBackground);

Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java
===================================================================
--- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java	2007-10-21 17:24:26 UTC (rev 855)
@@ -23,11 +23,12 @@
     return obj_created;
   }
  
-  public boolean setBot(String name, float x, float y, float r) {
+  public boolean setBot(String name, float x, float y, float r, boolean certainty) {
     name.toUpperCase(); //names are always case insensitive
     boolean bot_created = false;
     BotShape bot = getBot(name);
     bot.setLocation(x, y, r);
+    bot.setCertainty(certainty);
     canvas.repaint();
     return bot_created;
   }

Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderDisplay.java
===================================================================
--- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderDisplay.java	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderDisplay.java	2007-10-21 17:24:26 UTC (rev 855)
@@ -43,6 +43,8 @@
                     try {
                         if(tool.getName() == "Zoom Out") {
                             mapCanvas.zoomOut();
+                        } else if(tool.getName() == "E-STOP") {
+                            eStop();
                         } else if(tool.getName() == "Undock") {
                             undock();
                         } else if(tool.getName() == "Cancel Task") {
@@ -53,12 +55,23 @@
                             startSession();
                             ToggleButtonTool bt = (ToggleButtonTool)tool;
                             bt.toggleState();
-                            ((JToggleButton)((JPanel)toolbar).getComponent(0)).setText(bt.getName());
+                            ((JToggleButton)((JPanel)toolbar).getComponent(bt.index)).setText(bt.getName());
                         } else if(tool.getName() == "Stop Session") {
                             endSession();
                             ToggleButtonTool bt = (ToggleButtonTool)tool;
                             bt.toggleState();
-                            ((JToggleButton)((JPanel)toolbar).getComponent(0)).setText(bt.getName());
+                            toolbar.validate();
+                            ((JToggleButton)((JPanel)toolbar).getComponent(bt.index)).setText(bt.getName());
+                        } else if(tool.getName() == "Pause") {
+                            pauseRobot();
+                            ToggleButtonTool bt = (ToggleButtonTool)tool;
+                            bt.toggleState();
+                            ((JToggleButton)((JPanel)toolbar).getComponent(bt.index)).setText(bt.getName());
+                        } else if(tool.getName() == "Continue") {
+                            unpauseRobot();
+                            ToggleButtonTool bt = (ToggleButtonTool)tool;
+                            bt.toggleState();
+                            ((JToggleButton)((JPanel)toolbar).getComponent(bt.index)).setText(bt.getName());
                         }
                     } catch (NullPointerException e) {}
                 }
@@ -339,6 +352,12 @@
                 "Click to start speaking",
                 "Stop Session",
                 "Click to mute"));
+        t.addTool(new ToggleButtonTool(mapCanvas,
+                "Pause",
+                "Pause a robot",
+                "Continue",
+                "Unpause a robot"));
+        t.addTool(new ButtonTool(mapCanvas, "E-STOP", "Emergency Stop"));
         t.addTool(new PointTool(mapCanvas,
                 "Select",
                 "Click on a robot to select it.",
@@ -446,6 +465,27 @@
     }
     
     /**
+     * Send emergency stop to all robots
+     */
+    public void eStop() {
+        for(PenDecoderServer server: servers) server.eStop();
+    }
+    
+    /**
+     * Send a message to the dialog manager to pause a robot.
+     */
+    public void pauseRobot() {
+        for(PenDecoderServer server: servers) server.pauseRobot();
+    }
+    
+    /**
+     * Send a message to the dialog manage to unpause a robot.
+     */
+    public void unpauseRobot() {
+        for(PenDecoderServer server: servers) server.unpauseRobot();
+    }
+    
+    /**
      * Send a message to the dialog manager that the user has indicated a set of
      * waypoints along which to search.
      * @param shape A polyline to search along.

Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java
===================================================================
--- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java	2007-10-21 17:24:26 UTC (rev 855)
@@ -42,7 +42,7 @@
   public void serverOpReinitialize(GFrame f) {
     String botName = (String)f.getProperty(":user_id");
     if(!botName.equals("TeamTalk")) {
-      botTracker.setBot(botName, 0, 0, 0);
+      botTracker.setBot(botName, 0, 0, 0, true);
     }
   }
   
@@ -52,8 +52,9 @@
     float x = 100*((Float)f.getProperty(":x")).floatValue();
     float y = 100*((Float)f.getProperty(":y")).floatValue();
     float r = ((Float)f.getProperty(":r")).floatValue();
+    short error = f.getInt(":error").shortValue();
     
-    botTracker.setBot(name, x, y, r);
+    botTracker.setBot(name, x, y, r, (error==0));
     return (GFrame) null;
   }
   
@@ -303,6 +304,23 @@
     send_to_hub(f);
   }
   
+  public void eStop() {
+    System.err.println("estop...");
+    sayToBot("Commands", "[HumanHaltCommand]", null);
+  }
+  
+  public void pauseRobot() {
+    System.err.println("Pausing...");
+    //Map<String, String> loc = new HashMap<String, String>();
+    sayToBot("Commands", "[HumanPauseCommand]", null);
+  }
+  
+  public void unpauseRobot() {
+    System.err.println("Unpausing...");
+    //Map<String, String> loc = new HashMap<String, String>();
+    sayToBot("Commands", "[HumanContinueCommand]", null);
+  }
+  
   public void say(String utt) {
     GFrame f = new Clause("main");
     
@@ -334,21 +352,22 @@
     String parse = new String();
     
     //constructing the nets
+    if(net == null) net = new HashMap<String, String>();
     Iterator<Map.Entry<String, String>> i = net.entrySet().iterator();
     while(i.hasNext()) {
-      Map.Entry<String, String> pair = i.next();
-      GFrame gfNet = new Clause("net");
-      gfNet.setProperty(":name", pair.getKey());
-      gfNet.setProperty(":contents", pair.getValue());
-      hyp += pair.getValue();
-      parse += "( " + pair.getKey() + " ( " + pair.getValue() + " ) )";
-      if(i.hasNext()) {
-        hyp += " ";
-        parse += " ";
-      }
-      pgoNets.addElement(gfNet);
+        Map.Entry<String, String> pair = i.next();
+        GFrame gfNet = new Clause("net");
+        gfNet.setProperty(":name", pair.getKey());
+        gfNet.setProperty(":contents", pair.getValue());
+        hyp += pair.getValue();
+        parse += "( " + pair.getKey() + " ( " + pair.getValue() + " ) )";
+        if(i.hasNext()) {
+            hyp += " ";
+            parse += " ";
+        }
+        pgoNets.addElement(gfNet);
     }
-    
+
     //then construct the encompassing slot
     gfSlot.setProperty(":nets", pgoNets);
     gfSlot.setProperty(":numnets", net.size());

Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java
===================================================================
--- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java	2007-10-21 17:24:26 UTC (rev 855)
@@ -19,6 +19,7 @@
   public int addTool(AbstractDecoderTool tool) {
     if (tool != null) {
       tools.add(tool);
+      tool.index = tools.size() - 1;
       return (tools.size() - 1); 
     }
     return -1; 

Modified: trunk/TeamTalk/Agents/TeamTalkBackend/agent.cpp
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkBackend/agent.cpp	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/TeamTalkBackend/agent.cpp	2007-10-21 17:24:26 UTC (rev 855)
@@ -35,7 +35,7 @@
   ostringstream cmd, title;
   cmd << HUB << " -verbosity 3 -pgm_file " << cfilename;
   title << uppername << " Hub";
-  debug << "sending to pythia: " << cmd.str() << endl;
+  debug("agent") << "sending to pythia: " << cmd.str() << endl;
   Pythia::Message(cmd.str(), title.str()).send("localhost");
 }
 
@@ -51,7 +51,7 @@
   ostringstream cmd, title;
   cmd << HELIOS << " -port " << iHeliosPort << " -config " << cfilename;
   title << uppername << " Helios";
-  debug << "sending to pythia: " << cmd.str() << endl;
+  debug("agent") << "sending to pythia: " << cmd.str() << endl;
   Pythia::Message(cmd.str(), title.str()).send("localhost");
 }
 
@@ -81,7 +81,7 @@
   ostringstream cmd, title;
   cmd << DM << " -maxconns 6 -config " << cfilename;
   title << uppername << " DM";
-  debug << "sending to pythia: " << cmd.str() << endl;
+  debug("agent") << "sending to pythia: " << cmd.str() << endl;
   Pythia::Message(cmd.str(), title.str()).send("localhost");
 }
 
@@ -134,6 +134,7 @@
 		Gal_SetProp(f, ":x", Gal_FloatObject((float)rloc->getX()));
 		Gal_SetProp(f, ":y", Gal_FloatObject((float)rloc->getY()));
 		Gal_SetProp(f, ":r", Gal_FloatObject((float)rloc->getAngle()));
+    Gal_SetProp(f, ":error", Gal_IntObject(rloc->getErrorState()));
 		return f;
 	}
 
@@ -630,18 +631,18 @@
 			debug << '"' << token << '"' << endl;
 			f_xcoord = static_cast<float>(GetNumber999(token));
 		}
-		debug << "got x" << endl;
+		debug("agent") << "got x" << endl;
 		issOrdinal >> token;
 		if(token == "NEGATIVE") {
-			debug << "got negative y" << endl;
+			debug("agent") << "got negative y" << endl;
 			issOrdinal >> token;
-			debug << '"' << token << '"' << endl;
+			debug("agent") << '"' << token << '"' << endl;
 			f_ycoord = static_cast<float>(-GetNumber999(token));
 		} else {
-			debug << '"' << token << '"' << endl;
+			debug("agent") << '"' << token << '"' << endl;
 			f_ycoord = static_cast<float>(GetNumber999(token));
 		}
-		debug << "got y" << endl;
+		debug("agent") << "got y" << endl;
 		MsgCmdGoTo go(Point<float>(f_xcoord, f_ycoord), true);
 #ifdef USE_TXT_COMMANDS
 		sendAction(&go);
@@ -655,7 +656,7 @@
 
 void Agent::turn_command(const Gal_Frame& inframe)
 {
-	debug << "got turn command" << endl;
+	debug("agent") << "got turn command" << endl;
 	string sDirection(Gal_GetString(inframe, ":direction"));
 	bool bRel(false);
 	double fRad;
@@ -714,7 +715,7 @@
 
 void Agent::set_pose_command(const Gal_Frame& inframe)
 {
-	debug << "got set pose command" << endl;
+	debug("agent") << "got set pose command" << endl;
 	const char* x = Gal_GetString(inframe, ":x");
 	const char* y = Gal_GetString(inframe, ":y");
 	const char* a = Gal_GetString(inframe, ":angle");
@@ -731,11 +732,23 @@
     return;
   }
 	MsgCmdSetPos set_pos((float)atof(x), (float)atof(y), (float)atof(a));
-	debug << "setpos (" << x << ' ' << y << ") " << a;
+	debug("agent") << "setpos (" << x << ' ' << y << ") " << a;
   
   sendAction(&set_pos);
 }
 
+void Agent::pause_command() {
+  debug("agent") << "got pause command" << endl;
+  MsgCmdPause pause;
+  sendAction(&pause);
+}
+
+void Agent::continue_command() {
+  debug("agent") << "got continue command" << endl;
+  MsgCmdResume resume;
+  sendAction(&resume);
+}
+
 string Agent::getName() const {return name_;}
 TeamTalk::RobotClient* Agent::getRobotClient() {return robotClient_;}
 const TeamTalk::RobotClient* Agent::getRobotClient() const {return robotClient_;}

Modified: trunk/TeamTalk/Agents/TeamTalkBackend/agent.h
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkBackend/agent.h	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/TeamTalkBackend/agent.h	2007-10-21 17:24:26 UTC (rev 855)
@@ -54,6 +54,8 @@
   void move_to_goal_command(const Gal_Frame& inframe);
   void turn_command(const Gal_Frame& inframe);
   void set_pose_command(const Gal_Frame& inframe);
+  void pause_command();
+  void continue_command();
 
   //forming outgoing Galaxy Frames
   void writeFrame(Gal_Frame f) const;

Modified: trunk/TeamTalk/Agents/TeamTalkBackend/gal_be.cpp
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkBackend/gal_be.cpp	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/TeamTalkBackend/gal_be.cpp	2007-10-21 17:24:26 UTC (rev 855)
@@ -36,7 +36,7 @@
 // [2006-07-14] (tk): this restarts sphinx for a newly created dict and lm
 void restartDecoder() 
 {
-	debug << "sending restart_decoder" << endl;
+	debug("gal_be") << "sending restart_decoder" << endl;
 	Gal_Frame gfInput = Gal_MakeFrame("restart_decoder", GAL_CLAUSE);
   galaxyRobots->writeFrameSkeletonHub(gfInput);
 };
@@ -73,8 +73,11 @@
 void *init_server(Gal_Server *s, int argc, char **argv) 
 {
   DebugStream::threashold_ = DebugStream::D;
-  debug.on("client");
-  debug.on("packet");
+  debug.off("client");
+  debug.off("packet");
+  debug.off("agent");
+  debug.off("gal_be");
+  debug.on("adapter");
 
   srand((unsigned int)time(NULL));
 
@@ -93,13 +96,13 @@
 	const char *user_id = Gal_GetString(f, ":user_id");
 	if(!user_id) error << "no user_id" << endl;
   else if(!strcmp(user_id, "TeamTalk")) {
-    debug << "reinit: setting skeleton comm" << endl;
+    debug("gal_be") << "reinit: setting skeleton comm" << endl;
     galaxyRobots->setSkeletonComm(GalSS_EnvComm((GalSS_Environment*)server_data));
     restartDecoder();
     galaxyRobots->setRobotVoices();
   }
   else { 
-    debug << "reinit: adding robot" << endl;
+    debug("gal_be") << "reinit: adding robot" << endl;
     galaxyRobots->addRobot(user_id, GalSS_EnvComm((GalSS_Environment*)server_data));
   }
 	return f;
@@ -115,7 +118,7 @@
 		return f;
 	}
 
-  debug << "frame: " << f << endl;
+  debug("gal_be") << "frame: " << f << endl;
 	char* s_inframe = Gal_StringValue(aStr);
 	if(!s_inframe) {
 		error << "couldn't get string value for inframe" << endl;
@@ -137,14 +140,14 @@
 		inotfixed.getline(cpVal, 254);
 		fixed << '"' << cpVal << "\" ";
 	} while(inotfixed);
-	debug << "working with fixed version: " << fixed.str() << endl;
+	debug("gal_be") << "working with fixed version: " << fixed.str() << endl;
 	Gal_Frame inframe = Gal_ReadFrameFromString(fixed.str().c_str());
 	if(!inframe) {
 		error << "couldn't find :inframe" << endl;
 		return f;
 	}
 
-	debug << inframe << endl;
+	debug("gal_be") << inframe << endl;
   galaxyRobots->processGalaxyMessage(inframe);
 
 	Gal_SetProp(inframe, ":outframe", aStr);

Modified: trunk/TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp	2007-10-21 17:24:26 UTC (rev 855)
@@ -8,9 +8,9 @@
 vector<string> GalaxyRobots::processPeerfile(const string& fname) 
 {
 	vector<string> names;
-	debug << "about to add robots" << endl;
+	debug("adapter") << "about to add robots" << endl;
 	ifstream Frobotips(fname.c_str());
-	if(!Frobotips) error << "problem opening " << fname << endl;
+	if(!Frobotips) error("adapter") << "problem opening " << fname << endl;
 	string rname;
 	while(Frobotips >> rname) {
 		if(rname.at(0) == '#') {
@@ -57,7 +57,7 @@
 
 void GalaxyRobots::addRobotNamesToGrammar(const vector<string>& names) 
 {
-	debug << "adding robot names to grammar:";
+	debug("adapter") << "adding robot names to grammar:";
 	ofstream namefile("..\\..\\Resources\\Grammar\\TeamTalkRobots");
 	for(vector<string>::const_iterator i = names.begin(); i != names.end(); i++) {
 		namefile << tolower(*i) << endl;
@@ -84,14 +84,14 @@
 		Gal_Frame f = Gal_MakeFrame("trader_message", GAL_CLAUSE);
 		if(msg->hdr.type == Boeing::INFO) {
 			Gal_SetProp(f, ":type", Gal_StringObject("info"));
-			debug << "got info message: " << msg->info.task << endl;
+			debug("adapter") << "got info message: " << msg->info.task << endl;
 			istringstream input(msg->info.task);
 			string token;
 			string ip;
 			string object;
 			float x, y;
 			input >> token;
-			debug << "got info token " << token << endl;
+			debug("adapter") << "got info token " << token << endl;
 			if(token != "object") {
 				ip = token;
 				input >> token;
@@ -101,29 +101,33 @@
 				}
 			}
 			input >> object;
-			debug << "got info object " << object << endl;
+			debug("adapter") << "got info object " << object << endl;
 			input >> token;
-			debug << "got info token " << token << endl;
+			debug("adapter") << "got info token " << token << endl;
 			if(token != "at") {
 				error << "was expecting 'at'" << endl;
 				continue;
 			}
 			input >> token;
-			debug << "got info token " << token << endl;
+			debug("adapter") << "got info token " << token << endl;
 			if(token.empty() || token.at(0) != '(') {
 				error << "was expecting (..." << endl;
 				continue;
 			}
 			if(token == "(") {
 				input >> token;
-				debug << "got info token " << token << endl;
-				x = (float)atof(token.c_str());
+				debug("adapter") << "got info token " << token << endl;
+        if(!token.empty() && token.at(0) == '(') {
+          x = (float)atof(token.c_str()+1);
+        } else {
+				  x = (float)atof(token.c_str());
+        }
 			} else {
 				x = (float)atof(token.c_str()+1);
 			}
-			debug << "got info x: " << x << endl;
+			debug("adapter") << "got info x: " << x << endl;
 			input >> token;
-			debug << "got info token " << token << endl;
+			debug("adapter") << "got info token " << token << endl;
 			if(token.empty()) {
 				error << "was expecting ...)" << endl;
 				continue;
@@ -138,12 +142,12 @@
 		} else if(msg->hdr.type == Boeing::TASK_ACK) {
 			Gal_SetProp(f, ":type", Gal_StringObject("ack"));
 			Gal_SetProp(f, ":taskid", Gal_IntObject(msg->ack.taskid));
-			debug << "got task ack: " << msg->ack.taskid << endl;
+			debug("adapter") << "got task ack: " << msg->ack.taskid << endl;
 		} else if(msg->hdr.type == Boeing::TASK_DONE) {
 			Gal_SetProp(f, ":type", Gal_StringObject("done"));
 			Gal_SetProp(f, ":taskid", Gal_IntObject(msg->done.taskid));
 			Gal_SetProp(f, ":status", Gal_IntObject(msg->done.status));
-			debug << "got task done: " << msg->done.taskid << ' ' << msg->done.status << endl;
+			debug("adapter") << "got task done: " << msg->done.taskid << ' ' << msg->done.status << endl;
 		} else { 
 			warn << "unknown message type '" << msg->hdr.type << "' in traderlistener" << endl;
 			Gal_FreeFrame(f);
@@ -196,7 +200,7 @@
 		Gal_SetProp(f, ":resolution", Gal_IntObject(msg->map.resolution));
 		int *temp = new int[msg->map.array_length];
 		for(int i=0; i<msg->map.array_length; i++) temp[i] = msg->map.map[i];
-		debug << "got raw: " << temp[0] 
+		debug("adapter") << "got raw: " << temp[0] 
 		<< " rl: " << ((temp[0]&0xFFFFFF00)>>8) 
 			<< " rv: " << (temp[0]&0x000000FF) << endl;
 		Gal_SetProp(f, ":encoded_map", 
@@ -210,7 +214,7 @@
 { 
 	GalaxyRobots* me = (GalaxyRobots*)thisp;
 	Boeing::MapClient* m_client = me->m_client;
-	debug << "starting trackmap thread" << endl;
+	debug("adapter") << "starting trackmap thread" << endl;
 	for(int t=0; true; t++) {
 		Sleep(1000);
 		if(!(t%3)) { //send map keepalive every 3 seconds
@@ -221,7 +225,7 @@
 
 void GalaxyRobots::writeFrameAllHubs(Gal_Frame f) 
 {
-	debug << "writing to all hubs" << endl;
+	debug("adapter") << "writing to all hubs" << endl;
 	for(set<Agent>::iterator i = agents_.begin(); i != agents_.end(); i++) {
 		i->writeFrame(f);
 	}
@@ -246,7 +250,7 @@
 
 	iTraderTaskId = rand();
 
-	debug << "about to get the p_client" << endl;
+	debug("adapter") << "about to get the p_client" << endl;
 	try {
 		t_client = new Boeing::TraderClient();
 		m_client = new Boeing::MapClient();
@@ -270,7 +274,7 @@
 		if(!t_client->isConnected()) {
 			fatal << "optraderserver not found" << endl;
 		} else {
-			debug << "connected to trader" << endl;
+			debug("adapter") << "connected to trader" << endl;
 			//start listening threads
 			_beginthread(traderlistener, 0, (void*) this);
 		}
@@ -295,12 +299,12 @@
 
 void GalaxyRobots::setRobotVoices() 
 {
-	debug << "attempting to set robot voices" << endl;
+	debug("adapter") << "attempting to set robot voices" << endl;
 	for(TeamTalk::RobotsClient::const_iterator i = r_client->begin();
 		i != r_client->end(); i++) {
 			string name(toupper((*i)->getName()));
 			string voice(toupper((*i)->getVoice()));
-			debug << "adding voice " << voice << " to name " << name << endl;
+			debug("adapter") << "adding voice " << voice << " to name " << name << endl;
 			SendRobotConfigMessage(name, voice);
 	}
 }
@@ -341,7 +345,7 @@
 	Gal_Frame f = Agent::galaxyFrame(m);
 	char *frame_name = Gal_FrameName(f);
 	if(frame_name != NULL && strcmp(frame_name, "robot_message")) {
-		debug << "sending to skeleton hub: " << m->render() << endl;
+		debug("adapter") << "sending to skeleton hub: " << m->render() << endl;
 		writeFrameSkeletonHub(f);
 		Gal_FreeFrame(f);
 	}
@@ -349,7 +353,7 @@
 
 void GalaxyRobots::halt_command()
 {
-	debug << "sending halt query to backend" << endl;
+	debug("adapter") << "sending halt query to backend" << endl;
 	for(set<Agent>::iterator i = agents_.begin(); i != agents_.end(); i++) {
 		i->halt_command();
 	}
@@ -358,9 +362,9 @@
 void GalaxyRobots::search_or_explore(const char* query, const Gal_Frame& inframe)
 {
 	if(!strcmp(query, "search_command")) {
-		debug << "sending search command to backend" << endl;
+		debug("adapter") << "sending search command to backend" << endl;
 	} else {
-		debug << "sending explore command to backend" << endl;
+		debug("adapter") << "sending explore command to backend" << endl;
 	}
 	geometry::Polygon<float> polygon;
 	ostringstream search;
@@ -389,7 +393,7 @@
 
 void GalaxyRobots::cancel_task(const Gal_Frame& inframe)
 {
-	debug << "sending cancel task to backend" << endl;
+	debug("adapter") << "sending cancel task to backend" << endl;
 	const char* s = Gal_GetString(inframe, ":taskid");
 	if(!s) {
 		error << "no taskid for cancel command" << endl;
@@ -413,13 +417,13 @@
 		return;
 	}
 
-	debug << "query is " << query << endl;
+	debug("adapter") << "query is " << query << endl;
 	if(!robot) {
 		error << "there is no robot" << endl;
 		return;
 	}
 
-	debug << "robot is " << robot << endl;
+	debug("adapter") << "robot is " << robot << endl;
 	Agent* agent = find(robot);
 	if(!agent) {
 		error << "cannot find client for robot: " << robot << endl;
@@ -445,6 +449,10 @@
 		agent->set_pose_command(inframe);
 	else if(!strcmp(query, "cancel_task"))
 		cancel_task(inframe);
+  else if(!strcmp(query, "pause_command"))
+    agent->pause_command();
+  else if(!strcmp(query, "continue_command"))
+    agent->continue_command();
 	else error << "unhandled query: " << query << endl;
 }
 

Modified: trunk/TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-template.pgm
===================================================================
--- trunk/TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-template.pgm	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-template.pgm	2007-10-21 17:24:26 UTC (rev 855)
@@ -12,14 +12,6 @@
 ;; -------------------------------------------------
 
 ;; -------------------------------------------------
-;; The tty-sphinx server handles keyboard input
-;; -------------------------------------------------
-
-;;SERVER: tty-sphinx at localhost:11001
-;;OPERATIONS: speak process_parse
-;;INIT: :greeting "Welcome to the %%DialogManager%%!"
-
-;; -------------------------------------------------
 ;; The sphinx server handles decoding speech
 ;; -------------------------------------------------
 
@@ -178,10 +170,6 @@
 OUT: :parse :input_features
 LOG_OUT: :parse :input_features
 
-;;RULE: :parse --> tty-sphinx.process_parse
-;;IN: :parse :input_features
-;;OUT: 
-
 RULE: :parse --> PenDecoder.process_parse
 IN: :parse :input_features
 OUT: 
@@ -198,13 +186,6 @@
 OUT:
 
 ;; Handle any :speaktext keywords by sending to
-;; tty-sphinx also
-;;RULE: :speaktext --> tty-sphinx.speak
-;;LOG_IN: :tty-phrase
-;;IN: (:tty-phrase :speaktext) :interruptable :id
-;;OUT:
-
-;; Handle any :speaktext keywords by sending to
 ;; PenDecoder also
 RULE: :speaktext --> PenDecoder.speak
 LOG_IN: :tty-phrase
@@ -226,12 +207,8 @@
 
 PROGRAM: robot_message
 
-;;RULE: :goal | --> PenDecoder.speak
-;;IN: :robot_name :speaktext
-;;OUT:
-
 RULE: :type = "location" --> PenDecoder.set_bot
-IN: :robot_name :x :y :r
+IN: :robot_name :x :y :r :error
 OUT: 
 
 RULE: :type = "goal" --> PenDecoder.set_goal

Modified: trunk/TeamTalk/Libraries/PrimitiveComm/robot_client.cpp
===================================================================
--- trunk/TeamTalk/Libraries/PrimitiveComm/robot_client.cpp	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Libraries/PrimitiveComm/robot_client.cpp	2007-10-21 17:24:26 UTC (rev 855)
@@ -30,7 +30,7 @@
 
 bool RobotClient::connect() 
 {
-  debug << "opening " << robot_.loc << ':' << robot_.port << endl;
+  debug("client") << "opening " << robot_.loc << ':' << robot_.port << endl;
   return open(robot_.loc.c_str(), robot_.port) != 0;
 }
 
@@ -54,10 +54,10 @@
 #endif
 { 
   RobotClient* me = (RobotClient*)thisp;
-	debug << "starting trackbots thread" << endl;
+	debug("client") << "starting trackbots thread" << endl;
 	for(int t=0; true; t++) {
 		Sleep(1000);
-		debug << "sending location request" << endl;
+		debug("client") << "sending location request" << endl;
     if(!me->sendReqLocation()) {
       //maybe we're not connected anymore, try to connect
       warn << "we appear to be disconnected...trying to reconnect" << endl;

Modified: trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.cpp
===================================================================
--- trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.cpp	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.cpp	2007-10-21 17:24:26 UTC (rev 855)
@@ -359,6 +359,7 @@
 // MsgCmdPause ********************************************************
 
 //normal instantiation
+MsgCmdPause::MsgCmdPause() : MsgCmd() {}
 MsgCmdPause::MsgCmdPause(int priority, string sender) : MsgCmd(priority, sender) {}
   
 //instantiation from a Boeing packet
@@ -370,13 +371,14 @@
 // MsgCmdResume *******************************************************
 
 //normal instantiation
+MsgCmdResume::MsgCmdResume() : MsgCmd() {}
 MsgCmdResume::MsgCmdResume(int priority, string sender) : MsgCmd(priority, sender) {}
 
 //instantiation from a Boeing packet
 MsgCmdResume::MsgCmdResume(string sender, double tstamp, int priority, int taskID, string action)
 : MsgCmd(sender, tstamp, priority, taskID) {}
 
-string MsgCmdResume::renderBoeingPlayAction() const {return "resum,e";}
+string MsgCmdResume::renderBoeingPlayAction() const {return "resume";}
 
 // MsgCmdFollow *******************************************************
 
@@ -573,7 +575,7 @@
 float MsgRobLocation::getY() const {return loc_.y;}
 float MsgRobLocation::getAngle() const {return angle_;}
 bool MsgRobLocation::isMoving() const {return moving_;}
-short MsgRobLocation::getErrorState() const {return error_state_;}
+int MsgRobLocation::getErrorState() const {return error_state_;}
 
 bool MsgRobLocation::operator==(const MsgRobLocation& x) const {
   return (loc_-x.loc_).length() <= tolerance && 

Modified: trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.h
===================================================================
--- trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.h	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.h	2007-10-21 17:24:26 UTC (rev 855)
@@ -177,6 +177,7 @@
 class MsgCmdPause : public MsgCmd {
 public:
   //normal instantiation
+  MsgCmdPause();
   MsgCmdPause(int priority, string sender=string());
   //instantiation from a Boeing packet
   MsgCmdPause(string sender, double tstamp, int priority, int taskID, string action);
@@ -186,6 +187,7 @@
 class MsgCmdResume : public MsgCmd {
 public:
   //normal instantiation
+  MsgCmdResume();
   MsgCmdResume(int priority, string sender=string());
   //instantiation from a Boeing packet
   MsgCmdResume(string sender, double tstamp, int priority, int taskID, string action);
@@ -289,7 +291,7 @@
   float getY() const;
   float getAngle() const;
   bool isMoving() const;
-  short getErrorState() const;
+  int getErrorState() const;
   bool operator==(const MsgRobLocation& x) const;
   bool operator!=(const MsgRobLocation& x) const;
   string render() const;

Modified: trunk/TeamTalk/Resources/Grammar/GRAMMAR/TeamTalkTask.gra
===================================================================
--- trunk/TeamTalk/Resources/Grammar/GRAMMAR/TeamTalkTask.gra	2007-10-19 17:53:19 UTC (rev 854)
+++ trunk/TeamTalk/Resources/Grammar/GRAMMAR/TeamTalkTask.gra	2007-10-21 17:24:26 UTC (rev 855)
@@ -92,7 +92,7 @@
 
 [HumanHaltCommand]
 	(*[RobotName] all stop)
-	(*[RobotName] stop immediately)
+	(*[RobotName] stop *immediately)
 ;
 
 [Number-180-by5]


More information about the TeamTalk-developers mailing list