[TeamTalk 29]: [566] TeamTalk/Agents/boeingLib/boeing: Added changes to support dynamic map origins, effectivly suppoting dynamic map

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Mon Jan 29 17:27:41 EST 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070129/682c8136/attachment.html
-------------- next part --------------
Modified: TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc	2006-12-21 06:16:02 UTC (rev 565)
+++ TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc	2007-01-29 22:27:40 UTC (rev 566)
@@ -6,14 +6,26 @@
 using namespace std;
 
 void MsgMap::MsgMapFactory(MapMsgEncoding encoding, 
-			      MsgMap *buf, const unsigned char* raw_map, int raw_map_size,
-            short invoice, int seq,
-			      int x_in, int y_in, int resolution_in) {
+			   MsgMap *buf, const void* raw_map, int raw_map_size,
+			   short invoice, int seq,
+			   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,
+		resolution_in);
+}
+
+void MsgMap::MsgMapFactory(MapMsgEncoding encoding, 
+			   MsgMap *buf, const void* raw_map, int raw_map_size,
+			   short invoice, int seq,
+			   int x_in, int y_in, float x_o, float y_o,
+			   int resolution_in) {
   buf->invoice = invoice; buf->seq = seq;
   buf->x = x_in; buf->y = y_in;
+  buf->x_origin = x_o; buf->y_origin = y_o;
   buf->resolution = resolution_in;
   unsigned char *msgMapData = ((unsigned char*)buf)+sizeof(MsgMap)-sizeof(int);
-  buf->array_length = encodeMap(encoding, msgMapData, raw_map, raw_map_size);
+  buf->array_length = encodeMap(encoding, msgMapData, (const unsigned char*) raw_map, raw_map_size);
   buf->encoding = encoding;
 }
 

Modified: TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.h
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.h	2006-12-21 06:16:02 UTC (rev 565)
+++ TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.h	2007-01-29 22:27:40 UTC (rev 566)
@@ -74,19 +74,33 @@
     short invoice;
     short encoding;
     int seq;
-    int resolution; //cell size in pixels
+    int resolution; //cell size in centimenters
     int x, y; //# of cells in x and y dimention
+    float x_origin, y_origin; //vector to the origin from map's ul corner (in meters)
     int array_length; //size of compressed map array
     int map[1];
 
     static const int MAX_RUNLENGTH = 1<<23;
 
     //puts a MsgMap into the buf
+    //interpretation of raw_map cell chars
+    //   0x00 -> unchanged
+    //   0x20 -> clear
+    //   0x40 -> unseen/unknown
+    //   0xff -> occupied
+    //raw map is interpreted to be left-handed and height-major
     static void MsgMapFactory(MapMsgEncoding encodingType, 
-			      MsgMap *buf, const unsigned char* raw_map, int raw_map_size,
+			      MsgMap *buf, const void* raw_map, int raw_map_size,
 			      short invoice, int seq, 
-            int x_in, int y_in, int resolution_in = 10);
+			      int x_in, int y_in, float x_o, float y_o,
+			      int resolution_in = 10);
 
+    static void MsgMapFactory(MapMsgEncoding encodingType, 
+			      MsgMap *buf, const void* raw_map, int raw_map_size,
+			      short invoice, int seq, 
+			      int x_in, int y_in,
+			      int resolution_in = 10);
+
     int getSize() const; //returns actual size of struct given the array_length (in bytes)
     int getBuffSize() const; //returns the minimum size of the required decode buf (in bytes)
 


More information about the TeamTalk-developers mailing list