From tk at edam.speech.cs.cmu.edu Mon Jan 29 17:27:41 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Mon, 29 Jan 2007 17:27:41 -0500 Subject: [TeamTalk 29]: [566] TeamTalk/Agents/boeingLib/boeing: Added changes to support dynamic map origins, effectivly suppoting dynamic map Message-ID: <200701292227.l0TMRfum020007@edam.speech.cs.cmu.edu> 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) From tk at edam.speech.cs.cmu.edu Mon Jan 29 18:07:20 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Mon, 29 Jan 2007 18:07:20 -0500 Subject: [TeamTalk 30]: [567] TeamTalk/Agents/boeingLib: update from darcs Message-ID: <200701292307.l0TN7KOR020069@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070129/d5759977/attachment.html -------------- next part -------------- Modified: TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc =================================================================== --- TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc 2007-01-29 22:27:40 UTC (rev 566) +++ TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc 2007-01-29 23:07:19 UTC (rev 567) @@ -170,8 +170,15 @@ if (debug) printf(" Got request image message\n"); result.hdr.type = REQ_IMAGE; - } else { - fprintf(stderr, "Unknown message '%s'\n",mca->action); + } else{ + if (debug) + printf(" Got some message, assume action message: '%s'\n", + mca->action); + result.hdr.type = CMD_ACTION; + + printf("Got some message (assume action) '%s'\n",mca->action); + //} else{ + // fprintf(stderr, "Unknown message '%s'\n",mca->action); } return (result.hdr.type); Modified: TeamTalk/Agents/boeingLib/boeing/boeing_map_server.cc =================================================================== --- TeamTalk/Agents/boeingLib/boeing/boeing_map_server.cc 2007-01-29 22:27:40 UTC (rev 566) +++ TeamTalk/Agents/boeingLib/boeing/boeing_map_server.cc 2007-01-29 23:07:19 UTC (rev 567) @@ -65,16 +65,13 @@ printf("WARNING: mapserver Not connected\n"); return NULL; } - //printf("mapserver connected\n"); // is there anything to get? if (!sock->isConnected() || !sock->readyForRecv()) return (NULL); // receive the header... - //printf("mapserver about to recv\n"); int rv = sock->recv(rxdata.buff,sizeof(rxdata)); - //printf("mapserver got %d bytes\n", rv); if (rv>0 && rv!=rxdata.hdr.len) { printf("WARNING: size mismatch! %i, but packet says %i\n", Modified: TeamTalk/Agents/boeingLib/boeing/boeing_robot_client.cc =================================================================== --- TeamTalk/Agents/boeingLib/boeing/boeing_robot_client.cc 2007-01-29 22:27:40 UTC (rev 566) +++ TeamTalk/Agents/boeingLib/boeing/boeing_robot_client.cc 2007-01-29 23:07:19 UTC (rev 567) @@ -271,7 +271,7 @@ //=== Receiving ====================================== -const MsgRobot* RobotClient::getNextMessage() +MsgRobot const *RobotClient::getNextMessage() { // read your socket if there is something available // process it *NON-BLOCKING* Modified: TeamTalk/Agents/boeingLib/boeing/boeing_robot_server.cc =================================================================== --- TeamTalk/Agents/boeingLib/boeing/boeing_robot_server.cc 2007-01-29 22:27:40 UTC (rev 566) +++ TeamTalk/Agents/boeingLib/boeing/boeing_robot_server.cc 2007-01-29 23:07:19 UTC (rev 567) @@ -89,7 +89,6 @@ printf("WARNING: robotserver Not connected\n"); return NULL; } - //printf("robotserver connected\n"); // check the command timeout double t=Profiler::getTimeOfDay(); @@ -104,9 +103,7 @@ } // receive the header... - //printf("robotserver about to recieve\n"); int rv = socket_s->recv(rxdata.buff,sizeof(rxdata)); - //printf("robotserver got %d bytes\n", rv); // do some error checking before going any further if (rv>=(int)sizeof(rxdata)) { Modified: TeamTalk/Agents/boeingLib/boeing/boeing_trader_server.cc =================================================================== --- TeamTalk/Agents/boeingLib/boeing/boeing_trader_server.cc 2007-01-29 22:27:40 UTC (rev 566) +++ TeamTalk/Agents/boeingLib/boeing/boeing_trader_server.cc 2007-01-29 23:07:19 UTC (rev 567) @@ -65,16 +65,13 @@ printf("WARNING: traderserver Not connected\n"); return NULL; } - //printf("traderserver connected\n"); // is there anything to get? if (!sock->readyForRecv()) return (NULL); // receive the header... - //printf("traderserver about to recieve\n"); int rv = sock->recv(rxdata.buff,sizeof(rxdata)); - //printf("traderserver got %d bytes\n", rv); if (rv > 0 && rv!=rxdata.hdr.len) { printf("WARNING: size mismatch! %i, but packet says %i\n", Modified: TeamTalk/Agents/boeingLib/boeing/boeing_trader_server.h =================================================================== --- TeamTalk/Agents/boeingLib/boeing/boeing_trader_server.h 2007-01-29 22:27:40 UTC (rev 566) +++ TeamTalk/Agents/boeingLib/boeing/boeing_trader_server.h 2007-01-29 23:07:19 UTC (rev 567) @@ -29,7 +29,7 @@ //=== Rx Methods ====================================== /// get the next message (if there is one). Returns NULL if there is none - const MsgTraderServer* getNextMessage(); + MsgTraderServer const *getNextMessage(); //=== Send Methods ==================================== Modified: TeamTalk/Agents/boeingLib/coralshared/memfile.h =================================================================== --- TeamTalk/Agents/boeingLib/coralshared/memfile.h 2007-01-29 22:27:40 UTC (rev 566) +++ TeamTalk/Agents/boeingLib/coralshared/memfile.h 2007-01-29 23:07:19 UTC (rev 567) @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -17,7 +18,7 @@ public: memfile() {buf=NULL; len=0;} ~memfile() {mclose();} - + void *mopen(const char *filename,off_t &length); void mclose(); };