[TeamTalk 320]: [856] trunk/TeamTalk: 1) Bot uncertainty on the PenDecoder is now controlled through API calls rather than computed internally .

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Sun Oct 21 23:45:43 EDT 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071021/8d695725/attachment-0001.html
-------------- next part --------------
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-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java	2007-10-22 03:45:42 UTC (rev 856)
@@ -24,7 +24,8 @@
   /**
    * this is the iconification of the uncertainty ring, placed on the map
    */
-  protected java.awt.Shape placedUncertaintyRing;
+  protected java.awt.Shape placedUncertaintyRing = new java.awt.geom.Ellipse2D.Float();
+  protected java.awt.Shape uncertaintyRing = new java.awt.geom.Ellipse2D.Float();
   
   /**
    * the current transparency value for the bot
@@ -59,9 +60,11 @@
   protected TaskStatus goal_status;
   
   /**
-   * certainly boolean
+   * certainly range is the radius of a circle that we are certain the bot is inside
+   * (in centimeters)
    */
-  protected boolean certainty = true;
+  protected int certainty_range = 0;
+  protected static final int certainty_threshold = 50;
   
   /**
    * last known good position and orientation of robot (in centimeters and radians)
@@ -70,16 +73,6 @@
    */
   protected float lkgx, lkgy, lkgr;
   
-  /**
-   * amount of turning since last placement (in radians)
-   */
-  protected float odometry_turns;
-  
-  /**
-   * distance traveled since last placement (in centimeters)
-   */
-  protected float odometry_distance;
-  
   protected static Color unselected_color = Color.RED;
   protected static Color selected_color = Color.YELLOW;
   protected static Color failed_color = Color.WHITE;
@@ -142,10 +135,8 @@
     placedDot = move.createTransformedShape(dot);
     
     //reset the placed uncertainty ring
-    odometry_distance = 0F;
-    odometry_turns = 0F;
     alpha = 1F;
-    java.awt.Shape uncertaintyRing = new java.awt.geom.Ellipse2D.Float();
+    uncertaintyRing = new java.awt.geom.Ellipse2D.Float();
     placedUncertaintyRing = move.createTransformedShape(uncertaintyRing);
     
     //reset goal
@@ -156,13 +147,19 @@
   }
   
   /**
-   * set certainty
+   * set certainty (in centimeters)
    */
