[TeamTalk 31]: [568] TeamTalk: changes to support dynamic maps

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Sun Feb 25 09:08:58 EST 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070225/ed7fca44/attachment-0001.html
-------------- next part --------------
Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvas.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvas.java	2007-01-29 23:07:19 UTC (rev 567)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvas.java	2007-02-25 14:08:57 UTC (rev 568)
@@ -163,6 +163,14 @@
     return null;
   }
   
+  public void debugPoint(Point p) {
+      drawingPad.interpreter.print_human(null, null, "clicked on (pixels): " + p.toString() 
+                + " map coord (cm): " + screen_to_map.transform(p, null).toString()
+                + " map dimentions (pixels): (" + image_width_in_pixels + ", " + image_height_in_pixels + ")"
+                + " map dimentions (cm): (" + native_width + ", " + native_height + ")"
+                + " origin (cm): (" + x_origin + ", " + y_origin + ")");
+  }
+  
   // factory method
   protected EventListener makeCanvasListener() {
     return (drawingCanvasListener = new DrawingCanvasListener(this));

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingPad.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingPad.java	2007-01-29 23:07:19 UTC (rev 567)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingPad.java	2007-02-25 14:08:57 UTC (rev 568)
@@ -95,9 +95,9 @@
     imager.repaint();
   }
   
