[TeamTalk 5]: [542] tags/BTH-0.1: Merged bugfixes from main branch into BTH-0.1.
tk@edam.speech.cs.cmu.edu
tk at edam.speech.cs.cmu.edu
Wed Nov 8 11:59:52 EST 2006
An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20061108/c4b77d46/attachment-0001.html
-------------- next part --------------
Property changes on: tags/BTH-0.1/TeamTalk/Agents/PenDecoder
___________________________________________________________________
Name: svn:ignore
+ dist
build
Modified: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/.nbintdb
===================================================================
(Binary files differ)
Deleted: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/Untitled
===================================================================
(Binary files differ)
Deleted: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/corp5aStage.jpg
===================================================================
(Binary files differ)
Modified: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/map.properties
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/PenDecoder/map.properties 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/PenDecoder/map.properties 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,4 +1,4 @@
# Sample ResourceBundle properties file
-edu.cmu.ravenclaw.pendecoder.mapfile = cmu_wordmark1r-boeing.PNG
+edu.cmu.ravenclaw.pendecoder.mapfile = highbay.png
edu.cmu.ravenclaw.pendecoder.mapwidth = 6200
edu.cmu.ravenclaw.pendecoder.mapheight = 4650
\ No newline at end of file
Deleted: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/nbproject/private/private.properties
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/PenDecoder/nbproject/private/private.properties 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/PenDecoder/nbproject/private/private.properties 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,5 +0,0 @@
-application.args=-port 11002
-#file.reference.galaxy.jar=D:\\Projects\\zap2\\ExternalLibraries\\Galaxy\\contrib\\MITRE\\bindings\\java\\lib\\galaxy.jar
-javac.debug=false
-javadoc.preview=false
-user.properties.file=C:\\Documents and Settings\\tkharris.SCS\\.netbeans\\4.1\\build.properties
Modified: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,95 +1,90 @@
package edu.cmu.ravenclaw.pendecoder;
import java.util.*;
-import java.awt.*;
-import java.io.*;
import edu.cmu.ravenclaw.pendecoder.scribble3.*;
+import java.awt.Graphics;
-public class BotTracker extends Thread {
- protected ScribbleCanvas canvas;
- protected float bot1x, bot1y, bot2x, bot2y, bot1r, bot2r;
- protected int size = 3;
+public class BotTracker {
+ protected ScribbleCanvas canvas;
+ protected final static int size = 3;
+
+ protected HashMap<String, Shape> bots = new HashMap<String, Shape>();
+ protected HashMap<Shape, String> names = new HashMap<Shape, String>();
+
+ BotTracker(ScribbleCanvas c) {
+ canvas = c;
+ }
+
+ public boolean setObject(String name, float x, float y) {
+ name.toUpperCase(); //names are always case insensitive
+ boolean obj_created = false;
+ ObjShape obj = getObj(name);
+ obj.setLocation(x, y);
+ canvas.repaint();
+ return obj_created;
+ }
+
+ public boolean setBot(String name, float x, float y, float r) {
+ name.toUpperCase(); //names are always case insensitive
+ boolean bot_created = false;
+ BotShape bot = getBot(name);
+ bot.setLocation(x, y, r);
+ canvas.repaint();
+ return bot_created;
+ }
- BotTracker(ScribbleCanvas c) {
- canvas = c;
- bot1x = 0; bot1y = 0;
- bot2x = 0; bot2y = 0;
- bot1r = 0; bot2r = 0;
+ private synchronized ObjShape getObj(String name) {
+ ObjShape obj = objOf(name);
+ if(obj == null) {
+ System.err.println("adding bot named: " + name);
+ //int botplace = 1000 + bots.size()*20;
+ //bot = new BotShape(name, botplace, -botplace, r);
+ obj = new ObjShape(name, canvas.colorGenerator);
+ bots.put(name, obj);
+ names.put(obj, name);
+ canvas.addShape(obj);
}
+ return obj;
+ }
- public void run() {
- File botlocs = null;
- try {
- botlocs = new File("botlocs.txt");
- } catch (Exception e) {
- System.err.println("bottracker: " + e.toString());
- System.exit(1);
- }
-
- HashMap<String, BotShape> bots = new HashMap<String, BotShape>();
-
- /*
- BotShape bot1, bot2;
- bot1 = new BotShape("dot", 3000, 3000, 0F);
- bot2 = new BotShape("brain", 3000, 3500, (float) Math.PI);
-
- bot1.x = bot1x;
- bot1.y = bot1y;
- bot1.rad = bot1r;
- canvas.addShape(bot1);
- bot2.x = bot2x;
- bot2.y = bot2y;
- bot2.rad = bot2r;
- canvas.addShape(bot2);
- */
- //Random movement = new Random((new Date()).getTime());
- for(;;) {
- Graphics g = canvas.getGraphics();
- g.setPaintMode();
- canvas.repaint();
-
- try {
- sleep(500);
- } catch(InterruptedException e) {
- }
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new FileReader(botlocs));
- String line;
- while(reader.ready()) {
- line = reader.readLine();
- String [] stuff = line.split(":");
- String name = stuff[0];
- float botx = Float.parseFloat(stuff[1]);
- float boty = Float.parseFloat(stuff[2]);
- float botr = Float.parseFloat(stuff[3]);
- BotShape bot = bots.get(name);
- if(bot == null) {
- int botplace = 1000 + bots.size()*20;
- bot = new BotShape(name, botplace, botplace, 0F);
- bots.put(name, bot);
- canvas.addShape(bot);
- }
- bot.setLocation(botx, boty, botr);
- }
- } catch (Exception e) {
- System.err.println("tracker: problem reading");
- continue;
- }
-
-/*
- float speed = 33*movement.nextFloat();
- bot1x += speed*Math.cos(bot1.rad);
- bot1y += speed*Math.sin(bot1.rad);
- bot1r += (movement.nextFloat() - 0.5)/4;
- bot1.setLocation(bot1x, bot1y, bot1r);
-
- speed = 33*movement.nextFloat();
- bot2x += speed*Math.cos(bot2.rad);
- bot2y += speed*Math.sin(bot2.rad);
- bot2r += (movement.nextFloat() - 0.5)/4;
- bot2.setLocation(bot2x, bot2y, bot2r);
- */
- }
+ private synchronized BotShape getBot(String name) {
+ BotShape bot = botOf(name);
+ if(bot == null) {
+ System.err.println("adding bot named: " + name);
+ //int botplace = 1000 + bots.size()*20;
+ //bot = new BotShape(name, botplace, -botplace, r);
+ bot = new BotShape(name, canvas.colorGenerator);
+ bots.put(name, bot);
+ names.put(bot, name);
+ canvas.addShape(bot);
}
+ return bot;
+ }
+
+ public void setGoal(java.lang.String name, boolean relative, float x, float y) {
+ name.toUpperCase();
+ Shape s = bots.get(name);
+ if(s == null || !(s instanceof BotShape)) {
+ System.err.println("odd, bot set goal but can't be found: " + name);
+ } else {
+ BotShape bot = (BotShape) s;
+ bot.setGoal(relative, x, y);
+ }
+ }
+
+ public String nameOf(BotShape bot) {
+ return names.get(bot);
+ }
+
+ public ObjShape objOf(String name) {
+ Shape s = bots.get(name);
+ if(s instanceof ObjShape) return (ObjShape)s;
+ else return null;
+ }
+
+ public BotShape botOf(String name) {
+ Shape s = bots.get(name);
+ if(s instanceof BotShape) return (BotShape)s;
+ else return null;
+ }
}
Deleted: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker_2.java
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker_2.java 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker_2.java 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,90 +0,0 @@
-package edu.cmu.ravenclaw.pendecoder;
-
-import java.util.*;
-import edu.cmu.ravenclaw.pendecoder.scribble3.*;
-import java.awt.Graphics;
-
-public class BotTracker_2 {
- protected ScribbleCanvas canvas;
- protected final static int size = 3;
-
- protected HashMap<String, Shape> bots = new HashMap<String, Shape>();
- protected HashMap<Shape, String> names = new HashMap<Shape, String>();
-
- BotTracker_2(ScribbleCanvas c) {
- canvas = c;
- }
-
- public boolean setObject(String name, float x, float y) {
- name.toUpperCase(); //names are always case insensitive
- boolean obj_created = false;
- ObjShape obj = getObj(name);
- obj.setLocation(x, y);
- canvas.repaint();
- return obj_created;
- }
-
- public boolean setBot(String name, float x, float y, float r) {
- name.toUpperCase(); //names are always case insensitive
- boolean bot_created = false;
- BotShape bot = getBot(name);
- bot.setLocation(x, y, r);
- canvas.repaint();
- return bot_created;
- }
-
- private synchronized ObjShape getObj(String name) {
- ObjShape obj = objOf(name);
- if(obj == null) {
- System.err.println("adding bot named: " + name);
- //int botplace = 1000 + bots.size()*20;
- //bot = new BotShape(name, botplace, -botplace, r);
- obj = new ObjShape(name, canvas.colorGenerator);
- bots.put(name, obj);
- names.put(obj, name);
- canvas.addShape(obj);
- }
- return obj;
- }
-
- private synchronized BotShape getBot(String name) {
- BotShape bot = botOf(name);
- if(bot == null) {
- System.err.println("adding bot named: " + name);
- //int botplace = 1000 + bots.size()*20;
- //bot = new BotShape(name, botplace, -botplace, r);
- bot = new BotShape(name, canvas.colorGenerator);
- bots.put(name, bot);
- names.put(bot, name);
- canvas.addShape(bot);
- }
- return bot;
- }
-
- public void setGoal(java.lang.String name, boolean relative, float x, float y) {
- name.toUpperCase();
- Shape s = bots.get(name);
- if(s == null || !(s instanceof BotShape)) {
- System.err.println("odd, bot set goal but can't be found: " + name);
- } else {
- BotShape bot = (BotShape) s;
- bot.setGoal(relative, x, y);
- }
- }
-
- public String nameOf(BotShape bot) {
- return names.get(bot);
- }
-
- public ObjShape objOf(String name) {
- Shape s = bots.get(name);
- if(s instanceof ObjShape) return (ObjShape)s;
- else return null;
- }
-
- public BotShape botOf(String name) {
- Shape s = bots.get(name);
- if(s instanceof BotShape) return (BotShape)s;
- else return null;
- }
-}
Modified: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java 2006-11-08 16:59:50 UTC (rev 542)
@@ -27,7 +27,7 @@
public static final int PORT = 11002;
protected static DrawingPad frame = null;
protected static int lastUttID = 0;
- public static BotTracker_2 botTracker = null;
+ public static BotTracker botTracker = null;
/** Creates a new instance of PenDecoderServer */
public PenDecoderServer(MainServer mainserver, java.net.Socket socket) throws IOException {
@@ -38,7 +38,7 @@
frame.setVisible(true);
//start tracking bots
- botTracker = new BotTracker_2(frame.getCanvas());
+ botTracker = new BotTracker(frame.getCanvas());
}
frame.addServer(this);
}
Modified: tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/scribble3/ScribbleTool.java
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/scribble3/ScribbleTool.java 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/scribble3/ScribbleTool.java 2006-11-08 16:59:50 UTC (rev 542)
@@ -33,6 +33,7 @@
public void mouseClickedAt(Point p) {}
public void mouseDoubleClickedAt(Point p) {}
+ public void mouseRightClickedAt(Point p) {}
public void mouseMovedTo(Point p) {}
public Icon getIcon() {
Modified: tags/BTH-0.1/TeamTalk/Agents/PrimitiveComm/PrimitiveComm.vcproj
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/PrimitiveComm/PrimitiveComm.vcproj 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/PrimitiveComm/PrimitiveComm.vcproj 2006-11-08 16:59:50 UTC (rev 542)
@@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=".;../boeingLib/boeing;../boeingLib/shared"
+ AdditionalIncludeDirectories=".;../boeingLib/boeing;../boeingLib/coralshared"
PreprocessorDefinitions="_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib (from rev 541, TeamTalk/Agents/boeingLib)
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile
===================================================================
--- TeamTalk/Agents/boeingLib/Makefile 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,211 +0,0 @@
-# This makefile is derived from James Bruces make file
-# which is avialable under GPL as:
-#
-# (C) 2003-2005 James Bruce, Carnegie Mellon University
-# Licensed under the GPL, version 2. See "doc/License.txt" or visit
-# "http://www.gnu.org/copyleft/gpl.html" for details.
-#
-# Modifications by Brett Browning, Marc Zinck, Carnegie Mellon University
-
-include Makefile.config
-
-BIN_MODULES := utils
-LIB_MODULES := boeing coralshared
-OTHER_MODULES :=
-ALL_MODULES := $(OTHER_MODULES) $(LIB_MODULES) $(BIN_MODULES)
-BIN := bin
-LIB := lib
-
-# Get the cpu settings
-CPU := $(shell ./bin/cpuflags)
-
-ROOTDIR=$(shell basename `pwd`)
-
-#======================================================================#
-# Compilation options
-#======================================================================#
-
-CC := g++-3.4
-
-# CFlags base
-CFLAGS += -Wall -D_GNU_SOURCE
-CFLAGS += $(CPU)
-CFLAGS += -ffast-math
-CFLAGS += -g -O3
-
-# uncomment to turn off asserts
-# CFLAGS += -DNDEBUG
-
-# Definitions
-DEF :=
-
-#======================================================================#
-
-DEP_ECHO = @echo Dependency: $@
-CC_ECHO = @echo Compiling: $@
-LINK_ECHO = @echo Linking: $@
-CLEAN_ECHO = @echo Cleaning.
-
-ifneq ($(VERBOSE), 1)
- Q := @
-endif
-
-
-#======================================================================#
-# Library settings
-
-GSL_LIBS := $(shell pkg-config --libs gsl --silence-errors)
-GSL_FLAGS := $(shell pkg-config --cflags gsl --silence-errors)
-
-X_LIBS := -L/usr/X11R6/lib -lX11
-COMPRESS_LIBS := -lz -ljpeg
-THREAD_LIBS := -lpthread
-MATH_LIBS := -lm
-
-#XML_FLAGS := $(shell xml2-config --cflags)
-#XML_LIBS := $(shell xml2-config --libs)
-
-
-ifneq ($(shell ls /usr/lib/libsctp.a 2>/dev/null),)
-SCTP_FLAGS := -DUSE_SCTP
-SCTP_LIBS := -lsctp
-endif
-
-SRC_LIBS := $(patsubst %,lib/lib%.a,$(LIB_MODULES))
-
-
-#======================================================================#
-# Common Includes
-#======================================================================#
-
-INC_DIRS += $(ALL_MODULES)
-
-#======================================================================#
-# Build Rules
-#======================================================================#
-
-# all includes should be relative to top level, or in one of the
-# following directories. They should *not* include "../"
-CFLAGS += $(SCTP_FLAGS) $(GSL_FLAGS) $(XML_FLAGS)
-
-# sort and uniquefy them
-CFLAGS := $(sort $(CFLAGS))
-
-CFLAGS += -I. $(addprefix -I,$(INC_DIRS))
-
-
-# start with empty libraries
-LIBS += $(MATH_LIBS) $(COMPRESS_LIBS) $(SCTP_LIBS)
-
-
-# Each module will add to this
-ALL_SRC :=
-ALL_BIN_TARGETS :=
-ALL_LIB_TARGETS :=
-
-all: all_real
-
-# Include the description for each module
-include $(patsubst %,%/Makefile.sub,$(BIN_MODULES) $(LIB_MODULES))
-
-# Remove duplicates
-ALL_SRC := $(sort $(ALL_SRC))
-
-# Determine the object files
-OBJ := \
- $(patsubst %.cc,%.o,$(filter %.cc,$(ALL_SRC))) \
- $(patsubst %.c,%.o,$(filter %.c,$(ALL_SRC))) \
- $(patsubst %.java,%.class,$(filter %.java,$(ALL_SRC)))
-
-# Determine the target files
-ALL_BIN_TARGETS := $(addprefix $(BIN)/,$(ALL_BIN_TARGETS))
-ALL_LIB_TARGETS := $(addprefix $(LIB)/,$(ALL_LIB_TARGETS))
-
-# Include the dependencies
--include $(OBJ:.o=.d)
-
-# ignore implicit rules (I think)
-.SUFFIXES:
-
-# rules to run unconditionally
-# (i.e. those which do not generate a file the same name as the target)
-.PHONY: doc
-
-# Compilation rule
-%.o: %.cc
- $(CC_ECHO)
- $(Q)$(CC) $(CFLAGS) $(DEF) $(INC) -c $< -o $@
-
-# Dependency generation rule
-%.d: %.cc
- $(DEP_ECHO)
- $(Q)$(CC) $(CFLAGS) -MM $< | ./bin/fixdepend $(dir $<) > $@
-
-all_real: $(ALL_BIN_TARGETS) $(ALL_LIB_TARGETS)
-
-doc:
- doxygen doc/doxygen.cfg
-
-sloc:
- find . -type f | grep -E ".*\.[ch]c?$$" | grep -v _darcs | xargs wc -l
-
-strip:
- strip -v --strip-unneeded $(ALL_BIN_TARGETS)
-
-tarball:
- $(Q)echo "Tarring up the project to $(ROOTDIR)"
- $(Q)tar -czf ../$(ROOTDIR).tgz -C .. -X tarball_excludes $(ROOTDIR)
-
-ifdef INSTALLDIR
-INSTALLDIR_LIB=$(INSTALLDIR)/lib
-INSTALLDIR_INCLUDE=$(INSTALLDIR)/include
-install: all_real
- @echo "Installing to $(INSTALLDIR)"
- @echo "Coping library files to $(INSTALLDIR_LIB)"
-
- @if [ ! -d $(INSTALLDIR_LIB) ] ; then \
- echo "Creating $(INSTALLDIR_LIB)"; \
- mkdir $(INSTALLDIR_LIB) ; \
- fi;
- @cp $(LIB)/* $(INSTALLDIR_LIB)
-
- @if [ ! -d $(INSTALLDIR_INCLUDE) ] ; then \
- echo "Creating $(INSTALLDIR_INCLUDE)"; \
- mkdir $(INSTALLDIR_INCLUDE) ; \
- fi;
-
- @for d in $(LIB_MODULES) ; do \
- if [ ! -d $(INSTALLDIR_INCLUDE)/$$d ] ; then \
- echo "Creating $(INSTALLDIR_INCLUDE)/$$d" ; \
- mkdir $(INSTALLDIR_INCLUDE)/$$d ; \
- fi; \
- echo "Coping header files to $(INSTALLDIR_INCLUDE)/$$d" ; \
- cp $$d/*.h $(INSTALLDIR_INCLUDE)/$$d ; \
- done
-else
-install:
- @echo "Please specify an install directory in Makefile.config"
-endif
-
-clean:
- $(CLEAN_ECHO)
- $(Q)find . -type f -name "*.[od]" | xargs rm -f
- $(Q)find . -type f -name "*~" | xargs rm -f
- $(Q)find . -type f -name "*.class" | xargs rm -f
-
-cleanbin:
- rm -f $(ALL_BIN_TARGETS)
-
-cleanlib:
- rm -f $(ALL_LIB_TARGETS)
-
-cleandoc:
- (cd doc/html; rm -f doxygen.css *.html *.png *.map *.md5 *.dot)
-
-cleandepend:
- find . -name *.d -exec rm {} \;
-
-distclean: clean cleanbin cleanlib cleandoc cleandepend
-
-# don't need to do anything extra since dependencies are built automatically
-depend:
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile (from rev 541, TeamTalk/Agents/boeingLib/Makefile)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,211 @@
+# This makefile is derived from James Bruces make file
+# which is avialable under GPL as:
+#
+# (C) 2003-2005 James Bruce, Carnegie Mellon University
+# Licensed under the GPL, version 2. See "doc/License.txt" or visit
+# "http://www.gnu.org/copyleft/gpl.html" for details.
+#
+# Modifications by Brett Browning, Marc Zinck, Carnegie Mellon University
+
+include Makefile.config
+
+BIN_MODULES := utils
+LIB_MODULES := boeing coralshared
+OTHER_MODULES :=
+ALL_MODULES := $(OTHER_MODULES) $(LIB_MODULES) $(BIN_MODULES)
+BIN := bin
+LIB := lib
+
+# Get the cpu settings
+CPU := $(shell ./bin/cpuflags)
+
+ROOTDIR=$(shell basename `pwd`)
+
+#======================================================================#
+# Compilation options
+#======================================================================#
+
+CC := g++-3.4
+
+# CFlags base
+CFLAGS += -Wall -D_GNU_SOURCE
+CFLAGS += $(CPU)
+CFLAGS += -ffast-math
+CFLAGS += -g -O3
+
+# uncomment to turn off asserts
+# CFLAGS += -DNDEBUG
+
+# Definitions
+DEF :=
+
+#======================================================================#
+
+DEP_ECHO = @echo Dependency: $@
+CC_ECHO = @echo Compiling: $@
+LINK_ECHO = @echo Linking: $@
+CLEAN_ECHO = @echo Cleaning.
+
+ifneq ($(VERBOSE), 1)
+ Q := @
+endif
+
+
+#======================================================================#
+# Library settings
+
+GSL_LIBS := $(shell pkg-config --libs gsl --silence-errors)
+GSL_FLAGS := $(shell pkg-config --cflags gsl --silence-errors)
+
+X_LIBS := -L/usr/X11R6/lib -lX11
+COMPRESS_LIBS := -lz -ljpeg
+THREAD_LIBS := -lpthread
+MATH_LIBS := -lm
+
+#XML_FLAGS := $(shell xml2-config --cflags)
+#XML_LIBS := $(shell xml2-config --libs)
+
+
+ifneq ($(shell ls /usr/lib/libsctp.a 2>/dev/null),)
+SCTP_FLAGS := -DUSE_SCTP
+SCTP_LIBS := -lsctp
+endif
+
+SRC_LIBS := $(patsubst %,lib/lib%.a,$(LIB_MODULES))
+
+
+#======================================================================#
+# Common Includes
+#======================================================================#
+
+INC_DIRS += $(ALL_MODULES)
+
+#======================================================================#
+# Build Rules
+#======================================================================#
+
+# all includes should be relative to top level, or in one of the
+# following directories. They should *not* include "../"
+CFLAGS += $(SCTP_FLAGS) $(GSL_FLAGS) $(XML_FLAGS)
+
+# sort and uniquefy them
+CFLAGS := $(sort $(CFLAGS))
+
+CFLAGS += -I. $(addprefix -I,$(INC_DIRS))
+
+
+# start with empty libraries
+LIBS += $(MATH_LIBS) $(COMPRESS_LIBS) $(SCTP_LIBS)
+
+
+# Each module will add to this
+ALL_SRC :=
+ALL_BIN_TARGETS :=
+ALL_LIB_TARGETS :=
+
+all: all_real
+
+# Include the description for each module
+include $(patsubst %,%/Makefile.sub,$(BIN_MODULES) $(LIB_MODULES))
+
+# Remove duplicates
+ALL_SRC := $(sort $(ALL_SRC))
+
+# Determine the object files
+OBJ := \
+ $(patsubst %.cc,%.o,$(filter %.cc,$(ALL_SRC))) \
+ $(patsubst %.c,%.o,$(filter %.c,$(ALL_SRC))) \
+ $(patsubst %.java,%.class,$(filter %.java,$(ALL_SRC)))
+
+# Determine the target files
+ALL_BIN_TARGETS := $(addprefix $(BIN)/,$(ALL_BIN_TARGETS))
+ALL_LIB_TARGETS := $(addprefix $(LIB)/,$(ALL_LIB_TARGETS))
+
+# Include the dependencies
+-include $(OBJ:.o=.d)
+
+# ignore implicit rules (I think)
+.SUFFIXES:
+
+# rules to run unconditionally
+# (i.e. those which do not generate a file the same name as the target)
+.PHONY: doc
+
+# Compilation rule
+%.o: %.cc
+ $(CC_ECHO)
+ $(Q)$(CC) $(CFLAGS) $(DEF) $(INC) -c $< -o $@
+
+# Dependency generation rule
+%.d: %.cc
+ $(DEP_ECHO)
+ $(Q)$(CC) $(CFLAGS) -MM $< | ./bin/fixdepend $(dir $<) > $@
+
+all_real: $(ALL_BIN_TARGETS) $(ALL_LIB_TARGETS)
+
+doc:
+ doxygen doc/doxygen.cfg
+
+sloc:
+ find . -type f | grep -E ".*\.[ch]c?$$" | grep -v _darcs | xargs wc -l
+
+strip:
+ strip -v --strip-unneeded $(ALL_BIN_TARGETS)
+
+tarball:
+ $(Q)echo "Tarring up the project to $(ROOTDIR)"
+ $(Q)tar -czf ../$(ROOTDIR).tgz -C .. -X tarball_excludes $(ROOTDIR)
+
+ifdef INSTALLDIR
+INSTALLDIR_LIB=$(INSTALLDIR)/lib
+INSTALLDIR_INCLUDE=$(INSTALLDIR)/include
+install: all_real
+ @echo "Installing to $(INSTALLDIR)"
+ @echo "Coping library files to $(INSTALLDIR_LIB)"
+
+ @if [ ! -d $(INSTALLDIR_LIB) ] ; then \
+ echo "Creating $(INSTALLDIR_LIB)"; \
+ mkdir $(INSTALLDIR_LIB) ; \
+ fi;
+ @cp $(LIB)/* $(INSTALLDIR_LIB)
+
+ @if [ ! -d $(INSTALLDIR_INCLUDE) ] ; then \
+ echo "Creating $(INSTALLDIR_INCLUDE)"; \
+ mkdir $(INSTALLDIR_INCLUDE) ; \
+ fi;
+
+ @for d in $(LIB_MODULES) ; do \
+ if [ ! -d $(INSTALLDIR_INCLUDE)/$$d ] ; then \
+ echo "Creating $(INSTALLDIR_INCLUDE)/$$d" ; \
+ mkdir $(INSTALLDIR_INCLUDE)/$$d ; \
+ fi; \
+ echo "Coping header files to $(INSTALLDIR_INCLUDE)/$$d" ; \
+ cp $$d/*.h $(INSTALLDIR_INCLUDE)/$$d ; \
+ done
+else
+install:
+ @echo "Please specify an install directory in Makefile.config"
+endif
+
+clean:
+ $(CLEAN_ECHO)
+ $(Q)find . -type f -name "*.[od]" | xargs rm -f
+ $(Q)find . -type f -name "*~" | xargs rm -f
+ $(Q)find . -type f -name "*.class" | xargs rm -f
+
+cleanbin:
+ rm -f $(ALL_BIN_TARGETS)
+
+cleanlib:
+ rm -f $(ALL_LIB_TARGETS)
+
+cleandoc:
+ (cd doc/html; rm -f doxygen.css *.html *.png *.map *.md5 *.dot)
+
+cleandepend:
+ find . -name *.d -exec rm {} \;
+
+distclean: clean cleanbin cleanlib cleandoc cleandepend
+
+# don't need to do anything extra since dependencies are built automatically
+depend:
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile.config
===================================================================
--- TeamTalk/Agents/boeingLib/Makefile.config 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile.config 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,4 +0,0 @@
-# Directory where lib and include directories will be placed
-# For system wide usual use /usr/local/
-
-INSTALLDIR=~/software/external/boeingLib
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile.config (from rev 541, TeamTalk/Agents/boeingLib/Makefile.config)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile.config (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/Makefile.config 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,4 @@
+# Directory where lib and include directories will be placed
+# For system wide usual use /usr/local/
+
+INSTALLDIR=~/software/external/boeingLib
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/README
===================================================================
--- TeamTalk/Agents/boeingLib/README 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/README 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,48 +0,0 @@
-INTRODUCTION
-------------
-
-This is the Boeing repository for storing the interfaces between the
-Boeing Robot server/client and the Traderbot server/client. To compile
-the code just run make in the base directory. This will produce
-(hopefully) a library in the lib directory called libboeing.a for static
-linkage with your program. It will also create a set of testing
-utilities that can be used to test or interact with each of hte various
-servers/clients.
-
-Testing Binaries:
-
-test_robot_server - runs a fake robot server on the default port
-test_robot_client - runs a simple shell to talk to robot servers
-test_trader_server - runs a fake traderbot server
-test_trader_client - runs a simple shell to talk to the trader server
-
-
-Known Dependencies:
-
-The code was compiled under gcc 3.3 on a debian x86 system. It has been
-tested on Pentium 2, 3, 4, and M class machines. It makes use of the g++
-STL, and the configuration system uses the cpp pre processor.
-
-The robot client command line utility requires libreadline to be installed and the corresponding development packages (header + library).
-In debian these can be installed with:
- apt-get install libreadline5-dev
-We are using version 5.1.
-
-
-Directories:
-
-bin/ - output location for the testing binaries, and script files
-lib/ - output location for the library libboeing.a
-boeing/ - contains all of the boeing files (.h and .cc)
-utils/ - testing files (.cc)
-shared/ - shared utility files from the Coral research group (these are GPLed)
-
-
-DEVELOPMENT TEAM
-----------------
-
-Brett Browning, M. Bernardine Dias, E. Gil Jones, Thomas Harris, Brenna Argall, Marc Zinck, Manuela Veloso, Tony Stentz, Alex Rudnicky
-
-Carnegie Mellon University
-
-
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/README (from rev 541, TeamTalk/Agents/boeingLib/README)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/README (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/README 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,48 @@
+INTRODUCTION
+------------
+
+This is the Boeing repository for storing the interfaces between the
+Boeing Robot server/client and the Traderbot server/client. To compile
+the code just run make in the base directory. This will produce
+(hopefully) a library in the lib directory called libboeing.a for static
+linkage with your program. It will also create a set of testing
+utilities that can be used to test or interact with each of hte various
+servers/clients.
+
+Testing Binaries:
+
+test_robot_server - runs a fake robot server on the default port
+test_robot_client - runs a simple shell to talk to robot servers
+test_trader_server - runs a fake traderbot server
+test_trader_client - runs a simple shell to talk to the trader server
+
+
+Known Dependencies:
+
+The code was compiled under gcc 3.3 on a debian x86 system. It has been
+tested on Pentium 2, 3, 4, and M class machines. It makes use of the g++
+STL, and the configuration system uses the cpp pre processor.
+
+The robot client command line utility requires libreadline to be installed and the corresponding development packages (header + library).
+In debian these can be installed with:
+ apt-get install libreadline5-dev
+We are using version 5.1.
+
+
+Directories:
+
+bin/ - output location for the testing binaries, and script files
+lib/ - output location for the library libboeing.a
+boeing/ - contains all of the boeing files (.h and .cc)
+utils/ - testing files (.cc)
+shared/ - shared utility files from the Coral research group (these are GPLed)
+
+
+DEVELOPMENT TEAM
+----------------
+
+Brett Browning, M. Bernardine Dias, E. Gil Jones, Thomas Harris, Brenna Argall, Marc Zinck, Manuela Veloso, Tony Stentz, Alex Rudnicky
+
+Carnegie Mellon University
+
+
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing (from rev 541, TeamTalk/Agents/boeingLib/boeing)
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/Makefile.sub
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/Makefile.sub 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/Makefile.sub 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,24 +0,0 @@
-DIR := boeing
-
-#==== lib ===================================================================#
-
-
-#==== boeing_server =========================================================#
-
-SRC += $(wildcard $(DIR)/*.cc)
-
-SRC := $(filter-out test%.cc , $(SRC))
-SRC := $(shell ls -t $(sort $(SRC)))
-
-TARGET := libboeing.a
-
-LIB_BOEING_OBJ := $(SRC:.cc=.o)
-
-ALL_SRC += $(SRC)
-ALL_LIB_TARGETS += $(TARGET)
-
-$(TARGET): $(LIB)/$(TARGET)
-
-$(LIB)/$(TARGET): $(LIB_BOEING_OBJ)
- $(LINK_ECHO)
- $(Q)$(AR) -r $@ $(LIB_BOEING_OBJ)
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/Makefile.sub (from rev 541, TeamTalk/Agents/boeingLib/boeing/Makefile.sub)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/Makefile.sub (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/Makefile.sub 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,24 @@
+DIR := boeing
+
+#==== lib ===================================================================#
+
+
+#==== boeing_server =========================================================#
+
+SRC += $(wildcard $(DIR)/*.cc)
+
+SRC := $(filter-out test%.cc , $(SRC))
+SRC := $(shell ls -t $(sort $(SRC)))
+
+TARGET := libboeing.a
+
+LIB_BOEING_OBJ := $(SRC:.cc=.o)
+
+ALL_SRC += $(SRC)
+ALL_LIB_TARGETS += $(TARGET)
+
+$(TARGET): $(LIB)/$(TARGET)
+
+$(LIB)/$(TARGET): $(LIB_BOEING_OBJ)
+ $(LINK_ECHO)
+ $(Q)$(AR) -r $@ $(LIB_BOEING_OBJ)
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,189 +0,0 @@
-#include "boeing_converter.h"
-#include "util.h"
-#include "error_check.h"
-
-#include "string_helper.h"
-
-static const int debug=false;
-
-using namespace Boeing;
-
-//==== Basic Parsing methods ============================
-
-//==== Conversion methods ===============================
-
-/** convert from an action message into one of the predefined
- command message packets. Returns the type of the message,
- or -1 on failure to match a message. The result is put in the
- union msgcmd
-*/
-int Boeing::convert(MsgCmdAction *mca,MsgCmd &result)
-{
- // first set up the message header
- mzero(result);
- result.hdr.tstamp = mca->tstamp;
- result.msg_cmdtask.taskid = mca->taskid;
-
- // take initial guess to save some typing
- result.hdr.len = sizeof(MsgCmdTask);
-
- // string of leading characters
- string name;
- string action=mca->action;
- char *params;
- int pi = extractWord(mca->action,name);
- if (pi<0) {
- if (debug) {
- printf(" %s: Failed to extract action name from %s\n",
- __PRETTY_FUNCTION__,mca->action);
- }
- return -1;
- }
-
- params=NULL;
- if (pi>0 && pi<(int)strlen(mca->action)) {
- params = mca->action + pi;
- params = (char*)(stripBraces(params).c_str());
- }
-
- if (debug)
- printf(" Got %s message\n", name.c_str());
-
- int rv;
-
- // now work out what message it is
- if (name == "halt") {
- if (debug)
- printf(" Got halt message\n");
- result.hdr.type = CMD_HALT;
-
- } else if (name == "goto") {
- if (debug)
- printf(" Goto message\n");
- if (!params) {
- fprintf(stderr, " Malformed goto message '%s'\n",mca->action);
- return -1;
- }
-
- result.hdr.type = CMD_GOTO;
- result.hdr.len = sizeof(MsgCmdGoTo);
-
- result.msg_goto.attr = 0;
-
- char temp[1024];
-
- rv=sscanf(params, " %s %f%*[,: ] %f%*[,: ] %f",
- temp,&result.msg_goto.x,&result.msg_goto.y,
- &result.msg_goto.angle);
-
- if (rv<3) {
- fprintf(stderr, " Malformed goto message '%s'\n",mca->action);
- return -1;
- } else if (rv==4) {
- result.msg_goto.attr |= MsgCmdGoTo::UseAngle;
- }
-
- if(strncasecmp(temp,"rel",64) == 0) {
- result.msg_goto.attr |= MsgCmdGoTo::Relative;
- }
- } else if (name == "home") {
- if (debug)
- printf(" Got home message\n");
- result.hdr.type = CMD_HOME;
- } else if (name == "pause") {
- if (debug)
- printf(" Got pause message\n");
- result.hdr.type = CMD_PAUSE;
- } else if (name == "resume") {
- if (debug)
- printf(" Got resume message\n");
- result.hdr.type = CMD_RESUME;
- } else if (name == "follow") {
- if (debug)
- printf(" Got follow message\n");
- result.hdr.type = CMD_FOLLOW;
- result.hdr.len = sizeof(MsgCmdFollow);
-
- memset(result.msg_follow.ip,0,MAX_STRING_LENGTH);
- memset(result.msg_follow.search,0,MAX_STRING_LENGTH);
-
- if (params) {
- Strings param_array;
- extractParameterArray(params,param_array);
-
- char temp[1024];
- for (size_t j=0; j<param_array.size(); j++) {
- if (sscanf(param_array[j].c_str(),"IP=%1023s",temp)>0) {
- strncpy(result.msg_follow.ip,temp,MAX_STRING_LENGTH-1);
- } else if (sscanf(param_array[j].c_str(),"SEARCH=%1023s",temp)>0) {
- strncpy(result.msg_follow.search,temp,MAX_STRING_LENGTH-1);
- }
- }
- }
-
- } else if (name == "cover") {
- if (debug)
- printf(" Got cover message\n");
- if (!params) {
- printf(" Malformed cover message\n");
- return -1;
- }
-
- result.hdr.type = CMD_COVER;
- result.hdr.len = sizeof(MsgCmdCover);
-
- printf("str='%s'\n",params);
-
- Strings param_array;
- extractParameterArray(params,param_array);
-
- printf("str='%s'\n",params);
- for (size_t j=0; j<param_array.size(); j++) {
- printf("'%s' ",param_array[j].c_str());
- }
-
- if (param_array.size()%2 != 0) {
- printf("Malformed cover message! (%i)\n",(int)param_array.size());
- return -1;
- }
-
- int n=0;
- for (size_t j=0; j<param_array.size()-1 && n<RP_Polygon::MAX_POLYGON; j+=2) {
- result.msg_cover.cover_shape.xpoint[n] = atof(param_array[j].c_str());
- result.msg_cover.cover_shape.ypoint[n] = atof(param_array[j+1].c_str());
- n++;
- }
- result.msg_cover.cover_shape.n = n;
-
- } else if (name == "reqlocation") {
- if (debug)
- printf(" Got request message\n");
- result.hdr.type = REQ_LOCATION;
- } else if (name == "reqimage") {
- if (debug)
- printf(" Got request image message\n");
- result.hdr.type = REQ_IMAGE;
- } else {
- fprintf(stderr, "Unknown message '%s'\n",mca->action);
- }
-
- return (result.hdr.type);
-}
-
-/**
- * strip off the brackets so that we are compatable with the language
- * syntax. We just replace them with spaces
- */
-string Boeing::stripBraces(char const *msg)
-{
- string s=msg;
-
- // really nasty way of doing it...
- char *cp;
- for (cp=(char *)s.c_str(); cp && *cp; cp++) {
- if (*cp=='(' || *cp==')')
- *cp=' ';
- }
- return s;
-}
-
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc (from rev 541, TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.cc 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,189 @@
+#include "boeing_converter.h"
+#include "util.h"
+#include "error_check.h"
+
+#include "string_helper.h"
+
+static const int debug=false;
+
+using namespace Boeing;
+
+//==== Basic Parsing methods ============================
+
+//==== Conversion methods ===============================
+
+/** convert from an action message into one of the predefined
+ command message packets. Returns the type of the message,
+ or -1 on failure to match a message. The result is put in the
+ union msgcmd
+*/
+int Boeing::convert(MsgCmdAction *mca,MsgCmd &result)
+{
+ // first set up the message header
+ mzero(result);
+ result.hdr.tstamp = mca->tstamp;
+ result.msg_cmdtask.taskid = mca->taskid;
+
+ // take initial guess to save some typing
+ result.hdr.len = sizeof(MsgCmdTask);
+
+ // string of leading characters
+ string name;
+ string action=mca->action;
+ char *params;
+ int pi = extractWord(mca->action,name);
+ if (pi<0) {
+ if (debug) {
+ printf(" %s: Failed to extract action name from %s\n",
+ __PRETTY_FUNCTION__,mca->action);
+ }
+ return -1;
+ }
+
+ params=NULL;
+ if (pi>0 && pi<(int)strlen(mca->action)) {
+ params = mca->action + pi;
+ params = (char*)(stripBraces(params).c_str());
+ }
+
+ if (debug)
+ printf(" Got %s message\n", name.c_str());
+
+ int rv;
+
+ // now work out what message it is
+ if (name == "halt") {
+ if (debug)
+ printf(" Got halt message\n");
+ result.hdr.type = CMD_HALT;
+
+ } else if (name == "goto") {
+ if (debug)
+ printf(" Goto message\n");
+ if (!params) {
+ fprintf(stderr, " Malformed goto message '%s'\n",mca->action);
+ return -1;
+ }
+
+ result.hdr.type = CMD_GOTO;
+ result.hdr.len = sizeof(MsgCmdGoTo);
+
+ result.msg_goto.attr = 0;
+
+ char temp[1024];
+
+ rv=sscanf(params, " %s %f%*[,: ] %f%*[,: ] %f",
+ temp,&result.msg_goto.x,&result.msg_goto.y,
+ &result.msg_goto.angle);
+
+ if (rv<3) {
+ fprintf(stderr, " Malformed goto message '%s'\n",mca->action);
+ return -1;
+ } else if (rv==4) {
+ result.msg_goto.attr |= MsgCmdGoTo::UseAngle;
+ }
+
+ if(strncasecmp(temp,"rel",64) == 0) {
+ result.msg_goto.attr |= MsgCmdGoTo::Relative;
+ }
+ } else if (name == "home") {
+ if (debug)
+ printf(" Got home message\n");
+ result.hdr.type = CMD_HOME;
+ } else if (name == "pause") {
+ if (debug)
+ printf(" Got pause message\n");
+ result.hdr.type = CMD_PAUSE;
+ } else if (name == "resume") {
+ if (debug)
+ printf(" Got resume message\n");
+ result.hdr.type = CMD_RESUME;
+ } else if (name == "follow") {
+ if (debug)
+ printf(" Got follow message\n");
+ result.hdr.type = CMD_FOLLOW;
+ result.hdr.len = sizeof(MsgCmdFollow);
+
+ memset(result.msg_follow.ip,0,MAX_STRING_LENGTH);
+ memset(result.msg_follow.search,0,MAX_STRING_LENGTH);
+
+ if (params) {
+ Strings param_array;
+ extractParameterArray(params,param_array);
+
+ char temp[1024];
+ for (size_t j=0; j<param_array.size(); j++) {
+ if (sscanf(param_array[j].c_str(),"IP=%1023s",temp)>0) {
+ strncpy(result.msg_follow.ip,temp,MAX_STRING_LENGTH-1);
+ } else if (sscanf(param_array[j].c_str(),"SEARCH=%1023s",temp)>0) {
+ strncpy(result.msg_follow.search,temp,MAX_STRING_LENGTH-1);
+ }
+ }
+ }
+
+ } else if (name == "cover") {
+ if (debug)
+ printf(" Got cover message\n");
+ if (!params) {
+ printf(" Malformed cover message\n");
+ return -1;
+ }
+
+ result.hdr.type = CMD_COVER;
+ result.hdr.len = sizeof(MsgCmdCover);
+
+ printf("str='%s'\n",params);
+
+ Strings param_array;
+ extractParameterArray(params,param_array);
+
+ printf("str='%s'\n",params);
+ for (size_t j=0; j<param_array.size(); j++) {
+ printf("'%s' ",param_array[j].c_str());
+ }
+
+ if (param_array.size()%2 != 0) {
+ printf("Malformed cover message! (%i)\n",(int)param_array.size());
+ return -1;
+ }
+
+ int n=0;
+ for (size_t j=0; j<param_array.size()-1 && n<RP_Polygon::MAX_POLYGON; j+=2) {
+ result.msg_cover.cover_shape.xpoint[n] = atof(param_array[j].c_str());
+ result.msg_cover.cover_shape.ypoint[n] = atof(param_array[j+1].c_str());
+ n++;
+ }
+ result.msg_cover.cover_shape.n = n;
+
+ } else if (name == "reqlocation") {
+ if (debug)
+ printf(" Got request message\n");
+ result.hdr.type = REQ_LOCATION;
+ } else if (name == "reqimage") {
+ if (debug)
+ printf(" Got request image message\n");
+ result.hdr.type = REQ_IMAGE;
+ } else {
+ fprintf(stderr, "Unknown message '%s'\n",mca->action);
+ }
+
+ return (result.hdr.type);
+}
+
+/**
+ * strip off the brackets so that we are compatable with the language
+ * syntax. We just replace them with spaces
+ */
+string Boeing::stripBraces(char const *msg)
+{
+ string s=msg;
+
+ // really nasty way of doing it...
+ char *cp;
+ for (cp=(char *)s.c_str(); cp && *cp; cp++) {
+ if (*cp=='(' || *cp==')')
+ *cp=' ';
+ }
+ return s;
+}
+
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.h
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/boeing_converter.h 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.h 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,30 +0,0 @@
-#ifndef __BOEING_CONVERTER_H__
-#define __BOEING_CONVERTER_H__
-
-#include <stdio.h>
-#include <string>
-#include <vector>
-#include "boeing_robot_packet.h"
-
-using std::string;
-using std::vector;
-
-namespace Boeing {
-
- //==== Conversion methods ===============================
-
- /** convert from an action message into one of the predefined
- command message packets. Returns the type of the message,
- or -1 on failure to match a message. The result is put in the
- union msgcmd
- */
- int convert(Boeing::MsgCmdAction *mcpa,Boeing::MsgCmd &result);
-
- /**
- * strip off the brackets so that we are compatable with the language
- * syntax. We just replace them with spaces
- */
- string stripBraces(char const *msg);
-};
-
-#endif
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.h (from rev 541, TeamTalk/Agents/boeingLib/boeing/boeing_converter.h)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.h (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_converter.h 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,30 @@
+#ifndef __BOEING_CONVERTER_H__
+#define __BOEING_CONVERTER_H__
+
+#include <stdio.h>
+#include <string>
+#include <vector>
+#include "boeing_robot_packet.h"
+
+using std::string;
+using std::vector;
+
+namespace Boeing {
+
+ //==== Conversion methods ===============================
+
+ /** convert from an action message into one of the predefined
+ command message packets. Returns the type of the message,
+ or -1 on failure to match a message. The result is put in the
+ union msgcmd
+ */
+ int convert(Boeing::MsgCmdAction *mcpa,Boeing::MsgCmd &result);
+
+ /**
+ * strip off the brackets so that we are compatable with the language
+ * syntax. We just replace them with spaces
+ */
+ string stripBraces(char const *msg);
+};
+
+#endif
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.cc
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/boeing_map_client.cc 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.cc 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,179 +0,0 @@
-#include <iostream>
-
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef WIN32
-#include <unistd.h>
-#endif
-
-#include "boeing_map_client.h"
-
-#include <udpsocket.h>
-#include <timer.h>
-
-using namespace Boeing;
-using namespace std;
-
-static const bool debug_flag = false;
-
-
-//=== Debugging ================================
-static void debug(char const *fmt,...)
-{
- if (debug_flag) {
- va_list ap;
- va_start(ap,fmt);
- printf("BOEING Map CLIENT: ");
- vprintf(fmt,ap);
- va_end(ap);
- }
-}
-
-MapClient::MapClient() {
- sock = new UDPSocket();
-}
-
-MapClient::~MapClient(){
- close();
- delete sock;
-}
-
-int MapClient::open(char const *h, int p)
-{
- sock->set(-1,-1);
-
- // open the socket
- if (sock->connectClient(h,p) <= 0) {
- fprintf(stderr, "ERROR: Cannot open client socket %s:%i\n", h,p);
- return false;
- }
- return true;
-}
-
-void MapClient::close()
-{
- debug("closing\n");
- sock->disconnect();
-}
-
-
-//=== Sending ==========================================
-
-bool MapClient::sendPacket(MsgHeader *msg)
-{
- if (!isConnected()) {
- printf("Not connected!\n");
- return false;
- }
-
- debug("Sending msg type %x len %i\n",msg->type,msg->len);
-
- // set time info
- msg->tstamp = Profiler::getTimeOfDay();
- sock->send(msg, msg->len);
-
- // return the status
- return (true);
-}
-
-bool MapClient::sendSubscribe(short invoice) {
- MsgMapReq msg;
-
- msg.type = MAP_SUBSCRIBE;
- msg.invoice = invoice;
- msg.len = sizeof(MsgMapReq);
-
- return sendPacket(&msg);
-}
-
-bool MapClient::sendUnsubscribe(short invoice) {
- MsgMapReq msg;
-
- msg.type = MAP_UNSUBSCRIBE;
- msg.invoice = invoice;
- msg.len = sizeof(MsgMapReq);
-
- return sendPacket(&msg);
-}
-
-bool MapClient::sendKeepAlive(short invoice) {
- MsgMapReq msg;
-
- msg.type = MAP_KEEPALIVE;
- msg.invoice = invoice;
- msg.len = sizeof(MsgMapReq);
-
- return sendPacket(&msg);
-}
-
-bool MapClient::sendAck(short invoice, int seq) {
- MsgMapReq msg;
-
- msg.type = MAP_ACK;
- msg.invoice = invoice;
- msg.seq = seq;
- msg.len = sizeof(MsgMapReq);
-
- return sendPacket(&msg);
-}
-
-//=== Receiving ======================================
-
-const MsgMapClient *MapClient::getNextMessage()
-{
- // block for something, then read your socket
-
- int fd;
- fd_set rfds;
- int retval;
-
- if (!isConnected()) {
- printf("WARNING: Not connected\n");
- return NULL;
- }
-
- fd = sock->getFD();
- FD_ZERO(&rfds);
- FD_SET(fd, &rfds);
- retval = select(fd+1,&rfds,NULL,NULL,NULL);
- if(retval < 0){
- fprintf(stderr, "ERROR: select(...) : %s\n",strerror(errno));
- return NULL;
- }
-
- // receive the header...
- int rv = sock->recv(rxdata.buff,sizeof(rxdata));
-
- debug("Got message rv %i, type %x len %u\n",rv,
- rxdata.hdr.type,rxdata.hdr.len);
-
- if (rv!=rxdata.hdr.len) {
- printf("WARNING: size mismatch! %i, but packet says %i\n",
- rv,rxdata.hdr.len);
- } else {
- sendAck(rxdata.map.invoice, rxdata.map.seq);
- cerr << "acked invoice " << rxdata.map.invoice << " seq " << rxdata.map.seq << endl;
- }
-
- if (0 && debug_flag) {
- printf("received = ");
- for (int i=0; i<rv; i++)
- printf("%x, ", (int) rxdata.buff[i] & 0xFF);
- printf("\n");
- }
-
- // should check the msg length matches what we got...
- return ((rv>0 && rv==rxdata.hdr.len) ? &rxdata : NULL);
-}
-
-int MapClient::isConnected(){
- return sock->isConnected();
-}
-
-int MapClient::getFD(){
- return sock->getFD();
-}
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.cc (from rev 541, TeamTalk/Agents/boeingLib/boeing/boeing_map_client.cc)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.cc (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.cc 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,179 @@
+#include <iostream>
+
+#include <math.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#include "boeing_map_client.h"
+
+#include <udpsocket.h>
+#include <timer.h>
+
+using namespace Boeing;
+using namespace std;
+
+static const bool debug_flag = false;
+
+
+//=== Debugging ================================
+static void debug(char const *fmt,...)
+{
+ if (debug_flag) {
+ va_list ap;
+ va_start(ap,fmt);
+ printf("BOEING Map CLIENT: ");
+ vprintf(fmt,ap);
+ va_end(ap);
+ }
+}
+
+MapClient::MapClient() {
+ sock = new UDPSocket();
+}
+
+MapClient::~MapClient(){
+ close();
+ delete sock;
+}
+
+int MapClient::open(char const *h, int p)
+{
+ sock->set(-1,-1);
+
+ // open the socket
+ if (sock->connectClient(h,p) <= 0) {
+ fprintf(stderr, "ERROR: Cannot open client socket %s:%i\n", h,p);
+ return false;
+ }
+ return true;
+}
+
+void MapClient::close()
+{
+ debug("closing\n");
+ sock->disconnect();
+}
+
+
+//=== Sending ==========================================
+
+bool MapClient::sendPacket(MsgHeader *msg)
+{
+ if (!isConnected()) {
+ printf("Not connected!\n");
+ return false;
+ }
+
+ debug("Sending msg type %x len %i\n",msg->type,msg->len);
+
+ // set time info
+ msg->tstamp = Profiler::getTimeOfDay();
+ sock->send(msg, msg->len);
+
+ // return the status
+ return (true);
+}
+
+bool MapClient::sendSubscribe(short invoice) {
+ MsgMapReq msg;
+
+ msg.type = MAP_SUBSCRIBE;
+ msg.invoice = invoice;
+ msg.len = sizeof(MsgMapReq);
+
+ return sendPacket(&msg);
+}
+
+bool MapClient::sendUnsubscribe(short invoice) {
+ MsgMapReq msg;
+
+ msg.type = MAP_UNSUBSCRIBE;
+ msg.invoice = invoice;
+ msg.len = sizeof(MsgMapReq);
+
+ return sendPacket(&msg);
+}
+
+bool MapClient::sendKeepAlive(short invoice) {
+ MsgMapReq msg;
+
+ msg.type = MAP_KEEPALIVE;
+ msg.invoice = invoice;
+ msg.len = sizeof(MsgMapReq);
+
+ return sendPacket(&msg);
+}
+
+bool MapClient::sendAck(short invoice, int seq) {
+ MsgMapReq msg;
+
+ msg.type = MAP_ACK;
+ msg.invoice = invoice;
+ msg.seq = seq;
+ msg.len = sizeof(MsgMapReq);
+
+ return sendPacket(&msg);
+}
+
+//=== Receiving ======================================
+
+const MsgMapClient *MapClient::getNextMessage()
+{
+ // block for something, then read your socket
+
+ int fd;
+ fd_set rfds;
+ int retval;
+
+ if (!isConnected()) {
+ printf("WARNING: Not connected\n");
+ return NULL;
+ }
+
+ fd = sock->getFD();
+ FD_ZERO(&rfds);
+ FD_SET(fd, &rfds);
+ retval = select(fd+1,&rfds,NULL,NULL,NULL);
+ if(retval < 0){
+ fprintf(stderr, "ERROR: select(...) : %s\n",strerror(errno));
+ return NULL;
+ }
+
+ // receive the header...
+ int rv = sock->recv(rxdata.buff,sizeof(rxdata));
+
+ debug("Got message rv %i, type %x len %u\n",rv,
+ rxdata.hdr.type,rxdata.hdr.len);
+
+ if (rv!=rxdata.hdr.len) {
+ printf("WARNING: size mismatch! %i, but packet says %i\n",
+ rv,rxdata.hdr.len);
+ } else {
+ sendAck(rxdata.map.invoice, rxdata.map.seq);
+ cerr << "acked invoice " << rxdata.map.invoice << " seq " << rxdata.map.seq << endl;
+ }
+
+ if (0 && debug_flag) {
+ printf("received = ");
+ for (int i=0; i<rv; i++)
+ printf("%x, ", (int) rxdata.buff[i] & 0xFF);
+ printf("\n");
+ }
+
+ // should check the msg length matches what we got...
+ return ((rv>0 && rv==rxdata.hdr.len) ? &rxdata : NULL);
+}
+
+int MapClient::isConnected(){
+ return sock->isConnected();
+}
+
+int MapClient::getFD(){
+ return sock->getFD();
+}
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.h
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/boeing_map_client.h 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.h 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,61 +0,0 @@
-/**
- Boeing Map client ==
-*/
-
-#ifndef __BOEING_MAP_CLIENT_H__
-#define __BOEING_MAP_CLIENT_H__
-
-#include <vector>
-#include <string>
-using std::vector;
-using std::string;
-
-#include "boeing_map_packet.h"
-
-class UDPSocket;
-
-// client class to manage UDP connections to robots
-namespace Boeing {
-
- class MapClient {
- private:
- UDPSocket *sock;
- MsgMapClient rxdata;
-
- public:
- //=== Initiialization ===================================
-
- // fill out any constructor/destructor info you need
- MapClient();
- ~MapClient();
-
- /// returns the target client number
- int open(char const *h, int p = MAP_PORT);
- void close();
-
- //=== Sending ==========================================
-
- bool sendSubscribe(short invoice);
- bool sendUnsubscribe(short invoice);
- bool sendKeepAlive(short invoice);
- bool sendAck(short invoice, int seq);
-
- //=== Receiving ======================================
-
- /** returns a pointer to the next received message.
- REturns NULL on failure. Sets the client to be
- the id of the sending client */
- const MsgMapClient *getNextMessage();
-
- int isConnected();
- int getFD();
-
- private:
- //=== Local methods ==========================
- // private method to actually send stuff out the socket
- bool sendPacket(MsgHeader *msg);
-
- };
-};
-
-#endif
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.h (from rev 541, TeamTalk/Agents/boeingLib/boeing/boeing_map_client.h)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.h (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_client.h 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,61 @@
+/**
+ Boeing Map client ==
+*/
+
+#ifndef __BOEING_MAP_CLIENT_H__
+#define __BOEING_MAP_CLIENT_H__
+
+#include <vector>
+#include <string>
+using std::vector;
+using std::string;
+
+#include "boeing_map_packet.h"
+
+class UDPSocket;
+
+// client class to manage UDP connections to robots
+namespace Boeing {
+
+ class MapClient {
+ private:
+ UDPSocket *sock;
+ MsgMapClient rxdata;
+
+ public:
+ //=== Initiialization ===================================
+
+ // fill out any constructor/destructor info you need
+ MapClient();
+ ~MapClient();
+
+ /// returns the target client number
+ int open(char const *h, int p = MAP_PORT);
+ void close();
+
+ //=== Sending ==========================================
+
+ bool sendSubscribe(short invoice);
+ bool sendUnsubscribe(short invoice);
+ bool sendKeepAlive(short invoice);
+ bool sendAck(short invoice, int seq);
+
+ //=== Receiving ======================================
+
+ /** returns a pointer to the next received message.
+ REturns NULL on failure. Sets the client to be
+ the id of the sending client */
+ const MsgMapClient *getNextMessage();
+
+ int isConnected();
+ int getFD();
+
+ private:
+ //=== Local methods ==========================
+ // private method to actually send stuff out the socket
+ bool sendPacket(MsgHeader *msg);
+
+ };
+};
+
+#endif
Deleted: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc
===================================================================
--- TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc 2006-11-08 15:54:45 UTC (rev 541)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc 2006-11-08 16:59:50 UTC (rev 542)
@@ -1,118 +0,0 @@
-#include <iostream>
-
-#include "boeing_map_packet.h"
-
-using namespace Boeing;
-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) {
- buf->invoice = invoice; buf->seq = seq;
- buf->x = x_in; buf->y = y_in;
- 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->encoding = encoding;
-}
-
-int MsgMap::getSize() const {
- switch(encoding) {
- case MAP_RLE:
- return sizeof(MsgMap)+sizeof(int)*(array_length-1);
- case MAP_RAW:
- case MAP_JPEG:
- return sizeof(MsgMap)-sizeof(int)+array_length;
- default:
- cerr << "unknown encoding" << endl;
- }
- return 0;
-}
-
-int MsgMap::getBuffSize() const {
- switch(encoding) {
- case MAP_RAW:
- case MAP_JPEG:
- return array_length;
- case MAP_RLE:
- return x*y;
- default: cerr << "unknown encoding" << endl;
- }
- return 0;
-}
-
-void MsgMap::unencodeMap(MapMsgEncoding encoding,
- unsigned char *raw_map,
- const unsigned char* compressed_map,
- int compressed_map_size) {
- switch(encoding) {
- case MAP_RAW:
- case MAP_JPEG:
- memcpy(raw_map, compressed_map, compressed_map_size);
- break;
- case MAP_RLE:
- unencodeMap_RLE(raw_map, compressed_map, compressed_map_size);
- break;
- default: cerr << "unknown encoding" << endl;
- }
-}
-
-void MsgMap::decode(unsigned char *raw_map) const {
- unencodeMap((MapMsgEncoding)encoding, raw_map, (const unsigned char *)map, array_length);
-}
-
-void MsgMap::unencodeMap_RLE(unsigned char *raw_map,
- const unsigned char* compressed_map,
- int compressed_map_size) {
- int j=0, k=0;
- for(int i=0; i<compressed_map_size; i++) {
- int run_length = (compressed_map[i]&0xFFFFFF00)>>8;
- char run_value = (char) (compressed_map[i]&0x000000FF);
- for(; j<k+run_length; j++) {
- raw_map[j] = run_value;
- }
- k=j;
- }
-}
-
-int MsgMap::encodeMap(MapMsgEncoding encoding,
- unsigned char *buf,
- const unsigned char* raw_map,
- unsigned int raw_map_size) {
- switch (encoding) {
- case MAP_RAW:
- case MAP_JPEG:
- memcpy(buf, raw_map, raw_map_size);
- return raw_map_size;
- case MAP_RLE:
- return encodeMap_RLE(buf, raw_map, raw_map_size);
- default:
- cerr << "unknown encoding: " << encoding << endl;
- }
- return -1;
-}
-
-//encode, returns the compressed map size
-int MsgMap::encodeMap_RLE(unsigned char *compressed_map,
- const unsigned char* raw_map,
- unsigned int raw_map_size) {
- if(!raw_map_size) { //odd, map has no area
- return 0;
- }
- unsigned int i=0;
- int run_length = 1;
- int run_value = raw_map[0];
- int *compressed_map_ = (int *)compressed_map;
- for(unsigned int j=1; j<raw_map_size; j++) {
- if(raw_map[j]!=run_value || run_length == MAX_RUNLENGTH) {
- compressed_map_[i++] =
- ((run_length<<8) | ((unsigned int)run_value & 0x000000FF));
- run_length = 1;
- run_value = raw_map[j];
- } else run_length++;
- }
- compressed_map_[i++] =
- ((run_length<<8) | ((unsigned int)run_value & 0x000000FF));
- return i;
-}
Copied: tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc (from rev 541, TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc)
===================================================================
--- tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc (rev 0)
+++ tags/BTH-0.1/TeamTalk/Agents/boeingLib/boeing/boeing_map_packet.cc 2006-11-08 16:59:50 UTC (rev 542)
@@ -0,0 +1,118 @@
+#include <iostream>
+
+#include "boeing_map_packet.h"
+
+using namespace Boeing;
+using namespace std;
+
+void MsgMap::MsgMapFactory(MapMsgEncoding encoding,
@@ Diff output truncated at 60000 characters. @@
More information about the TeamTalk-developers
mailing list