-  public boolean setCertainty(boolean certainty) {
-      if(!certainty) System.err.println("uncertain robot location");
-      boolean what_was = certainty;
-      certainty = this.certainty;
-      return what_was;
+  public void setCertainty(int certainty) {
+    if(certainty > certainty_threshold)
+      System.err.println("uncertain robot location");
+    certainty_range = certainty;
+    java.awt.Shape uncertaintyRing =
+            new java.awt.geom.Ellipse2D.Float(-certainty_range,-certainty_range,
+            certainty_range, certainty_range);
+    
+    //set transparency of the bot and label based on the placement confidence
+    alpha = certainty_range > 1000? 0: 1F-certainty_range/1000F;
+    composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha);
   }
   
   /**
@@ -198,7 +195,10 @@
     }
     
     //draw uncertainty ring
-    //g.draw(placedUncertaintyRing);
+    if(certainty_range > certainty_threshold) {
+      System.err.println("drawing uncertainty ring, size: " + certainty_range);
+      g.draw(placedUncertaintyRing);      
+    }
 
     //set composite
     Composite originalComposite = g.getComposite();
@@ -220,7 +220,8 @@
         } else {
             g.setColor(unselected_color);
         }
-        if(!certainty) g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5F));
+        if(certainty_range > certainty_threshold) 
+          g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5F));
         g.fill(arrow);
     }
     
@@ -245,7 +246,7 @@
     myG.scale(at.getScaleX(), at.getScaleY()); //recover screen's scale, i.e. don't zoom text
     
     //draw the label background
-    if(!certainty) myG.setFont(uncertainFont);
+    if(certainty_range > certainty_threshold) myG.setFont(uncertainFont);
     Rectangle2D labelBackground = myG.getFontMetrics().getStringBounds(name, myG);
     myG.setColor(labelBackgroundColor);
     myG.fill(labelBackground);
@@ -292,37 +293,18 @@
    */
   public void setLocation(float x, float y, float rad) {
     if(this.x != x || this.y != y || this.rad != rad) {
-      odometry_distance += Math.sqrt((x-this.x)*(x-this.x)+(y-this.y)*(y-this.y));
-      odometry_turns += Math.abs(arcDiff(this.rad, rad));
 
       //set new x and y and place icon
       this.x = x; this.y = y; this.rad = rad;
-      if(alpha > 0.01) {
+      AffineTransform move = new AffineTransform(placement);
+      if(certainty_range <= certainty_threshold) {
         lkgx = x; lkgy = y; lkgr = rad;
       }
-      AffineTransform move = new AffineTransform(placement);
       move.translate(lkgx,lkgy);
       move.rotate(lkgr);
       placedIcon = move.createTransformedShape(icon);
       placedDot = move.createTransformedShape(dot);
-      
-      //model placement confidence at a ring around the bot
-      float turn_uncertainty = odometry_turns/5000;
-      float distance_uncertainty;
-      if(turn_uncertainty >= (float)Math.PI) {
-        distance_uncertainty = Float.MAX_VALUE;
-      } else {
-        distance_uncertainty = 2*odometry_distance*(float)Math.tan(turn_uncertainty/2);
-      }
-      java.awt.Shape uncertaintyRing = 
-              new java.awt.geom.Ellipse2D.Float(
-              -(int)distance_uncertainty,-(int)distance_uncertainty, 
-              (int)(distance_uncertainty*2), (int)(distance_uncertainty*2));
       placedUncertaintyRing = move.createTransformedShape(uncertaintyRing);
-
-      //set transparency of the bot and label based on the placement confidence
-      alpha = distance_uncertainty > 1000? 0: 1F-distance_uncertainty/1000F;
-      composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha);
     }
   }
   

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-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java	2007-10-22 03:45:42 UTC (rev 856)
@@ -6,6 +6,7 @@
 public class BotTracker {
   protected MapCanvas canvas;
   protected final static int size = 3;
+  protected static int treasureNum = 0;
   
   protected HashMap<String, Shape> bots = new HashMap<String, Shape>();
   protected HashMap<Shape, String> names = new HashMap<Shape, String>();
@@ -17,13 +18,16 @@
   public boolean setObject(String name, float x, float y) {
     name.toUpperCase(); //names are always case insensitive
     boolean obj_created = false;
+    //name is a class, assume for now that each update is a new instance of that
+    //class 
+    name += treasureNum++;
     ObjShape obj = getObj(name);
     obj.setLocation(x, y);
     canvas.repaint();
     return obj_created;
   }
  
-  public boolean setBot(String name, float x, float y, float r, boolean certainty) {
+  public boolean setBot(String name, float x, float y, float r, int certainty) {
     name.toUpperCase(); //names are always case insensitive
     boolean bot_created = false;
     BotShape bot = getBot(name);

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-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderDisplay.java	2007-10-22 03:45:42 UTC (rev 856)
@@ -347,30 +347,28 @@
      */
     protected ToolKit createToolkit() {
         ToolKit t = new ToolKit();
+        
+        //stopping control
+        t.addTool(new ButtonTool(mapCanvas, "E-STOP", "Emergency Stop"));
+        t.addTool(new ButtonTool(mapCanvas, "Cancel Task", "Cancel the last task."));
         t.addTool(new ToggleButtonTool(mapCanvas,
-                "Start Session",
-                "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"));
+        
+        //select
         t.addTool(new PointTool(mapCanvas,
                 "Select",
                 "Click on a robot to select it.",
                 PointTool.POINT));
+        
+        //reposition
         t.addTool(new PlacementTool(mapCanvas,
                 "Re-position",
                 "Click to reposition the selected robot. Drag to orient it at the new position."));
-        t.addTool(new PointTool(mapCanvas,
-                "Zoom In",
-                "Click to zoom into a point on the map.",
-                PointTool.ZOOMIN));
-        t.addTool(new ButtonTool(mapCanvas, "Zoom Out", "Zoom out to see the entire map."));
-        t.addTool(new ButtonTool(mapCanvas, "Cancel Task", "Cancel the last task."));
+        
+        //issue commands
         t.addTool(new NPointTool(mapCanvas,
                 "Search",
                 "Select waypoints along which to search.",
@@ -379,6 +377,18 @@
                 "Explore",
                 "Select waypoints along which to explore.",
                 NPointTool.POLYLINE_EXPLORE));
+        
+        //manage session and gui
+        t.addTool(new ToggleButtonTool(mapCanvas,
+                "Start Session",
+                "Click to start speaking",
+                "Stop Session",
+                "Click to mute"));
+        t.addTool(new PointTool(mapCanvas,
+                "Zoom In",
+                "Click to zoom into a point on the map.",
+                PointTool.ZOOMIN));
+        t.addTool(new ButtonTool(mapCanvas, "Zoom Out", "Zoom out to see the entire map."));
         t.addTool(new ButtonTool(mapCanvas, "Undock", "Click to undock application components."));
         return t;
     }

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-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java	2007-10-22 03:45:42 UTC (rev 856)
@@ -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, true);
+      botTracker.setBot(botName, 0, 0, 0, 0);
     }
   }
   