-  public void mapUpdate(int type, int x_dim, int y_dim, int resolution, int[] encoded_map) {
-    canvas.mapUpdate(type, x_dim, y_dim, resolution, encoded_map);
-    if(type == MapBufferedImage.FULL) drawingCanvas.zoomOut();
+  public void mapUpdate(int type, int x_dim, int y_dim, float x_origin, float y_origin, int resolution, int[] encoded_map) {
+    canvas.mapUpdate(type, x_dim, y_dim, x_origin, y_origin, resolution, encoded_map);
+    //if(type == MapBufferedImage.FULL) drawingCanvas.zoomOut();
   }
   
   public void addServer(PenDecoderServer server) {

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java	2007-01-29 23:07:19 UTC (rev 567)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java	2007-02-25 14:08:57 UTC (rev 568)
@@ -200,14 +200,16 @@
     String type = (String)f.getProperty(":type");
     int x_dim = ((Integer)f.getProperty(":x_size")).intValue();
     int y_dim = ((Integer)f.getProperty(":y_size")).intValue();
+    float x_origin = ((Float)f.getProperty(":x_origin")).floatValue();
+    float y_origin = ((Float)f.getProperty(":y_origin")).floatValue();
     int resolution = ((Integer)f.getProperty(":resolution")).intValue();
     int compressed_map[] = f.getInt32(":encoded_map").getIntArray();
     if(type.equals(new String("full"))) {
       System.err.println("got a full map");
-      frame.mapUpdate(MapBufferedImage.FULL, x_dim, y_dim, resolution, compressed_map);
+      frame.mapUpdate(MapBufferedImage.FULL, x_dim, y_dim, x_origin, y_origin, resolution, compressed_map);
     } else if(type.equals(new String("diff"))) {
       System.err.println("got a diff map");
-      frame.mapUpdate(MapBufferedImage.DIFF, x_dim, y_dim, resolution, compressed_map);
+      frame.mapUpdate(MapBufferedImage.DIFF, x_dim, y_dim, x_origin, y_origin, resolution, compressed_map);
     } else {
       System.err.println("got unknow update type: " + type);
     }

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PointTool.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PointTool.java	2007-01-29 23:07:19 UTC (rev 567)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PointTool.java	2007-02-25 14:08:57 UTC (rev 568)
@@ -25,6 +25,8 @@
         String name = canvas.selectObj(p);
         if(name != null) {
           canvas.saySelectBot(name);
+        } else {
+          canvas.debugPoint(p);
         }
         break;
       case ZOOMIN: 

Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/scribble3/ScribbleCanvas.java
===================================================================
--- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/scribble3/ScribbleCanvas.java	2007-01-29 23:07:19 UTC (rev 567)
+++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/scribble3/ScribbleCanvas.java	2007-02-25 14:08:57 UTC (rev 568)
@@ -50,6 +50,11 @@
   protected float native_width, native_height;
   
   /**
+   * A vector from the upper left corner of the map to the world origin (in centimeters)
+   */
+  protected float x_origin, y_origin;
+  
+  /**
    * The width and height of the actual map image (in pixels)
    */
   protected float image_width_in_pixels, image_height_in_pixels;
@@ -156,7 +161,7 @@
     backImage = new MapBufferedImage(bi);
   }
   
-  public void mapUpdate(int type, int x_dim, int y_dim, int resolution, int[] encoded_map) {
+  public void mapUpdate(int type, int x_dim, int y_dim, float x_origin, float y_origin, int resolution, int[] encoded_map) {
     byte[] decoded_map = new byte[x_dim*y_dim];
     decodeMap(decoded_map, x_dim, y_dim, encoded_map);
     /*
@@ -169,6 +174,8 @@
       backImage = MapBufferedImage.createMapBufferedImage(x_dim, y_dim);
       native_width = x_dim*resolution;
       native_height = y_dim*resolution;
+      this.x_origin = x_origin*100;
+      this.y_origin = y_origin*100;
       image_width_in_pixels = x_dim;
       image_height_in_pixels = y_dim;
       backImage.setFullMap(decoded_map);
@@ -386,8 +393,10 @@
   public void setPreferredSize(Dimension d) {
     view_size = d;
     map_to_screen.setToScale(view_size.width/native_width,
-                             -view_size.height/native_height);
-    map_to_screen.translate(native_width/2, -native_height/2);
+                             //-view_size.height/native_height);
+                             view_size.height/native_height);
+    //map_to_screen.translate(native_width/2, -native_height/2);
+    map_to_screen.translate(-x_origin, -y_origin);
     try {
       screen_to_map = map_to_screen.createInverse();
     } catch (NoninvertibleTransformException e) {

Modified: TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp
===================================================================
--- TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp	2007-01-29 23:07:19 UTC (rev 567)
+++ TeamTalk/Agents/TeamTalkBackend/robot-galaxy_adapter.cpp	2007-02-25 14:08:57 UTC (rev 568)
@@ -178,6 +178,8 @@
 		}
 		Gal_SetProp(f, ":x_size", Gal_IntObject(msg->map.x));
 		Gal_SetProp(f, ":y_size", Gal_IntObject(msg->map.y));
+    Gal_SetProp(f, ":x_origin", Gal_FloatObject(msg->map.x_origin));
+		Gal_SetProp(f, ":y_origin", Gal_FloatObject(msg->map.y_origin));
 		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];

Modified: TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc	2007-01-29 23:07:19 UTC (rev 567)
+++ TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc	2007-02-25 14:08:57 UTC (rev 568)
@@ -11,7 +11,7 @@
 			   int x_in, int y_in,
 			   int resolution_in) {
   MsgMapFactory(encoding, buf, raw_map, raw_map_size, invoice, seq, x_in, y_in,
-		x_in*resolution_in/100.0/2, y_in*resolution_in/100.0/2,
+		x_in*resolution_in/100.0F/2, y_in*resolution_in/100.0F/2,
 		resolution_in);
 }
 

Modified: TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-skeleton.pgm
===================================================================
--- TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-skeleton.pgm	2007-01-29 23:07:19 UTC (rev 567)
+++ TeamTalk/Configurations/DesktopConfiguration/TeamTalk-hub-desktop-skeleton.pgm	2007-02-25 14:08:57 UTC (rev 568)
@@ -170,7 +170,7 @@
 
 PROGRAM: map_message
 RULE: --> PenDecoder.map_update
-IN: :type :x_size :y_size :resolution :encoded_map
+IN: :type :x_size :y_size :x_origin :y_origin :resolution :encoded_map
 OUT:
 
 PROGRAM: trader_message


More information about the TeamTalk-developers mailing list