From bfrisch at edam.speech.cs.cmu.edu Mon Jul 2 22:40:05 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Mon, 2 Jul 2007 22:40:05 -0400 Subject: [TeamTalk 106]: [643] usarsim/Maps/DM-RoboticsLab_250.ut2: Updated Robotics Lab, Textures Now Are Perfect Colors.. Message-ID: <200707030240.l632e5nR019648@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070702/7ecc9aa1/attachment.html -------------- next part -------------- Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) From tk at edam.speech.cs.cmu.edu Tue Jul 3 23:10:40 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Tue, 3 Jul 2007 23:10:40 -0400 Subject: [TeamTalk 107]: [644] TeamTalk/Agents/TeamTalkBackend: Modified backend to use dynamic pythia for spawned processes Message-ID: <200707040310.l643Aevt025686@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070703/f8d89a57/attachment.html -------------- next part -------------- Modified: TeamTalk/Agents/TeamTalkBackend/TeamTalkBackend.vcproj =================================================================== --- TeamTalk/Agents/TeamTalkBackend/TeamTalkBackend.vcproj 2007-07-03 02:40:05 UTC (rev 643) +++ TeamTalk/Agents/TeamTalkBackend/TeamTalkBackend.vcproj 2007-07-04 03:10:39 UTC (rev 644) @@ -41,7 +41,7 @@ #include #include +#include + #include #include @@ -30,9 +32,10 @@ string cfilename = writeSpecializedConfig("TeamTalk-hub-desktop", "pgm", subs, uppername); - ostringstream args; - args << "-verbosity 3 -pgm_file " << cfilename; - serverChildren_.push(spawn(false, cfilename, ".", HUB, args.str()).hProcess); + ostringstream cmd, title; + cmd << HUB << " -verbosity 3 -pgm_file " << cfilename; + title << uppername << " Hub"; + Pythia::Message(cmd.str(), title.str()).send("localhost"); } void Agent::spawnHelios(const string& uppername) @@ -44,9 +47,10 @@ string cfilename = writeSpecializedConfig("helios", "cfg", subs, uppername); - ostringstream args; - args << "-port " << iHeliosPort << " -config " << cfilename; - serverChildren_.push(spawn(false, cfilename, ".", HELIOS, args.str()).hProcess); + ostringstream cmd, title; + cmd << HELIOS << " -port " << iHeliosPort << " -config " << cfilename; + title << uppername << " Helios"; + Pythia::Message(cmd.str(), title.str()).send("localhost"); } void Agent::spawnDM(const string& uppername, const string& safeness) @@ -72,9 +76,10 @@ writeSpecializedConfig("grounding", "policies", subs, uppername); string cfilename = writeSpecializedConfig("TeamTalkDM", "cfg", subs, uppername); - ostringstream args; - args << "-maxconns 6 -config " << cfilename; - serverChildren_.push(spawn(false, cfilename, ".", DM, args.str()).hProcess); + ostringstream cmd, title; + cmd << DM << " -maxconns 6 -config " << cfilename; + title << uppername << " DM"; + Pythia::Message(cmd.str(), title.str()).send("localhost"); } vector::iterator Agent::findMsgById(int taskid) { From tk at edam.speech.cs.cmu.edu Wed Jul 4 16:33:06 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Wed, 4 Jul 2007 16:33:06 -0400 Subject: [TeamTalk 108]: [645] TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config : 1) Removed column configuration in light of new Pythia configuration memory Message-ID: <200707042033.l64KX6TG028814@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070704/095f439a/attachment.html -------------- next part -------------- Modified: TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config =================================================================== --- TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config 2007-07-04 03:10:39 UTC (rev 644) +++ TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config 2007-07-04 20:33:05 UTC (rev 645) @@ -1,5 +1,3 @@ -NUM_DIVISIONS: 2 - EXPAND: $GC_HOME ..\..\ExternalLibraries\Galaxy EXPAND: $MITRE_ROOT $GC_HOME\contrib\MITRE EXPAND: $TEAMTALK ..\.. @@ -19,30 +17,39 @@ PROCESS: $JAVAEXE -classpath bsh-core-2.0b4.jar;bsh-util-2.0b4.jar;jiu.jar;dist/PenDecoder.jar;$MITRE_ROOT/bindings/java/lib/galaxy.jar edu.cmu.ravenclaw.pendecoder.PenDecoderServer -port 11002 -peerfile $CONFIGURATION\peerfile.txt PROCESS_WORKDIR: $PENDECODER +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: PenDecoder PROCESS: $BIN\KalliopeSwift.exe -maxconns 6 -config swift.cfg +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Kalliope PROCESS: $BIN\TeamTalkBackend.exe -verbosity 1 -maxconns 6 +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: TeamTalkBackend PROCESS: $PERL -I../Rosetta bin/TeamTalk PROCESS_WORKDIR: $NLG +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Rosetta PROCESS: $BIN\NlgServer2.exe -maxconns 6 -nlghost localhost +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: NLGServer PROCESS: $BIN\phoenix2.exe -maxconns 6 -grammardir $GRAMMAR -grammarfn $GRAMMAR\TeamTalk.net +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Phoenix PROCESS: $BIN\Audio_Server.exe -maxconns 6 -sps 16000 -engine_list sphinx_engines.txt +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Audio_Server PROCESS: $BIN\Sphinx_Engine -name male -argfn male-16khz.arg -port 9990 PROCESS_WORKDIR: $DECODER +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Sphinx_Male PROCESS: $GC_HOME\bin\x86-nt\HUB.exe -verbosity 3 -pgm_file TeamTalk-hub-desktop-skeleton.pgm +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Hub From tk at edam.speech.cs.cmu.edu Wed Jul 4 23:21:12 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Wed, 4 Jul 2007 23:21:12 -0400 Subject: [TeamTalk 109]: [646] TeamTalk/Agents: Fixed post-build copy problem with spaces in the path. Message-ID: <200707050321.l653LCq5029462@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070704/65e7c8fe/attachment.html -------------- next part -------------- Modified: TeamTalk/Agents/TeamTalkBackend/TeamTalkBackend.vcproj =================================================================== --- TeamTalk/Agents/TeamTalkBackend/TeamTalkBackend.vcproj 2007-07-04 20:33:05 UTC (rev 645) +++ TeamTalk/Agents/TeamTalkBackend/TeamTalkBackend.vcproj 2007-07-05 03:21:10 UTC (rev 646) @@ -95,7 +95,7 @@ /> Modified: TeamTalk/Agents/TeamTalkBackend/backendstub/backendstub.vcproj =================================================================== --- TeamTalk/Agents/TeamTalkBackend/backendstub/backendstub.vcproj 2007-07-04 20:33:05 UTC (rev 645) +++ TeamTalk/Agents/TeamTalkBackend/backendstub/backendstub.vcproj 2007-07-05 03:21:10 UTC (rev 646) @@ -95,7 +95,7 @@ /> Modified: TeamTalk/Agents/TeamTalkDM/TeamTalkDM.vcproj =================================================================== --- TeamTalk/Agents/TeamTalkDM/TeamTalkDM.vcproj 2007-07-04 20:33:05 UTC (rev 645) +++ TeamTalk/Agents/TeamTalkDM/TeamTalkDM.vcproj 2007-07-05 03:21:10 UTC (rev 646) @@ -100,7 +100,7 @@ /> From tk at edam.speech.cs.cmu.edu Fri Jul 6 21:54:18 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Fri, 6 Jul 2007 21:54:18 -0400 Subject: [TeamTalk 110]: [647] TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder: 1) removed some unnecessary casts Message-ID: <200707070154.l671sIhs008836@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070706/9906ea20/attachment.html -------------- next part -------------- Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java 2007-07-05 03:21:10 UTC (rev 646) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java 2007-07-07 01:54:16 UTC (rev 647) @@ -306,7 +306,7 @@ placedUncertaintyRing = move.createTransformedShape(uncertaintyRing); //set transparency of the bot and label based on the placement confidence - alpha = distance_uncertainty > 1000? 0: 1F-(float)distance_uncertainty/1000F; + alpha = distance_uncertainty > 1000? 0: 1F-distance_uncertainty/1000F; composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); } } Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java 2007-07-05 03:21:10 UTC (rev 646) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java 2007-07-07 01:54:16 UTC (rev 647) @@ -12,8 +12,7 @@ * @author tkharris */ -import com.sun.image.codec.jpeg.JPEGCodec; -import com.sun.image.codec.jpeg.JPEGImageDecoder; +import javax.imageio.ImageIO; import edu.cmu.ravenclaw.pendecoder.scribble3.MapBufferedImage; import java.io.*; import java.util.*; @@ -224,11 +223,12 @@ public GFrame serverOpImage(GFrame f) { GBinary gb = f.getBinary(":jpeg"); - JPEGImageDecoder codec = JPEGCodec.createJPEGDecoder(new ByteArrayInputStream(gb.getBytes())); try { - frame.image(codec.decodeAsBufferedImage()); + frame.image(ImageIO.read(new ByteArrayInputStream(gb.getBytes()))); } catch(java.io.IOException e) { System.err.println("problem decoding jpeg image"); + } catch(IllegalArgumentException e) { + System.err.println("problem decoding jpeg image"); } return (GFrame)null; } Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolyLineShape.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolyLineShape.java 2007-07-05 03:21:10 UTC (rev 646) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolyLineShape.java 2007-07-07 01:54:16 UTC (rev 647) @@ -44,7 +44,6 @@ public void draw(Graphics2D g) { //System.err.println("drawing polyline"); if(vertecies.isEmpty()) return; - Graphics2D g2 = (Graphics2D)g; if (color != null) { g.setColor(color); } @@ -72,7 +71,6 @@ public void draw(Graphics2D g, Point last) { if(vertecies.isEmpty()) return; - Graphics2D g2 = (Graphics2D)g; if (color != null) { g.setColor(color); } Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolygonShape.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolygonShape.java 2007-07-05 03:21:10 UTC (rev 646) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PolygonShape.java 2007-07-07 01:54:16 UTC (rev 647) @@ -16,7 +16,6 @@ } public void draw(Graphics2D g) { - Graphics2D g2 = (Graphics2D)g; if (color != null) { g.setColor(color); } @@ -31,7 +30,6 @@ } public void draw(Graphics2D g, Point last) { - Graphics2D g2 = (Graphics2D)g; if (color != null) { g.setColor(color); } Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/RectangleShape.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/RectangleShape.java 2007-07-05 03:21:10 UTC (rev 646) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/RectangleShape.java 2007-07-07 01:54:16 UTC (rev 647) @@ -5,7 +5,6 @@ public class RectangleShape extends TwoEndsShape { public void draw(Graphics2D g) { - Graphics2D g2 = (Graphics2D)g; int x = (int) Math.min(start.getX(), end.getX()); int y = (int) Math.min(start.getY(), end.getY()); int w = (int) Math.abs(start.getX() - end.getX()); Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java 2007-07-05 03:21:10 UTC (rev 646) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java 2007-07-07 01:54:16 UTC (rev 647) @@ -32,7 +32,7 @@ public AbstractDecoderTool getTool(int i) { if (i >= 0 && i < tools.size()) { - return (AbstractDecoderTool) tools.get(i); + return tools.get(i); } return null; } @@ -40,7 +40,7 @@ public AbstractDecoderTool findTool(String name) { if (name != null) { for (int i = 0; i < tools.size(); i++) { - AbstractDecoderTool tool = (AbstractDecoderTool) tools.get(i); + AbstractDecoderTool tool = tools.get(i); if (name.equals(tool.getName())) { return tool; } From bfrisch at edam.speech.cs.cmu.edu Mon Jul 9 20:40:28 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Mon, 9 Jul 2007 20:40:28 -0400 Subject: [TeamTalk 111]: [648] 1) Robots moved to new starting position near table in room with garage door. Message-ID: <200707100040.l6A0eSxs025968@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070709/4c40ab0e/attachment.html -------------- next part -------------- Modified: moast-bth/moast/etc/moast.ini =================================================================== --- moast-bth/moast/etc/moast.ini 2007-07-07 01:54:16 UTC (rev 647) +++ moast-bth/moast/etc/moast.ini 2007-07-10 00:40:26 UTC (rev 648) @@ -308,6 +308,15 @@ UTM_START_POSE_1 = -5.5 3.5 1.7 0.0 0.0 0 UTM_START_POSE_2 = -1.7 -3.29 1.7 0.0 0.0 0 +[DM-USAR_yellow_250] +UNREAL_UTM_OFFSET = 0. 0. 0 +RESOLUTION = 0.01905 +UTM_LETTER = N +UTM_ZONE = 18 +UTM_START_POSE_COUNT = 2 +UTM_START_POSE_1 = -5.5 3.5 1.7 0.0 0.0 0 +UTM_START_POSE_2 = -1.7 -3.29 1.7 0.0 0.0 0 + [DM-TestRoom_250] UNREAL_UTM_OFFSET = 10 10 10 RESOLUTION = 0.01905 @@ -372,10 +381,10 @@ UTM_LETTER = N UTM_ZONE = 18 UTM_START_POSE_COUNT = 2 -UTM_START_POSE_1 = 0. 0. -1. 0. 0. 0. -#UTM_START_POSE_2 = 3.63 10.8 -.446 0 0 0 -UTM_START_POSE_2 = 1. 1. -1. 0. 0. 0. +UTM_START_POSE_1 = 25.0 6.5 -1. 0. 0. 0. +UTM_START_POSE_2 = 25.0 7.5 -1. 0. 0. 0. + [DM-TallTestWorld_250] UNREAL_UTM_OFFSET = 0. 0. 0 RESOLUTION = 0.01905 Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) From tk at edam.speech.cs.cmu.edu Wed Jul 11 12:23:32 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Wed, 11 Jul 2007 12:23:32 -0400 Subject: [TeamTalk 112]: [649] usarsim: 1) imported updates from usarsim to bring system current, to use, get latest (3.14) required base files and recompile Message-ID: <200707111623.l6BGNWId008201@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070711/ad441e21/attachment-0001.html -------------- next part -------------- Added: usarsim/System/Makefile =================================================================== --- usarsim/System/Makefile (rev 0) +++ usarsim/System/Makefile 2007-07-11 16:23:30 UTC (rev 649) @@ -0,0 +1,34 @@ +LINUX_DIR=../../ut2004-linux/ + +MAPS=$(LINUX_DIR)/Maps/DM-RoboticsLab_250.ut2 + +PACKAGES=$(LINUX_DIR)/System/USARBotAPI.u \ + $(LINUX_DIR)/System/USARBot.u \ + $(LINUX_DIR)/System/USARMisPkg.u \ + $(LINUX_DIR)/System/USARModels.u \ + $(LINUX_DIR)/System/USARVictims.u \ + $(LINUX_DIR)/System/TreasureHunt.u + +INIS=$(LINUX_DIR)/System/USARSim.ini + +BATCH=$(LINUX_DIR)/System/usar_sx.sh + +all: ucc $(MAPS) $(PACKAGES) $(INIS) $(BATCH) + +ucc: + wine UCC.exe make -ini=USARSim.ini + +$(LINUX_DIR)/Maps/%.ut2:../Maps/%.ut2 + cp -f $< $@ + +$(LINUX_DIR)/System/%.u:%.u + cp -f $< $@ + +$(LINUX_DIR)/System/%.ini:%.ini + cp -f $< $@ + +$(LINUX_DIR)/System/%.sh:%.sh + cp -f $< $@ + + + Modified: usarsim/System/USARSim.ini =================================================================== --- usarsim/System/USARSim.ini 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/System/USARSim.ini 2007-07-11 16:23:30 UTC (rev 649) @@ -100,23 +100,13 @@ ServerPackages=XWeapons ServerPackages=XInterface ServerPackages=Vehicles -ServerPackages=TeamSymbols_UT2003 -ServerPackages=TeamSymbols_UT2004 -ServerPackages=BonusPack -ServerPackages=SkaarjPack_rc -ServerPackages=SkaarjPack -ServerPackages=UTClassic -ServerPackages=UT2k4Assault -ServerPackages=Onslaught ServerPackages=GUI2K4 -ServerPackages=UT2k4AssaultFull -ServerPackages=OnslaughtFull -ServerPackages=xVoting ServerPackages=USARBotAPI ServerPackages=USARBot ServerPackages=USARModels ServerPackages=USARMisPkg ServerPackages=USARVictims +ServerPackages=TreasureHunt UseStaticMeshBatching=True ColorHighDetailMeshes=False ColorSlowCollisionMeshes=False @@ -469,16 +459,7 @@ EditPackages=XAdmin EditPackages=XWebAdmin EditPackages=Vehicles -EditPackages=BonusPack -EditPackages=SkaarjPack_rc -EditPackages=SkaarjPack -EditPackages=UTClassic -EditPackages=UT2k4Assault -EditPackages=Onslaught EditPackages=GUI2K4 -EditPackages=UT2k4AssaultFull -EditPackages=OnslaughtFull -EditPackages=xVoting EditPackages=StreamlineFX EditPackages=UTV2004c EditPackages=UTV2004s @@ -487,6 +468,7 @@ EditPackages=USARModels EditPackages=USARMisPkg EditPackages=USARVictims +EditPackages=TreasureHunt CutdownPackages=Core CutdownPackages=Editor CutdownPackages=Engine @@ -518,8 +500,8 @@ ApplicationPaths[0]=/ServerAdmin Applications[1]=xWebAdmin.UTImageServer ApplicationPaths[1]=/images -bEnabled=False -ListenPort=80 +bEnabled=True +ListenPort=8080 [Engine.Console] ConsoleHotKey=9 Modified: usarsim/System/make.bat =================================================================== --- usarsim/System/make.bat 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/System/make.bat 2007-07-11 16:23:30 UTC (rev 649) @@ -3,5 +3,6 @@ IF EXIST USARModels.u move /Y USARModels.u USARModelsu.bak IF EXIST USARVictims.u move /Y USARVictims.u USARVictimsu.bak IF EXIST USARMisPkg.u move /Y USARMisPkg.u USARMisPkgu.bak +IF EXIST TreasureHunt.u move /Y TreasureHunt.u TreasureHuntu.bak ucc make -ini=USARSim.ini pause Deleted: usarsim/System/make.csh =================================================================== --- usarsim/System/make.csh 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/System/make.csh 2007-07-11 16:23:30 UTC (rev 649) @@ -1,18 +0,0 @@ -#!/bin/sh - -LINUX_DIR=../../ut2004-linux/System - -touch mark -mv USARBotAPI.u USARBotAPI.u.bak -mv USARBot.u USARBot.u.bak -mv USARModels.u USARModels.u.bak -mv USARVictims.u USARVictims.u.bak -mv USARMisPkg.u USARMisPkg.u.bak -wine UCC.exe make -ini=USARSim.ini - -for file in `find . -type f -newer mark | grep -v "bak$"` -do -echo "Got new file $file" -mv -f $LINUX_DIR/$file $LINUX_DIR/$file.bak -cp $file $LINUX_DIR/$file -done Modified: usarsim/System/usar_sx.bat =================================================================== --- usarsim/System/usar_sx.bat 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/System/usar_sx.bat 2007-07-11 16:23:30 UTC (rev 649) @@ -1,2 +1,2 @@ -ucc server %1%?game=USARBot.USARDeathMatch?TimeLimit=0?GameStats=False -ini=USARSim.ini -log=usar_server.log +ucc server %1%?game=TreasureHunt.TreasureHuntGame?TimeLimit=0?GameStats=False?AdminName=admin?AdminPassword=findT -ini=USARSim.ini -log=usar_server.log pause Deleted: usarsim/System/usar_sx.csh =================================================================== --- usarsim/System/usar_sx.csh 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/System/usar_sx.csh 2007-07-11 16:23:30 UTC (rev 649) @@ -1,3 +0,0 @@ -#!/usr/local/bin/tcsh - -./ucc-bin server $1?game=USARBot.USARDeathMatch?TimeLimit=0?GameStats=False -ini=USARSim.ini -log=usar_server.log Copied: usarsim/System/usar_sx.sh (from rev 646, usarsim/System/usar_sx.csh) =================================================================== --- usarsim/System/usar_sx.sh (rev 0) +++ usarsim/System/usar_sx.sh 2007-07-11 16:23:30 UTC (rev 649) @@ -0,0 +1,3 @@ +#!/bin/bash + +./ucc-bin server $1?game=TreasureHunt.TreasureHuntGame?TimeLimit=0?GameStats=False?AdminName=admin?AdminPassword=findT -ini=USARSim.ini -log=usar_server.log -nohomedir Modified: usarsim/Tools/ImageSrv/ImageSrvDlg.cpp =================================================================== --- usarsim/Tools/ImageSrv/ImageSrvDlg.cpp 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/Tools/ImageSrv/ImageSrvDlg.cpp 2007-07-11 16:23:30 UTC (rev 649) @@ -23,7 +23,7 @@ #define UTCAPP "ut2004.exe" #define DLLFILE "Hook.dll" #define UTWND FindWindow(NULL,"Unreal Tournament 2004") -#define UTCCMD "?spectatoronly=1?TimeLimit=0?quickstart=true -ini=usarsim.ini" //Client +#define UTCCMD "?spectatoronly=1?game=USARBot.USARDeathMatch?TimeLimit=0?quickstart=true -ini=usarsim.ini" //Client #define UTSCMD "?spectatoronly=1?quickstart=true -ini=usarsim.ini" //Server #define UT_ADDRESS "127.0.0.1" Modified: usarsim/Tools/Usar_UI/USARRoute.cpp =================================================================== --- usarsim/Tools/Usar_UI/USARRoute.cpp 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/Tools/Usar_UI/USARRoute.cpp 2007-07-11 16:23:30 UTC (rev 649) @@ -70,8 +70,8 @@ GetClientRect(&rect); m_OffsetX=(rect.right+rect.left)/2; m_OffsetY=(rect.bottom+rect.top)/2; - m_ScaleX=0.2; - m_ScaleY=0.2; + m_ScaleX=0.2f; + m_ScaleY=0.2f; m_Data=NULL; return true; } Modified: usarsim/Tools/Usar_UI/UsarDlg.cpp =================================================================== --- usarsim/Tools/Usar_UI/UsarDlg.cpp 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/Tools/Usar_UI/UsarDlg.cpp 2007-07-11 16:23:30 UTC (rev 649) @@ -1,754 +1,770 @@ -// UsarDlg.cpp : implementation file -// -#include "stdafx.h" -#include "Usar.h" -#include "UsarDlg.h" -#include "USARSocket.h" -#include "USARRoute.h" -#include "MessagePanel.h" -#include "MessageParser.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -#define PORTNUM 3000 -#define MSGLINES 1000 -#define POINTSNUM 10000 - -int MaxMsg=256; -BOOL bLOCK=false; - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - -// Dialog Data - //{{AFX_DATA(CAboutDlg) - enum { IDD = IDD_ABOUTBOX }; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CAboutDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - //{{AFX_MSG(CAboutDlg) - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ - //{{AFX_DATA_INIT(CAboutDlg) - //}}AFX_DATA_INIT -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CAboutDlg) - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) - //{{AFX_MSG_MAP(CAboutDlg) - // No message handlers - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUsarDlg dialog - -CUsarDlg::CUsarDlg(CWnd* pParent /*=NULL*/) - : CDialog(CUsarDlg::IDD, pParent) -{ - //{{AFX_DATA_INIT(CUsarDlg) - m_Server = _T(""); - m_Location = _T(""); - m_Rotation = _T(""); - m_Time = _T(""); - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); - m_Control = false; - m_arOut = NULL; - m_arIn = NULL; -} - -void CUsarDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CUsarDlg) - DDX_Control(pDX, IDC_TAB1, m_Table); - DDX_Control(pDX, IDC_COMBO1, m_Command); - DDX_Control(pDX, IDC_BUTTON2, m_Send); - DDX_Control(pDX, IDC_BUTTON1, m_Connect); - DDX_Control(pDX, IDC_LIST1, m_Msg); - DDX_Text(pDX, IDC_EDIT1, m_Server); - DDX_Text(pDX, IDC_EDIT2, m_Location); - DDX_Text(pDX, IDC_EDIT3, m_Rotation); - DDX_Text(pDX, IDC_EDIT4, m_Time); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CUsarDlg, CDialog) - //{{AFX_MSG_MAP(CUsarDlg) - ON_WM_SYSCOMMAND() - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - ON_BN_CLICKED(IDC_BUTTON1, OnConnect) - ON_BN_CLICKED(IDC_BUTTON2, OnSend) - ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1) - ON_BN_CLICKED(IDC_BUTTON3, OnControl) - ON_BN_CLICKED(IDC_BUTTON4, OnZoomIn) - ON_BN_CLICKED(IDC_BUTTON5, OnZoomOut) - ON_BN_CLICKED(IDC_BUTTON7, OnOriginal) - ON_BN_CLICKED(IDC_BUTTON6, OnClear) - ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CUsarDlg message handlers - -BOOL CUsarDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // Add "About..." menu item to system menu. - - // IDM_ABOUTBOX must be in the system command range. - ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); - ASSERT(IDM_ABOUTBOX < 0xF000); - - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - CString strAboutMenu; - strAboutMenu.LoadString(IDS_ABOUTBOX); - if (!strAboutMenu.IsEmpty()) - { - pSysMenu->AppendMenu(MF_SEPARATOR); - pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); - } - } - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - // TODO: Add extra initialization here - m_Server = "localhost"; - m_Command.LimitText(128); - //m_arIn = NULL; - //m_arOut = NULL; - m_Socket = new USARSocket(this); - - //m_Control = false; - - m_CachedMove.vx=0.001f; - m_CachedMove.vy=0.001f; - m_CachedMove.rx=-1; - m_CachedMove.cx=0.001f; - m_CachedMove.cy=0.001f; - m_CachedMove.cz=0.001f; - - memset(&m_Joyinfo,0,sizeof(JOYINFOEX)); - m_Joyinfo.dwSize = sizeof(JOYINFOEX); - m_Joyinfo.dwFlags = JOY_RETURNPOV | JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ | JOY_RETURNR; - - m_Table.Init(); - m_finishTime = clock(); - - UpdateData(false); - return TRUE; // return TRUE unless you set the focus to a control -} - -void CUsarDlg::OnSysCommand(UINT nID, LPARAM lParam) -{ - if ((nID & 0xFFF0) == IDM_ABOUTBOX) - { - CAboutDlg dlgAbout; - dlgAbout.DoModal(); - } - else - { - CDialog::OnSysCommand(nID, lParam); - } -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CUsarDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CUsarDlg::OnQueryDragIcon() -{ - return (HCURSOR) m_hIcon; -} - -void CUsarDlg::OnConnect() -{ - // TODO: Add your control notification handler code here - UpdateData(); - if (m_arOut==NULL) { - if (!m_Socket->Create()) { - MessageBox("Can't create socket","Socket",MB_OK); - return; - } - if (!m_Socket->Connect(m_Server,PORTNUM)) { - MessageBox("Can't connect to server","Connect",MB_OK); - m_Socket->Close(); - return; - } - m_File = new CSocketFile(m_Socket); - m_arIn = new CArchive(m_File, CArchive::load); - m_arOut = new CArchive(m_File, CArchive::store); - m_Connect.SetWindowText("Disconnect"); - InitZoom(); - m_Send.EnableWindow(true); - //if (m_HasJoystick) - GetDlgItem(IDC_BUTTON3)->EnableWindow(true); - //clear data - m_Movement.raw.RemoveAll(); - m_Movement.points.RemoveAll(); - //CString str; - //m_arIn->ReadString(str); - //m_Msg.AddString(str); - } - else { - if (m_arIn!=NULL) { - delete m_arIn; - m_arIn=NULL; - } - delete m_arOut; - m_arOut=NULL; - delete m_File; - m_File=NULL; - m_Socket->Close(); - m_Connect.SetWindowText("Connect"); - m_Send.EnableWindow(false); - GetDlgItem(IDC_BUTTON3)->EnableWindow(false); - } -} - -void CUsarDlg::OnSend() -{ - // TODO: Add your control notification handler code here - CString str; - if (m_arOut==NULL) return; - m_Command.GetWindowText(str); - m_Command.InsertString(0,str); - try { - m_arOut->WriteString(str); - m_arOut->WriteString("\r\n"); - m_arOut->Flush(); - }catch (CException* e) { - e->Delete(); - MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); - exit(1); - } -} - -void CUsarDlg::OnSelchangeCombo1() -{ - // TODO: Add your control notification handler code here - CString str; - int i = m_Command.GetCurSel(); - m_Command.GetLBText(i,str); - m_Command.SetWindowText(str); -} - -void CUsarDlg::ProcessPendingRead() -{ - // TODO: Add your message handler code here and/or call default - CString str; - int tmp,process=1; - - do { - m_arIn->ReadString(str); - m_Msg.InsertString(0,str); - if (m_Msg.GetCount()>=MSGLINES) - m_Msg.DeleteString(MSGLINES); - tmp = str.GetLength()*6; - if (tmp>MaxMsg) { - MaxMsg = tmp; - m_Msg.SetHorizontalExtent(tmp); - } - // If we get more than one STA message, we possibly have heavy traffic. - // So we discard all the messages after the second STA message to - // empty the queue. - if (str.Find("STA")==0) { - if (process==1) process=2; - else if (process==2) process=0; - } - if (process) ProcessMessage(str); - - }while(!m_arIn->IsBufferEmpty()); - - UpdateData(false); - Sleep(5); -} - -void CUsarDlg::ProcessMessage(CString str) -{ - int p1,p2; - //Robot state - if (str.Find("STA")==0 || str.Find("{Type GroundTruth}")>0) { - p1 = str.Find("{Time"); - if (p1>0) { - p1 += 5; - p2 = str.Find("}",p1); - m_Time = str.Mid(p1,p2-p1); - } - p1 = str.Find("{Location",p2); - if (p1>0) { - p1 += 9; - p2 = str.Find("}",p1); - m_Location = str.Mid(p1,p2-p1); - } - p1 = str.Find("{Orientation",p2); - if (p1>0) { - p1 += 12; - p2 = str.Find("}",p1); - m_Rotation = str.Mid(p1,p2-p1); - } - AddPoint(m_Location,m_Rotation); - return; - } -} - -void CUsarDlg::OnControl() -{ - // TODO: Add your control notification handler code here - if (!m_Control) { - GetDlgItem(IDC_BUTTON3)->SetWindowText("&Control"); - SetCapture(); - m_Control=true; - int srcWidth = GetSystemMetrics(SM_CXSCREEN)-25; - int srcHeight = GetSystemMetrics(SM_CYSCREEN)-25; - GetWindowRect(&m_winPos); - RECT tmp; - tmp.left = m_winPos.left>25?m_winPos.left:25; - tmp.right = m_winPos.right25?m_winPos.top:25; - tmp.bottom = m_winPos.bottomSetWindowText("&Command"); - m_Control=false; - ReleaseCapture(); - } -} - -LRESULT CUsarDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) -{ - // TODO: Add your specialized code here and/or call the base class - switch(message) - { - case WM_CREATE: - /* Capture the joystick. If this fails, beep and display - * error. - */ - if(joySetCapture(m_hWnd, JOYSTICKID1, 0, FALSE)) - { - MessageBeep(MB_ICONEXCLAMATION); - MessageBox("Couldn't capture the joystick", NULL, MB_OK | MB_ICONEXCLAMATION); - m_HasJoystick = false; - //return -1; - } - else m_HasJoystick = true; - break; - - case MM_JOY1MOVE : - //if (m_Control) Rotate(lParam); - /*if (m_Control)*/ Move(); - break; - case WM_RBUTTONDOWN: - if (m_arOut!=NULL) OnControl(); - break; - case WM_ACTIVATE: - if (LOWORD(wParam)==WA_INACTIVE) - ReleaseCapture(); - else if (m_Control && m_arOut!=NULL) - SetCapture(); - break; - case WM_DESTROY: - /* We're shutting down. Release capture on the joystick, - * make sure any sounds that are playing are stopped. - */ - if (m_HasJoystick) joyReleaseCapture(JOYSTICKID1); - PostQuitMessage(0); - break; - } - return CDialog::WindowProc(message, wParam, lParam); -} - -BOOL CUsarDlg::PreTranslateMessage(MSG* pMsg) -{ - // TODO: Add your specialized code here and/or call the base class - int processed; - if (!m_Control) return CDialog::PreTranslateMessage(pMsg); - switch(pMsg->message) { - case WM_KEYDOWN: - processed=KMove(pMsg->wParam,pMsg->lParam,1); - break; - case WM_KEYUP: - processed=KMove(pMsg->wParam,pMsg->lParam,0); - break; - case WM_MOUSEMOVE: - processed=KMove(pMsg->wParam,pMsg->lParam,2); - break; - default: - processed=0; - } - if (processed) return true; - else { - if (pMsg->message!=WM_MOUSEMOVE&&(m_pitchAmount!=0||m_yawAmount!=0)) { - SYSTEMTIME systime; - GetSystemTime(&systime); - if ((systime.wMilliseconds-m_systime.wMilliseconds)>0.1) { - m_pitchAmount=0; - m_yawAmount=0; - CString str="CAMERA {Rotation 0,0,0}\r\n"; - //m_Msg.InsertString(0,str); - if (m_arOut!=NULL) { - try { - m_arOut->WriteString(str); - m_arOut->Flush(); - }catch (CException* e) { - e->Delete(); - MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); - exit(1); - } - } - Sleep(50); - } - } - return CDialog::PreTranslateMessage(pMsg); - } -} - -int CUsarDlg::KMove(WPARAM wParam, LPARAM lParam, int type) -{ - CString str; - int processed=1; - int x,y; - switch(wParam) { - case VK_LEFT: - m_turnAmount=type?m_turnAmount+0.2f:0.0f; - m_turnAmount=(m_turnAmount>20.0f)?20.0f:m_turnAmount; - str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",-m_turnAmount,m_turnAmount); - break; - case VK_RIGHT: - m_turnAmount=type?m_turnAmount+0.2f:0.0f; - m_turnAmount=(m_turnAmount>20.0f)?20.0f:m_turnAmount; - str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",m_turnAmount,-m_turnAmount); - break; - case VK_UP: - m_moveAmount=type?m_moveAmount+0.2f:0.0f; - m_moveAmount=(m_moveAmount>20.0f)?20.0f:m_moveAmount; - str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",m_moveAmount,m_moveAmount); - break; - case VK_DOWN: - m_moveAmount=type?m_moveAmount+0.2f:0.0f; - m_moveAmount=(m_moveAmount>20.0f)?20.0f:m_moveAmount; - str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",-m_moveAmount,-m_moveAmount); - break; - case VK_RETURN: - case VK_ESCAPE: - break; - default: - processed=0; - } - if (m_arOut!=NULL&&str.GetLength()>1) { - try { - m_arOut->WriteString(str); - m_arOut->Flush(); - }catch (CException* e) { - e->Delete(); - MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); - exit(1); - } - } - - if (type==2) { - x=LOWORD(lParam); - y=HIWORD(lParam); - //str.Format("Mouse x=%d y=%d W=%d H=%d",x,y,m_winWidth,m_winHeight); - //m_Msg.InsertString(0,str); - if ((x>m_winRange.left)&&(xm_winRange.top)&&(y0.08f) m_pitchAmount=0.08f; - if (m_pitchAmount<-0.08f) m_pitchAmount=-0.08f; - m_yawAmount=(x-m_oldMX)*0.02f; - if (m_yawAmount>0.08f) m_yawAmount=0.08f; - if (m_yawAmount<-0.08f) m_yawAmount=-0.08f; - m_oldMX=x; - m_oldMY=y; - str.Format("CAMERA {Rotation 0,%f,%f}\r\n",m_pitchAmount,m_yawAmount); - if (m_arOut!=NULL) { - try { - m_arOut->WriteString(str); - m_arOut->Flush(); - }catch (CException* e) { - e->Delete(); - MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); - exit(1); - } - } - GetSystemTime(&m_systime); - } - else - SetCursorPos((m_winPos.left+m_winPos.right)/2,(m_winPos.top+m_winPos.bottom)/2); - - } - return processed; -} - -void CUsarDlg::Move() -{ - CString str,tmp; - WORD x,y,pov; - float rx,ry,rz,d; - float vx,vy,vz; - - rx = 0; ry = 0; rz = 0; - //ry = m_Movement.c_Rotation.y; - vx =0; vy = 0; vz = 0; - d = 0; - - joyGetPosEx(JOYSTICKID1, &m_Joyinfo); - - // Trun left/right - x = LOWORD(m_Joyinfo.dwXpos) >> 11; - if (x <= 11) vx = (x - 12)/0.6f; - else if (x >= 20) vx = (x - 19)/0.6f; - - // Move forward/backward - y = LOWORD(m_Joyinfo.dwYpos) >> 11; - if (y <= 11) vy = (y - 12)/0.6f; - else if (y >= 20) vy = (y - 19)/0.6f; - - if (vx!=m_CachedMove.vx||vy!=m_CachedMove.vy) { - m_CachedMove.vx = vx; - m_CachedMove.vy = vy; - str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",vx-vy,-vy-vx); - //m_Msg.InsertString(0,str); - } - - // View pitch & yaw - pov = LOWORD(m_Joyinfo.dwPOV); - rx=0;ry=0;rz=0; - if (pov<36000) { - d = pov*3.1415926f/18000; - ry=(float)(0.006*cos(d)); - rz=(float)(0.006*sin(d)); - } - rx=0; - - if (rx!=m_CachedMove.cx || m_CachedMove.cx!=0 || - ry!=m_CachedMove.cy || m_CachedMove.cy!=0 || - rz!=m_CachedMove.cz || m_CachedMove.cy!=0) { - m_CachedMove.cx = rx; - m_CachedMove.cy = ry; - m_CachedMove.cz = rz; - tmp.Format("CAMERA {Rotation %f,%f,%f}\r\n",rx,ry,rz); - //m_Msg.InsertString(0,tmp); - str+=tmp; - } - - if (m_arOut!=NULL&&str.GetLength()>1) { - try { - m_arOut->WriteString(str); - m_arOut->Flush(); - }catch (CException* e) { - e->Delete(); - MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); - exit(1); - } - } - /* - str.Format("X=%d %d Y=%d %d Z=%d %d R=%d POV=%d %d", - m_Joyinfo.dwXpos,x, - m_Joyinfo.dwYpos,y, - m_Joyinfo.dwZpos,0, - m_Joyinfo.dwRpos, - m_Joyinfo.dwPOV,pov); - - m_Msg.InsertString(0,str); - */ -} - -void CUsarDlg::AddPoint(CString Location, CString Rotation) -{ - int x0,y0,z0; - int x,y,z; - int p1,p2; - - if (bLOCK) return; - p1 = Location.Find(','); - p2 = Location.Find(',',p1+1); - x0 = (int)(-atof((LPCSTR)Location.Left(p1))*500); - x = (int)((float)x0*m_Zoom.scaleX+m_Zoom.offsetX); - y0 = (int)(-atof((LPCSTR)Location.Mid(p1+1,p2-p1))*500); - y = (int)((float)y0*m_Zoom.scaleY+m_Zoom.offsetY); - z0 = (int)(atof((LPCSTR)Location.Mid(p2+1))*500); - if (m_Movement.c_Location.x!=x0||m_Movement.c_Location.y!=y0||m_Movement.points.GetSize()==0) { - m_Movement.c_Location.x=x; - m_Movement.c_Location.y=y; - m_Movement.points.Add(m_Movement.c_Location); - m_Movement.c_Location.x=x0; - m_Movement.c_Location.y=y0; - m_Movement.raw.Add(m_Movement.c_Location); - m_Movement.z = z0; - m_Table.DrawPoint(&m_Movement); - } - - p1 = Rotation.Find(','); - p2 = Rotation.Find(',',p1+1); - z = (int)(atof((LPCSTR)Rotation.Left(p1))*10430.37835); - x = (int)(atof((LPCSTR)Rotation.Mid(p1+1,p2-p1))*10430.37835); - y = (int)(atof((LPCSTR)Rotation.Mid(p2+1))*10430.37835); - if (m_Movement.c_Rotation.x!=x||m_Movement.c_Rotation.y!=y||m_Movement.points.GetSize()==0) { - m_Movement.c_Rotation.x=x; - m_Movement.c_Rotation.y=y; - m_Table.DrawPoint(&m_Movement); - } - if (m_Movement.points.GetSize()>=POINTSNUM) m_Movement.points.RemoveAt(0); - if (m_Movement.raw.GetSize()>=POINTSNUM) m_Movement.raw.RemoveAt(0); -} - -void CUsarDlg::InitZoom() -{ - USARRoute * ur; - ur = ((USARRoute *)m_Table.m_tabPages[m_Table.m_tabCurrent]); - m_Zoom.offsetX = ur->m_OffsetX; - m_Zoom.offsetY = ur->m_OffsetY; - m_Zoom.scaleX = ur->m_ScaleX; - m_Zoom.scaleY = ur->m_ScaleY; -} - - -void CUsarDlg::UpdatePoints() -{ - POINT p; - int n = m_Movement.points.GetSize(); - for (int i=0;iLoadIcon(IDR_MAINFRAME); + m_Control = false; + m_arOut = NULL; + m_arIn = NULL; +} + +void CUsarDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CUsarDlg) + DDX_Control(pDX, IDC_TAB1, m_Table); + DDX_Control(pDX, IDC_COMBO1, m_Command); + DDX_Control(pDX, IDC_BUTTON2, m_Send); + DDX_Control(pDX, IDC_BUTTON1, m_Connect); + DDX_Control(pDX, IDC_LIST1, m_Msg); + DDX_Text(pDX, IDC_EDIT1, m_Server); + DDX_Text(pDX, IDC_EDIT2, m_Location); + DDX_Text(pDX, IDC_EDIT3, m_Rotation); + DDX_Text(pDX, IDC_EDIT4, m_Time); + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CUsarDlg, CDialog) + //{{AFX_MSG_MAP(CUsarDlg) + ON_WM_SYSCOMMAND() + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_BUTTON1, OnConnect) + ON_BN_CLICKED(IDC_BUTTON2, OnSend) + ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1) + ON_BN_CLICKED(IDC_BUTTON3, OnControl) + ON_BN_CLICKED(IDC_BUTTON4, OnZoomIn) + ON_BN_CLICKED(IDC_BUTTON5, OnZoomOut) + ON_BN_CLICKED(IDC_BUTTON7, OnOriginal) + ON_BN_CLICKED(IDC_BUTTON6, OnClear) + ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CUsarDlg message handlers + +BOOL CUsarDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Add "About..." menu item to system menu. + + // IDM_ABOUTBOX must be in the system command range. + ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); + ASSERT(IDM_ABOUTBOX < 0xF000); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + if (pSysMenu != NULL) + { + CString strAboutMenu; + strAboutMenu.LoadString(IDS_ABOUTBOX); + if (!strAboutMenu.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); + } + } + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // TODO: Add extra initialization here + m_Server = "localhost"; + m_Command.LimitText(128); + //m_arIn = NULL; + //m_arOut = NULL; + m_Socket = new USARSocket(this); + + //m_Control = false; + + m_CachedMove.vx=0.001f; + m_CachedMove.vy=0.001f; + m_CachedMove.rx=-1; + m_CachedMove.cx=0.001f; + m_CachedMove.cy=0.001f; + m_CachedMove.cz=0.001f; + + memset(&m_Joyinfo,0,sizeof(JOYINFOEX)); + m_Joyinfo.dwSize = sizeof(JOYINFOEX); + m_Joyinfo.dwFlags = JOY_RETURNPOV | JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ | JOY_RETURNR; + + m_Table.Init(); + m_finishTime = clock(); + + UpdateData(false); + return TRUE; // return TRUE unless you set the focus to a control +} + +void CUsarDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + if ((nID & 0xFFF0) == IDM_ABOUTBOX) + { + CAboutDlg dlgAbout; + dlgAbout.DoModal(); + } + else if ((nID & 0xFFF0) == SC_CLOSE) + { + EndDialog(IDOK); + } + else + { + CDialog::OnSysCommand(nID, lParam); + } +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CUsarDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialog::OnPaint(); + } +} + +// The system calls this to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CUsarDlg::OnQueryDragIcon() +{ + return (HCURSOR) m_hIcon; +} + +void CUsarDlg::OnConnect() +{ + // TODO: Add your control notification handler code here + UpdateData(); + if (m_arOut==NULL) { + if (!m_Socket->Create()) { + MessageBox("Can't create socket","Socket",MB_OK); + return; + } + if (!m_Socket->Connect(m_Server,PORTNUM)) { + MessageBox("Can't connect to server","Connect",MB_OK); + m_Socket->Close(); + return; + } + m_File = new CSocketFile(m_Socket); + m_arIn = new CArchive(m_File, CArchive::load); + m_arOut = new CArchive(m_File, CArchive::store); + m_Connect.SetWindowText("Disconnect"); + InitZoom(); + m_Send.EnableWindow(true); + //if (m_HasJoystick) + GetDlgItem(IDC_BUTTON3)->EnableWindow(true); + //clear data + m_Movement.raw.RemoveAll(); + m_Movement.points.RemoveAll(); + //CString str; + //m_arIn->ReadString(str); + //m_Msg.AddString(str); + } + else { + if (m_arIn!=NULL) { + delete m_arIn; + m_arIn=NULL; + } + delete m_arOut; + m_arOut=NULL; + delete m_File; + m_File=NULL; + m_Socket->Close(); + m_Connect.SetWindowText("Connect"); + m_Send.EnableWindow(false); + GetDlgItem(IDC_BUTTON3)->EnableWindow(false); + } +} + +void CUsarDlg::OnSend() +{ + // TODO: Add your control notification handler code here + CString str; + if (m_arOut==NULL) return; + m_Command.GetWindowText(str); + m_Command.InsertString(0,str); + try { + m_arOut->WriteString(str); + m_arOut->WriteString("\r\n"); + m_arOut->Flush(); + }catch (CException* e) { + e->Delete(); + MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); + exit(1); + } +} + +void CUsarDlg::OnSelchangeCombo1() +{ + // TODO: Add your control notification handler code here + CString str; + int i = m_Command.GetCurSel(); + m_Command.GetLBText(i,str); + m_Command.SetWindowText(str); +} + +void CUsarDlg::ProcessPendingRead() +{ + // TODO: Add your message handler code here and/or call default + CString str; + int tmp,process=1; + + do { + m_arIn->ReadString(str); + m_Msg.InsertString(0,str); + if (m_Msg.GetCount()>=MSGLINES) + m_Msg.DeleteString(MSGLINES); + tmp = str.GetLength()*6; + if (tmp>MaxMsg) { + MaxMsg = tmp; + m_Msg.SetHorizontalExtent(tmp); + } + // If we get more than one STA message, we possibly have heavy traffic. + // So we discard all the messages after the second STA message to + // empty the queue. + if (str.Find("STA")==0) { + if (process==1) process=2; + else if (process==2) process=0; + } + if (process) ProcessMessage(str); + + }while(!m_arIn->IsBufferEmpty()); + + UpdateData(false); + Sleep(5); +} + +void CUsarDlg::ProcessMessage(CString str) +{ + int p1,p2; + //Robot state + if (str.Find("STA")==0 || str.Find("{Type GroundTruth}")>0) { + p1 = str.Find("{Time"); + if (p1>0) { + p1 += 5; + p2 = str.Find("}",p1); + m_Time = str.Mid(p1,p2-p1); + } + p1 = str.Find("{Location",p2); + if (p1>0) { + p1 += 9; + p2 = str.Find("}",p1); + m_Location = str.Mid(p1,p2-p1); + } + p1 = str.Find("{Orientation",p2); + if (p1>0) { + p1 += 12; + p2 = str.Find("}",p1); + m_Rotation = str.Mid(p1,p2-p1); + } + AddPoint(m_Location,m_Rotation); + return; + } +} + +void CUsarDlg::OnControl() +{ + // TODO: Add your control notification handler code here + if (!m_Control) { + GetDlgItem(IDC_BUTTON3)->SetWindowText("&Control"); + SetCapture(); + m_Control=true; + int srcWidth = GetSystemMetrics(SM_CXSCREEN)-25; + int srcHeight = GetSystemMetrics(SM_CYSCREEN)-25; + GetWindowRect(&m_winPos); + RECT tmp; + tmp.left = m_winPos.left>25?m_winPos.left:25; + tmp.right = m_winPos.right25?m_winPos.top:25; + tmp.bottom = m_winPos.bottomSetWindowText("&Command"); + m_Control=false; + ReleaseCapture(); + } +} + +LRESULT CUsarDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +{ + // TODO: Add your specialized code here and/or call the base class + switch(message) + { + case WM_CREATE: + /* Capture the joystick. If this fails, beep and display + * error. + */ + if(joySetCapture(m_hWnd, JOYSTICKID1, 0, FALSE)) + { + MessageBeep(MB_ICONEXCLAMATION); + MessageBox("Couldn't capture the joystick", NULL, MB_OK | MB_ICONEXCLAMATION); + m_HasJoystick = false; + //return -1; + } + else m_HasJoystick = true; + break; + + case MM_JOY1MOVE : + //if (m_Control) Rotate(lParam); + /*if (m_Control)*/ Move(); + break; + case WM_RBUTTONDOWN: + if (m_arOut!=NULL) OnControl(); + break; + case WM_ACTIVATE: + if (LOWORD(wParam)==WA_INACTIVE) + ReleaseCapture(); + else if (m_Control && m_arOut!=NULL) + SetCapture(); + break; + case WM_DESTROY: + /* We're shutting down. Release capture on the joystick, + * make sure any sounds that are playing are stopped. + */ + if (m_HasJoystick) joyReleaseCapture(JOYSTICKID1); + PostQuitMessage(0); + break; + } + return CDialog::WindowProc(message, wParam, lParam); +} + +BOOL CUsarDlg::PreTranslateMessage(MSG* pMsg) +{ + // TODO: Add your specialized code here and/or call the base class + int processed; + if (!m_Control) return CDialog::PreTranslateMessage(pMsg); + switch(pMsg->message) { + case WM_KEYDOWN: + processed=KMove(pMsg->wParam,pMsg->lParam,1); + break; + case WM_KEYUP: + processed=KMove(pMsg->wParam,pMsg->lParam,0); + break; + case WM_MOUSEMOVE: + processed=KMove(pMsg->wParam,pMsg->lParam,2); + break; + default: + processed=0; + } + if (processed) return true; + else { + if (pMsg->message!=WM_MOUSEMOVE&&(m_pitchAmount!=0||m_yawAmount!=0)) { + SYSTEMTIME systime; + GetSystemTime(&systime); + if ((systime.wMilliseconds-m_systime.wMilliseconds)>0.1) { + m_pitchAmount=0; + m_yawAmount=0; + CString str="CAMERA {Rotation 0,0,0}\r\n"; + //m_Msg.InsertString(0,str); + if (m_arOut!=NULL) { + try { + m_arOut->WriteString(str); + m_arOut->Flush(); + }catch (CException* e) { + e->Delete(); + MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); + exit(1); + } + } + Sleep(50); + } + } + return CDialog::PreTranslateMessage(pMsg); + } +} + +int CUsarDlg::KMove(WPARAM wParam, LPARAM lParam, int type) +{ + CString str; + int processed=1; + int x,y; + switch(wParam) { + case VK_LEFT: + m_turnAmount=type?m_turnAmount+0.2f:0.0f; + m_turnAmount=(m_turnAmount>20.0f)?20.0f:m_turnAmount; + str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",-m_turnAmount,m_turnAmount); + break; + case VK_RIGHT: + m_turnAmount=type?m_turnAmount+0.2f:0.0f; + m_turnAmount=(m_turnAmount>20.0f)?20.0f:m_turnAmount; + str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",m_turnAmount,-m_turnAmount); + break; + case VK_UP: + m_moveAmount=type?m_moveAmount+0.2f:0.0f; + m_moveAmount=(m_moveAmount>20.0f)?20.0f:m_moveAmount; + str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",m_moveAmount,m_moveAmount); + break; + case VK_DOWN: + m_moveAmount=type?m_moveAmount+0.2f:0.0f; + m_moveAmount=(m_moveAmount>20.0f)?20.0f:m_moveAmount; + str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",-m_moveAmount,-m_moveAmount); + break; + case VK_RETURN: + case VK_ESCAPE: + break; + default: + processed=0; + } + if (m_arOut!=NULL&&str.GetLength()>1) { + try { + m_arOut->WriteString(str); + m_arOut->Flush(); + }catch (CException* e) { + e->Delete(); + MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); + exit(1); + } + } + + if (type==2) { + x=LOWORD(lParam); + y=HIWORD(lParam); + //str.Format("Mouse x=%d y=%d W=%d H=%d",x,y,m_winWidth,m_winHeight); + //m_Msg.InsertString(0,str); + if ((x>m_winRange.left)&&(xm_winRange.top)&&(y0.08f) m_pitchAmount=0.08f; + if (m_pitchAmount<-0.08f) m_pitchAmount=-0.08f; + m_yawAmount=(x-m_oldMX)*0.02f; + if (m_yawAmount>0.08f) m_yawAmount=0.08f; + if (m_yawAmount<-0.08f) m_yawAmount=-0.08f; + m_oldMX=x; + m_oldMY=y; + str.Format("CAMERA {Rotation 0,%f,%f}\r\n",m_pitchAmount,m_yawAmount); + if (m_arOut!=NULL) { + try { + m_arOut->WriteString(str); + m_arOut->Flush(); + }catch (CException* e) { + e->Delete(); + MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); + exit(1); + } + } + GetSystemTime(&m_systime); + } + else + SetCursorPos((m_winPos.left+m_winPos.right)/2,(m_winPos.top+m_winPos.bottom)/2); + + } + return processed; +} + +void CUsarDlg::Move() +{ + CString str,tmp; + WORD x,y,pov; + float rx,ry,rz,d; + float vx,vy,vz; + + rx = 0; ry = 0; rz = 0; + //ry = m_Movement.c_Rotation.y; + vx =0; vy = 0; vz = 0; + d = 0; + + joyGetPosEx(JOYSTICKID1, &m_Joyinfo); + + // Trun left/right + x = LOWORD(m_Joyinfo.dwXpos) >> 11; + if (x <= 11) vx = (x - 12)/0.6f; + else if (x >= 20) vx = (x - 19)/0.6f; + + // Move forward/backward + y = LOWORD(m_Joyinfo.dwYpos) >> 11; + if (y <= 11) vy = (y - 12)/0.6f; + else if (y >= 20) vy = (y - 19)/0.6f; + + if (vx!=m_CachedMove.vx||vy!=m_CachedMove.vy) { + m_CachedMove.vx = vx; + m_CachedMove.vy = vy; + str.Format("DRIVE {Left %f} {Right %f} {Normalized true}\r\n",vx-vy,-vy-vx); + //m_Msg.InsertString(0,str); + } + + // View pitch & yaw + pov = LOWORD(m_Joyinfo.dwPOV); + rx=0;ry=0;rz=0; + if (pov<36000) { + d = pov*3.1415926f/18000; + ry=(float)(0.006*cos(d)); + rz=(float)(0.006*sin(d)); + } + rx=0; + + if (rx!=m_CachedMove.cx || m_CachedMove.cx!=0 || + ry!=m_CachedMove.cy || m_CachedMove.cy!=0 || + rz!=m_CachedMove.cz || m_CachedMove.cy!=0) { + m_CachedMove.cx = rx; + m_CachedMove.cy = ry; + m_CachedMove.cz = rz; + tmp.Format("CAMERA {Rotation %f,%f,%f}\r\n",rx,ry,rz); + //m_Msg.InsertString(0,tmp); + str+=tmp; + } + + if (m_arOut!=NULL&&str.GetLength()>1) { + try { + m_arOut->WriteString(str); + m_arOut->Flush(); + }catch (CException* e) { + e->Delete(); + MessageBox("Loss connection. Exit!","Error",MB_OK|MB_ICONSTOP); + exit(1); + } + } + /* + str.Format("X=%d %d Y=%d %d Z=%d %d R=%d POV=%d %d", + m_Joyinfo.dwXpos,x, + m_Joyinfo.dwYpos,y, + m_Joyinfo.dwZpos,0, + m_Joyinfo.dwRpos, + m_Joyinfo.dwPOV,pov); + + m_Msg.InsertString(0,str); + */ +} + +void CUsarDlg::AddPoint(CString Location, CString Rotation) +{ + int x0,y0,z0; + int x,y,z; + int p1,p2; + + if (bLOCK) return; + p1 = Location.Find(','); + if (p1==-1) return; + p2 = Location.Find(',',p1+1); + if (p2==-1) return; + x0 = (int)(-atof((LPCSTR)Location.Left(p1))*500); + x = (int)((float)x0*m_Zoom.scaleX+m_Zoom.offsetX); + y0 = (int)(-atof((LPCSTR)Location.Mid(p1+1,p2-p1))*500); + y = (int)((float)y0*m_Zoom.scaleY+m_Zoom.offsetY); + z0 = (int)(atof((LPCSTR)Location.Mid(p2+1))*500); + if (m_Movement.c_Location.x!=x0||m_Movement.c_Location.y!=y0||m_Movement.points.GetSize()==0) { + m_Movement.c_Location.x=x; + m_Movement.c_Location.y=y; + m_Movement.points.Add(m_Movement.c_Location); + m_Movement.c_Location.x=x0; + m_Movement.c_Location.y=y0; + m_Movement.raw.Add(m_Movement.c_Location); + m_Movement.z = z0; + m_Table.DrawPoint(&m_Movement); + } + + p1 = Rotation.Find(','); + if (p1==-1) return; + p2 = Rotation.Find(',',p1+1); + if (p2==-1) return; + z = (int)(atof((LPCSTR)Rotation.Left(p1))*10430.37835); + x = (int)(atof((LPCSTR)Rotation.Mid(p1+1,p2-p1))*10430.37835); + y = (int)(atof((LPCSTR)Rotation.Mid(p2+1))*10430.37835); + if (m_Movement.c_Rotation.x!=x||m_Movement.c_Rotation.y!=y||m_Movement.points.GetSize()==0) { + m_Movement.c_Rotation.x=x; + m_Movement.c_Rotation.y=y; + m_Table.DrawPoint(&m_Movement); + } + if (m_Movement.points.GetSize()>=POINTSNUM) m_Movement.points.RemoveAt(0); + if (m_Movement.raw.GetSize()>=POINTSNUM) m_Movement.raw.RemoveAt(0); +} + +void CUsarDlg::InitZoom() +{ + USARRoute * ur; + ur = ((USARRoute *)m_Table.m_tabPages[m_Table.m_tabCurrent]); + m_Zoom.offsetX = ur->m_OffsetX; + m_Zoom.offsetY = ur->m_OffsetY; + m_Zoom.scaleX = ur->m_ScaleX; + m_Zoom.scaleY = ur->m_ScaleY; +} + + +void CUsarDlg::UpdatePoints() +{ + POINT p; + int n = m_Movement.points.GetSize(); + for (int i=0;ibot = NULL; - origin.px = cf->ReadTupleLength(section,"origin",0,FLT_MAX); - origin.py = cf->ReadTupleLength(section,"origin",1,FLT_MAX); - //origin.pa = cf->ReadTupleAngle(section,"origin",2,FLT_MAX); + origin.px = cf->ReadTupleLength(section,"origin",0,0); + origin.py = cf->ReadTupleLength(section,"origin",1,0); + //origin.pa = cf->ReadTupleAngle(section,"origin",2,0); origin.pa = 0.0; return; Modified: usarsim/Tools/player/server/drivers/usarsim/src/us_position.cc =================================================================== --- usarsim/Tools/player/server/drivers/usarsim/src/us_position.cc 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/Tools/player/server/drivers/usarsim/src/us_position.cc 2007-07-11 16:23:30 UTC (rev 649) @@ -48,7 +48,7 @@ return; } } - strncpy(this->odo_name, cf->ReadString(section,"odo_name", DEFAULT_GAMEBOTS_CLASS),sizeof(this->odo_name)); + strncpy(this->odo_name, cf->ReadString(section,"odo_name","Odometry"),sizeof(this->odo_name)); pthread_mutex_init(&posMutex, NULL); // bot device @@ -81,15 +81,20 @@ bot->steeringType = new char[128]; } bot->devices |= US_CONF_ROBOT; + bot->devices |= US_GEOM_ROBOT; char* cmd = new char[USBOT_MAX_CMD_LEN]; sprintf(cmd,"GETCONF {Type Robot}\r\n"); bot->AddCommand(cmd); + char* cmd2 = new char[USBOT_MAX_CMD_LEN]; + sprintf(cmd2,"GETGEO {Type Robot}\r\n"); + bot->AddCommand(cmd2); int count =0; - while (!bot->bConfRobot == true && count < USBOT_STARTUP_CONN_LIMIT) + while (!bot->bConfRobot == true && !bot->bGeoRobot == true && count < USBOT_STARTUP_CONN_LIMIT) { usleep(USBOT_DELAY_USEC); count++; } + setSteerType(); StartThread(); // Start the device thread return 0; @@ -115,35 +120,25 @@ int UsPosition::ProcessMessage(MessageQueue *resp_queue, player_msghdr *hdr, void *data) { if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, PLAYER_POSITION2D_REQ_GET_GEOM, this->device_addr)) - { - int count = 0; - bot->devices |= US_GEOM_ROBOT; + { PLAYER_MSG0(3,"POSITION REQ GEO\n"); - char* cmd = new char[USBOT_MAX_CMD_LEN]; - sprintf(cmd,"GETGEO {Type Robot}\r\n"); - bot->AddCommand(cmd); - - while (!bot->bGeoRobot == true && count bGeoRobot == true) { PLAYER_MSG0(3,"POSITION REQ GEO NACK\n"); this->Publish(this->device_addr,resp_queue, - PLAYER_MSGTYPE_RESP_NACK, - PLAYER_POSITION2D_REQ_GET_GEOM, - (void*)bot->robotGeom, - sizeof(player_position2d_geom_t),NULL); + PLAYER_MSGTYPE_RESP_NACK, + PLAYER_POSITION2D_REQ_GET_GEOM, + (void*)bot->robotGeom, + sizeof(player_position2d_geom_t),NULL); return -1; } PLAYER_MSG0(3,"POSITION REQ GEO ACK\n"); - setSteerType(); this->Publish(this->device_addr,resp_queue, - PLAYER_MSGTYPE_RESP_ACK,PLAYER_POSITION2D_REQ_GET_GEOM, - (void*)bot->robotGeom, sizeof(player_position2d_geom_t),NULL); + PLAYER_MSGTYPE_RESP_ACK, + PLAYER_POSITION2D_REQ_GET_GEOM, + (void*)bot->robotGeom, + sizeof(player_position2d_geom_t),NULL); return 0; } else if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, @@ -194,8 +189,8 @@ else {//will only work if robot is stopped while turning sprintf(cmd,"DRIVE {Left %f} {Right %f}\r\n", - (trans - bot->maxWheelSeparation * rotate) / bot->wheelRadius, - (trans + bot->maxWheelSeparation * rotate) / bot->wheelRadius); + (trans - 100.0 * bot->maxWheelSeparation * rotate) / bot->wheelRadius, + (trans + 100.0 * bot->maxWheelSeparation * rotate) / bot->wheelRadius); } } else if(steer_type == ACKERMANNSTEERED) Added: usarsim/TreasureHunt/Classes/TreasureHuntGame.uc =================================================================== --- usarsim/TreasureHunt/Classes/TreasureHuntGame.uc (rev 0) +++ usarsim/TreasureHunt/Classes/TreasureHuntGame.uc 2007-07-11 16:23:30 UTC (rev 649) @@ -0,0 +1,99 @@ +class TreasureHuntGame extends USARDeathMatch; + +// +// Restart a player. Since we want to use GameInfo.RestartPlayer +// but this is overridden by BotDeathMatch.RestartPlayer, we need +// to copy all of the GameInfo.RestartPlayer code, which is below. +// +function RestartPlayer( Controller aPlayer ) +{ + local NavigationPoint startSpot; + local int TeamNum; + local class DefaultPlayerClass; + local Vehicle V, Best; + local vector ViewDir; + local float BestDist, Dist; + + if(aPlayer.IsA('RemoteBot') || aPlayer.IsA('Player')) { + Super.RestartPlayer(aPlayer); + return; + } + + log("RESTARTSOMETHING"@aPlayer); + + if( bRestartLevel && Level.NetMode!=NM_DedicatedServer && Level.NetMode!=NM_ListenServer ) + return; + + if ( (aPlayer.PlayerReplicationInfo == None) || (aPlayer.PlayerReplicationInfo.Team == None) ) + TeamNum = 255; + else + TeamNum = aPlayer.PlayerReplicationInfo.Team.TeamIndex; + + startSpot = FindPlayerStart(aPlayer, TeamNum); + if( startSpot == None ) + { + log(" Player start not found!!!"); + return; + } + + if (aPlayer.PreviousPawnClass!=None && aPlayer.PawnClass != aPlayer.PreviousPawnClass) + BaseMutator.PlayerChangedClass(aPlayer); + + if ( aPlayer.PawnClass != None ) + aPlayer.Pawn = Spawn(aPlayer.PawnClass,,,StartSpot.Location,StartSpot.Rotation); + + if( aPlayer.Pawn==None ) + { + DefaultPlayerClass = GetDefaultPlayerClass(aPlayer); + aPlayer.Pawn = Spawn(DefaultPlayerClass,,,StartSpot.Location,StartSpot.Rotation); + } + if ( aPlayer.Pawn == None ) + { + log("Couldn't spawn player of type "$aPlayer.PawnClass$" at "$StartSpot); + aPlayer.GotoState('Dead'); + if ( PlayerController(aPlayer) != None ) + PlayerController(aPlayer).ClientGotoState('Dead','Begin'); + return; + } + if ( PlayerController(aPlayer) != None ) + PlayerController(aPlayer).TimeMargin = -0.1; + aPlayer.Pawn.Anchor = startSpot; + aPlayer.Pawn.LastStartSpot = PlayerStart(startSpot); + aPlayer.Pawn.LastStartTime = Level.TimeSeconds; + aPlayer.PreviousPawnClass = aPlayer.Pawn.Class; + + aPlayer.Possess(aPlayer.Pawn); + aPlayer.PawnClass = aPlayer.Pawn.Class; + + aPlayer.Pawn.PlayTeleportEffect(true, true); + aPlayer.ClientSetRotation(aPlayer.Pawn.Rotation); + AddDefaultInventory(aPlayer.Pawn); + TriggerEvent( StartSpot.Event, StartSpot, aPlayer.Pawn); + + if ( bAllowVehicles && (Level.NetMode == NM_Standalone) && (PlayerController(aPlayer) != None) ) + { + // tell bots not to get into nearby vehicles for a little while + BestDist = 2000; + ViewDir = vector(aPlayer.Pawn.Rotation); + for ( V=VehicleList; V!=None; V=V.NextVehicle ) + if ( V.bTeamLocked && (aPlayer.GetTeamNum() == V.Team) ) + { + Dist = VSize(V.Location - aPlayer.Pawn.Location); + if ( (ViewDir Dot (V.Location - aPlayer.Pawn.Location)) < 0 ) + Dist *= 2; + if ( Dist < BestDist ) + { + Best = V; + BestDist = Dist; + } + } + + if ( Best != None ) + Best.PlayerStartTime = Level.TimeSeconds + 8; + } +} + +defaultproperties +{ +} + \ No newline at end of file Modified: usarsim/USARBot/Classes/AerialVehicle.uc =================================================================== --- usarsim/USARBot/Classes/AerialVehicle.uc 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/USARBot/Classes/AerialVehicle.uc 2007-07-11 16:23:30 UTC (rev 649) @@ -25,16 +25,19 @@ local float time; Super.timer(); + + if(!USARRemoteBot(Controller).emptyBattery) // If the battery is not empty, we can send the message + { + time = Level.TimeSeconds; - time = Level.TimeSeconds; + outstring = "STA {Type AerialVehicle} {Time "$time$"}"$ + " {LightToggle "$bHeadlightOn$"}"$ + " {LightIntensity "$HeadlightItensity$"}"$ + " {Battery "$(batteryLife-myLife)$"}"$ + " {View "$ViewNum$"}"; - outstring = "STA {Type AerialVehicle} {Time "$time$"}"$ - " {LightToggle "$bHeadlightOn$"}"$ - " {LightIntensity "$HeadlightItensity$"}"$ - " {Battery "$(batteryLife-myLife)$"}"$ - " {View "$ViewNum$"}"; - - USARRemoteBot(Controller).myConnection.SendLine(outstring); + USARRemoteBot(Controller).myConnection.SendLine(outstring); + } } function string getRobotGeo() Modified: usarsim/USARBot/Classes/BallHSensor.uc =================================================================== --- usarsim/USARBot/Classes/BallHSensor.uc 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/USARBot/Classes/BallHSensor.uc 2007-07-11 16:23:30 UTC (rev 649) @@ -109,7 +109,7 @@ halfResY = CameraYres/2; //Computes perspective transformation constant - K = float(halfResX)/(Tan(KRobot(Platform).CameraZoom[0]/(2*RAD2DEG))); + K = float(halfResX)/(Tan(KRobot(Platform).CamList[0].CameraFov/(2*RAD2DEG))); K1= K / BallCamPos.X; //Make perspective transformation x2dMod = int(K1 * BallCamPos.Y); Modified: usarsim/USARBot/Classes/GroundVehicle.uc =================================================================== --- usarsim/USARBot/Classes/GroundVehicle.uc 2007-07-10 00:40:26 UTC (rev 648) +++ usarsim/USARBot/Classes/GroundVehicle.uc 2007-07-11 16:23:30 UTC (rev 649) @@ -35,41 +35,44 @@ Super.timer(); - time = Level.TimeSeconds; + if(!USARRemoteBot(Controller).emptyBattery) // If the battery is not empty, we can send the message + { + time = Level.TimeSeconds; - // Front Steer and Rear Steer Angles are 0.00 by default - FrontSteerAngle = "0.0000"; - RearSteerAngle = "0.0000"; + // Front Steer and Rear Steer Angles are 0.00 by default + FrontSteerAngle = "0.0000"; + RearSteerAngle = "0.0000"; - // Get the current front steer angle - for(i=0; i An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070711/096d84c2/attachment-0001.html -------------- next part -------------- Modified: moast-bth/TeamTalkSimulator/robot.cc =================================================================== --- moast-bth/TeamTalkSimulator/robot.cc 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/TeamTalkSimulator/robot.cc 2007-07-11 16:33:26 UTC (rev 650) @@ -541,7 +541,7 @@ AmMobJACmdSpin spin; spin.absAngle = canonical_angle(r - goTo->getAngle()); spin.tolerance = PI/40; - spin.direction = PRIM_MOB_JA_CMD_ROTATE_SHORTEST; + spin.direction = MOAST_ROTATE_SHORTEST; spin.serial_number = amStatP->echo_serial_number + 1; debug << "spinning: " << spin.absAngle << " tol: " << spin.tolerance << " SHORTEST" << endl; Modified: moast-bth/moast/bin/Makefile.am =================================================================== --- moast-bth/moast/bin/Makefile.am 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/bin/Makefile.am 2007-07-11 16:33:26 UTC (rev 650) @@ -80,9 +80,10 @@ ../src/sim/simWare/swKBMsg.hh ../src/sim/simWare/swKBMsg.cc \ ../src/sim/simWare/usarInfSkin.hh ../src/sim/simWare/usarInfSkin.cc \ ../src/sim/simWare/trafficSupSkin.hh ../src/sim/simWare/trafficSupSkin.cc \ -../src/sim/simWare/swTraffic.hh ../src/sim/simWare/swTraffic.cc +../src/sim/simWare/swTraffic.hh ../src/sim/simWare/swTraffic.cc \ +../src/prim/primMobEngine.cc ../include/primMobEngine.hh -segmentTest_SOURCES = ../src/tools/segmentTools/cluster.cc ../src/tools/segmentTools/test.cc ../src/tools/segmentTools/chainHull.cc ../src/tools/segmentTools/cluster.hh ../src/tools/segmentTools/vectorWM.cc ../src/tools/segmentTools/vectorWm.hh +segmentTest_SOURCES = ../src/tools/segmentTools/cluster.cc ../src/tools/segmentTools/test.cc ../src/tools/segmentTools/chainHull.cc ../src/tools/segmentTools/cluster.hh ../src/tools/segmentTools/vectorWM.cc ../src/tools/segmentTools/vectorWM.hh segmentTest_LDADD = ../lib/libmoast.a -L$(RCSLIB_DIR)/lib -lrcs -lposemath -lm exampleUtmConvert_SOURCES = ../src/tools/exampleUtmConvert.cc @@ -121,7 +122,7 @@ primSPMain_SOURCES = ../src/prim/primSPMain.cc primSPMain_LDADD = ../lib/libmoast.a -L$(RCSLIB_DIR)/lib -lrcs -lposemath -lm -primMobMain_SOURCES = ../src/prim/primMobMain.cc +primMobMain_SOURCES = ../src/prim/primMobMain.cc ../src/prim/primMobEngine.cc primMobMain_LDADD = ../lib/libmoast.a -L$(RCSLIB_DIR)/lib -lrcs -lposemath -lm primMisMain_SOURCES = ../src/prim/primMisMain.cc @@ -252,7 +253,7 @@ joySDL_SOURCES = ../src/tools/joySDL.cc joySDL_LDADD = @SDL_LIBS@ ../lib/libmoast.a -L$(RCSLIB_DIR)/lib -lrcs -lposemath -lm -robojoy_SOURCES = ../src/tools/robojoy.cc +robojoy_SOURCES = ../src/tools/robojoy.cc ../src/tools/gomath.c ../include/gotypes.h ../include/gomath.h robojoy_LDADD = @SDL_LIBS@ ../lib/libmoast.a -L$(RCSLIB_DIR)/lib -lrcs -lposemath -lm endif Modified: moast-bth/moast/bin/runJoy =================================================================== --- moast-bth/moast/bin/runJoy 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/bin/runJoy 2007-07-11 16:33:26 UTC (rev 650) @@ -14,15 +14,16 @@ #Submarine #PLATFORM=6; JOYMODE=3 #Zerg -PLATFORM=7; JOYMODE=1 +#PLATFORM=7; JOYMODE=1 #Talon #PLATFORM=8; JOYMODE=1 #TeleMax #PLATFORM=9; JOYMODE=1 #AirRobot PLATFORM=10; JOYMODE=4 -#STARTLOC=1 -STARTLOC=2 +STARTLOC=1 +#STARTLOC=2 +#STARTLOC=3 #done with user area # #are we on cygwin? @@ -150,7 +151,15 @@ pid10=$! fi -./joySDL -d1 -x3 -y3 -z3 -w3 -m$JOYMODE& +# Old Joystick Program +#./joySDL -d1 -x3 -y3 -z3 -w3 -m$JOYMODE& + +# Settings for the AirRobot +#./robojoy -d1 -x1.5708 -y-5 -z5 -w-5 + +# Settings for other robots (robojoy will adjust scale factors automatically) +./robojoy -d1& + pid11=$! ./$TOP Modified: moast-bth/moast/doc/refManual_tex/am/gfx/CVS/Entries =================================================================== --- moast-bth/moast/doc/refManual_tex/am/gfx/CVS/Entries 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/doc/refManual_tex/am/gfx/CVS/Entries 2007-07-11 16:33:26 UTC (rev 650) @@ -1,13 +1,13 @@ -/AMMobGraphicalOutput.jpg/1.1/Fri Dec 8 19:24:50 2006// -/AMSPMap.jpg/1.1/Fri Dec 8 19:25:47 2006// -/AMSPMapDisplay.jpg/1.1/Fri Dec 8 19:24:50 2006// -/bothWallsFound.jpg/1.1/Fri Dec 8 19:26:38 2006// -/changingAMSPMap.jpg/1.1/Fri Dec 8 19:26:38 2006// -/figLinearizedPath.jpg/1.1/Wed Jan 10 17:04:02 2007// -/figRounding.jpg/1.1/Wed Jan 10 17:03:19 2007// -/findingViewedCells.jpg/1.1/Fri Dec 8 19:26:38 2006// -/ladarRaysHittingWall.jpg/1.1/Fri Dec 8 19:24:50 2006// -/pathReplanningInvariance.jpg/1.1/Fri Dec 8 19:24:50 2006// -/planningToHorizon.jpg/1.1/Fri Dec 8 19:25:47 2006// -/upperWallMissing.jpg/1.1/Fri Dec 8 19:25:47 2006// +/AMMobGraphicalOutput.jpg/1.1/Sun May 20 20:30:52 2007// +/AMSPMap.jpg/1.1/Sun May 20 20:30:52 2007// +/AMSPMapDisplay.jpg/1.1/Sun May 20 20:30:52 2007// +/bothWallsFound.jpg/1.1/Sun May 20 20:30:52 2007// +/changingAMSPMap.jpg/1.1/Sun May 20 20:30:52 2007// +/figLinearizedPath.jpg/1.1/Sun May 20 20:30:52 2007// +/figRounding.jpg/1.1/Sun May 20 20:30:52 2007// +/findingViewedCells.jpg/1.1/Sun May 20 20:30:52 2007// +/ladarRaysHittingWall.jpg/1.1/Sun May 20 20:30:52 2007// +/pathReplanningInvariance.jpg/1.1/Sun May 20 20:30:52 2007// +/planningToHorizon.jpg/1.1/Sun May 20 20:30:52 2007// +/upperWallMissing.jpg/1.1/Sun May 20 20:30:52 2007// D Modified: moast-bth/moast/doc/refManual_tex/am/gfx/CVS/Root =================================================================== --- moast-bth/moast/doc/refManual_tex/am/gfx/CVS/Root 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/doc/refManual_tex/am/gfx/CVS/Root 2007-07-11 16:33:26 UTC (rev 650) @@ -1 +1 @@ -:pserver:anonymous at moast.cvs.sourceforge.net:/cvsroot/moast +:ext:tkharris at moast.cvs.sourceforge.net:/cvsroot/moast Added: moast-bth/moast/doc/refManual_tex/tools/joystick.tex =================================================================== --- moast-bth/moast/doc/refManual_tex/tools/joystick.tex (rev 0) +++ moast-bth/moast/doc/refManual_tex/tools/joystick.tex 2007-07-11 16:33:26 UTC (rev 650) @@ -0,0 +1,60 @@ +\subsection{Joystick} +The vehicle mobility and mission packages can be controlled with a +PC-compatible game joystick. The standard joystick provides two X-Y +joysticks and 10 selection buttons numbered 1 through 10, clustered in +different groups. + +The dual X-Y joysticks are distinguished here as ``left'' and +``right,'' and their directions are ``up'' (away from you), ``down'' +(toward you), ``left'' and ``right''. + +The joystick application is \verb+robojoy+, typically entered with no +arguments, e.g., + +\begin{verbatim} +cd /bin +./robojoy +\end{verbatim} + +After about 10 seconds during which the program connects to the +controller, the program will dump out some diagnostics information and +accept joystick commands. + +Button 9 toggles between Mobility Mode and Joint Mode. The current +mode is printed in the text window in which \verb+robojoy+ is running. + +In Mobility mode, the dual joysticks function according to the type of +mobility platform being driven. In a skid steer vehicle, the left +joystick controls the left skid, and the right joystick controls the +right skid, with ``up'' driving the skid foward, and ``down'' driving +the skid backward. A left turn is accomplished my moving the left +joystick down and the right joystick up. + +In Mobilty mode, if there are any flippers on the vehicle, buttons 5, +6, 7 and 8 control the front and rear flippers. Buttons 5 and 7 raise +and lower the front flippers, respectively; Buttons 6 and 8 raise and +lower the rear flippers, respectively. + +In Joint mode, the buttons select the joint to be actuated, and the +left joystick's left and right directions move the joint in the +negative and positive direction, respectively. + +Button 10 switches between Tool and World mode. In either of these +modes, the left joystick L/R controls motion in the X direction, the +left joystick U/D controls Y motion and the right joystick U/D +controls Z motion. The right joystick L/R controls gripper opening and +closing. + +In Tool Mode, the XYZ are relative to the gripper, where X is +side-to-side, Y is in-out, and Z is up-down. + +In World Mode, the XYZ are relative to the vehicle body, where X is +side-to-side, Y is front-to-back, and Z is up-down. + +Rotations about XYZ can be done by holding down Button 8 while using +the joysticks. For example, to rotate around the Z axis, which looks +like a panning motion, hold down Button 8 and move the right joystick +up and down. To rotate around the X axis, which looks likes a tilting +motion, hold down Button 8 and move the left joystick side-to-side. + + Modified: moast-bth/moast/doc/refManual_tex/tools.tex =================================================================== --- moast-bth/moast/doc/refManual_tex/tools.tex 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/doc/refManual_tex/tools.tex 2007-07-11 16:33:26 UTC (rev 650) @@ -1,2 +1,4 @@ \input{tools/libraries} \input{tools/tools} +\input{tools/joystick} + Modified: moast-bth/moast/etc/moast.nml =================================================================== --- moast-bth/moast/etc/moast.nml 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/etc/moast.nml 2007-07-11 16:33:26 UTC (rev 650) @@ -326,7 +326,7 @@ B symbolicData3 SHMEM localhost 43072 0 * 268 * 25468 TCP=20469 xdr B symbolicData4 SHMEM localhost 43072 0 * 269 * 25469 TCP=20470 xdr -B trafficData SHMEM localhost 10304 0 * 270 * 25470 TCP=20471 xdr +B trafficData1 SHMEM localhost 10304 0 * 270 * 25470 TCP=20471 xdr B trafficCtrlCmd1 SHMEM localhost 4160 0 * 271 * 25471 TCP=20472 xdr B trafficCtrlStat1 SHMEM localhost 1088 0 * 272 * 25472 TCP=20473 xdr B trafficCtrlCfg1 SHMEM localhost 1088 0 * 273 * 25473 TCP=20474 xdr @@ -1320,13 +1320,13 @@ P sectMobPL1 primMobJAStat4 LOCAL localhost RW 0 INF 0 5 # MOAST Tools -P trafficSim trafficData LOCAL localhost RW 2 INF 1 0 +P trafficSim trafficData1 LOCAL localhost RW 2 INF 1 0 P trafficSim trafficCtrlCmd1 LOCAL localhost RW 2 INF 1 0 P trafficSim trafficCtrlStat1 LOCAL localhost RW 2 INF 1 0 P trafficSim trafficCtrlCfg1 LOCAL localhost RW 2 INF 1 0 P trafficSim trafficCtrlSet1 LOCAL localhost RW 2 INF 1 0 -P trafficShell trafficData LOCAL localhost RW 0 INF 0 1 +P trafficShell trafficData1 LOCAL localhost RW 0 INF 0 1 P trafficShell trafficCtrlCmd1 LOCAL localhost RW 0 INF 0 1 P trafficShell trafficCtrlStat1 LOCAL localhost RW 0 INF 0 1 P trafficShell trafficCtrlCfg1 LOCAL localhost RW 0 INF 0 1 @@ -1375,6 +1375,7 @@ P virtSensor1 servoSPCfg1 REMOTE localhost RW 0 INF 0 4 P virtSensor1 symbolicData1 REMOTE localhost RW 0 INF 0 1 +P joystick navDataExt1 REMOTE localhost RW 0 INF 0 12 P joystick servoMobJACmd1 LOCAL localhost RW 0 INF 0 3 P joystick servoMobJAStat1 LOCAL localhost RW 0 INF 0 3 P joystick servoMobJACfg1 LOCAL localhost RW 0 INF 0 3 @@ -1397,6 +1398,7 @@ P joystick servoMisJACfg1_2 LOCAL localhost RW 0 INF 0 3 P joystick servoMisJACfg1_3 LOCAL localhost RW 0 INF 0 3 P joystick servoMisJACfg1_4 LOCAL localhost RW 0 INF 0 3 +P joystick navDataExt2 REMOTE localhost RW 0 INF 0 11 P joystick servoMobJACmd2 LOCAL localhost RW 0 INF 0 3 P joystick servoMobJAStat2 LOCAL localhost RW 0 INF 0 3 P joystick servoMobJACfg2 LOCAL localhost RW 0 INF 0 3 @@ -1419,6 +1421,7 @@ P joystick servoMisJACfg2_2 LOCAL localhost RW 0 INF 0 3 P joystick servoMisJACfg2_3 LOCAL localhost RW 0 INF 0 3 P joystick servoMisJACfg2_4 LOCAL localhost RW 0 INF 0 3 +P joystick navDataExt3 REMOTE localhost RW 0 INF 0 11 P joystick servoMobJACmd3 LOCAL localhost RW 0 INF 0 3 P joystick servoMobJAStat3 LOCAL localhost RW 0 INF 0 3 P joystick servoMobJACfg3 LOCAL localhost RW 0 INF 0 3 @@ -1441,6 +1444,7 @@ P joystick servoMisJACfg3_2 LOCAL localhost RW 0 INF 0 3 P joystick servoMisJACfg3_3 LOCAL localhost RW 0 INF 0 3 P joystick servoMisJACfg3_4 LOCAL localhost RW 0 INF 0 3 +P joystick navDataExt4 REMOTE localhost RW 0 INF 0 11 P joystick servoMobJACmd4 LOCAL localhost RW 0 INF 0 3 P joystick servoMobJAStat4 LOCAL localhost RW 0 INF 0 3 P joystick servoMobJACfg4 LOCAL localhost RW 0 INF 0 3 @@ -1467,7 +1471,7 @@ P moastErrorLog moastError LOCAL localhost RW 0 INF 0 3 P nmlPrint moastError LOCAL localhost RW 0 INF 0 4 -P nmlPrint navDataExt1 LOCAL localhost RW 0 INF 0 12 +P nmlPrint navDataExt1 LOCAL localhost RW 0 INF 0 13 P nmlPrint servoSPLinescan1_1 LOCAL localhost RW 0 INF 0 4 P nmlPrint servoSPSonarArr1_1 LOCAL localhost RW 0 INF 0 2 P nmlPrint servoSPVict1_1 LOCAL localhost RW 0 INF 0 3 @@ -1475,7 +1479,7 @@ P nmlPrint servoSPNav1_1 LOCAL localhost RW 0 INF 0 3 P nmlPrint symbolicData1 LOCAL localhost RW 0 INF 0 2 P nmlPrint primSPLinescan1 LOCAL localhost RW 0 INF 0 3 -P nmlPrint navDataExt2 LOCAL localhost RW 0 INF 0 11 +P nmlPrint navDataExt2 LOCAL localhost RW 0 INF 0 12 P nmlPrint servoSPLinescan2_1 LOCAL localhost RW 0 INF 0 3 P nmlPrint servoSPSonarArr2_1 LOCAL localhost RW 0 INF 0 2 P nmlPrint servoSPNav2_1 LOCAL localhost RW 0 INF 0 3 @@ -1483,7 +1487,7 @@ P nmlPrint servoSPRfid2_1 LOCAL localhost RW 0 INF 0 2 P nmlPrint symbolicData2 LOCAL localhost RW 0 INF 0 1 P nmlPrint primSPLinescan2 LOCAL localhost RW 0 INF 0 3 -P nmlPrint navDataExt3 LOCAL localhost RW 0 INF 0 11 +P nmlPrint navDataExt3 LOCAL localhost RW 0 INF 0 12 P nmlPrint servoSPLinescan3_1 LOCAL localhost RW 0 INF 0 3 P nmlPrint servoSPSonarArr3_1 LOCAL localhost RW 0 INF 0 2 P nmlPrint servoSPNav3_1 LOCAL localhost RW 0 INF 0 3 @@ -1491,7 +1495,7 @@ P nmlPrint servoSPVict3_1 LOCAL localhost RW 0 INF 0 3 P nmlPrint symbolicData3 LOCAL localhost RW 0 INF 0 1 P nmlPrint primSPLinescan3 LOCAL localhost RW 0 INF 0 3 -P nmlPrint navDataExt4 LOCAL localhost RW 0 INF 0 11 +P nmlPrint navDataExt4 LOCAL localhost RW 0 INF 0 12 P nmlPrint servoSPLinescan4_1 LOCAL localhost RW 0 INF 0 3 P nmlPrint servoSPSonarArr4_1 LOCAL localhost RW 0 INF 0 2 P nmlPrint servoSPRfid4_1 LOCAL localhost RW 0 INF 0 2 @@ -1500,7 +1504,7 @@ P nmlPrint symbolicData4 LOCAL localhost RW 0 INF 0 1 P nmlPrint primSPLinescan4 LOCAL localhost RW 0 INF 0 3 -P javaGui navDataExt1 REMOTE localhost RW 0 INF 0 13 +P javaGui navDataExt1 REMOTE localhost RW 0 INF 0 14 P javaGui primMobJACmd1 REMOTE localhost RW 0 INF 0 6 P javaGui primMobJAStat1 REMOTE localhost RW 0 INF 0 6 P javaGui primMobJACfg1 REMOTE localhost RW 0 INF 0 5 @@ -1524,13 +1528,13 @@ P javaGui vehMobPLSet1 REMOTE localhost RW 0 INF 0 4 P notifier sectMobPLStat1 LOCAL localhost RW 0 INF 0 3 P notifier moastError LOCAL localhost RW 0 INF 0 5 -P spqrConvert navDataExt1 LOCAL localhost RW 2 INF 1 14 +P spqrConvert navDataExt1 LOCAL localhost RW 2 INF 1 15 P spqrConvert vehMobPLCmd1 LOCAL localhost RW 0 INF 0 5 P spqrConvert vehMobPLStat1 LOCAL localhost RW 0 INF 0 5 P spqrConvert vehMobPLCfg1 LOCAL localhost RW 0 INF 0 5 P spqrConvert vehMobPLSet1 LOCAL localhost RW 0 INF 0 5 P spqrConvert vehMapOut1 LOCAL localhost RW 0 INF 0 3 -P spqrConvert navDataExt2 LOCAL localhost RW 2 INF 1 12 +P spqrConvert navDataExt2 LOCAL localhost RW 2 INF 1 13 P spqrConvert vehMobPLCmd2 LOCAL localhost RW 0 INF 0 4 P spqrConvert vehMobPLStat2 LOCAL localhost RW 0 INF 0 4 P spqrConvert vehMobPLCfg2 LOCAL localhost RW 0 INF 0 4 Modified: moast-bth/moast/etc/moastBuffers.cfg =================================================================== --- moast-bth/moast/etc/moastBuffers.cfg 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/etc/moastBuffers.cfg 2007-07-11 16:33:26 UTC (rev 650) @@ -376,7 +376,7 @@ b bufname=symbolicData4 size=43000 # traffic simulation buffers -b bufname=trafficData size=10240 +b bufname=trafficData1 size=10240 b bufname=trafficCtrlCmd1 size=4096 b bufname=trafficCtrlStat1 size=1024 b bufname=trafficCtrlCfg1 size=1024 Modified: moast-bth/moast/etc/moastTools.cfg =================================================================== --- moast-bth/moast/etc/moastTools.cfg 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/etc/moastTools.cfg 2007-07-11 16:33:26 UTC (rev 650) @@ -1,7 +1,7 @@ # # trafficSim # -p bufname=trafficData name=trafficSim master=1 server=2 proctype=local +p bufname=trafficData1 name=trafficSim master=1 server=2 proctype=local p bufname=trafficCtrlCmd1 name=trafficSim master=1 server=2 proctype=local p bufname=trafficCtrlStat1 name=trafficSim master=1 server=2 proctype=local p bufname=trafficCtrlCfg1 name=trafficSim master=1 server=2 proctype=local @@ -11,7 +11,7 @@ # # trafficShell # -p bufname=trafficData name=trafficShell master=0 server=0 proctype=local +p bufname=trafficData1 name=trafficShell master=0 server=0 proctype=local p bufname=trafficCtrlCmd1 name=trafficShell master=0 server=0 proctype=local p bufname=trafficCtrlStat1 name=trafficShell master=0 server=0 proctype=local p bufname=trafficCtrlCfg1 name=trafficShell master=0 server=0 proctype=local @@ -81,6 +81,7 @@ # # joystick # +p bufname=navDataExt1 name=joystick master=0 server=0 proctype=remote p bufname=servoMobJACmd1 name=joystick master=0 server=0 proctype=local p bufname=servoMobJAStat1 name=joystick master=0 server=0 proctype=local p bufname=servoMobJACfg1 name=joystick master=0 server=0 proctype=local @@ -104,6 +105,7 @@ p bufname=servoMisJACfg1_3 name=joystick master=0 server=0 proctype=local p bufname=servoMisJACfg1_4 name=joystick master=0 server=0 proctype=local # +p bufname=navDataExt2 name=joystick master=0 server=0 proctype=remote p bufname=servoMobJACmd2 name=joystick master=0 server=0 proctype=local p bufname=servoMobJAStat2 name=joystick master=0 server=0 proctype=local p bufname=servoMobJACfg2 name=joystick master=0 server=0 proctype=local @@ -127,6 +129,7 @@ p bufname=servoMisJACfg2_3 name=joystick master=0 server=0 proctype=local p bufname=servoMisJACfg2_4 name=joystick master=0 server=0 proctype=local # +p bufname=navDataExt3 name=joystick master=0 server=0 proctype=remote p bufname=servoMobJACmd3 name=joystick master=0 server=0 proctype=local p bufname=servoMobJAStat3 name=joystick master=0 server=0 proctype=local p bufname=servoMobJACfg3 name=joystick master=0 server=0 proctype=local @@ -150,6 +153,7 @@ p bufname=servoMisJACfg3_3 name=joystick master=0 server=0 proctype=local p bufname=servoMisJACfg3_4 name=joystick master=0 server=0 proctype=local # +p bufname=navDataExt4 name=joystick master=0 server=0 proctype=remote p bufname=servoMobJACmd4 name=joystick master=0 server=0 proctype=local p bufname=servoMobJAStat4 name=joystick master=0 server=0 proctype=local p bufname=servoMobJACfg4 name=joystick master=0 server=0 proctype=local Added: moast-bth/moast/etc/traffic.ini =================================================================== --- moast-bth/moast/etc/traffic.ini (rev 0) +++ moast-bth/moast/etc/traffic.ini 2007-07-11 16:33:26 UTC (rev 650) @@ -0,0 +1,22 @@ +; Traffic Simulation initialization file +[DM-Mapping_250] +UTM_START_POSE_1 = 3.63 10.8 -.446 0 0 0 +UTM_START_POSE_2 = 3.41 9.96 -.446 0 0 0 +UTM_START_POSE_3 = 2.14 9.86 -.446 0 1.57 0 +UTM_START_POSE_4 = 3.63 11.9 -.446 0 0 0 +PLATFORM_TYPE_1 = Talon +PLATFORM_TYPE_2 = Talon +PLATFORM_TYPE_3 = Zerg +PLATFORM_TYPE_4 = Zerg + +[DM-compWorldDay2_250] +UTM_START_POSE_1 = -44.81 22. -4 0 0 0 +UTM_START_POSE_2 = -44. 22 -4 0 0 0 +UTM_START_POSE_3 = -49 33.5 -4 0 0 0 +UTM_START_POSE_4 = -42 32.5 -4 0 0 0 +PLATFORM_TYPE_1 = Talon +PLATFORM_TYPE_2 = Talon +PLATFORM_TYPE_3 = Zerg +PLATFORM_TYPE_4 = Zerg + + Modified: moast-bth/moast/include/Makefile.am =================================================================== --- moast-bth/moast/include/Makefile.am 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/include/Makefile.am 2007-07-11 16:33:26 UTC (rev 650) @@ -35,4 +35,5 @@ nmlPosition.hh \ nmlMap.hh \ trafficData.hh \ -trafficCtrl.hh +trafficCtrl.hh \ +primMobEngine.hh Added: moast-bth/moast/include/gomath.h =================================================================== --- moast-bth/moast/include/gomath.h (rev 0) +++ moast-bth/moast/include/gomath.h 2007-07-11 16:33:26 UTC (rev 650) @@ -0,0 +1,698 @@ +/* + DISCLAIMER: + This software was produced by the National Institute of Standards + and Technology (NIST), an agency of the U.S. government, and by statute is + not subject to copyright in the United States. Recipients of this software + assume all responsibility associated with its operation, modification, + maintenance, and subsequent redistribution. + + See NIST Administration Manual 4.09.07 b and Appendix I. +*/ + +/*! + \file gomath.h + + \brief Declarations for pose math functions + + \code CVS Status: + $Author: proctor $ + $Revision: 1.1 $ + $Date: 2007/05/09 15:19:06 $ + \endcode + + \author Fred Proctor +*/ + +#ifndef GO_MATH_H +#define GO_MATH_H + +#include /* sizeof */ +#include /* M_PI */ +#include /* FLT,DBL_MIN,MAX,EPSILON */ +#include "gotypes.h" /* go_integer,real */ + +#define go_sq(x) ((x)*(x)) +#define go_cub(x) ((x)*(x)*(x)) +#define go_qua(x) ((x)*(x)*(x)*(x)) + +extern void go_sincos(go_real t, go_real * s, go_real * c); + +extern go_real go_cbrt(go_real t); + +#ifdef M_PI +#define GO_PI M_PI +#else +#define GO_PI 3.14159265358979323846 +#endif +#define GO_2_PI (2.0*GO_PI) + +#ifdef M_PI_2 +#define GO_PI_2 M_PI_2 +#else +#define GO_PI_2 1.57079632679489661923 +#endif + +#ifdef M_PI_4 +#define GO_PI_4 M_PI_4 +#else +#define GO_PI_4 0.78539816339744830962 +#endif + +#define GO_TO_DEG(rad) ((rad)*57.295779513082323) +#define GO_TO_RAD(deg) ((deg)*0.0174532925199432952) + +/* how close translational quantities must be to be equal */ +#define GO_TRAN_CLOSE(x,y) (fabs((x)-(y)) < GO_REAL_EPSILON) +#define GO_TRAN_SMALL(x) (fabs(x) < GO_REAL_EPSILON) + +/* how close rotational quantities must be to be equal */ +#define GO_ROT_CLOSE(x,y) (fabs((x)-(y)) < GO_REAL_EPSILON) +#define GO_ROT_SMALL(x) (fabs(x) < GO_REAL_EPSILON) + +/* how close general quantities must be to be equal */ +#define GO_CLOSE(x,y) (fabs((x)-(y)) < GO_REAL_EPSILON) +#define GO_SMALL(x) (fabs(x) < GO_REAL_EPSILON) + +typedef struct { + go_real x, y, z; +} go_cart; + +typedef struct { + go_real theta, phi, r; +} go_sph; + +typedef struct { + go_real theta, r, z; +} go_cyl; + +typedef struct { + go_real x, y, z; +} go_uvec; + +typedef struct { + go_real s, x, y, z; +} go_rvec; + +/* | m.x.x m.y.x m.z.x | */ +/* go_mat m = | m.x.y m.y.y m.z.y | */ +/* | m.x.z m.y.z m.z.z | */ + +typedef struct { + go_cart x; /* x unit vector */ + go_cart y; /* y unit vector */ + go_cart z; /* z unit vector */ +} go_mat; + +typedef struct { + go_real s, x, y, z; +} go_quat; + +typedef struct { + go_real z, y, zp; +} go_zyz; + +typedef struct { + go_real z, y, x; +} go_zyx; + +typedef struct { + go_real r, p, y; +} go_rpy; + +typedef struct { + go_cart tran; + go_quat rot; +} go_pose; + +extern go_pose +go_pose_this(go_real x, go_real y, go_real z, + go_real rs, go_real rx, go_real ry, go_real rz); + +extern go_pose +go_pose_identity(void); + +typedef struct { + go_cart tran; + go_mat rot; +} go_hom; + +typedef struct { + go_cart tran; + go_rpy rot; +} go_rpose; + +/* + struct arguments are passed to functions as const pointers since the + speed is at least as fast for all but structs of one or two elements. +*/ + +/* translation rep conversion functions */ + +extern go_result go_cart_sph_convert(const go_cart *, go_sph *); +extern go_result go_cart_cyl_convert(const go_cart *, go_cyl *); +extern go_result go_sph_cart_convert(const go_sph *, go_cart *); +extern go_result go_sph_cyl_convert(const go_sph *, go_cyl *); +extern go_result go_cyl_cart_convert(const go_cyl *, go_cart *); +extern go_result go_cyl_sph_convert(const go_cyl *, go_sph *); + +/* rotation vector to true vector conversions */ + +extern go_result go_cart_rvec_convert(const go_cart *, go_rvec *); +extern go_result go_rvec_cart_convert(const go_rvec *, go_cart *); +extern go_result go_cart_rpy_convert(const go_cart *, go_rpy *); +extern go_result go_rpy_cart_convert(const go_rpy *, go_cart *); + +/* rotation rep conversion functions */ + +extern go_result go_rvec_quat_convert(const go_rvec *, go_quat *); +extern go_result go_rvec_mat_convert(const go_rvec *, go_mat *); +extern go_result go_rvec_zyz_convert(const go_rvec *, go_zyz *); +extern go_result go_rvec_zyx_convert(const go_rvec *, go_zyx *); +extern go_result go_rvec_rpy_convert(const go_rvec *, go_rpy *); + +extern go_result go_quat_rvec_convert(const go_quat *, go_rvec *); +extern go_result go_quat_mat_convert(const go_quat *, go_mat *); +extern go_result go_quat_zyz_convert(const go_quat *, go_zyz *); +extern go_result go_quat_zyx_convert(const go_quat *, go_zyx *); +extern go_result go_quat_rpy_convert(const go_quat *, go_rpy *); + +extern go_result go_mat_rvec_convert(const go_mat *, go_rvec *); +extern go_result go_mat_quat_convert(const go_mat *, go_quat *); +extern go_result go_mat_zyz_convert(const go_mat *, go_zyz *); +extern go_result go_mat_zyx_convert(const go_mat *, go_zyx *); +extern go_result go_mat_rpy_convert(const go_mat *, go_rpy *); + +extern go_result go_zyz_rvec_convert(const go_zyz *, go_rvec *); +extern go_result go_zyz_quat_convert(const go_zyz *, go_quat *); +extern go_result go_zyz_mat_convert(const go_zyz *, go_mat *); +extern go_result go_zyz_zyx_convert(const go_zyz *, go_zyx *); +extern go_result go_zyz_rpy_convert(const go_zyz *, go_rpy *); + +extern go_result go_zyx_rvec_convert(const go_zyx *, go_rvec *); +extern go_result go_zyx_quat_convert(const go_zyx *, go_quat *); +extern go_result go_zyx_mat_convert(const go_zyx *, go_mat *); +extern go_result go_zyx_zyz_convert(const go_zyx *, go_zyz *); +extern go_result go_zyx_rpy_convert(const go_zyx *, go_rpy *); + +extern go_result go_rpy_rvec_convert(const go_rpy *, go_rvec *); +extern go_result go_rpy_quat_convert(const go_rpy *, go_quat *); +extern go_result go_rpy_mat_convert(const go_rpy *, go_mat *); +extern go_result go_rpy_zyz_convert(const go_rpy *, go_zyz *); +extern go_result go_rpy_zyx_convert(const go_rpy *, go_zyx *); + +/* combined rep conversion functions */ + +extern go_result go_pose_hom_convert(const go_pose *, go_hom *); +extern go_result go_hom_pose_convert(const go_hom *, go_pose *); + +/* translation functions, that work only with the preferred + go_cart type. Other types must be converted to go_cart + to use these, e.g., there's no go_sph_cyl_compare() */ + +extern go_flag go_cart_cart_compare(const go_cart *, const go_cart *); +extern go_result go_cart_cart_dot(const go_cart *, const go_cart *, + go_real *); +extern go_result go_cart_cart_cross(const go_cart *, const go_cart *, + go_cart *); +extern go_result go_cart_mag(const go_cart *, go_real *); +extern go_result go_cart_cart_disp(const go_cart *, const go_cart *, + go_real *); +extern go_result go_cart_cart_add(const go_cart *, const go_cart *, + go_cart *); +extern go_result go_cart_cart_sub(const go_cart *, const go_cart *, + go_cart *); +extern go_result go_cart_scale_mult(const go_cart *, go_real, go_cart *); +extern go_result go_cart_scale_div(const go_cart *, go_real, go_cart *); +extern go_result go_cart_neg(const go_cart *, go_cart *); +extern go_result go_cart_unit(const go_cart *, go_cart *); +extern go_result go_cart_is_norm(const go_cart *); +extern go_result go_cart_inv(const go_cart *, go_cart *); +extern go_result go_cart_cart_proj(const go_cart *, const go_cart *, + go_cart *); +extern go_result go_cart_plane_proj(const go_cart *, const go_cart *, + go_cart *); +extern go_result go_cart_cart_angle(const go_cart *, const go_cart *, + go_real *); +extern go_result go_cart_centroid(const go_cart * varray, + go_integer num, + go_cart * centroid); +extern go_result go_cart_centroidize(const go_cart * vinarray, + go_integer num, + go_cart * centroid, + go_cart * voutarray); +extern go_result go_cart_cart_pose(const go_cart *, const go_cart *, + go_cart *, go_cart *, + go_integer, go_pose *); + +/*! + Returns the Cartesian point \a p whose distances from three other points + \a c1, \a c2 and \a c3 are \a l1, \a l2 and \a l3, respectively. In + general there are 0, 1 or two points possible. If no point is possible, + this returns GO_RESULT_ERROR, otherwise the points are returned in \a + p1 and \a p2, which may be the same point. +*/ + +go_result go_cart_trilaterate(const go_cart * c1, + const go_cart * c2, + const go_cart * c3, + go_real l1, + go_real l2, + go_real l3, + go_cart * p1, + go_cart * p2); + +/* unit vector functions, which assume unit vectors as arguments. If they + aren't the results will be unexpected */ + +extern go_result go_uvec_uvec_dot(const go_uvec *, const go_uvec *, + go_real *); +extern go_result go_uvec_uvec_angle(const go_uvec *, const go_uvec *, + go_real *); + +/* quat functions */ + +extern go_flag go_quat_quat_compare(const go_quat *, const go_quat *); +extern go_result go_quat_mag(const go_quat *, go_real *); +extern go_result go_quat_unit(const go_quat *, go_quat *); +extern go_result go_quat_norm(const go_quat *, go_quat *); +extern go_result go_quat_inv(const go_quat *, go_quat *); +extern go_result go_quat_is_norm(const go_quat *); +extern go_result go_quat_scale_mult(const go_quat *, go_real, go_quat *); +extern go_result go_quat_scale_div(const go_quat *, go_real, go_quat *); +extern go_result go_quat_quat_mult(const go_quat *, const go_quat *, + go_quat *); +extern go_result go_quat_cart_mult(const go_quat *, const go_cart *, + go_cart *); + +/* rotation vector functions */ + +extern go_flag go_rvec_rvec_compare(const go_rvec * r1, const go_rvec * r2); +extern go_result go_rvec_scale_mult(const go_rvec *, go_real, go_rvec *); +extern go_result go_rvec_scale_div(const go_rvec *, go_real, go_rvec *); +extern go_result go_rvec_is_norm(const go_rvec *); +extern go_result go_rvec_norm(const go_rvec *, go_rvec *); + +/* rotation matrix functions */ + +/* | m.x.x m.y.x m.z.x | */ +/* M = | m.x.y m.y.y m.z.y | */ +/* | m.x.z m.y.z m.z.z | */ + +extern go_result go_mat_norm(const go_mat *, go_mat *); +extern go_result go_mat_is_norm(const go_mat *); +extern go_result go_mat_inv(const go_mat *, go_mat *); +extern go_result go_mat_cart_mult(const go_mat *, const go_cart *, go_cart *); +extern go_result go_mat_mat_mult(const go_mat *, const go_mat *, go_mat *); + +/* pose functions*/ + +extern go_flag go_pose_pose_compare(const go_pose *, const go_pose *); +extern go_result go_pose_inv(const go_pose *, go_pose *); +extern go_result go_pose_cart_mult(const go_pose *, const go_cart *, + go_cart *); +extern go_result go_pose_pose_mult(const go_pose *, const go_pose *, + go_pose *); + +/* homogeneous transform functions */ + +extern go_result go_hom_inv(const go_hom *, go_hom *); + +/* declarations for general MxN matrices */ + +/*! + Declare a matrix variable \a m with \a rows rows and \a cols columns. + Allocates \a rows X \a columns of space in \a mspace. +*/ + +typedef go_real go_vector; + +typedef struct { + go_integer rows; + go_integer cols; + go_real ** el; + go_real ** elcpy; + go_real * v; + go_integer * index; +} go_matrix; + +#define GO_MATRIX_DECLARE(M,Mspace,_rows,_cols) \ +go_matrix M = {0, 0, 0, 0, 0, 0}; \ +struct { \ + go_real * el[_rows]; \ + go_real * elcpy[_rows]; \ + go_real stg[_rows][_cols]; \ + go_real stgcpy[_rows][_cols]; \ + go_real v[_rows]; \ + go_integer index[_rows]; \ +} Mspace + +#define go_matrix_init(M,Mspace,_rows,_cols) \ +M.el = Mspace.el; \ +M.elcpy = Mspace.elcpy; \ +for (M.rows = 0; M.rows < (_rows); M.rows++) { \ + M.el[M.rows] = Mspace.stg[M.rows]; \ + M.elcpy[M.rows] = Mspace.stgcpy[M.rows]; \ +} \ +M.rows = (_rows); \ +M.cols = (_cols); \ +M.v = Mspace.v; \ +M.index = Mspace.index + +extern go_result +go_set_singular_epsilon(go_real epsilon); + +extern go_result +ludcmp(go_real ** a, + go_real * scratchrow, + go_integer n, + go_integer * indx, + go_real * d); + +extern go_result +lubksb(go_real ** a, + go_integer n, + go_integer * indx, + go_real * b); + +/* MxN matrix, Mx1 vector functions */ + +extern go_result +go_cart_vector_convert(const go_cart * c, + go_vector * v); +extern go_result +go_vector_cart_convert(const go_real * v, + go_cart * c); + +extern go_result +go_quat_matrix_convert(const go_quat * quat, + go_matrix * matrix); + +extern go_result +go_mat_matrix_convert(const go_mat * mat, + go_matrix * matrix); + +extern go_result +go_matrix_matrix_add(const go_matrix * a, + const go_matrix * b, + go_matrix * apb); + +extern go_result +go_matrix_matrix_copy(const go_matrix * src, + go_matrix * dst); + +extern go_result +go_matrix_matrix_mult(const go_matrix * a, + const go_matrix * b, + go_matrix * ab); + +extern go_result +go_matrix_vector_mult(const go_matrix * a, + const go_vector * v, + go_vector * av); + +/*! + The matrix-vector cross product is a matrix of the same dimension, + whose columns are the column-wise cross products of the matrix + and the vector. The matrices must be 3xN, the vector 3x1. +*/ +extern go_result +go_matrix_vector_cross(const go_matrix * a, + const go_vector * v, + go_matrix * axv); + +extern go_result +go_matrix_transpose(const go_matrix * a, + go_matrix * at); + +extern go_result +go_matrix_inv(const go_matrix * a, + go_matrix * ainv); + +/* Square matrix functions, where matN is an NxN matrix, and vecN + is an Nx1 vector */ + +/*! + Given a 6x6 matrix \a a, computes the inverse and returns it in + \a ainv. Leaves \a a untouched. Returns GO_RESULT_OK if there is an + inverse, else GO_RESULT_SINGULAR if the matrix is singular. +*/ +extern go_result go_mat6_inv(const go_real a[6][6], + go_real ainv[6][6]); + +/*! + Given two 6x6 matrices \a a and \a b, multiplies them and returns + the result in \a axb. Leaves \a a and \a b untouched. + Returns GO_RESULT_OK. +*/ +extern go_result go_mat6_mat6_mult(const go_real a[6][6], + const go_real b[6][6], + go_real axb[6][6]); + +/*! + Given a 6x6 matrix \a a and a 6x1 vector \a v, multiplies them + and returns the result in \a axv. Leaves \a a and \a v untouched. + Returns GO_RESULT_OK. +*/ +extern go_result go_mat6_vec6_mult(const go_real a[6][6], + const go_real v[6], + go_real axv[6]); + +/* Denavit-Hartenberg to pose conversions */ + +/* + The link frams is assumed to be + + | i-1 + | T + | i + + that is, elements of the link frame expressed wrt the + previous link frame. +*/ + +/*! + These DH parameters follow the convention in John J. Craig, + _Introduction to Robotics: Mechanics and Control_. +*/ +typedef struct { + go_real a; /*< a[i-1] */ + go_real alpha; /*< alpha[i-1] */ + go_real d; /*< d[i] */ + go_real theta; /*< theta[i] */ +} go_dh; + +/*! + PK parameters are used for parallel kinematic mechanisms, and + represent the Cartesian positions of the ends of the link in the + stationary base frame and the moving platform frame. + */ +typedef struct { + go_cart base; /*< position of fixed end in base frame */ + go_cart platform; /*< position of moving end in platform frame */ +} go_pk; + +/*! + PP parameters represent the pose of the link with respect to the + previous link, with \a prismatic non-zero for prismatic links + and zero for revolute links. Prismatic joints are assumed to + move along the Z axis, revolute joints about the Z axis. + */ +typedef struct { + go_pose pose; /* e.g., from go_dh_pose_convert */ +} go_pp; + +/*! Types of link parameter representations */ +enum { + GO_LINK_DH = 1, /*< for Denavit-Hartenberg params */ + GO_LINK_PK, /*< for parallel kinematics */ + GO_LINK_PP /*< for serial kinematics */ +}; + +/*! + This is the generic link structure for PKM sliding/cable links and + serial revolute/prismatic links. + */ +typedef struct { + union { + go_dh dh; /*< if you have DH params and don't want to convert to PP */ + go_pk pk; /*< if you have a parallel machine, e.g., hexapod or robot crane */ + go_pp pp; /*< if you have a serial machine, e.g., an industrial robot */ + } u; + go_flag type; /*< one of GO_LINK_DH,PK,PP */ + go_flag quantity; /*< one of GO_QUANTITY_LENGTH,ANGLE */ +} go_link; + +/*! + Converts DH parameters in \a dh to their pose equivalent, stored + in \a pose. + */ +extern go_result go_dh_pose_convert(const go_dh * dh, go_pose * pose); + +/*! + Converts \a pose to the equivalent DH parameters, stored in \a dh. + Warning! Conversion from these DH parameters back to a pose via \a + go_dh_pose_convert will NOT in general result in the same + pose. Poses have 6 degrees of freedom, DH parameters have 4, and + conversion to DH parameters loses some information. The source of + this information loss is the convention imposed on DH parameters for + choice of X-Y-Z axis directions. With poses, there is no such + convention, and poses are thus freer than DH parameters. + */ +extern go_result go_pose_dh_convert(const go_pose * pose, go_dh * dh); + +/* + Fixes the pose in PP parameters \a pp to its value when the joint + variable is \a joint, storing the result in \a ppout. \a pp + represents the pose when the joint value is 0, its origin; \a ppout + represents the pose at an arbitrary joint value. +*/ +extern go_result go_link_joint_set(const go_link * link, go_real joint, go_link * linkout); + +typedef struct { + go_real re; + go_real im; +} go_complex; + +extern go_complex go_complex_add(go_complex z1, go_complex z2); +extern go_complex go_complex_sub(go_complex z1, go_complex z2); +extern go_complex go_complex_mult(go_complex z1, go_complex z2); +extern go_complex go_complex_div(go_complex z1, go_complex z2, go_result * result); +extern go_complex go_complex_scale(go_complex z, go_real scale); +extern go_real go_complex_mag(go_complex z); +extern go_real go_complex_arg(go_complex z); +extern void go_complex_sqrt(go_complex z, go_complex * z1, go_complex * z2); +extern void go_complex_cbrt(go_complex z, go_complex * z1, go_complex * z2, go_complex * z3); + +typedef struct { + /* leading coefficient is 1, x^2 + ax + b = 0 */ + go_real a; + go_real b; +} go_quadratic; + +typedef struct { + /* leading coefficient is 1, x^3 + ax^2 + bx + c = 0 */ + go_real a; + go_real b; + go_real c; +} go_cubic; + +typedef struct { + /* leading coefficient is 1, x^4 + ax^3 + bx^2 + cx + d = 0 */ + go_real a; + go_real b; + go_real c; + go_real d; +} go_quartic; + +extern go_result go_quadratic_solve(const go_quadratic * quad, + go_complex * z1, + go_complex * z2); + +extern go_result go_cubic_solve(const go_cubic * cub, + go_complex * z1, + go_complex * z2, + go_complex * z3); + +extern go_result go_quartic_solve(const go_quartic * quart, + go_complex * z1, + go_complex * z2, + go_complex * z3, + go_complex * z4); + +extern go_result go_tridiag_reduce(go_real ** a, + go_integer n, + go_real * d, + go_real * e); + +extern go_result go_tridiag_ql(go_real * d, + go_real * e, + go_integer n, + go_real ** z); + +#endif /* GO_MATH_H */ + +/* + $Log: gomath.h,v $ + Revision 1.1 2007/05/09 15:19:06 proctor + Added the math source files from go motion, and changed the Makefile.am + so that robojoy links these in. + + Revision 1.27 2007/05/08 21:10:20 proctor + Reworked the handling of kinematic parameters, taking them out of the TRAJ + section and putting them in the SERVO sections as DH,PP,PK_PARAMETERS + and getting rid of unit handling-- now everything is converted to Go units + before sending to Go. + + Revision 1.26 2007/05/04 15:20:24 proctor + Comments on go_link + + Revision 1.25 2007/05/04 13:06:04 proctor + Added comments on go_dh, go_pp and put in placeholders for go_pk and go_link + + Revision 1.24 2007/05/01 18:24:03 proctor + Added go_cart_rpy,uvec convert functions + + Revision 1.23 2007/04/27 17:33:28 proctor + Added go_set_singular_epsilon, and verified gojactest.c works and builds + inverses for all three cases + + Revision 1.22 2007/04/26 21:37:19 proctor + Added gojactest.c and conversions between go_quat and go_matrix + + Revision 1.21 2007/04/24 23:10:08 proctor + Used new go_matrix structure + + Revision 1.20 2007/04/24 15:19:51 proctor + Added general matrix functions + + Revision 1.19 2006/12/22 13:48:57 proctor + Added traj_ref setup, but not handling-- still need to run the calculations + in do_cmd_move_world, and this will wait until we get time for testing + + Revision 1.18 2006/11/22 15:36:15 proctor + Fixed sqrt check on mat to quat convert, to fix problems in puma kins + + Revision 1.17 2006/11/20 17:39:28 proctor + Took out RC matrix index macro in place of [][] notation + + Revision 1.16 2006/11/16 18:48:23 proctor + Fixed unix rtapi_arg bug with string malloc + + Revision 1.15 2006/11/14 14:02:48 proctor + Added roboch stuff + + Revision 1.14 2006/11/08 21:28:25 proctor + Added roboch Robocrane-Horizontal code, and updates to gomath for the + trilateration functions. Also made the comparison values coarser. + + Revision 1.13 2006/10/31 21:19:07 proctor + Completed go_pose_cart_mult, adding go_tridiag functions + + Revision 1.12 2006/10/10 14:24:35 proctor + Replaced the original go_traj_cj_compute with one that had the correct + two checks for the existence of an acceleration phase, and split out the + code into smaller easy pieces. Moved go_sq,cub,qua into gomath.h. + + Revision 1.11 2006/10/07 19:38:05 proctor + Put go_cbrt in gomath.c,h, took out of gotraj.c + + Revision 1.10 2006/09/20 19:55:41 proctor + Fixed bug in go_cubic_solve where values that should be complex conjugates weren't, + and complex roots of scalars were being used. + + Revision 1.9 2006/09/18 20:17:58 proctor + Added beginnings of absolute orientation, namely complex number handling + and quadratic, cubic solving in gomath.c + + Revision 1.8 2006/09/07 13:50:50 proctor + Fixed stepper motor interface, and added deadband to PID. + + Revision 1.7 2006/07/25 14:36:25 proctor + Changed go_rot to go_rvec + + Revision 1.6 2006-07-24 21:57:55 proctor + In gomath, added Denavit-Hartenberg/pose conversion functions; + in rtai, added some stepper-related changes + +*/ + Added: moast-bth/moast/include/gotypes.h =================================================================== --- moast-bth/moast/include/gotypes.h (rev 0) +++ moast-bth/moast/include/gotypes.h 2007-07-11 16:33:26 UTC (rev 650) @@ -0,0 +1,225 @@ +#ifndef GO_TYPES_H +#define GO_TYPES_H + +#include /* DBL_MAX, FLOAT_MAX */ +#include /* INT_MAX */ + +/* + Primitive types: go_result, go_real, go_integer, go_flag + + These are intended to make smaller or faster versions of the Go + library, or to reflect processor architectures. The defaults are + usually fine and nothing should need to be overridden. + + If you do override these when compiling your code, you run the + risk that the Go library you link with will have been compiled + with other choices. To detect this at link time, references to + global variables such as 'go_integer_int' will be compiled into + your code by the 'go_init()' macro. If they are not present in the + Go library, the linker will complain and your application will fail + to build. For example, if you override the definition for go_integer + to be a long int, and link with a precompiled default version of the + Go library, you will see something like this: + + gcc yourapp.c -DGO_INTEGER_LONG -lgo -lm -o yourapp + ... + In function `main': + .../yourapp.c:10: undefined reference to `go_integer_long' + + The fix is to recompile the entire Go library with your override + settings, e.g., + + cd .../go + make clean + make CFLAGS+=-DGO_INTEGER_LONG all + + You should probably save the resulting non-default Go library + as something else and recompile Go with the defaults, e.g., + + mv libgo.a libgofast.a + make clean + make all + + You'll then compile your application like this: + + gcc yourapp.c -DGO_INTEGER_LONG -lgofast -lm -o yourapp + + Type descriptions: + + go_result is the type for error codes returned from functions, + one of the types in GO_RESULT_OK, ... as defined in the enum below. + The default value is 'int'. Override at compile time with one of: + + GO_RESULT_CHAR + GO_RESULT_SHORT + GO_RESULT_INT + + e.g., -DGO_RESULT_CHAR + + go_real is the type for real-valued numbers. The default value + is 'double'. Override at compile time with one of: + + GO_REAL_FLOAT + GO_REAL_DOUBLE + GO_REAL_LONG_DOUBLE + + e.g., -DGO_REAL_FLOAT + + go_integer is the type for signed integers. The default value + is 'int'. Override at compile time with one of: + + GO_INTEGER_SHORT + GO_INTEGER_INT + GO_INTEGER_LONG + GO_INTEGER_LONG_LONG + + e.g., -DGO_INTEGER_LONG_LONG + + go_flag is the type for small non-negative flags. The default + value is 'unsigned char'. Override at compile time with one of: + + GO_FLAG_UCHAR + GO_FLAG_USHORT + GO_FLAG_UINT + + e.g., -DGO_FLAG_UINT +*/ + +/* go_result: char, short, default int */ + +#if defined(GO_RESULT_CHAR) +typedef char go_result; +#define GO_RESULT go_result_char +extern int go_result_char; + +#elif defined(GO_RESULT_SHORT) +typedef short int go_result; +#define GO_RESULT go_result_short +extern int go_result_short; + +#else +#define GO_RESULT_INT +typedef int go_result; +#define GO_RESULT go_result_int +extern int go_result_int; +#endif + +/*! + GO_RESULT symbols run through a small range of values, on the + order of tens, suitable for a byte. GO_RESULT_OK is zero for easy + detection of error conditions, e.g., if (result) { handle error } +*/ +enum { + GO_RESULT_OK = 0, + GO_RESULT_IGNORED, /* action can't be done, ignored */ + GO_RESULT_BAD_ARGS, /* arguments bad, e.g., null pointer */ + GO_RESULT_RANGE_ERROR, /* supplied range value out of bounds */ + GO_RESULT_DOMAIN_ERROR, /* resulting domain out of bounds */ + GO_RESULT_ERROR, /* action can't be done, a problem */ + GO_RESULT_IMPL_ERROR, /* function not implemented */ + GO_RESULT_NORM_ERROR, /* a value is expected to be normalized */ + GO_RESULT_DIV_ERROR, /* divide by zero */ + GO_RESULT_SINGULAR, /* a matrix is singular */ + GO_RESULT_NO_SPACE, /* no space for append operation */ + GO_RESULT_EMPTY, /* data structure is empty */ + GO_RESULT_BUG /* a bug in Go, e.g., unknown case */ +}; + +/*! + Joints are characterized by the quantities they affect, such as + length for linear joints and angle for rotary joints. +*/ +enum { + GO_QUANTITY_LENGTH = 1, + GO_QUANTITY_ANGLE +}; + +#define go_quantity_to_string(q) (q) == GO_QUANTITY_LENGTH ? "Length" : (q) == GO_QUANTITY_ANGLE ? "Angle" : "?" + +/* go_real: float, long double, default double; GO_INF is defined as + the associated max value from float.h */ + +/* + In IEEE floating point, + + FLT_MIN = 1.175494e-38, FLT_EPSILON 1.192093e-07 + DBL_MIN = 2.225074e-308, DBL_EPSILON 2.220446e-16 +*/ + +#if defined(GO_REAL_FLOAT) +typedef float go_real; +#define GO_REAL go_real_float +extern int go_real_float; +#define GO_REAL_MIN FLT_MIN +#define GO_REAL_MAX FLT_MAX +#define GO_REAL_EPSILON (1.0e-4) +#define GO_INF FLT_MAX + +#elif defined(GO_REAL_LONG_DOUBLE) +typedef long double go_real; +#define GO_REAL go_real_long_double +extern int go_real_long_double; +#define GO_REAL_MIN DBL_MIN +#define GO_REAL_MAX DBL_MAX +#define GO_REAL_EPSILON (1.0e-10) +#define GO_INF DBL_MAX + +#else +#define GO_REAL_DOUBLE +typedef double go_real; +#define GO_REAL go_real_double +extern int go_real_double; +#define GO_REAL_MIN DBL_MIN +#define GO_REAL_MAX DBL_MAX +#define GO_REAL_EPSILON (1.0e-7) +#define GO_INF DBL_MAX +#endif + +/* go_integer: short, long, long long, default int */ + +#if defined(GO_INTEGER_SHORT) +typedef short int go_integer; +#define GO_INTEGER go_integer_short +extern int go_integer_short; +#define GO_INTEGER_MAX SHRT_MAX + +#elif defined(GO_INTEGER_LONG) +typedef long int go_integer; +#define GO_INTEGER go_integer_long +extern int go_integer_long; +#define GO_INTEGER_MAX LONG_MAX + +#elif defined(GO_INTEGER_LONG_LONG) +typedef long long int go_integer; +#define GO_INTEGER go_integer_long_long +extern int go_integer_long_long; +#define GO_INTEGER_MAX LONG_MAX + +#else +#define GO_INTEGER_INT +typedef int go_integer; +#define GO_INTEGER go_integer_int +extern int go_integer_int; +#define GO_INTEGER_MAX INT_MAX +#endif + +/* go_flag: unsigned short, unsigned int, default unsigned char */ + +#if defined(GO_FLAG_USHORT) +typedef unsigned short go_flag; +#define GO_FLAG go_flag_ushort +extern int go_flag_ushort; + +#elif defined(GO_FLAG_UINT) +typedef unsigned int go_flag; +#define GO_FLAG go_flag_uint +extern int go_flag_uint; + +#else +#define GO_FLAG_UCHAR +typedef unsigned char go_flag; +#define GO_FLAG go_flag_uchar +extern int go_flag_uchar; +#endif + +#endif /* GO_TYPES_H */ Modified: moast-bth/moast/include/moastNmlGlobal.hh =================================================================== --- moast-bth/moast/include/moastNmlGlobal.hh 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/include/moastNmlGlobal.hh 2007-07-11 16:33:26 UTC (rev 650) @@ -17,8 +17,8 @@ \code CVS Status: $Author: dr_steveb $ - $Revision: 1.9 $ - $Date: 2006/10/31 09:30:41 $ + $Revision: 1.10 $ + $Date: 2007/06/28 12:14:12 $ \endcode \author Fred Proctor @@ -76,27 +76,57 @@ extern NML *symbolicDataBuf[NUM_SYMBOLIC_DATA_BUFFERS]; +#if NUM_NAV_DATA_EXT_BUFFERS extern NML *navDataExtBuf[NUM_NAV_DATA_EXT_BUFFERS]; +#else +extern NML *navDataExtBuf; +#endif +#if NUM_SERVO_SP_LINESCAN_BUFFERS extern NML *servoSPLinescanBuf[NUM_SERVO_SP_LINESCAN_BUFFERS]; +#else +extern NML *servoSPLinescanBuf; +#endif + extern NML *primSPLinescanBuf[NUM_PRIM_SP_LINESCAN_BUFFERS]; extern NML *amSPMapBuf[NUM_AM_SP_MAP_BUFFERS]; extern NML *vehMapBuf[NUM_VEH_MOB_PL_BUFFERS]; +#if NUM_SERVO_MOB_JA_BUFFERS extern RCS_CMD_CHANNEL *servoMobJACmdBuf[NUM_SERVO_MOB_JA_BUFFERS]; extern RCS_CMD_CHANNEL *servoMobJACfgBuf[NUM_SERVO_MOB_JA_BUFFERS]; extern RCS_STAT_CHANNEL *servoMobJAStatBuf[NUM_SERVO_MOB_JA_BUFFERS]; extern RCS_STAT_CHANNEL *servoMobJASetBuf[NUM_SERVO_MOB_JA_BUFFERS]; +#else +extern RCS_CMD_CHANNEL *servoMobJACmdBuf; +extern RCS_CMD_CHANNEL *servoMobJACfgBuf; +extern RCS_STAT_CHANNEL *servoMobJAStatBuf; +extern RCS_STAT_CHANNEL *servoMobJASetBuf; +#endif +#if NUM_SERVO_SP_BUFFERS extern RCS_CMD_CHANNEL *servoSPCmdBuf[NUM_SERVO_SP_BUFFERS]; extern RCS_STAT_CHANNEL *servoSPStatBuf[NUM_SERVO_SP_BUFFERS]; extern RCS_STAT_CHANNEL *servoSPSetBuf[NUM_SERVO_SP_BUFFERS]; extern RCS_CMD_CHANNEL *servoSPCfgBuf[NUM_SERVO_SP_BUFFERS]; +#else +extern RCS_CMD_CHANNEL *servoSPCmdBuf; +extern RCS_STAT_CHANNEL *servoSPStatBuf; +extern RCS_STAT_CHANNEL *servoSPSetBuf; +extern RCS_CMD_CHANNEL *servoSPCfgBuf; +#endif +#if NUM_SERVO_MIS_JA_BUFFERS extern RCS_CMD_CHANNEL *servoMisJACmdBuf[NUM_SERVO_MIS_JA_BUFFERS]; extern RCS_STAT_CHANNEL *servoMisJAStatBuf[NUM_SERVO_MIS_JA_BUFFERS]; extern RCS_STAT_CHANNEL *servoMisJASetBuf[NUM_SERVO_MIS_JA_BUFFERS]; extern RCS_CMD_CHANNEL *servoMisJACfgBuf[NUM_SERVO_MIS_JA_BUFFERS]; +#else +extern RCS_CMD_CHANNEL *servoMisJACmdBuf; +extern RCS_STAT_CHANNEL *servoMisJAStatBuf; +extern RCS_STAT_CHANNEL *servoMisJASetBuf; +extern RCS_CMD_CHANNEL *servoMisJACfgBuf; +#endif extern RCS_CMD_CHANNEL *primMobJACmdBuf[NUM_PRIM_MOB_JA_BUFFERS]; extern RCS_STAT_CHANNEL *primMobJAStatBuf[NUM_PRIM_MOB_JA_BUFFERS]; @@ -160,6 +190,9 @@ Modification history: $Log: moastNmlGlobal.hh,v $ + Revision 1.10 2007/06/28 12:14:12 dr_steveb + Removed 0 length arrays that Microsoft compiliers complain about + Revision 1.9 2006/10/31 09:30:41 dr_steveb Changes for SPQR integration Modified: moast-bth/moast/include/moastTypes.hh =================================================================== --- moast-bth/moast/include/moastTypes.hh 2007-07-11 16:23:30 UTC (rev 649) +++ moast-bth/moast/include/moastTypes.hh 2007-07-11 16:33:26 UTC (rev 650) @@ -16,8 +16,8 @@ \code CVS Status: $Author: dr_steveb $ - $Revision: 1.6 $ - $Date: 2007/04/25 15:08:57 $ + $Revision: 1.8 $ + $Date: 2007/06/28 12:02:35 $ \endcode \author Fred Proctor @@ -26,6 +26,7 @@ #ifndef MOAST_TYPES_HH #define MOAST_TYPES_HH +#include // FILE, fprintf #include // RCS_STAT_SOURCE_FILE_LEN #include // PM_CARTESIAN @@ -82,13 +83,45 @@ }; //! 2-D location structure -typedef struct { +class Location2D +{ +public: + Location2D(){}; //! the north location of the point double north; //! the east location of the point double east; -}Location2D; + Location2D(const Location2D ©In) // copy constructor to handle pass by value + { + north = copyIn.north; + east = copyIn.east; + }; + + Location2D& operator=(const Location2D &rhs) + { + this->north = rhs.north; + this->east = rhs.east; + return *this; + }; + + int operator==(const Location2D &rhsIn) const + { + if( this->north!=rhsIn.north || this->east!=rhsIn.east ) + return 0; + else + return 1; + }; + +// sort by (increasing north, decreasing east) + int operator<(const Location2D &rhs) const + { + if( this->north == rhs.north && this->east > rhs.east ) return 1; // make (0,4) come before (0,0) + if( this->north < rhs.north ) return 1; + return 0; + }; +}; + //! A directed line segment may be represented by its two endpoints class LineSegment { @@ -112,11 +145,40 @@ end.north = north; end.east = east; }; + void print(FILE *output=stdout) + { + fprintf( output, "%f %f\n%f %f\n\n", + start.north, start.east, + end.north, end.east ); + }; Location2D start; Location2D end; long properties; //!< a pointer that points to a properties structure for this line }; +/* + An ArcSegment is a path from an implicit start location to an end + location, along a circular arc. In a 2-D problem, the Z values are + ignored, and the normal vector is assumed to be +Z. +*/ +typedef struct { + PM_CARTESIAN center; // coords of center + PM_CARTESIAN end; // coords of end + PM_CARTESIAN normal; // normal vector + // nominal angular displacement about normal from implicit start to end + double theta; + // tolerance along path, difference between outer and inner radius + double annular_tol; + // speed along the segment; acceleration is a system-wide parameter + double speed; + int isArc; // 1 means arc, 0 means line, use 'end' +} ArcSegment; + +//! define conventions for rotations +enum {MOAST_ROTATE_CW, // force clockwise rotation + MOAST_ROTATE_CCW, // force counter-clockwise rotation + MOAST_ROTATE_SHORTEST}; // take shortest rotation + //! Constrained interger structure typedef struct { //! integer value that will be constrained @@ -165,6 +227,12 @@ /* $Log: moastTypes.hh,v $ + Revision 1.8 2007/06/28 12:02:35 dr_steveb + Changed location2d into a class from a structure + + Revision 1.7 2007/05/10 13:15:31 dr_steveb + Moved rotation and arcSegment declaration from primMobJA to moastTypes so that multiple apps can use them. + Revision 1.6 2007/04/25 15:08:57 dr_steveb Added traffic simulation files Added: moast-bth/moast/include/primMobEngine.hh =================================================================== --- moast-bth/moast/include/primMobEngine.hh (rev 0) +++ moast-bth/moast/include/primMobEngine.hh 2007-07-11 16:33:26 UTC (rev 650) @@ -0,0 +1,188 @@ +/* + DISCLAIMER: + This software was produced by the National Institute of Standards + and Technology (NIST), an agency of the U.S. government, and by statute is + not subject to copyright in the United States. Recipients of this software + assume all responsibility associated with its operation, modification, + maintenance, and subsequent redistribution. + + See NIST Administration Manual 4.09.07 b and Appendix I. +*/ + +/*! + \file primMobEngine.hh + + \brief Vehicle primitive level planning engine + + \code CVS Status: + $Author: dr_steveb $ + $Revision: 1.2 $ + $Date: 2007/05/16 15:16:21 $ + \endcode + + \author Stephen Balakirsky & Fred Proctor +*/ +#ifndef __primMobEngine__ +#define __primMobEngine__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include // sizeof(), NULL +#include // getenv(), strtol() +#include // SIGINT, signal() +#include +#include // strncpy +#include // sqrt(), fabs(), atan2() +#include // FLT_EPSILON +#ifdef HAVE_GETOPT_H +#include +#else +#include "getopt.h" +#endif +#include +#ifndef RCS_STAT_SOURCE_FILE_LEN +#define RCS_STAT_SOURCE_FILE_LEN 64 +#endif +#include "moastTypes.hh" // MOAST_NML_BUFFER_NAME_LEN + +#define DEG(x) (57.295779513082323 * (x)) +#define RAD(x) (0.017453292519943 * (x)) + +#define LOG_FILE "out.log" +/* + In IEEE floating point, + + FLT_MIN = 1.175494e-38, FLT_EPSILON 1.192093e-07 + DBL_MIN = 2.225074e-308, DBL_EPSILON 2.220446e-16 + + The FLT_EPSILON value makes a good fuzzy comparison for the + equality of two reals. +*/ + +#define IS_SMALL(x) (fabs(x) < FLT_EPSILON) +#define IS_POSITIVE(x) ((x) >= FLT_EPSILON) +#define WAYPOINT_INITIAL_SIZE MAX_WAYPOINTS // how many waypoints we start with +#define HYPOT(x,y) sqrt((x)*(x)+(y)*(y)) +// force angles to be in range [-Pi..Pi) +#define NORM(x) while ((x) >= PM_PI) (x) -= PM_2_PI; while ((x) < -PM_PI) (x) += PM_2_PI + + +#define DEFAULT_CYCLE_TIME 0.050 +#define DEFAULT_MAX_TRAN_VEL 1.0 // m/s +#define DEFAULT_MAX_TRAN_ACC 1.0 // m/s/s +#define DEFAULT_MAX_ROT_VEL 1.0 // rad/s +#define DEFAULT_MAX_ROT_ACC 1.0 // rad/s/s +#define DEFAULT_V_CUTOFF_ANGLE 1.0 // rad +#define DEFAULT_W_CUTOFF_ANGLE 1.0 // rad +#define DEFAULT_DEBUG 0 + +class PrimMobEngine{ + private: + // computationally efficient values from wheel radius, separation + double v, w; // angular and linear velocities + double wheel_radius; + double wheel_radius_inverse; + double wheel_separation; + double wheel_separation_half; + int waypoint_size; // size of whole array + int waypoint_num; // how many currently in the array + int waypoint_index; // which one we're working on @@ Diff output truncated at 60000 characters. @@ From tk at edam.speech.cs.cmu.edu Wed Jul 11 12:41:40 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Wed, 11 Jul 2007 12:41:40 -0400 Subject: [TeamTalk 114]: [651] TeamTalk/Agents/PrimitiveComm/Makefile: 1) make clean removes dependency files Message-ID: <200707111641.l6BGfeZq008411@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070711/21c2c73c/attachment.html -------------- next part -------------- Modified: TeamTalk/Agents/PrimitiveComm/Makefile =================================================================== --- TeamTalk/Agents/PrimitiveComm/Makefile 2007-07-11 16:33:26 UTC (rev 650) +++ TeamTalk/Agents/PrimitiveComm/Makefile 2007-07-11 16:41:40 UTC (rev 651) @@ -75,4 +75,4 @@ # Clean rule clean: $(CLEAN_ECHO) - $(Q)rm -f *.o $(LIBRARIES) + $(Q)rm -f *.o *.d $(LIBRARIES) Property changes on: TeamTalk/Agents/PrimitiveComm/Makefile ___________________________________________________________________ Name: svn:executable - * From bfrisch at edam.speech.cs.cmu.edu Wed Jul 11 17:30:15 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Wed, 11 Jul 2007 17:30:15 -0400 Subject: [TeamTalk 115]: [652] usarsim/System/USARSim.ini: Updated USARSim.ini Message-ID: <200707112130.l6BLUFon010244@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070711/e9409438/attachment.html -------------- next part -------------- Modified: usarsim/System/USARSim.ini =================================================================== --- usarsim/System/USARSim.ini 2007-07-11 16:41:40 UTC (rev 651) +++ usarsim/System/USARSim.ini 2007-07-11 21:30:15 UTC (rev 652) @@ -292,12 +292,12 @@ LanServerMaxTickRate=30 [Engine.GameReplicationInfo] -ServerName=UT2004 Server -ShortName=UT2 Server +ServerName=TeamTalk UT2004 Server +ShortName=TeamTalk UT2k4 Server ServerRegion=0 AdminName= AdminEmail= -MessageOfTheDay= +MessageOfTheDay=This server is for the use of TeamTalk project developers only. All other use prohibited. [D3DDrv.D3DRenderDevice] DetailTextures=True @@ -577,7 +577,7 @@ [Engine.AccessControl] AdminPassword= -GamePassword= +GamePassword=findT bBanByID=True LoginDelaySeconds=0.000000 IPPolicies=ACCEPT;* From bfrisch at edam.speech.cs.cmu.edu Wed Jul 11 21:39:37 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Wed, 11 Jul 2007 21:39:37 -0400 Subject: [TeamTalk 116]: [653] usarsim/Maps/DM-RoboticsLab_250.ut2: Updated Robotics Lab Map: Message-ID: <200707120139.l6C1db93010995@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070711/f925352e/attachment.html -------------- next part -------------- Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) From tk at edam.speech.cs.cmu.edu Wed Jul 11 23:33:49 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Wed, 11 Jul 2007 23:33:49 -0400 Subject: [TeamTalk 117]: [654] usarsim: 1) Fixed some make issues for USARSim Message-ID: <200707120333.l6C3XnFJ011159@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070711/ea202032/attachment.html -------------- next part -------------- Modified: usarsim/System/Makefile =================================================================== --- usarsim/System/Makefile 2007-07-12 01:39:36 UTC (rev 653) +++ usarsim/System/Makefile 2007-07-12 03:33:49 UTC (rev 654) @@ -1,34 +1,46 @@ -LINUX_DIR=../../ut2004-linux/ +INSTALL_DIR=../../ut2004-linux -MAPS=$(LINUX_DIR)/Maps/DM-RoboticsLab_250.ut2 +PACKAGES=USARBotAPI.u USARBot.u USARMisPkg.u USARModels.u USARVictims.u \ + TreasureHunt.u -PACKAGES=$(LINUX_DIR)/System/USARBotAPI.u \ - $(LINUX_DIR)/System/USARBot.u \ - $(LINUX_DIR)/System/USARMisPkg.u \ - $(LINUX_DIR)/System/USARModels.u \ - $(LINUX_DIR)/System/USARVictims.u \ - $(LINUX_DIR)/System/TreasureHunt.u +INSTALL_MAPS=$(INSTALL_DIR)/Maps/DM-RoboticsLab_250.ut2 -INIS=$(LINUX_DIR)/System/USARSim.ini +INSTALL_PACKAGES=$(INSTALL_DIR)/System/USARBotAPI.u \ + $(INSTALL_DIR)/System/USARBot.u \ + $(INSTALL_DIR)/System/USARMisPkg.u \ + $(INSTALL_DIR)/System/USARModels.u \ + $(INSTALL_DIR)/System/USARVictims.u \ + $(INSTALL_DIR)/System/TreasureHunt.u -BATCH=$(LINUX_DIR)/System/usar_sx.sh +INSTALL_INIS=$(INSTALL_DIR)/System/USARSim.ini -all: ucc $(MAPS) $(PACKAGES) $(INIS) $(BATCH) +INSTALL_BATCH=$(INSTALL_DIR)/System/usar_sx.sh +all: $(PACKAGES) ucc + +install: $(INSTALL_MAPS) $(INSTALL_PACKAGES) $(INSTALL_INIS) $(INSTALL_BATCH) + +$(INSTALL_DIR)/%:../% + cp -f $< $@ + ucc: wine UCC.exe make -ini=USARSim.ini -$(LINUX_DIR)/Maps/%.ut2:../Maps/%.ut2 - cp -f $< $@ +USARBotAPI.u:../USARBotAPI/Classes/*.uc + rm -f $@ -$(LINUX_DIR)/System/%.u:%.u - cp -f $< $@ +USARBot.u:../USARBot/Classes/*.uc + rm -f $@ -$(LINUX_DIR)/System/%.ini:%.ini - cp -f $< $@ +USARMisPkg.u:../USARMisPkg/Classes/*.uc + rm -f $@ -$(LINUX_DIR)/System/%.sh:%.sh - cp -f $< $@ +USARModels.u:../USARModels/Classes/*.uc + rm -f $@ +USARVictims.u:../USARVictims/Classes/*.uc + rm -f $@ +TreasureHunt.u:../TreasureHunt/Classes/*.uc + rm -f $@ Added: usarsim/TreasureHunt/Classes/FemaleTreasureHunterPawn.uc =================================================================== --- usarsim/TreasureHunt/Classes/FemaleTreasureHunterPawn.uc (rev 0) +++ usarsim/TreasureHunt/Classes/FemaleTreasureHunterPawn.uc 2007-07-12 03:33:49 UTC (rev 654) @@ -0,0 +1,10 @@ +Class FemaleTreasureHunterPawn extends TreasureHunterPawn; + +defaultproperties +{ + // Size of all female hunters is the same + DrawScale=1.65 + + // Animation subset + Mesh=SkeletalMesh'UDN_CharacterModels_K.GenericFemale' +} \ No newline at end of file Added: usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc =================================================================== --- usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc (rev 0) +++ usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc 2007-07-12 03:33:49 UTC (rev 654) @@ -0,0 +1,21 @@ +Class MaleTreasureHunterPawn extends TreasureHunterPawn; + +defaultproperties +{ + // Size of all male hunter is the same + DrawScale=1.8 + + // Animation subset + Mesh=SkeletalMesh'UDN_CharacterModels_K.GenericMale' + + BaseEyeHeight=+00150.000000 + EyeHeight=+00150.000000 + CollisionRadius=+00061.200000 + CollisionHeight=+00203.000000 + CrouchHeight=+00070.200000 + CrouchRadius=+00061.200000 + GroundSpeed=+00800.000000 + AirSpeed=+00800.000000 + WaterSpeed=+00400.000000 + JumpZ=+00630.000000 +} \ No newline at end of file Modified: usarsim/TreasureHunt/Classes/TreasureHuntGame.uc =================================================================== --- usarsim/TreasureHunt/Classes/TreasureHuntGame.uc 2007-07-12 01:39:36 UTC (rev 653) +++ usarsim/TreasureHunt/Classes/TreasureHuntGame.uc 2007-07-12 03:33:49 UTC (rev 654) @@ -19,8 +19,6 @@ return; } - log("RESTARTSOMETHING"@aPlayer); - if( bRestartLevel && Level.NetMode!=NM_DedicatedServer && Level.NetMode!=NM_ListenServer ) return; @@ -39,12 +37,15 @@ if (aPlayer.PreviousPawnClass!=None && aPlayer.PawnClass != aPlayer.PreviousPawnClass) BaseMutator.PlayerChangedClass(aPlayer); - if ( aPlayer.PawnClass != None ) + if ( aPlayer.PawnClass != None && aPlayer.PawnClass.IsA('TreasureHunterPawn')) aPlayer.Pawn = Spawn(aPlayer.PawnClass,,,StartSpot.Location,StartSpot.Rotation); if( aPlayer.Pawn==None ) { - DefaultPlayerClass = GetDefaultPlayerClass(aPlayer); + //we may revert back to this once we speciallize the controller + //DefaultPlayerClass = GetDefaultPlayerClass(aPlayer); + //for now hardcode here + DefaultPlayerClass = class'MaleTreasureHunterPawn'; aPlayer.Pawn = Spawn(DefaultPlayerClass,,,StartSpot.Location,StartSpot.Rotation); } if ( aPlayer.Pawn == None ) Added: usarsim/TreasureHunt/Classes/TreasureHunterPawn.uc =================================================================== --- usarsim/TreasureHunt/Classes/TreasureHunterPawn.uc (rev 0) +++ usarsim/TreasureHunt/Classes/TreasureHunterPawn.uc 2007-07-12 03:33:49 UTC (rev 654) @@ -0,0 +1,5 @@ +Class TreasureHunterPawn extends UnrealPawn; + +defaultproperties +{ +} \ No newline at end of file From bfrisch at edam.speech.cs.cmu.edu Thu Jul 12 15:07:04 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Thu, 12 Jul 2007 15:07:04 -0400 Subject: [TeamTalk 118]: [655] 1) Updated moast.ini turns the robots around the other way. Message-ID: <200707121907.l6CJ744A014775@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070712/9028cbfb/attachment.html -------------- next part -------------- Modified: moast-bth/moast/etc/moast.ini =================================================================== --- moast-bth/moast/etc/moast.ini 2007-07-12 03:33:49 UTC (rev 654) +++ moast-bth/moast/etc/moast.ini 2007-07-12 19:07:02 UTC (rev 655) @@ -381,8 +381,8 @@ UTM_LETTER = N UTM_ZONE = 18 UTM_START_POSE_COUNT = 2 -UTM_START_POSE_1 = 25.0 6.5 -1. 0. 0. 0. -UTM_START_POSE_2 = 25.0 7.5 -1. 0. 0. 0. +UTM_START_POSE_1 = 25.0 6.5 -1. 0. 0. 3.14159265 +UTM_START_POSE_2 = 25.0 7.5 -1. 0. 0. 3.14159265 [DM-TallTestWorld_250] Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) From bfrisch at edam.speech.cs.cmu.edu Fri Jul 13 21:12:26 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Fri, 13 Jul 2007 21:12:26 -0400 Subject: [TeamTalk 119]: [656] usarsim: 1) Dummy folder for StaticMeshes Message-ID: <200707140112.l6E1CQWB019027@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070713/c8dc03b0/attachment.html -------------- next part -------------- Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) Added: usarsim/StaticMeshes/TreasureHunt.usx =================================================================== (Binary files differ) Property changes on: usarsim/StaticMeshes/TreasureHunt.usx ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From bfrisch at edam.speech.cs.cmu.edu Sat Jul 14 17:52:19 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Sat, 14 Jul 2007 17:52:19 -0400 Subject: [TeamTalk 120]: [657] usarsim: 1) Step area and walkway back. Message-ID: <200707142152.l6ELqJ9R025607@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070714/9434fa7c/attachment.html -------------- next part -------------- Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) Deleted: usarsim/StaticMeshes/TreasureHunt.usx =================================================================== (Binary files differ) Added: usarsim/StaticMeshes/TreasureHuntGate.usx =================================================================== (Binary files differ) Property changes on: usarsim/StaticMeshes/TreasureHuntGate.usx ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From bfrisch at edam.speech.cs.cmu.edu Sat Jul 14 19:52:15 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Sat, 14 Jul 2007 19:52:15 -0400 Subject: [TeamTalk 121]: [658] usarsim: 1) Now wall is mirror in Fun! Room Message-ID: <200707142352.l6ENqFmf025975@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070714/a8343706/attachment.html -------------- next part -------------- Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) Added: usarsim/Textures/TreasureHuntTex.utx =================================================================== (Binary files differ) Property changes on: usarsim/Textures/TreasureHuntTex.utx ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From bfrisch at edam.speech.cs.cmu.edu Mon Jul 16 19:41:59 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Mon, 16 Jul 2007 19:41:59 -0400 Subject: [TeamTalk 122]: [659] usarsim/Maps/DM-RoboticsLab_250.ut2: 1) Spiral staircase replaced with navigable one that player can walk up, even taller player Message-ID: <200707162341.l6GNfx33030850@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070716/0131532f/attachment.html -------------- next part -------------- Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) From bfrisch at edam.speech.cs.cmu.edu Mon Jul 16 20:24:24 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Mon, 16 Jul 2007 20:24:24 -0400 Subject: [TeamTalk 123]: [660] usarsim: 1) TreasureHuntGate.usx now replaced with TreasureHuntMesh. usx Message-ID: <200707170024.l6H0OOZV030926@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070716/405bd75c/attachment.html -------------- next part -------------- Modified: usarsim/Maps/DM-RoboticsLab_250.ut2 =================================================================== (Binary files differ) Deleted: usarsim/StaticMeshes/TreasureHuntGate.usx =================================================================== (Binary files differ) Added: usarsim/StaticMeshes/TreasureHuntMesh.usx =================================================================== (Binary files differ) Property changes on: usarsim/StaticMeshes/TreasureHuntMesh.usx ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From tk at edam.speech.cs.cmu.edu Wed Jul 18 17:35:41 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Wed, 18 Jul 2007 17:35:41 -0400 Subject: [TeamTalk 124]: [661] TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder: refactor : the distinction between scribble3 and the rest of pendecoder had been eroded , and became confusing, so I merged them. Message-ID: <200707182135.l6ILZfbV018807@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070718/dc79b00b/attachment-0001.html -------------- next part -------------- Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractDecoderTool.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractDecoderTool.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractDecoderTool.java 2007-07-18 21:35:40 UTC (rev 661) @@ -1,7 +1,5 @@ package edu.cmu.ravenclaw.pendecoder; -import edu.cmu.ravenclaw.pendecoder.scribble3.AbstractTool; - public abstract class AbstractDecoderTool extends AbstractTool { protected DrawingCanvas canvas; Added: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractTool.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractTool.java (rev 0) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/AbstractTool.java 2007-07-18 21:35:40 UTC (rev 661) @@ -0,0 +1,18 @@ +package edu.cmu.ravenclaw.pendecoder; + +import java.awt.Point; + +public abstract class AbstractTool implements Tool { + + protected DrawingCanvas canvas; + protected String name; + + public String getName() { + return name; + } + + protected AbstractTool(DrawingCanvas canvas, String name) { + this.canvas = canvas; + this.name = name; + } +} Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotShape.java 2007-07-18 21:35:40 UTC (rev 661) @@ -3,7 +3,7 @@ import java.awt.*; import java.awt.geom.*; -public class BotShape extends edu.cmu.ravenclaw.pendecoder.scribble3.Shape implements Cloneable { +public class BotShape extends edu.cmu.ravenclaw.pendecoder.Shape implements Cloneable { /** * this is the iconification of the robot Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java 2007-07-18 21:35:40 UTC (rev 661) @@ -1,17 +1,16 @@ package edu.cmu.ravenclaw.pendecoder; import java.util.*; -import edu.cmu.ravenclaw.pendecoder.scribble3.*; import java.awt.Graphics; public class BotTracker { - protected ScribbleCanvas canvas; + protected DrawingCanvas canvas; protected final static int size = 3; protected HashMap bots = new HashMap(); protected HashMap names = new HashMap(); - BotTracker(ScribbleCanvas c) { + BotTracker(DrawingCanvas c) { canvas = c; } Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ButtonTool.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ButtonTool.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ButtonTool.java 2007-07-18 21:35:40 UTC (rev 661) @@ -10,8 +10,6 @@ package edu.cmu.ravenclaw.pendecoder; -import edu.cmu.ravenclaw.pendecoder.scribble3.AbstractTool; - /** * * @author tkharris Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvas.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvas.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvas.java 2007-07-18 21:35:40 UTC (rev 661) @@ -3,8 +3,14 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.Point; import java.awt.Image; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.awt.image.DataBuffer; +import java.awt.image.IndexColorModel; +import java.awt.image.WritableRaster; import java.util.*; import java.io.*; import java.awt.event.*; @@ -12,25 +18,88 @@ import java.awt.geom.NoninvertibleTransformException; import java.util.EventListener; import javax.swing.*; -import edu.cmu.ravenclaw.pendecoder.scribble3.*; +import net.sourceforge.jiu.codecs.CodecMode; +import net.sourceforge.jiu.codecs.PNGCodec; +import net.sourceforge.jiu.data.PixelImage; +import net.sourceforge.jiu.gui.awt.ImageCreator; -public class DrawingCanvas extends ScribbleCanvas { +public class DrawingCanvas extends JComponent implements Scrollable { protected DrawingPad drawingPad = null; + protected DrawingCanvasListener drawingCanvasListener; static public String opTraderFrameHolder; //[2005-09-30] (tk): hack + /** + * The width and height of the area that the map represents (in centimeters) + */ + 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; + public DrawingCanvas() { + colorGenerator = new ColorGenerator(new Color[] { + Color.BLACK, //clear space + Color.DARK_GRAY, //hash marks + Color.GRAY, //unknown space + Color.GREEN, //obstructed space + Color.YELLOW //highlights + }); + + String mapfile = null; + try { + Properties properties = new Properties(); + properties.load(new FileInputStream("map.properties")); + mapfile = properties.getProperty("edu.cmu.ravenclaw.pendecoder.mapfile"); + if(mapfile == null) throw new Exception("mapfile is missing"); + String widthstr = properties.getProperty("edu.cmu.ravenclaw.pendecoder.mapwidth"); + if(widthstr == null) throw new Exception("mapwidth is missing"); + String heightstr = properties.getProperty("edu.cmu.ravenclaw.pendecoder.mapheight"); + native_width = Float.parseFloat(widthstr); + native_height = Float.parseFloat(heightstr); + } catch (NumberFormatException e) { + System.err.println("Can't parse double:" + e.toString()); + System.exit(1); + } catch (Exception e) { + System.err.println("Problem with properties" + e.toString()); + System.exit(1); + } + try { + PNGCodec codec = new PNGCodec(); + codec.setFile(mapfile, CodecMode.LOAD); + codec.process(); + PixelImage pixelimage = codec.getImage(); + backImage = new MapBufferedImage(ImageCreator.convertToAwtImage(pixelimage, ImageCreator.DEFAULT_ALPHA)); + image_width_in_pixels = backImage.getWidth(this); + image_height_in_pixels = backImage.getHeight(this); + setPreferredSize(new Dimension((int)image_width_in_pixels, + (int)image_height_in_pixels)); + } catch(Exception e) { + System.err.println("Problem reading or converting PNG: " + e.toString()); + System.exit(1); + } + drawingCanvasListener = makeCanvasListener(); + addMouseListener((MouseListener) listener); + addMouseMotionListener((MouseMotionListener) listener); } public DrawingCanvas(Image backImage, DrawingPad drawingPad) { - super(backImage); + //calling factory method + System.err.println("scribble w/backimage"); + drawingCanvasListener = makeCanvasListener(); + addMouseListener((MouseListener) listener); + addMouseMotionListener((MouseMotionListener) listener); + backImage = new MapBufferedImage(backImage); this.drawingPad = drawingPad; } - public DrawingCanvas(Image backImage) { - super(backImage); - } - public DrawingCanvas(DrawingPad drawingPad) { this.drawingPad = drawingPad; } @@ -43,6 +112,13 @@ return drawingCanvasListener.getTool(); } + /** + * factory method + */ + protected DrawingCanvasListener makeCanvasListener() { + return new DrawingCanvasListener(this); + } + public void saySelectBot(String name) { drawingPad.saySelectBot(name); } @@ -171,11 +247,266 @@ + " origin (cm): (" + x_origin + ", " + y_origin + ")"); } - // factory method - protected EventListener makeCanvasListener() { - return (drawingCanvasListener = new DrawingCanvasListener(this)); - } - - protected DrawingCanvasListener drawingCanvasListener; private static final long serialVersionUID = 2665310629710366124L; + + /** + * + * The list of shapes of the drawing + */ + protected List shapes = new ArrayList(); + + protected Color curColor = Color.black; + + protected EventListener listener; + + protected boolean mouseButtonDown = false; + + protected int x; + + protected int y; + + /** + * The image to display as the background (the map) + */ + protected MapBufferedImage backImage = null; + + /** + * An image of hashmarks for the transparent portions of the backImage + */ + protected BufferedImage hashImage = null; + + /** + * The width and height of the rendered map image (in pixels). + * The map is streched when the application window grows or during zooming, etc. + */ + protected Dimension view_size; + + /** + * A transform from the map image to the rendered map image + * The map is streched when the application window grows or during zooming, etc. + */ + protected AffineTransform mapScale = new AffineTransform(); + + /** + * A transform from screen coordinates (pixels, left-handed) + * to map coordinates (centimeters, right-handed) + */ + protected AffineTransform screen_to_map = new AffineTransform(); + + /** + * A transform from map coordinates (centimeters, right-handed) + * to screen coordinates (pixels, left-handed) + */ + protected AffineTransform map_to_screen = new AffineTransform(); + + /** + * A class to generate new colors, maximally distinct from an existing set. + */ + public ColorGenerator colorGenerator = null; + + 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); + if (type == MapBufferedImage.FULL) { + if (image_width_in_pixels != x_dim || image_height_in_pixels != y_dim) { + int colors[] = new int[3]; + colors[1] = Color.BLACK.getRGB(); + colors[2] = Color.DARK_GRAY.getRGB(); + IndexColorModel iColor = new IndexColorModel(2, 3, colors, 0, false, 0, DataBuffer.TYPE_BYTE); + hashImage = new BufferedImage(x_dim, y_dim, BufferedImage.TYPE_BYTE_INDEXED, iColor); + int hashing = 100 / resolution; + WritableRaster wr = hashImage.getRaster(); + for (int j = 0; j < y_dim; j++) { + for (int i = 0; i < x_dim; i++) { + if (j % hashing == 0 || i % hashing == 0) + wr.setSample(i, j, 0, 2); else + wr.setSample(i, j, 0, 1); + } + } + setPreferredSize(new Dimension(x_dim, y_dim)); + } + 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); + repaint(); + } else + if (type == MapBufferedImage.DIFF) { + if (x_dim != image_width_in_pixels || y_dim != image_height_in_pixels) { + System.err.println("diff map for different full map"); + } else { + backImage.setDiffMap(decoded_map); + repaint(); + } + } else { + System.err.println("unknown map type: " + type); + } + } + + protected void decodeMap(byte[] decoded_map, int x, int y, int[] encoded_map) { + System.err.println("x: " + x + " y: " + y + " encoded_len: " + encoded_map.length); + int j = 0, k = 0; + for (int i = 0; i < encoded_map.length; i++) { + int run_length = (encoded_map[i] & -256) >> 8; + byte run_value = (byte) (encoded_map[i] & 255); + if (i == 0) + System.err.println("raw: " + encoded_map[i] + " rl: " + run_length + " rv: " + run_value + " j: " + j); + for (; j < k + run_length; j++) { + decoded_map[j] = run_value; + } + k = j; + } + } + + public void setCurColor(Color curColor) { + this.curColor = curColor; + } + + public Color getCurColor() { + return curColor; + } + + public void addShape(Shape shape) { + if (shape != null) { + shapes.add(shape); + } + } + + public void removeShape(Shape shape) { + shapes.remove(shape); + } + + public void paintComponent(Graphics g) { + Dimension viewportDim = ((JViewport) getParent()).getExtentSize(); + if (view_size.width < viewportDim.width || view_size.height < viewportDim.height) { + setPreferredSize(new Dimension(Math.max(view_size.width, viewportDim.width), Math.max(view_size.height, viewportDim.height))); + revalidate(); + } + if (backImage == null) { + System.err.println("Got no backImage"); + return; + } + Graphics2D mapG = (Graphics2D) g.create(); + mapG.transform(mapScale); + if (hashImage != null) { + mapG.drawImage(hashImage, 0, 0, this); + } + mapG.drawImage(backImage, 0, 0, this); + Graphics2D shapeG = (Graphics2D) g.create(); + shapeG.transform(map_to_screen); + shapeG.setFont(BotShape.labelFont); + if (shapes != null) { + Iterator iter = shapes.iterator(); + while (iter.hasNext()) { + Shape shape = (Shape) iter.next(); + if (shape != null) { + shape.draw(shapeG); + if (shape instanceof BotShape) { + ((BotShape) shape).label(screen_to_map, shapeG); + } + } + } + } + } + + public void newFile() { + shapes.clear(); + repaint(); + } + + public void openFile(String filename) { + try { + ObjectInputStream in = new ObjectInputStream(new FileInputStream(filename)); + try { + List l = (List) in.readObject(); + Iterator li = l.iterator(); + while (li.hasNext()) { + shapes.add((Shape) li.next()); + } + } catch (Exception e) { + System.err.println("Some problem with reading: " + e); + } + in.close(); + repaint(); + } catch (IOException e1) { + System.out.println("Unable to open file: " + filename); + } + } + + public void saveFile(String filename) { + try { + ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(filename)); + out.writeObject(shapes); + out.close(); + System.out.println("Save drawing to " + filename); + } catch (IOException e) { + System.out.println("Unable to write file: " + filename); + } + } + + public AffineTransform getScreenToMap() { + return screen_to_map; + } + + public String selectObj(Point p) { + String retval = null; + screen_to_map.transform(p, p); + if (shapes != null) { + Iterator i = shapes.iterator(); + while (i.hasNext()) { + Shape shape = i.next(); + if (shape.contains(p)) { + shape.highlight(); + retval = shape.getName(); + } else { + shape.unhighlight(); + } + } + repaint(); + } + return retval; + } + + 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(x_origin, y_origin); + try { + screen_to_map = map_to_screen.createInverse(); + } catch (NoninvertibleTransformException e) { + System.err.println("couldn't build map_to_screen"); + } + mapScale.setToScale(view_size.width / image_width_in_pixels, view_size.height / image_height_in_pixels); + mapScale.translate(0, image_height_in_pixels); + } + + public Dimension getPreferredSize() { + return view_size; + } + + public Dimension getPreferredScrollableViewportSize() { + return getPreferredSize(); + } + + public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { + return 1; + } + + public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { + if (orientation == SwingConstants.VERTICAL) + return visibleRect.height / 2; else + return visibleRect.width / 2; + } + + public boolean getScrollableTracksViewportWidth() { + return false; + } + + public boolean getScrollableTracksViewportHeight() { + return false; + } } Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvasListener.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvasListener.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingCanvasListener.java 2007-07-18 21:35:40 UTC (rev 661) @@ -2,14 +2,59 @@ import java.awt.*; import java.awt.event.*; -import edu.cmu.ravenclaw.pendecoder.scribble3.*; -public class DrawingCanvasListener extends ScribbleCanvasListener { +public class DrawingCanvasListener implements MouseListener, MouseMotionListener { + protected DrawingCanvas canvas; + protected Tool tool; + public DrawingCanvasListener(DrawingCanvas canvas) { - super(canvas, null); + this.canvas = canvas; + tool = new DrawingTool(canvas, "Scribble"); } + public void mousePressed(MouseEvent e) { + Point p = e.getPoint(); + tool.mouseDownAt(p); + canvas.mouseButtonDown = true; + canvas.x = p.x; + canvas.y = p.y; + } + + public void mouseDragged(MouseEvent e) { + Point p = e.getPoint(); + if (canvas.mouseButtonDown) { + tool.mouseDraggedTo(p); + canvas.x = p.x; + canvas.y = p.y; + } + } + + public void mouseReleased(MouseEvent e) { + Point p = e.getPoint(); + tool.mouseReleasedAt(p); + canvas.mouseButtonDown = false; + } + + public void mouseClicked(MouseEvent e) { + Point p = e.getPoint(); + if(e.getClickCount() == 1) { + if(e.getButton() == e.BUTTON1) + tool.mouseClickedAt(p); + else + tool.mouseRightClickedAt(p); + } else { + tool.mouseDoubleClickedAt(p); + } + } + + public void mouseEntered(MouseEvent e) {} + public void mouseExited(MouseEvent e) {} + public void mouseMoved(MouseEvent e) { + Point p = e.getPoint(); + tool.mouseMovedTo(p); + } + public Tool getTool() { return tool; } Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingPad.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingPad.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingPad.java 2007-07-18 21:35:40 UTC (rev 661) @@ -6,11 +6,9 @@ import javax.swing.*; import bsh.util.JConsole; - -import edu.cmu.ravenclaw.pendecoder.scribble3.*; import java.awt.image.BufferedImage; -public class DrawingPad extends Scribble { +public class DrawingPad extends JFrame { protected ToolKit toolkit; protected JComponent toolbar; @@ -23,7 +21,28 @@ public DrawingPad(String title) { super(title); - + // calling factory method + drawingCanvas = makeCanvas(); + getContentPane().setLayout(new BorderLayout()); + menuBar = createMenuBar(); + getContentPane().add(menuBar, BorderLayout.NORTH); + pane = new JScrollPane(drawingCanvas); + JRootPane rootPane = new JRootPane(); + rootPane.setContentPane(pane); + LogoViewport logopane = new LogoViewport(); + rootPane.setGlassPane(logopane); + logopane.setVisible(true); + pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + getContentPane().add(rootPane, BorderLayout.CENTER); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + if (exitAction != null) { + exitAction.actionPerformed(new ActionEvent(DrawingPad.this, 0, null)); + } + } + }); + //add toolbar toolkit = createToolkit(); drawingCanvas.setTool(toolkit.getTool(0)); @@ -96,7 +115,7 @@ } 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); + drawingCanvas.mapUpdate(type, x_dim, y_dim, x_origin, y_origin, resolution, encoded_map); } public void addServer(PenDecoderServer server) { @@ -140,7 +159,7 @@ } // factory method - protected ScribbleCanvas makeCanvas() { + protected DrawingCanvas makeCanvas() { return (drawingCanvas = new DrawingCanvas(this)); } @@ -279,4 +298,52 @@ } private static final long serialVersionUID = -3941481106291332264L; + + protected JMenuBar createMenuBar() { + JMenuBar menuBar = new JMenuBar(); + JMenu menu; + JMenuItem mi; + menu = new JMenu("File"); + menuBar.add(menu); + exitAction = new ExitListener(); + mi = new JMenuItem("Exit"); + menu.add(mi); + mi.addActionListener(exitAction); + menu = new JMenu("Help"); + menuBar.add(menu); + mi = new JMenuItem("About"); + menu.add(mi); + mi.addActionListener(new AboutListener()); + return menuBar; + } + + class ExitListener implements ActionListener { + + public void actionPerformed(ActionEvent e) { + int result = JOptionPane.showConfirmDialog(null, "Do you want to exit?", "Exit Treasure Hunt GUI?", JOptionPane.YES_NO_OPTION); + if (result == JOptionPane.YES_OPTION) { + System.exit(0); + } + } + } + + + class AboutListener implements ActionListener { + + public void actionPerformed(ActionEvent e) { + JOptionPane.showMessageDialog(null, "Teamtalk version 1.0\nCarnegie Mellon\nBoeing Phantom Works\n", + "About", JOptionPane.INFORMATION_MESSAGE); + } + } + + protected JScrollPane pane; + + protected JMenuBar menuBar; + + protected ActionListener exitAction; + + protected static int width = 1200; + + protected static int height = 800; + } Added: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingTool.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingTool.java (rev 0) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/DrawingTool.java 2007-07-18 21:35:40 UTC (rev 661) @@ -0,0 +1,45 @@ +package edu.cmu.ravenclaw.pendecoder; + +import java.awt.*; +import javax.swing.Icon; + +public class DrawingTool extends AbstractTool { + + public DrawingTool(DrawingCanvas canvas, String name) { + super(canvas, name); + } + + public void mouseDownAt(Point p) { + curStroke = new edu.cmu.ravenclaw.pendecoder.Stroke(canvas.getCurColor()); + curStroke.addPoint(p); + } + + public void mouseDraggedTo(Point p) { + if (curStroke != null) { + curStroke.addPoint(p); + Graphics g = canvas.getGraphics(); + g.setColor(canvas.getCurColor()); + g.drawLine(canvas.x, canvas.y, p.x, p.y); + } + } + + public void mouseReleasedAt(Point p) { + if (curStroke != null) { + curStroke.addPoint(p); + canvas.addShape(curStroke); + curStroke = null; + } + } + + public void mouseClickedAt(Point p) {} + public void mouseDoubleClickedAt(Point p) {} + public void mouseRightClickedAt(Point p) {} + public void mouseMovedTo(Point p) {} + + public Icon getIcon() { + return null; + } + + protected edu.cmu.ravenclaw.pendecoder.Stroke curStroke = null; + +} Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/IconTool.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/IconTool.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/IconTool.java 2007-07-18 21:35:40 UTC (rev 661) @@ -15,8 +15,6 @@ import javax.swing.Icon; import javax.swing.ImageIcon; -import edu.cmu.ravenclaw.pendecoder.scribble3.*; - /** * * @author tkharris Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Imager.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Imager.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Imager.java 2007-07-18 21:35:40 UTC (rev 661) @@ -7,11 +7,7 @@ package edu.cmu.ravenclaw.pendecoder; -import java.awt.Canvas; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Image; +import java.awt.*; import java.awt.image.BufferedImage; /** Added: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/LogoViewport.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/LogoViewport.java (rev 0) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/LogoViewport.java 2007-07-18 21:35:40 UTC (rev 661) @@ -0,0 +1,90 @@ +/* + * LogoViewport.java + * + * Created on April 25, 2006, 12:35 PM + * + * To change this template, choose Tools | Options and locate the template under + * the Source Creation and Management node. Right-click the template and choose + * Open. You can then make changes to the template in the Source Editor. + */ + +package edu.cmu.ravenclaw.pendecoder; + +import java.awt.*; +import java.awt.image.*; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; +import javax.swing.JComponent; +import javax.swing.JScrollPane; + +/** + * + * @author tkharris + * LogoViewport displays an image with the white parts transparent onto the + * glass pane of a JScrollPane. + */ +public class LogoViewport extends JComponent { + + private Image logo_image; + private boolean have_dimensions = false; + private int image_width, image_height; + + /** + * Creates a new instance of LogoViewport + */ + public LogoViewport() { + try { + logo_image = ImageIO.read(new File("cmu_wordmark1r-boeing.JPG")); + } catch (IOException e) { + System.err.println("Problem reading "); + } + setOpaque(false); + } + + //this function makes colors "near" white transparent + //the more white you are, the more transparent you become + //this is useful for images with a sort-of white background + private static Image makeColorTransparent (Image im) { + ImageFilter filter = new RGBImageFilter() { + public final int filterRGB(int x, int y, int rgb) { + /* + int intensity = ((rgb & 0x00FF0000)>>16) + + ((rgb & 0x0000FF00)>>8) + + ((rgb & 0x000000FF)) + / 3; + if(intensity > 0xC0) intensity = 0xFF; + else if(intensity < 0x20) intensity = 0x00; + else if(intensity <= 0x80) intensity -= 0x20; + else intensity += 0x30; + return ((0xFF - intensity) << 24) | (rgb & 0x00FFFFFF); + */ + return (0xA0 << 24) | (rgb & 0xFFFFFF); + } + }; + + ImageProducer ip = new FilteredImageSource(im.getSource(), filter); + return Toolkit.getDefaultToolkit().createImage(ip); + } + + //just draw the image in the lower right-hand corner + public void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2 = (Graphics2D)g.create(); + if(!have_dimensions) { + image_width = logo_image.getWidth(this); + image_height = logo_image.getHeight(this); + have_dimensions = image_width != -1 && image_height != -1; + if(!have_dimensions) return; + } + Rectangle r = ((JScrollPane) getRootPane().getContentPane()).getViewportBorderBounds(); + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8F)); + g2.drawImage(logo_image, r.width-image_width, r.height-image_height, this); + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OVER)); + g2.setColor(new Color(1F, 1F, 1F, 0.7F)); + g2.fillRoundRect(r.width-image_width, r.height-image_height, + image_width, image_height, 20, 20); + } + + private static final long serialVersionUID = 317617020444574870L; +} Added: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/MapBufferedImage.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/MapBufferedImage.java (rev 0) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/MapBufferedImage.java 2007-07-18 21:35:40 UTC (rev 661) @@ -0,0 +1,69 @@ +/* + * MapBufferedImage.java + * + * Created on August 12, 2006, 9:48 AM + */ + +package edu.cmu.ravenclaw.pendecoder; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.*; + +/** + * + * @author tkharris + */ +public class MapBufferedImage extends BufferedImage { + + static public final int FULL = 0; + static public final int DIFF = 1; + + /** + * Creates a new instance of MapBufferedImage + */ + public MapBufferedImage(int w, int h, int type, IndexColorModel cm) { + super(w, h, type, cm); + } + + public MapBufferedImage(java.awt.Image i) { + super(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_RGB); + Graphics2D g2 = createGraphics(); + g2.drawImage(i, 0, 0, null); + g2.dispose(); + } + + static public MapBufferedImage createMapBufferedImage(int w, int h) { + int colors[] = new int[256]; + for(int i=0; i<256; i++) colors[i] = Color.BLACK.getRGB(); + colors[64] = Color.GRAY.getRGB(); + colors[255] = Color.GREEN.getRGB(); + IndexColorModel iColor = + new IndexColorModel(8, 256, colors, 0, false, 128, DataBuffer.TYPE_BYTE); + return new MapBufferedImage(w, h, TYPE_BYTE_INDEXED, iColor); + } + + public void setFullMap(byte[] ras) { + WritableRaster wr = getRaster(); + int h = getHeight(); + int w = getWidth(); + for(int y=0; y i = points.listIterator(); + while(i.hasNext()) { + at.transform(i.next(), i.next()); + } + } + + // The list of points on the stroke + // elements are instances of java.awt.Point + protected List points = new ArrayList(); + + private static final long serialVersionUID = 396896443777340918L; +} Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToggleButtonTool.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToggleButtonTool.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToggleButtonTool.java 2007-07-18 21:35:40 UTC (rev 661) @@ -10,8 +10,6 @@ package edu.cmu.ravenclaw.pendecoder; -import edu.cmu.ravenclaw.pendecoder.scribble3.AbstractTool; - /** * * @author tkharris Added: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Tool.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Tool.java (rev 0) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Tool.java 2007-07-18 21:35:40 UTC (rev 661) @@ -0,0 +1,16 @@ +package edu.cmu.ravenclaw.pendecoder; + +import java.awt.*; +import javax.swing.Icon; + +public interface Tool { + public Icon getIcon(); + public String getName(); + public void mouseDownAt(Point p); + public void mouseDraggedTo(Point p); + public void mouseReleasedAt(Point p); + public void mouseClickedAt(Point p); + public void mouseDoubleClickedAt(Point p); + public void mouseRightClickedAt(Point p); + public void mouseMovedTo(Point p); +} Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ToolKit.java 2007-07-18 21:35:40 UTC (rev 661) @@ -1,7 +1,6 @@ package edu.cmu.ravenclaw.pendecoder; import java.util.*; -import edu.cmu.ravenclaw.pendecoder.scribble3.Tool; /** * ToolKit is a collection of "tools" or drawing modes. Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/TwoEndsShape.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/TwoEndsShape.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/TwoEndsShape.java 2007-07-18 21:35:40 UTC (rev 661) @@ -5,7 +5,6 @@ import java.awt.geom.AffineTransform; import java.awt.geom.Point2D.Float; import java.awt.geom.Point2D; -import edu.cmu.ravenclaw.pendecoder.scribble3.Shape; public abstract class TwoEndsShape extends Shape implements Cloneable { Modified: TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/TwoEndsTool.java =================================================================== --- TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/TwoEndsTool.java 2007-07-17 00:24:24 UTC (rev 660) +++ TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/TwoEndsTool.java 2007-07-18 21:35:40 UTC (rev 661) @@ -2,7 +2,6 @@ import java.awt.*; import javax.swing.Icon; -import edu.cmu.ravenclaw.pendecoder.scribble3.*; public class TwoEndsTool extends AbstractDecoderTool { From tk at edam.speech.cs.cmu.edu Thu Jul 19 17:33:57 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Thu, 19 Jul 2007 17:33:57 -0400 Subject: [TeamTalk 125]: [662] TeamTalk/Agents/PenDecoder: 1) Removed jiu dependency Message-ID: <200707192133.l6JLXvej030094@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070719/e837efe7/attachment.html -------------- next part -------------- Deleted: TeamTalk/Agents/PenDecoder/jiu.jar =================================================================== (Binary files differ) Modified: TeamTalk/Agents/PenDecoder/nbproject/build-impl.xml =================================================================== --- TeamTalk/Agents/PenDecoder/nbproject/build-impl.xml 2007-07-18 21:35:40 UTC (rev 661) +++ TeamTalk/Agents/PenDecoder/nbproject/build-impl.xml 2007-07-19 21:33:55 UTC (rev 662) @@ -19,7 +19,7 @@ - cleanup --> - + @@ -100,7 +113,7 @@ - + @@ -118,7 +131,7 @@ - + @@ -131,6 +144,8 @@ + + @@ -158,7 +173,7 @@ - + @@ -221,8 +236,8 @@ - - + + @@ -238,11 +253,11 @@ Must select some files in the IDE or set javac.includes - + - + @@ -268,18 +283,51 @@ - + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + - + - + - + + @@ -363,7 +412,7 @@ - + @@ -377,11 +426,12 @@ Must select some files in the IDE or set javac.includes - + - + + @@ -397,7 +447,7 @@ - + Some tests failed; see details above. @@ -410,7 +460,7 @@ Must select some files in the IDE or set test.includes - + Some tests failed; see details above. @@ -423,11 +473,11 @@ --> Must select one file in the IDE or set test.class - + - + @@ -457,11 +507,11 @@ --> Must select one file in the IDE or set applet.url - + - +