@@ -53,8 +53,8 @@
     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, (error==0));
+    if(error == 0) botTracker.setBot(name, x, y, r, 0);
+    else botTracker.setBot(name, x, y, r, 100);
     return (GFrame) null;
   }
   

Modified: trunk/TeamTalk/Agents/TeamTalkBackend/agent.cpp
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkBackend/agent.cpp	2007-10-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/TeamTalkBackend/agent.cpp	2007-10-22 03:45:42 UTC (rev 856)
@@ -49,7 +49,7 @@
 	string cfilename = writeSpecializedConfig("helios", "cfg", subs, uppername);
 
   ostringstream cmd, title;
-  cmd << HELIOS << " -port " << iHeliosPort << " -config " << cfilename;
+  cmd << HELIOS << " -maxconns 6 -port " << iHeliosPort << " -config " << cfilename;
   title << uppername << " Helios";
   debug("agent") << "sending to pythia: " << cmd.str() << endl;
   Pythia::Message(cmd.str(), title.str()).send("localhost");
@@ -256,6 +256,8 @@
   const MsgRobLocation *rloc = dynamic_cast<const MsgRobLocation*>(m);
 	if(rloc != NULL) {
 		if(location_ == *rloc) return;
+    if(location_.getErrorState() != rloc->getErrorState()) 
+      SendErrorStatusToDM(rloc->getErrorState());
 		location_ = *rloc;
 	}
   const MsgCmdGoTo *move = dynamic_cast<const MsgCmdGoTo*>(m);
@@ -264,7 +266,7 @@
   if(done != NULL) {
     vector<MsgCmd*>::iterator i = findMsgById(done->getTaskID());
     if(i == commitments_.end()) {
-      error << "Can't fine msg with taskid: " << done->getTaskID() << endl;
+      error("agent") << "Can't fine msg with taskid: " << done->getTaskID() << endl;
       return;
     } else {
       (*i)->setStatus(done);
@@ -383,6 +385,12 @@
   free(pgoNets);
 }
 
+void Agent::SendErrorStatusToDM(int error) const {
+  string error_report = (error? "I am experiencing an error condition. Please help.": 
+    "All systems are OK.");
+  SendMessageToDM("ERROR", error_report);
+}
+
 void Agent::SendMoveStatusToDM(const MsgCmdGoTo* move) const {
   ostringstream move_report;
   if(move->useAngle()) {
@@ -463,7 +471,7 @@
 	string s_units(Gal_GetString(inframe, ":units"));
 	string s_direction(Gal_GetString(inframe, ":direction"));
 	if(!(s_distance.empty() && s_direction.empty())) {
-		error << "distance or direction missing" << endl;
+		error("agent") << "distance or direction missing" << endl;
 	} else {
 		Point<float> vec(static_cast<float>(GetNumber999(s_distance)), 0);
 		if(!s_distance.empty()) {
@@ -501,7 +509,7 @@
 #endif
 				delete go;
 			} else
-				error << "unknown direction " << s_direction << endl;
+				error("agent") << "unknown direction " << s_direction << endl;
 		}
 	}
 } 
@@ -519,7 +527,7 @@
 	if (Gal_GetString(inframe, ":units"))
 		s_units = Gal_GetString(inframe, ":units");
 	if(s_distance.empty() || s_direction.empty()) {
-		error << "distance or direction missing" << endl;
+		error("agent") << "distance or direction missing" << endl;
 	} else {
 		if(!s_distance.empty()) {
 			Point<float> vec(static_cast<float>(GetNumber999(s_distance)), 0);
@@ -555,7 +563,7 @@
 #endif
 				delete go;
 			} else
-				error << "unknown direction " << s_direction << endl;
+				error("agent") << "unknown direction " << s_direction << endl;
 		}
 	}
 } 
@@ -575,7 +583,7 @@
 	debug << "sending follow command to backend" << endl;
 	string followee = Gal_GetString(inframe, ":followee");
 	if(followee.empty()) {
-		error << "no followee" << endl;
+		error("agent") << "no followee" << endl;
 	} else {
 		MsgCmdFollow follow;
 #ifdef USE_TXT_COMMANDS
@@ -597,22 +605,22 @@
       robotClient_->sendHome(home.getPriority(), home.getTaskID());
 			//p_client->sendPacket(robot, MsgCmdHome());
 		} else if(sRelDist == "2") {
-			error << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
+			error("agent") << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
 			return;
 		} else if(sRelDist == "3") {
-			error << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
+			error("agent") << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
 			return;
 		} else if(sRelDist == "4") {
-			error << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
+			error("agent") << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
 			return;
 		} else if(sRelDist == "5") {
-			error << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
+			error("agent") << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
 			return;
 		} else if(sRelDist == "6") {
-			error << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
+			error("agent") << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
 			return;
 		} else {
-			error << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
+			error("agent") << "relative to goal '" << sRelDist << '\'' << " not understood" << endl;
 			return;
 		}
 	} else {
@@ -700,7 +708,7 @@
 			bRel = true;
 			fRad = PI;
 	} else {
-		error << "unknown direction " << sDirection << endl;
+		error("agent") << "unknown direction " << sDirection << endl;
 		return;
 	}
 	MsgCmdGoTo turn((float)fRad);
@@ -720,15 +728,15 @@
 	const char* y = Gal_GetString(inframe, ":y");
 	const char* a = Gal_GetString(inframe, ":angle");
   if(!x) {
-    error << "x is null" << endl;
+    error("agent") << "x is null" << endl;
     return;
   }
   if(!y) {
-    error << "y is null" << endl;
+    error("agent") << "y is null" << endl;
     return;
   }
   if(!a) {
-    error << "angle is null" << endl;
+    error("agent") << "angle is null" << endl;
     return;
   }
 	MsgCmdSetPos set_pos((float)atof(x), (float)atof(y), (float)atof(a));

Modified: trunk/TeamTalk/Agents/TeamTalkBackend/agent.h
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkBackend/agent.h	2007-10-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/TeamTalkBackend/agent.h	2007-10-22 03:45:42 UTC (rev 856)
@@ -71,6 +71,7 @@
                        const map<string, string>& sMessages) const;
 
   void SendMoveStatusToDM(const MsgCmdGoTo* move) const;
+  void SendErrorStatusToDM(int error) const;
 
   //processing incoming TeamTalk messages
   void processMessage(const Msg* m);

Modified: trunk/TeamTalk/Agents/TeamTalkBackend/gal_be.cpp
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkBackend/gal_be.cpp	2007-10-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/TeamTalkBackend/gal_be.cpp	2007-10-22 03:45:42 UTC (rev 856)
@@ -94,7 +94,7 @@
 Gal_Frame reinitialize(Gal_Frame f, void *server_data)
 {
 	const char *user_id = Gal_GetString(f, ":user_id");
-	if(!user_id) error << "no user_id" << endl;
+	if(!user_id) error("gal_be") << "no user_id" << endl;
   else if(!strcmp(user_id, "TeamTalk")) {
     debug("gal_be") << "reinit: setting skeleton comm" << endl;
     galaxyRobots->setSkeletonComm(GalSS_EnvComm((GalSS_Environment*)server_data));
@@ -114,14 +114,14 @@
 
 	aStr = Gal_GetObject(f, ":inframe");
 	if (!aStr) {
-		error << "couldn't get string value of :inframe" << endl;
+		error("gal_be") << "couldn't get string value of :inframe" << endl;
 		return f;
 	}
 
   debug("gal_be") << "frame: " << f << endl;
 	char* s_inframe = Gal_StringValue(aStr);
 	if(!s_inframe) {
-		error << "couldn't get string value for inframe" << endl;
+		error("gal_be") << "couldn't get string value for inframe" << endl;
 		return f;
 	}
 
@@ -143,7 +143,7 @@
 	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;
+		error("gal_be") << "couldn't find :inframe" << endl;
 		return f;
 	}
 

Modified: trunk/TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp	2007-10-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp	2007-10-22 03:45:42 UTC (rev 856)
@@ -42,14 +42,14 @@
 				ignoreToEndOfLine(Frobotips);
 				info << "adding robot@" << rip << ':' << port << ' ' << voice << ' ' << safeness << endl;
 				if(!r_client->addRobot(rname, rip, voice, safeness, port, this)) {
-					error << "couldn't add " << rname << endl;
+					error("adapter") << "couldn't add " << rname << endl;
 				} else {
 					names.push_back(rname);
 				}
 			}
 		} catch(TeamTalk::RobotClientException e) {
-			error << "unable to add robot " << rname << '(' << rip << ')' << endl;
-			error << e.what() << endl;
+      error("adapter") << "unable to add robot " << rname << '(' << rip << ')' << endl;
+			error("adapter") << e.what() << endl;
 		}
 	}
 	return names;
@@ -96,7 +96,7 @@
 				ip = token;
 				input >> token;
 				if(token != "object") {
-					error << "was expecting 'object'" << endl;
+					error("adapter") << "was expecting 'object'" << endl;
 					continue;
 				}
 			}
@@ -105,13 +105,13 @@
 			input >> token;
 			debug("adapter") << "got info token " << token << endl;
 			if(token != "at") {
-				error << "was expecting 'at'" << endl;
+				error("adapter") << "was expecting 'at'" << endl;
 				continue;
 			}
 			input >> token;
 			debug("adapter") << "got info token " << token << endl;
 			if(token.empty() || token.at(0) != '(') {
-				error << "was expecting (..." << endl;
+				error("adapter") << "was expecting (..." << endl;
 				continue;
 			}
 			if(token == "(") {
@@ -129,7 +129,7 @@
 			input >> token;
 			debug("adapter") << "got info token " << token << endl;
 			if(token.empty()) {
-				error << "was expecting ...)" << endl;
+				error("adapter") << "was expecting ...)" << endl;
 				continue;
 			} else if(token.at(token.length()-1) != ')') {
 				token.resize(token.length()-1);
@@ -177,7 +177,7 @@
 				Gal_SetProp(f, ":type", Gal_StringObject("diff"));
 				break;
 			default: 
-				error << "unknown message type '" << msg->hdr.type << "' in maplistener" << endl;
+				error("adapter") << "unknown message type '" << msg->hdr.type << "' in maplistener" << endl;
 				Gal_FreeFrame(f);
 				continue;
 		}
@@ -189,7 +189,7 @@
 				Gal_SetProp(f, ":order", Gal_StringObject("X_MAJOR"));
 				break;
 			default:
-				error << "unhandled order: " << msg->map.encoding << endl;
+				error("adapter") << "unhandled order: " << msg->map.encoding << endl;
 				Gal_FreeFrame(f);
 				continue;
 		}
@@ -239,7 +239,7 @@
 			GalIO_CommWriteFrame(skeleton_comm_, f, GAL_FALSE);
 			return;
 		}
-		error << "skeleton unavailable" << endl;
+		error("adapter") << "skeleton unavailable" << endl;
 		Sleep(1000);
 	}
 };
@@ -326,7 +326,7 @@
 void GalaxyRobots::addRobot(const string& name, GalIO_CommStruct* comm) 
 {
 	TeamTalk::RobotClient *robotClient = r_client->find(name);
-	if(!robotClient) error << "Couldn't find robotclient for: " << name << endl;
+	if(!robotClient) error("adapter") << "Couldn't find robotclient for: " << name << endl;
 	else agents_.insert(Agent(robotClient, comm));
 }
 
@@ -334,11 +334,10 @@
 {
 	Agent* agent = find(m->getSender());
 	if(agent == NULL) {
-		error << "agent not found for: " << m->getSender() << endl;
-		error << "agents are: ";
+		error("adapter") << "agent not found for: " << m->getSender() << endl;
+		error("adapter") << "agents are: ";
 		for(set<Agent>::const_iterator i = agents_.begin(); i != agents_.end(); i++)
-			error << '"' << i->getName() << "\" ";
-		error << endl;
+			error("adapter") << '"' << i->getName() << "\" " << endl;
 		return;
 	}
 	agent->processMessage(m);
@@ -396,13 +395,13 @@
 	debug("adapter") << "sending cancel task to backend" << endl;
 	const char* s = Gal_GetString(inframe, ":taskid");
 	if(!s) {
-		error << "no taskid for cancel command" << endl;
+		error("adapter") << "no taskid for cancel command" << endl;
 		return;
 	}
 	istringstream in(s);
 	int taskid;
 	if((in >> taskid).fail()) {
-		error << "couldn't parse taskid: " << s << endl;
+		error("adapter") << "couldn't parse taskid: " << s << endl;
 		return;
 	}
 	t_client->sendCancel(taskid);
@@ -413,20 +412,20 @@
 	char* query = Gal_GetString(inframe, ":query");
 	char* robot = Gal_GetString(inframe, ":robot_name");
 	if(!query) {
-		error << "there is no query" << endl;
+		error("adapter") << "there is no query" << endl;
 		return;
 	}
 
 	debug("adapter") << "query is " << query << endl;
 	if(!robot) {
-		error << "there is no robot" << endl;
+		error("adapter") << "there is no robot" << endl;
 		return;
 	}
 
 	debug("adapter") << "robot is " << robot << endl;
 	Agent* agent = find(robot);
 	if(!agent) {
-		error << "cannot find client for robot: " << robot << endl;
+		error("adapter") << "cannot find client for robot: " << robot << endl;
 		return;
 	}
 	if(!strcmp(query, "location_query")) 
@@ -453,7 +452,7 @@
     agent->pause_command();
   else if(!strcmp(query, "continue_command"))
     agent->continue_command();
-	else error << "unhandled query: " << query << endl;
+	else error("adapter") << "unhandled query: " << query << endl;
 }
 
 Agent* GalaxyRobots::find(const string& name) {

Modified: trunk/TeamTalk/Agents/TeamTalkDM/TeamTalkDialogTask.cpp
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkDM/TeamTalkDialogTask.cpp	2007-10-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/TeamTalkDM/TeamTalkDialogTask.cpp	2007-10-22 03:45:42 UTC (rev 856)
@@ -308,6 +308,7 @@
 		BOOL_USER_CONCEPT(report_location_command_issued, "")
 		STRING_SYSTEM_CONCEPT(location_report)
     STRING_SYSTEM_CONCEPT(move_report)
+    STRING_SYSTEM_CONCEPT(error_report)
 		BOOL_USER_CONCEPT(move_cardinal_command_issued, "")
 		BOOL_USER_CONCEPT(move_relative_command_issued, "")
 		BOOL_USER_CONCEPT(move_to_goal_command_issued, "")
@@ -333,6 +334,7 @@
     SUBAGENT(Explore, CExplore, "")
 		SUBAGENT(CommandMoveRelative, CCommandMoveRelative, "")
     SUBAGENT(ReportMove, CReportMove, "")
+    SUBAGENT(ReportError, CReportError, "")
 		SUBAGENT(Halt, CHalt, "")
 		SUBAGENT(Follow, CFollow, "")
 		SUBAGENT(Pause, CPause, "")
@@ -340,6 +342,7 @@
 		SUBAGENT(Turn, CTurn, "")
     SUBAGENT(SetPose, CSetPose, "")
     SUBAGENT(CancelTask, CCancelTask, "")
+    //SUBAGENT(RetrieveTreasure, CRetrieveTreasure, "")
 		SUBAGENT(ExpectCancel, CExpectCancel, "")
 		SUBAGENT(AllDoneDummy, CAllDoneDummy, "")
 	)
@@ -606,6 +609,37 @@
 )
 
 //-----------------------------------------------------------------------------
+// /TeamTalk/Task/ReportError
+//-----------------------------------------------------------------------------
+DEFINE_AGENCY(CReportError,
+	PRECONDITION(UPDATED(error_report) &&
+	  (*C("current_addressee").CreateMergedHistoryConcept() == C("robot_name") ||
+		 *C("current_addressee").CreateMergedHistoryConcept() == C("everyone")))
+	DEFINE_SUBAGENTS(
+		SUBAGENT(ExpectReportError, CExpectReportError, "")
+		SUBAGENT(InformError, CInformError, "")
+	)
+)
+
+//-----------------------------------------------------------------------------
+// /TeamTalk/Task/ReportError/ExpectReportError
+//-----------------------------------------------------------------------------
+DEFINE_EXPECT_AGENT(CExpectReportError,
+	EXPECT_CONCEPT(error_report)
+	EXPECT_WHEN(
+ 		(*C("current_addressee").CreateMergedHistoryConcept() == C("robot_name") ||
+		 *C("current_addressee").CreateMergedHistoryConcept() == C("everyone")))
+	GRAMMAR_MAPPING("[RobotMessage.Error]")
+)
+
+//-----------------------------------------------------------------------------
+// /TeamTalk/Task/ReportError/InformError
+//-----------------------------------------------------------------------------
+DEFINE_INFORM_AGENT(CInformError,
+	PROMPT("inform report_error_status <robot_name <error_report")
+)
+
+//-----------------------------------------------------------------------------
 // /TeamTalk/Task/Move/InformReaction2Move
 //-----------------------------------------------------------------------------
 DEFINE_INFORM_AGENT(CInformReaction2Move,
@@ -1649,6 +1683,11 @@
 )
 
 //-----------------------------------------------------------------------------
+// /TeamTalk/RetreieveTreasure
+//-----------------------------------------------------------------------------
+
+
+//-----------------------------------------------------------------------------
 // /TeamTalk/Task/AllDoneDummy
 //-----------------------------------------------------------------------------
 DEFINE_EXECUTE_AGENT( CAllDoneDummy, 
@@ -2922,6 +2961,9 @@
       DECLARE_AGENT(CReportMove)
         DECLARE_AGENT(CExpectReportMove)
         DECLARE_AGENT(CInformMove)
+			DECLARE_AGENT(CReportError)
+        DECLARE_AGENT(CExpectReportError)
+        DECLARE_AGENT(CInformError)
 			DECLARE_AGENT(CMoveToGoal)
 				DECLARE_AGENT(CExpectMoveToGoalCommand)
 				DECLARE_AGENT(CExpectRelDist)

Modified: trunk/TeamTalk/Agents/TeamTalkNLG/Rosetta/TeamTalk/Inform.pm
===================================================================
--- trunk/TeamTalk/Agents/TeamTalkNLG/Rosetta/TeamTalk/Inform.pm	2007-10-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Agents/TeamTalkNLG/Rosetta/TeamTalk/Inform.pm	2007-10-22 03:45:42 UTC (rev 856)
@@ -125,6 +125,10 @@
     "report_move" => ["This is <robot_name>. <move_report>",
     			  "<robot_name> here. <move_report>"],
 
+    # error report
+    "report_error_status" => ["This is <robot_name>. <error_report>",
+		       "<robot_name> here. <error_report>"],
+
     # verbal reaction to search command
     "report_search" => "I am organizing a search party for the specified area.",
 

Modified: trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.cpp
===================================================================
--- trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.cpp	2007-10-21 17:24:26 UTC (rev 855)
+++ trunk/TeamTalk/Libraries/PrimitiveComm/robot_packet2.cpp	2007-10-22 03:45:42 UTC (rev 856)
@@ -579,12 +579,14 @@
 
 bool MsgRobLocation::operator==(const MsgRobLocation& x) const {
   return (loc_-x.loc_).length() <= tolerance && 
-    abs(angle_ - x.angle_) <= angularTolerance;
+    abs(angle_ - x.angle_) <= angularTolerance &&
+    error_state_ == x.error_state_;
 }
 
 bool MsgRobLocation::operator!=(const MsgRobLocation& x) const {
   return (loc_-x.loc_).length() > tolerance ||
-    abs(angle_ - x.angle_) <= angularTolerance;
+    abs(angle_ - x.angle_) <= angularTolerance ||
+    error_state_ != x.error_state_;
 }
 
 string MsgRobLocation::render() const {


More information about the TeamTalk-developers mailing list