From tk at edam.speech.cs.cmu.edu Tue Dec 4 15:24:24 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Tue, 4 Dec 2007 15:24:24 -0500 Subject: [TeamTalk 341]: [877] vendor/USARSim/BaseFiles/v3.16: 1) Peg PocketTeamTalk externs to older versions since they' ve now been replaced with Olympus2 versions. Message-ID: <200712042024.lB4KOOeJ030280@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071204/097f0d09/attachment.html -------------- next part -------------- Property changes on: branches/mrmarge/PocketTeamTalk/Agents ___________________________________________________________________ Name: svn:externals - Pythia http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Pythia Helios http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Helios3 Kalliope http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Kalliope NlgServer http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/NlgServer2 Phoenix http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Phoenix2 + Pythia -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Pythia Helios -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Helios3 Kalliope -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Kalliope NlgServer -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/NlgServer2 Phoenix -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Phoenix2 Property changes on: branches/mrmarge/PocketTeamTalkBeta/trunk/Agents ___________________________________________________________________ Name: svn:externals - Pythia http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Pythia Helios http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Helios3 Kalliope http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Kalliope MultiDecoder/Audio_Server http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/MultiDecoder/Audio_Server MultiDecoder/Sphinx_Engine http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/MultiDecoder/Sphinx_Engine NlgServer http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/NlgServer2 Phoenix http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Phoenix2 DateTime http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/DateTime4 + Pythia -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Pythia Helios -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Helios3 Kalliope -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Kalliope MultiDecoder/Audio_Server -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/MultiDecoder/Audio_Server MultiDecoder/Sphinx_Engine -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/MultiDecoder/Sphinx_Engine NlgServer -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/NlgServer2 Phoenix -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/Phoenix2 DateTime -r2491 http://edam.speech.cs.cmu.edu/repos/olympus/trunk/Agents/DateTime4 Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java =================================================================== --- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java 2007-11-15 18:20:58 UTC (rev 876) +++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/BotTracker.java 2007-12-04 20:24:23 UTC (rev 877) @@ -1,7 +1,7 @@ package edu.cmu.ravenclaw.pendecoder; +import java.awt.geom.Point2D; import java.util.*; -import java.awt.Graphics; public class BotTracker { protected MapCanvas canvas; @@ -51,6 +51,16 @@ return obj; } + public List getObjLocations() { + List objLocations = new ArrayList(); + for(Shape obj: bots.values()) { + if(obj instanceof ObjShape) { + objLocations.add(((ObjShape)obj).getLocation()); + } + } + return objLocations; + } + private synchronized BotShape getBot(String name) { BotShape bot = botOf(name); if(bot == null) { Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ObjShape.java =================================================================== --- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ObjShape.java 2007-11-15 18:20:58 UTC (rev 876) +++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ObjShape.java 2007-12-04 20:24:23 UTC (rev 877) @@ -30,7 +30,8 @@ /** * position of bot in robot's coordinate system (in centimeters) */ - protected float x, y, rad; + protected Point2D.Float xy; + float rad; protected Color distinct_color = Color.BLUE; public static final Font labelFont = new Font("Lucida Sans", Font.BOLD, 14); @@ -75,7 +76,7 @@ AffineTransform at = new AffineTransform(); at.translate(x,y); at.rotate(rad); - placement.setToTranslation(this.x, this.y); + placement.setToTranslation(xy.x, xy.y); placement.rotate(this.rad); placement = placement.createInverse(); at.concatenate(placement); @@ -83,7 +84,7 @@ //create the placed icon AffineTransform move = new AffineTransform(placement); - move.translate(this.x,this.y); + move.translate(xy.x, xy.y); move.rotate(this.rad); placedIcon = move.createTransformedShape(icon); @@ -107,7 +108,7 @@ int[] xs = new int[] {50, dist-30, dist-30, dist, dist-30, dist-30, 50}; int[] ys = new int[] {12, 12, 24, 0, -24, -12, -12}; AffineTransform move = new AffineTransform(placement); - move.translate(x,y); + move.translate(xy.x, xy.y); move.rotate(angle); return move.createTransformedShape(new java.awt.Polygon(xs, ys, 7)); } @@ -139,7 +140,7 @@ //tranform from bot space to screen space AffineTransform p_translate = new AffineTransform(placement); - p_translate.translate(x,y); + p_translate.translate(xy.x, xy.y); //remove the rotational context, i.e. don't spin my text myG.translate(p_translate.getTranslateX(), p_translate.getTranslateY()); //draw out of reach (north east) of an 80cm long object @@ -190,16 +191,23 @@ * @param y y coordinate of robot's frmae location (in centimeters) */ public void setLocation(float x, float y) { - if(this.x != x || this.y != y || this.rad != rad) { + if(xy.x != x || xy.y != y || this.rad != rad) { //set new x and y and place icon - this.x = x; this.y = y; this.rad = rad; + xy.x = x; xy.y = y; this.rad = rad; AffineTransform move = new AffineTransform(placement); - move.translate(x,y); + move.translate(xy.x, xy.y); placedIcon = move.createTransformedShape(icon); } } /** + * Gets the location + */ + public Point2D.Float getLocation() { + return xy; + } + + /** * this shouldn't be called, required for interface * @param at an affine tranform for the scribble3 shape */ Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderDisplay.java =================================================================== --- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderDisplay.java 2007-11-15 18:20:58 UTC (rev 876) +++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderDisplay.java 2007-12-04 20:24:23 UTC (rev 877) @@ -43,6 +43,8 @@ try { if(tool.getName() == "Zoom Out") { mapCanvas.zoomOut(); + } else if(tool.getName() == "Retrieve") { + retrieve(); } else if(tool.getName() == "E-STOP") { eStop(); } else if(tool.getName() == "Undock") { @@ -377,6 +379,7 @@ "Explore", "Select waypoints along which to explore.", NPointTool.POLYLINE_EXPLORE)); + t.addTool(new ButtonTool(mapCanvas, "Retrieve", "Retrieve all treasures.")); //manage session and gui t.addTool(new ToggleButtonTool(mapCanvas, @@ -475,6 +478,13 @@ } /** + * Retrieve all treasures + */ + public void retrieve() { + for(PenDecoderServer server: servers) server.retrieve(); + } + + /** * Send emergency stop to all robots */ public void eStop() { Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java =================================================================== --- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java 2007-11-15 18:20:58 UTC (rev 876) +++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java 2007-12-04 20:24:23 UTC (rev 877) @@ -442,6 +442,17 @@ sayToBot("Commands", "[HumanSearchCommand]", loc); } + public void retrieve() { + System.err.println("Retrieving..."); + Map loc = new HashMap(); + List l = botTracker.getObjLocations(); + for(int i=0; i An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071204/59143f1d/attachment.html -------------- next part -------------- Modified: vendor/USARSim/BaseFiles/current/StaticMeshes/USARSim_Manufacturing_Meshes.usx =================================================================== (Binary files differ) From tk at edam.speech.cs.cmu.edu Tue Dec 4 15:37:42 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Tue, 4 Dec 2007 15:37:42 -0500 Subject: [TeamTalk 343]: [879] trunk/usarsim/StaticMeshes/USARSim_Manufacturing_Meshes.usx: Update USARSim to current BaseFiles. Message-ID: <200712042037.lB4Kbgug030308@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071204/89a11fb5/attachment-0001.html -------------- next part -------------- Modified: trunk/usarsim/StaticMeshes/USARSim_Manufacturing_Meshes.usx =================================================================== (Binary files differ) From tk at edam.speech.cs.cmu.edu Tue Dec 4 15:52:26 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Tue, 4 Dec 2007 15:52:26 -0500 Subject: [TeamTalk 344]: [880] trunk/usarsim: USARSim update from sourceforge. Message-ID: <200712042052.lB4KqQ1o030334@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071204/b8fd3609/attachment-0001.html -------------- next part -------------- Modified: trunk/usarsim/System/USARBot.ini =================================================================== --- trunk/usarsim/System/USARBot.ini 2007-12-04 20:37:42 UTC (rev 879) +++ trunk/usarsim/System/USARBot.ini 2007-12-04 20:52:26 UTC (rev 880) @@ -449,8 +449,8 @@ Sensors=(ItemClass=class'USARBot.GroundTruth',ItemName="GroundTruth",Position=(X=0.0,Y=0.0,Z=-0.0),Direction=(Y=0.0,Z=0.0,X=0.0)) Sensors=(ItemClass=class'USARBot.INSSensor',ItemName="INS",Position=(X=0.0,Y=0.0,Z=-0.0),Direction=(x=0.0,y=0.0,z=0.0)) Sensors=(ItemClass=class'USARModels.SICKLMS',ItemName="Scanner1",Position=(X=0.875,Y=0.0,Z=0.1),Direction=(Y=0.0,Z=0.0,X=0.0)) -Sensors=(ItemClass=class'USARModels.SICKLMS',ItemName="Scanner2",Position=(X=-0.75,Y=0.0,Z=-0.3),Direction=(Y=0.0,Z=3.145,X=0.0)) -Effecters=(ItemClass=class'USARBot.Roller',ItemName="Roller",Parent="UnitLoaderTop_Link1",Position=(Y=0.0,X=0.0,Z=-0.1),Direction=(Y=0.0,Z=0.0,X=0.0)) +;Sensors=(ItemClass=class'USARModels.SICKLMS',ItemName="Scanner2",Position=(X=-0.75,Y=0.0,Z=-0.3),Direction=(Y=0.0,Z=3.145,X=0.0)) +Effecters=(ItemClass=class'USARModels.UnitLoaderTableEffecter',ItemName="Roller",Parent="UnitLoaderTop_Link1",Position=(Y=0.0,X=-0.0,Z=-0.1),Direction=(Y=0.0,Z=0.0,X=0.0)) [USARBot.Hummer] bDebug=False Modified: trunk/usarsim/Tools/SimpleUI/ControlDlg.cpp =================================================================== --- trunk/usarsim/Tools/SimpleUI/ControlDlg.cpp 2007-12-04 20:37:42 UTC (rev 879) +++ trunk/usarsim/Tools/SimpleUI/ControlDlg.cpp 2007-12-04 20:52:26 UTC (rev 880) @@ -11,6 +11,7 @@ #include "FreeImage/FIIO_Mem.cpp" #include ".\controldlg.h" #include // sqrt() +#include "Tree.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -50,11 +51,12 @@ #define MAX_MSGS 512 #define BLOCK 2048 +#define PATH_LENGTH 512 #define arrayof(x) (sizeof(x)/sizeof(x[0])) -char _dllPath[512]; -char _utPath[512]; +char _dllPath[PATH_LENGTH]; +char _utPath[PATH_LENGTH]; ///////////////////////////////////////////////////////////////////////////// // CControlDlg dialog @@ -70,8 +72,6 @@ //}}AFX_DATA_INIT if (pParent) m_parent = (CSimpleUIDlg*)pParent; - m_cmdFile = NULL; - m_arOut = m_arIn = NULL; m_cmdSocket = NULL; m_videoSocket = NULL; m_videoState = 0; @@ -79,8 +79,9 @@ m_utclient = NULL; m_hookDLL = NULL; m_pFrameData = NULL; - strcpy(_utPath,UTCAPP); - strcpy(_dllPath,DLLFILE); + strcpy_s(_utPath,PATH_LENGTH,UTCAPP); + strcpy_s(_dllPath,PATH_LENGTH,DLLFILE); + m_vehicle = NULL; } void CControlDlg::DoDataExchange(CDataExchange* pDX) @@ -123,6 +124,11 @@ ON_BN_CLICKED(IDC_TURNMORE, OnTurnmore) //}}AFX_MSG_MAP ON_NOTIFY(TVN_SELCHANGED, IDC_MSG_TREE, OnTvnSelchangedMsgTree) + ON_BN_CLICKED(IDC_BUTTON1, &CControlDlg::OnBnClickedButton1) + ON_BN_CLICKED(IDC_BUTTON2, &CControlDlg::OnBnClickedButton2) + ON_BN_CLICKED(IDC_BUTTON3, &CControlDlg::OnBnClickedButton3) + ON_BN_CLICKED(IDC_BUTTON4, &CControlDlg::OnBnClickedButton4) + ON_BN_CLICKED(IDC_BUTTON5, &CControlDlg::OnBnClickedButton5) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -132,8 +138,6 @@ { CDialog::OnInitDialog(); - pLog = fopen ("usar_client.log", "w"); - m_videoState = 0; m_speed = 0.5; m_turn = 0; @@ -144,42 +148,34 @@ m_frameCount = 0; m_drMode = DR_STOP; m_pan = m_tilt = 0; - m_pens = false; + CString position = m_parent->m_position; + m_pTree = new CSensed(m_parent->m_model, position, &m_dMsgTree, &m_cMsgTree); + m_vehicle = new CRobot(m_pTree); + // Get the dimensions of the bounding rectangle. + GetDlgItem(IDC_VIDEO2)->GetWindowRect(&(m_pTree->m_LidarRec)); + ScreenToClient(&(m_pTree->m_LidarRec)); + m_pTree->m_pDC = GetDC(); + m_cmdSocket = new CCmdSocket(this); - if (!m_cmdSocket->Create()) { + if (!m_cmdSocket->Create()) + { MessageBox("Can't create command socket","Socket",MB_OK); - return TRUE; } - if (!m_cmdSocket->Connect(m_parent->m_cHost,m_parent->m_cPort)) { - MessageBox("Can't connect to UT server","Connection",MB_OK); + if (!m_cmdSocket->Connect(m_parent->m_cHost,m_parent->m_cPort)) + { m_cmdSocket->Close(); - return TRUE; + MessageBox("Can't connect to UT server","Connection",MB_OK); } - m_cmdFile = new CSocketFile(m_cmdSocket); - m_arIn = new CArchive(m_cmdFile, CArchive::load); - m_arOut = new CArchive(m_cmdFile, CArchive::store); - - SetRobot(m_parent->m_model); - CString position = m_parent->m_position; - CorrectPosition(position); - if (m_arOut) { - CString cmd; - cmd.Format("INIT {ClassName USARBot.%s} {Location %s}\r\n", - m_parent->m_model, position); - LogData(cmd); - try { - m_arOut->WriteString(cmd); - m_arOut->Flush(); - }catch (CException* e) { - e->Delete(); - MessageBox("Cannot write data!","Error",MB_OK|MB_ICONSTOP); - //exit(1); - } - } - SetMsgTree(); + int result = m_vehicle->OpenFiles(m_parent->m_model, position, + m_cmdSocket); + if (result & 0x10) + MessageBox("Can't create output archive","Output",MB_OK); + else if (result & 0x20) + MessageBox("Cannot write data!","Error",MB_OK|MB_ICONSTOP); + if (!m_parent->m_remote) { // Remote mode @@ -227,9 +223,6 @@ m_UTCOffsetY = posW.bottom - posW.top - posC.bottom; Sleep(100); // Move and scale Unreal Client to desired position -/* ut->SetWindowPos(&wndTop, posW.left, posW.top, - posW.right - posW.left, posW.bottom - posW.top, - SWP_FRAMECHANGED|SWP_NOACTIVATE); */ m_utclient->SetWindowPos(GetNextWindow(GW_HWNDPREV), posW.left, posW.top, posW.right - posW.left, posW.bottom - posW.top, @@ -255,166 +248,14 @@ m_bmpInfo.bmiHeader.biCompression = BI_RGB; m_bmpInfo.bmiHeader.biSizeImage = 0; - if (m_cap.sonar || m_cap.range) - UpdateLaser("", RANGE_SCALE ); + if (m_pTree->m_cap.sonar || m_pTree->m_cap.range) + m_vehicle->UpdateGraphics("", RANGE_SCALE ); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } //============================================================================= -void CControlDlg::CorrectPosition(CString str) -{ - float float3[3]; - sscanf(str,"%f,%f,%f",float3,float3+1,float3+2); - float3[2] += m_cap.startHeight; - str.Format("%04.2f,%04.2f,%04.2f",float3[0],float3[1],float3[2]); -} -//============================================================================= -void CControlDlg::SetRobot(CString name) -// better to do this from the ini file. -{ - m_cap.drive = DRIVE_SKID; - m_cap.sonar = true; - m_cap.range = RANGE_SCAN; - m_cap.odometry = true; - m_cap.inu = true; - m_cap.encoder = false; - m_cap.touch = false; - m_cap.rfid = false; - m_cap.sound = false; - m_cap.motion = false; - m_cap.camera = true; - m_cap.gps = false; - m_cap.gripper = false; - for (int i = 0; i 0) - { - m_dMsgTree.mt_laser = m_cMsgTree.InsertItem(_T("Laser"),0,TVI_LAST); - m_dMsgTree.mt_ls_count = 0; - m_dMsgTree.mt_ls_data = NULL; - } - m_cMsgTree.Expand(m_dMsgTree.mt_state,TVE_EXPAND); -} -//============================================================================= - void CControlDlg::ProcessVideoData() { int count; @@ -524,35 +365,8 @@ m_videoSocket->AsyncSelect(FD_READ|FD_CLOSE); } -void CControlDlg::ProcessMsgData() -{ - CString str; - int process=1; - //int tmp; - - do { - m_arIn->ReadString(str); - - //m_msgList.InsertString(0,str); - //if (m_msgList.GetCount()>=MAX_MSGS) - // m_msgList.DeleteString(MAX_MSGS); - - UpdateMsgTree(str); - LogData(str); - - //tmp = str.GetLength()*6; - //if (tmp>maxMsgLen) { - // maxMsgLen = tmp; - // m_msgList.SetHorizontalExtent(tmp); - //} - Sleep(1); - }while(!m_arIn->IsBufferEmpty()); - UpdateData(false); -} - void CControlDlg::OnClose() { - fclose(pLog); if (m_parent->m_remote) { // free(m_pFrameData); // can't free since it is linked to CRT; TCF 8/15/06 KillTimer(IDC_TIMER); @@ -561,73 +375,38 @@ m_utclient->SendMessage(WM_CLOSE); } } + if (m_pTree) + { + if (m_pTree->m_pDC) + ReleaseDC(m_pTree->m_pDC); + m_pTree->Close(); + delete m_pTree; + m_pTree = NULL; + } + if (m_vehicle) + { + m_vehicle->Close(); + delete m_vehicle; + m_vehicle = NULL; + } if (m_hookDLL!=NULL) FreeLibrary(m_hookDLL); - if (m_arIn) { - delete m_arIn; - m_arIn=NULL; + if (m_videoSocket) { + m_videoSocket->Close(); + delete m_videoSocket; + m_videoSocket = NULL; } - if (m_arOut) { - delete m_arOut; - m_arOut=NULL; - } - if (m_cmdFile) { - delete m_cmdFile; - m_cmdFile=NULL; - } if (m_cmdSocket) { m_cmdSocket->Close(); delete m_cmdSocket; m_cmdSocket = NULL; } - if (m_videoSocket) { - m_videoSocket->Close(); - delete m_videoSocket; - m_videoSocket = NULL; - } - - m_cMsgTree.DeleteAllItems(); -// if (m_dMsgTree.mt_sonars!=NULL) -// free(m_dMsgTree.mt_sonars); -// if (m_dMsgTree.mt_ls_data!=NULL) -// free(m_dMsgTree.mt_ls_data); - CleanUpGraphics(); - CDialog::OnClose(); } void CControlDlg::UpdateVideo() { - /* - //////////////////////////////////////////////////// - // Save to file - BITMAPINFO bi; - bi.bmiHeader.biSize = sizeof(bi.bmiHeader); - bi.bmiHeader.biWidth = m_FrameData->width; - bi.bmiHeader.biHeight = m_FrameData->height; - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biBitCount = 24; - bi.bmiHeader.biCompression = BI_RGB; - bi.bmiHeader.biSizeImage = m_FrameData->size; - bi.bmiHeader.biXPelsPerMeter = 0; - bi.bmiHeader.biYPelsPerMeter = 0; - bi.bmiHeader.biClrUsed = 0; - bi.bmiHeader.biClrImportant = 0; - - BITMAPFILEHEADER bmfh; - bmfh.bfType = 'MB'; - bmfh.bfSize = sizeof(bmfh) + sizeof(BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage; - bmfh.bfReserved1 = bmfh.bfReserved2 = 0; - bmfh.bfOffBits = sizeof(bmfh) + sizeof(BITMAPINFOHEADER); - - FILE* f = fopen("test.bmp", "wb"); - fwrite(reinterpret_cast(&bmfh), sizeof(bmfh), 1, f); - fwrite(reinterpret_cast(&(bi.bmiHeader)), sizeof(BITMAPINFOHEADER), 1, f); - fwrite(reinterpret_cast(m_FrameData->data), sizeof(BYTE), bi.bmiHeader.biSizeImage, f); - fclose(f); - */ - if (m_utclient && !IsIconic() && m_utclient->IsIconic()) { ::OpenIcon(m_utclient->m_hWnd); return; @@ -680,29 +459,25 @@ } } - - void CControlDlg::ShowUTC(BOOL show) { m_show = show; if (!show) { HDC hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL); m_utclient->SetWindowPos(this, - GetDeviceCaps(hScrDC, HORZRES)-10, - GetDeviceCaps(hScrDC, VERTRES)-10, - m_UTCOffsetX+m_imgWidth, m_UTCOffsetY+m_imgHeight, - SWP_FRAMECHANGED|SWP_NOACTIVATE); + GetDeviceCaps(hScrDC, HORZRES)-10, + GetDeviceCaps(hScrDC, VERTRES)-10, + m_UTCOffsetX+m_imgWidth, m_UTCOffsetY+m_imgHeight, + SWP_FRAMECHANGED|SWP_NOACTIVATE); DeleteDC(hScrDC); } else { RECT posW; GetWindowRect(&posW); m_utclient->SetWindowPos(this, -// posW.left, posW.top, -// posW.right - posW.left, posW.bottom - posW.top, - posW.left-m_UTCOffsetX-m_imgWidth, posW.top, - m_UTCOffsetX+m_imgWidth, m_UTCOffsetY+m_imgHeight, - SWP_FRAMECHANGED|SWP_NOACTIVATE); + posW.left-m_UTCOffsetX-m_imgWidth, posW.top, + m_UTCOffsetX+m_imgWidth, m_UTCOffsetY+m_imgHeight, + SWP_FRAMECHANGED|SWP_NOACTIVATE); } } @@ -730,6 +505,7 @@ m_height = m_pFrameData->height; } ((CButton *)GetDlgItem(IDC_UPDATE))->SetCheck(1); + m_vehicle->ProcessMsgData(); UpdateData(FALSE); UpdateVideo(); Sleep(2); @@ -767,16 +543,19 @@ AfxMessageBox( IDS_OPEN_UT2004, MB_OK|MB_ICONSTOP ); errno = 0; CFileDialog * pcf = new CFileDialog(true,".exe","ut2004", - OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - "Executable Files (*.exe)|*.exe"); + OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "Executable Files (*.exe)|*.exe"); pcf->DoModal(); CString utPath = pcf->GetPathName(); CString file = pcf->GetFileName(); delete pcf; utPath.Replace("\\","\\\\"); strncpy(_utPath,(LPCSTR)utPath,512); + + utPath.Replace((LPCSTR)file,"Hook.dll"); strncpy(_dllPath,(LPCSTR)utPath,512); +// strncpy_s(_dllPath,PATH_LENGTH,(LPCSTR)utPath); if (!DetourCreateProcessWithDll(_utPath, UTCCMD, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, @@ -839,18 +618,18 @@ void CControlDlg::OnCup() { m_drMode = DR_FORWARD; - Drive(); + m_vehicle->Drive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } void CControlDlg::OnCdown() { m_drMode = DR_BACKWARD; - Drive(); + m_vehicle->Drive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } void CControlDlg::OnCleft() { - if(m_cap.drive == DRIVE_ACKERMAN) + if(m_pTree->m_cap.drive == DRIVE_ACKERMAN) { if (m_turn <= TURN_STEP && -TURN_STEP <= m_turn) m_turn += TURN_STEP; @@ -860,12 +639,12 @@ } else m_drMode = DR_LEFT; - Drive(); + m_vehicle->Drive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } void CControlDlg::OnCright() { - if(m_cap.drive == DRIVE_ACKERMAN) + if(m_pTree->m_cap.drive == DRIVE_ACKERMAN) { if (m_turn <= TURN_STEP && -TURN_STEP <= m_turn) m_turn -= TURN_STEP; @@ -875,39 +654,37 @@ } else m_drMode = DR_RIGHT; - Drive(); + m_vehicle->Drive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } void CControlDlg::OnStop() { m_drMode = DR_STOP; - Drive(); + m_vehicle->Drive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } void CControlDlg::OnSpeedUp() { m_speed += SPEED_STEP; m_speed = m_speed>SPEED_MAX?SPEED_MAX:m_speed; - Drive(); + m_vehicle->Drive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } void CControlDlg::OnSpeedDown() { m_speed -= SPEED_STEP; m_speed = m_speedDrive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } void CControlDlg::OnStraight() { m_turn = 0; - Drive(); + m_vehicle->Drive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } - - void CControlDlg::OnTurnless() { m_turn *= 0.5; m_turn = m_turnDrive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } void CControlDlg::OnTurnmore() @@ -917,91 +694,35 @@ else m_turn += m_turn; m_turn = m_turn>TURN_MAX?TURN_MAX:m_turn; - Drive(); + m_vehicle->Drive(m_pTree->m_cap.drive, m_drMode, m_speed, m_turn); } -void CControlDlg::Drive() -{ - CString cmd; - if (m_arOut==NULL) return; - switch (m_cap.drive){ - case DRIVE_ACKERMAN: - switch (m_drMode){ - case DR_FORWARD: - cmd.Format("DRIVE {Speed %f} {FrontSteer %f}\r\n",m_speed, m_turn); -// cmd.Format("DRIVE {Speed %f}\r\n",m_speed); - break; - case DR_BACKWARD: - cmd.Format("DRIVE {Speed -%f} {FrontSteer -%f}\r\n",m_speed, m_turn); -// cmd.Format("DRIVE {Speed -%f}\r\n",m_speed); - break; - case DR_LEFT: - cmd.Format("DRIVE {Speed %f} {FrontSteer %f}\r\n",m_speed, m_turn); - break; - case DR_RIGHT: - cmd.Format("DRIVE {Speed %f} {FrontSteer -%f}\r\n",m_speed,m_turn); - break; - case DR_STOP: - cmd = "DRIVE {Speed 0} \r\n"; - break; - default: - cmd = ""; - } - break; - default: - case DRIVE_SKID: - switch (m_drMode){ - case DR_FORWARD: - cmd.Format("DRIVE {Left %f} {Right %f}\r\n",m_speed,m_speed); - break; - case DR_BACKWARD: - cmd.Format("DRIVE {Left -%f} {Right -%f}\r\n",m_speed,m_speed); - break; - case DR_LEFT: - cmd.Format("DRIVE {Left -%f} {Right %f}\r\n",m_speed,m_speed); - break; - case DR_RIGHT: - cmd.Format("DRIVE {Left %f} {Right -%f}\r\n",m_speed,m_speed); - break; - case DR_STOP: - cmd = "DRIVE {Left 0} {Right 0}\r\n"; - break; - default: - cmd = ""; - } - break; - } - m_arOut->WriteString(cmd); - LogData(cmd); - m_arOut->Flush(); -} - void CControlDlg::OnVleft() { m_pan += PAN_STEP; m_pan = m_panCamera(m_pan, m_tilt); } void CControlDlg::OnVright() { m_pan -= PAN_STEP; m_pan = m_panCamera(m_pan, m_tilt); } void CControlDlg::OnVup() { m_tilt += TILT_STEP; m_tilt = m_tiltCamera(m_pan, m_tilt); } void CControlDlg::OnVdown() { m_tilt -= TILT_STEP; m_tilt = m_tiltCamera(m_pan, m_tilt); } void CControlDlg::OnZoomIn() // Labeled "Straight" @@ -1010,495 +731,75 @@ m_zoom = m_zoomCamera(m_pan, m_tilt); } - void CControlDlg::OnZoomOut() { m_zoom += ZOOM_STEP; m_zoom = m_zoom>ZOOM_MAX?ZOOM_MAX:m_zoom; m_pan = 0; m_tilt = 0; - Camera(); + m_vehicle->Camera(m_pan, m_tilt); } - -void CControlDlg::Camera() -{ - CString cmd; - - if (m_arOut==NULL) return; -// cmd.Format("CAMERA {Rotation %d,%d,0} {Zoom %d}\r\n",m_pan,m_tilt,m_zoom); -// MISPKG {Name CameraPanTilt} {Link1 3.1415} {Link2 -0.1} - cmd.Format("MISPKG {Name CameraPanTilt} {Link1 %f} {Link2 %f}\r\n",m_pan,m_tilt); - m_arOut->WriteString(cmd); - LogData(cmd); - m_arOut->Flush(); -} - //============================================================================= -void CControlDlg::UpdateMsgTree(CString str) -{ - if (str.Find("STA",0)==0) { - - UpdateStatus( str ); - - } - else if (str.Find("MISSTA", 0)==0) { - if (str.Find("{Name CameraPanTilt}",0)>=0) { - UpdateCamera( str ); - }} - else if (str.Find("SEN",0)==0) - { - if (str.Find("{Type LIDAR}",0)>=0) { - UpdateRangeScan( str ); - UpdateLaser( str, RANGE_3D ); - } - else if(str.Find("{Type RangeScanner}",0)>=0) { - UpdateRangeScan( str ); - UpdateLaser( str, RANGE_SCAN ); - } - else if (str.Find("{Type Sonar}",0)>=0) { - UpdateSonar( str ); - UpdateLaser( str, RANGE_SONAR ); - } - else if (str.Find("{Type IR}",0)>=0) { - UpdateSonar( str ); - UpdateLaser( str, RANGE_IR ); - } - else if (str.Find("{Type Odometry}",0)>=0) { - UpdateOdometry( str ); - } - else if (str.Find("{Type INS}",0)>=0) { - UpdateINU( str ); - } - else if (str.Find("{Type GPS}",0)>=0) { - UpdateGPS( str ); - } - else - m_cMsgTree.SetItemText(m_dMsgTree.mt_other,(LPCSTR)str); - } - else { - CString tmp = "Other: " + str; - m_cMsgTree.SetItemText(m_dMsgTree.mt_other,(LPCSTR)tmp); - } - -} -//============================================================================= -void CControlDlg::UpdateStatus(CString str) -{ - CString tmp; - CString rot, loc, vel; - int count=3; - float float3[3]; - float speed, speed_kph; -// float wheels, wheels_degrees; - - tmp = "Time:"+CMessageParser::GetString("Time",str); - m_cMsgTree.SetItemText(m_dMsgTree.mt_time,(LPCSTR)tmp); - - CMessageParser::GetFloats("Location",str,',',&count,float3); - tmp.Format("Location(m): X=%6.2f Y=%6.2f Z=%6.2f",float3[0],float3[1],float3[2]); - m_cMsgTree.SetItemText(m_dMsgTree.mt_ch_loc,(LPCSTR)tmp); - loc.Format("Location: (%6.2f, %6.2f)",float3[0],float3[1]); - - CMessageParser::GetFloats("Orientation",str,',',&count,float3); - tmp.Format("Rotation(Rad): Pitch=%6.2f Roll=%6.2f Yaw=%6.2f",float3[0],float3[1],float3[2]); - m_cMsgTree.SetItemText(m_dMsgTree.mt_ch_rot,(LPCSTR)tmp); - - CMessageParser::GetFloats("Velocity",str,',',&count,float3); - tmp.Format("Velocity(m/s): X=%6.2f Y=%5.2f Z=%5.2f",float3[0],float3[1],float3[2]); - m_cMsgTree.SetItemText(m_dMsgTree.mt_ch_vel,(LPCSTR)tmp); - speed = (float)sqrt(float3[0]*float3[0]+float3[1]*float3[1]+float3[2]*float3[2]); - speed_kph = speed*(float)3.6; - vel.Format(" Speed = %6.2fm/s = %6.1fkm/h",speed, speed_kph); - - tmp.Format("Light: On=%s Intensity=%d", - (LPCSTR)CMessageParser::GetString("LightToggle",str), - CMessageParser::GetInt("LightIntensity",str)); - m_cMsgTree.SetItemText(m_dMsgTree.mt_light,(LPCSTR)tmp); - - tmp.Format("Fuel(%%):%d",(int)CMessageParser::GetFloat("Battery",str)); - m_cMsgTree.SetItemText(m_dMsgTree.mt_battery,(LPCSTR)tmp); - - tmp = "Chassis: " + loc + vel; - m_cMsgTree.SetItemText(m_dMsgTree.mt_chassis,(LPCSTR)tmp); - -} - -//============================================================================= -void CControlDlg::UpdateCamera(CString str) -{ - /* MISSTA {Time 4341.34} {Name CameraPanTilt} {Link1 0.00,-20.00} {Link2 0.00,-20.00} - - Had been: - MIS {Type PanTilt} {Name Cam1} - {Part CameraPan Location 0.0001,0.0006,0.1249 Orientation 0.0038,-0.0014,0.0000} - {Part CameraTilt Location 0.0001,0.0005,0.2962 Orientation 0.0000,0.0000,0.0000} */ - CString tmp; - CString pan, tilt; - int count=2; - float float2[2]; - - CMessageParser::GetFloats("Link1",str,',',&count,float2); - tmp.Format("Pan =%6.2f (Rad); torque=%6.2f",float2[0],float2[1]); - m_cMsgTree.SetItemText(m_dMsgTree.mt_pan_loc,(LPCSTR)tmp); - pan.Format(" Pan =%6.2f", float2[0]); - - CMessageParser::GetFloats("Link2",str,',',&count,float2); - tmp.Format(" Tilt =%6.2f (Rad); torque=%6.2f",float2[0],float2[1]); - m_cMsgTree.SetItemText(m_dMsgTree.mt_tilt_loc,(LPCSTR)tmp); - tilt.Format("Tilt =%6.2f", float2[0]); - - tmp = "Camera: " + pan + ", " + tilt; - m_cMsgTree.SetItemText(m_dMsgTree.mt_camera,(LPCSTR)tmp); -} - -//============================================================================= -void CControlDlg::UpdateSonar(CString str) -{ - CString tmp[32], sonar="Sonar:"; - const char *pChar; - int pos1=0, pos2=0, count=0; - while (pos1>=0 && count<32) { - tmp[count++] = CMessageParser::GetString("Name",str, pos1, pos2); - pos1 = pos2; - } - if (pos1<0) count--; - m_depth[m_cap.index_sonar][0] = (float) count; - if (m_dMsgTree.mt_sonars==NULL) { - m_dMsgTree.mt_so_count = count; - m_dMsgTree.mt_sonars = (HTREEITEM *)malloc(sizeof(HTREEITEM)*count); - for (int i=0;i=0) { - if (lastLn==0) lastLn = 8; - CString data; - dataStr = "Data: "; - for (int i=0;iGetWindowRect(&m_LidarRec); - ScreenToClient(&m_LidarRec); - CDC* pDC = GetDC(); - // Calculate sizes of Lidar areas - imgWidth = m_LidarRec.right - m_LidarRec.left; - imgHeight = m_LidarRec.bottom- m_LidarRec.top; - - switch (range) { - case RANGE_3D: - index = m_cap.index_range; - start = m_cap.start_range; - end = m_cap.end_range; - for (r = 0; r < LIDAR_ROW; r++) - { - name.Format("Range%-i", r); - int count = LIDAR_COL; - - // Capture the Lidar readings - CMessageParser::GetFloats(name,str,',',&count,&m_depth[index][1]); - m_depth[index][0] = (float) count; - if (count > 1) - { - col = (count-col)? count: col; - row++; - } - } - col--; - break; - case RANGE_SCAN: - index = m_cap.index_range; - start = m_cap.start_range; - end = m_cap.end_range; - break; - default: - index = m_cap.index_sonar; - start = m_cap.start_sonar; - end = m_cap.end_sonar; - break; - } - // Range scale - if (!m_pens) - { - InitializeGraphics(m_cap.end_scale-m_cap.start_scale); - pDC->FillSolidRect(&m_LidarRec, GRAY); - } - // Draw the color key - r = m_cap.start_scale + m_LidarRec.top; - chunk = (imgWidth - 65)/QUANTIZATION; - c=m_LidarRec.left+40; - pDC->MoveTo(c, r); - for (i = 0; i < QUANTIZATION; i++) { - c+=chunk; - pDC->SelectObject(m_hPen[i]); - pDC->LineTo(c, r); - } - pDC->DrawText("Close", -1, &m_LidarRec, DT_BOTTOM | DT_LEFT | DT_SINGLELINE); - pDC->DrawText("Far", -1, &m_LidarRec, DT_BOTTOM | DT_RIGHT | DT_SINGLELINE); - - if (range != RANGE_SCALE) - { - if (m_depth[index][0] == 0 && range != RANGE_SCALE) - return; - - start += m_LidarRec.top; - end += m_LidarRec.top; - col = (unsigned int) m_depth[index][0]; - col_box = imgWidth / col; - if (col_box < 1) col_box = 1; - c_pixels = col_box * col; - if (c_pixels > imgWidth) c_pixels = imgWidth; - row_box = end-start; - if (range == RANGE_3D) - row_box /= row; - else - row = 1; - if (row_box < 1) row_box = 1; - if (!m_pens) - InitializeGraphics(row_box/2); - r_pixels = row_box * row; - if (r_pixels > imgHeight) r_pixels = imgHeight; - // Draw the Lidar map - r = start; - for (r += row_box; r <= (unsigned)end; r += row_box) - { - c = (imgWidth-c_pixels)/2+m_LidarRec.left; - pDC->MoveTo(c, r); - c += col_box; - for (lidarCol=col; lidarCol>0; c += col_box,lidarCol--) - { - for (i=0; m_depth[index][lidarCol] > threshold[i]; i++) - { } - pDC->SelectObject(m_hPen[i]); - pDC->LineTo(c, r); - } - if (range == RANGE_3D) - index++; - - } - } - - if (pDC) - { - ReleaseDC(pDC); - } - -} -//============================================================================= -void CControlDlg::InitializeGraphics(int pen_width) -{ - m_hPen[0] = CreatePen( PS_SOLID, pen_width, WHITE); - m_hPen[1] = CreatePen( PS_SOLID, pen_width, YELLOW); - m_hPen[2] = CreatePen( PS_SOLID, pen_width, OFF_WHITE); - m_hPen[3] = CreatePen( PS_SOLID, pen_width, TAN); - m_hPen[4] = CreatePen( PS_SOLID, pen_width, OLIVE); - m_hPen[5] = CreatePen( PS_SOLID, pen_width, LT_GREEN); - m_hPen[6] = CreatePen( PS_SOLID, pen_width, MED_GREEN); - m_hPen[7] = CreatePen( PS_SOLID, pen_width, GREEN); - m_hPen[8] = CreatePen( PS_SOLID, pen_width, AQUA); - m_hPen[9] = CreatePen( PS_SOLID, pen_width, LT_BLUE); - m_hPen[10] = CreatePen( PS_SOLID, pen_width, ROYAL_BLUE); - m_hPen[11] = CreatePen( PS_SOLID, pen_width, PURPLE); - m_hPen[12] = CreatePen( PS_SOLID, pen_width, BLACK); - m_pens = true; -} -//============================================================================= -void CControlDlg::CleanUpGraphics() -{ - int i; - if (!m_pens) - return; - for (i=0; i<13; i++) - DeleteObject( m_hPen[i] ); -// DeleteObject( m_hGrayBrush ); - m_pens = false; - -} -//============================================================================= -void CControlDlg::UpdateOdometry(CString str) -{ - CString tmp ="Odometry:"; - int num=2; - int pos1=0, pos2=0; - float float3[3]; - - tmp += CMessageParser::GetString("Name",str, pos1, pos2); - m_cMsgTree.SetItemText(m_dMsgTree.mt_odometry,(LPCSTR)tmp); - - CMessageParser::GetFloats("Pose",str,',',&num,float3); - tmp.Format("Position(m): X=%6.2f Y=%6.2f ",float3[0],float3[1]); - m_cMsgTree.SetItemText(m_dMsgTree.mt_od_data,(LPCSTR)tmp); -} -//============================================================================= -void CControlDlg::UpdateGPS(CString str) -{ - CString tmp ="GPS:"; - int num=3; - int pos1=0, pos2=0; - int lat[3], lon[3]; - - tmp += CMessageParser::GetString("Name",str, pos1, pos2); - m_cMsgTree.SetItemText(m_dMsgTree.mt_gps,(LPCSTR)tmp); - - CMessageParser::GetInts("Latitude",str,',',&num,lat); - CMessageParser::GetInts("Longitude",str,',',&num,lon); - // assume North America - lon[0] = -lon[0]; - tmp.Format("Lat=%iN%02i.%04i, Long=%iW%02i.%04i", - lat[0], lat[1], lat[2], lon[0], lon[1], lon[2]); - m_cMsgTree.SetItemText(m_dMsgTree.mt_gps_data,(LPCSTR)tmp); - -} -//============================================================================= -void CControlDlg::UpdateINU(CString str) -{ - /* SEN {Type INU} {Name Compass} {Orientation 0.0000,-0.0512,0.0000} -*/ - CString tmp ="INS:"; - int num=3; - int pos1=0, pos2=0; - float float3[3]; - - tmp += CMessageParser::GetString("Name",str, pos1, pos2); - m_cMsgTree.SetItemText(m_dMsgTree.mt_inu,(LPCSTR)tmp); - - CMessageParser::GetFloats("Orientation",str,',',&num,float3); - tmp.Format("Orientation(Rad): Roll=%6.2f Pitch=%6.2f Yaw=%6.2f",float3[0],float3[1],float3[2]); - m_cMsgTree.SetItemText(m_dMsgTree.mt_inu_data,(LPCSTR)tmp); -} -//============================================================================= void CControlDlg::OnLight() { - CString cmd; - if (m_arOut==NULL) return; CString str; m_light.GetWindowText(str); if (str=="Lights On") { m_light.SetWindowText("Lights Off"); - cmd = "DRIVE {Light True}\r\n"; + m_vehicle->Lights(true); } else { m_light.SetWindowText("Lights On"); - cmd = "DRIVE {Light False}\r\n"; + m_vehicle->Lights(false); } - m_arOut->WriteString(cmd); - LogData (cmd); - m_arOut->Flush(); } //============================================================================== void CControlDlg::OnTrace() { - CString cmd; - if (m_arOut==NULL) return; CString str; m_trace.GetWindowText(str); if (str=="Trace On") { m_trace.SetWindowText("Trace Off"); - cmd = "TRACE {On True} {Interval 0.1} {Color 2}\r\n"; + m_vehicle->Trace(true); } else { m_trace.SetWindowText("Trace On"); - cmd = "TRACE {On False}\r\n"; + m_vehicle->Trace(false); } - m_arOut->WriteString(cmd); - LogData (cmd); - m_arOut->Flush(); } //============================================================================== -void CControlDlg::LogData(CString str) -{ - fprintf (pLog, "%s\n", str); -} -//============================================================================== void CControlDlg::OnTvnSelchangedMsgTree(NMHDR *pNMHDR, LRESULT *pResult) { LPNMTREEVIEW pNMTreeView = reinterpret_cast(pNMHDR); // TODO: Add your control notification handler code here *pResult = 0; } +void CControlDlg::ProcessMsgData() +{ + m_vehicle->ProcessMsgData(); + UpdateData(false); +} +void CControlDlg::OnBnClickedButton1() +{ + m_vehicle->Planner(1); +} +void CControlDlg::OnBnClickedButton2() +{ + m_vehicle->Planner(2); +} +void CControlDlg::OnBnClickedButton3() +{ + m_vehicle->Planner(3); +} + +void CControlDlg::OnBnClickedButton4() +{ + m_vehicle->Planner(4); +} + +void CControlDlg::OnBnClickedButton5() +{ + m_vehicle->Planner(5); +} Modified: trunk/usarsim/Tools/SimpleUI/ControlDlg.h =================================================================== --- trunk/usarsim/Tools/SimpleUI/ControlDlg.h 2007-12-04 20:37:42 UTC (rev 879) +++ trunk/usarsim/Tools/SimpleUI/ControlDlg.h 2007-12-04 20:52:26 UTC (rev 880) @@ -2,10 +2,9 @@ #define AFX_CONTROLDLG_H__917D5561_6084_45E1_A576_2B178677B882__INCLUDED_ #include "VideoSocket.h" // Added by ClassView -#include "CmdSocket.h" // Added by ClassView -#include "MessageParser.h" #include "InfoDlg.h" #include "FreeImage/FIIO_Mem.h" +#include "Robot.h" #if _MSC_VER > 1000 #pragma once @@ -13,35 +12,8 @@ // ControlDlg.h : header file // -typedef struct MessageTree_t { - HTREEITEM mt_time; - HTREEITEM mt_state; - HTREEITEM mt_chassis; - HTREEITEM mt_ch_rot; - HTREEITEM mt_ch_loc; - HTREEITEM mt_ch_vel; - HTREEITEM mt_camera; - HTREEITEM mt_pan_loc; -// HTREEITEM mt_pan_rot; - HTREEITEM mt_tilt_loc; -// HTREEITEM mt_tilt_rot; - HTREEITEM mt_light; - HTREEITEM mt_battery; - HTREEITEM mt_odometry; - HTREEITEM mt_od_data; - HTREEITEM mt_gps; - HTREEITEM mt_gps_data; - HTREEITEM mt_inu; - HTREEITEM mt_inu_data; - HTREEITEM mt_other; - HTREEITEM mt_sonar; - UINT mt_so_count; - HTREEITEM * mt_sonars; - HTREEITEM mt_laser; - UINT mt_ls_count; - HTREEITEM * mt_ls_data; -} MessageTree; + typedef struct FrameData_t { BYTE state; BYTE sequence; @@ -51,84 +23,22 @@ BYTE data[640*480*3+1]; } FrameData; -#define DRIVE_SKID 0 -#define DRIVE_ACKERMAN 1 -#define DRIVE_SUBMARINE 2 -#define DRIVE_JOINT 3 -#define RANGE_NONE 0 -#define RANGE_SCAN 1 -#define RANGE_3D 2 -#define RANGE_SONAR 3 -#define RANGE_IR 4 -#define RANGE_SCALE 5 -typedef struct Capability_t { - BYTE drive; - bool sonar; // or IR - BYTE range; - bool odometry; - bool inu; - bool encoder; - bool touch; - bool rfid; - bool sound; - bool motion; - bool camera; - bool gps; - bool gripper; - float startHeight; - int index_sonar; - int start_sonar; - int end_sonar; - int index_range; - int start_range; - int end_range; - int start_scale; - int end_scale; -} Capability; #define FRAME_PENDING 0 #define FRAME_OK 1 #define FRAME_ERROR 2 -// LIDAR ROW, COL is number of range entities, not number of pixels. -#define LIDAR_ROW 36 -#define LIDAR_COL 342 -#define WHITE RGB(255,255,255) -#define OFF_WHITE RGB(255,255,127) -#define YELLOW RGB(255,255, 0) -#define LT_TAN RGB(205,217,110) -#define TAN RGB(210,180, 70) -#define OLIVE RGB(155,187, 3) -#define LT_GREEN RGB(150,255,110) -#define MED_GREEN RGB(100,255, 75) -#define GREEN RGB( 0,255, 0) -#define AQUA RGB(120,200,200) -#define LT_BLUE RGB(180,180,240) -#define BLUE RGB(100,100,255) -#define ROYAL_BLUE RGB( 0, 6,246) -#define PURPLE RGB(107, 7,159) -#define BLACK 0 -#define GRAY RGB(212,212,212) -#define RED RGB(255, 0, 0) -#define PINK RGB(255,200,200) -#define QUANTIZATION 13 - typedef FrameData * (WINAPI *pfFrameData)(void); #ifdef VERBOSE static FILE* log=NULL; #endif -enum { - DR_STOP, - DR_FORWARD, - DR_BACKWARD, - DR_LEFT, - DR_RIGHT -}; + class CSimpleUIDlg; class CCmdSocket; class CVideoSocket; class CMessageParser; +class CRobot; ///////////////////////////////////////////////////////////////////////////// // CControlDlg dialog @@ -139,7 +49,6 @@ public: BOOL m_show; void UpdateVideo(); - CControlDlg(CWnd* pParent = NULL); // standard constructor void ProcessMsgData(); void ProcessVideoData(); @@ -148,7 +57,6 @@ enum { IDD = IDD_CONTROL_DLG }; CButton m_trace; CButton m_light; - CTreeCtrl m_cMsgTree; CButton m_showUT; UINT m_width; UINT m_height; @@ -170,13 +78,8 @@ clock_t m_lastClock; int m_frameCount; RECT m_bmpRec; - RECT m_LidarRec; BYTE m_videoState; - CSocketFile * m_cmdFile; - CArchive * m_arIn; - CArchive * m_arOut; CVideoSocket * m_videoSocket; - CCmdSocket * m_cmdSocket; CSimpleUIDlg * m_parent; FrameData * m_pFrameData; CWnd* m_utclient; @@ -191,32 +94,15 @@ float m_turn; float m_pan; float m_tilt; - FILE *pLog; - MessageTree m_dMsgTree; - Capability m_cap; - // m_depth[row][0] is number of items in row - // m_depth has first row for sonar or IR - // next for range sensors - // Remainer for 3D range sensor. - float m_depth[LIDAR_ROW][LIDAR_COL+1]; + MessageTree m_dMsgTree; + CTreeCtrl m_cMsgTree; + CCmdSocket * m_cmdSocket; +// Capability m_cap; + CRobot *m_vehicle; + CSensed *m_pTree; void SetRobot(CString name); void CorrectPosition(CString str); - void SetMsgTree(); - void UpdateMsgTree(CString str); - void UpdateStatus(CString str); - void UpdateCamera(CString str); - void UpdateSonar(CString str); - void UpdateRangeScan(CString str); - void UpdateLaser(CString str, int range); - void InitializeGraphics(int pen_width); - void CleanUpGraphics(); - void UpdateOdometry(CString str); - void UpdateGPS(CString str); - void UpdateINU(CString str); - void LogData(CString str); - void Camera(); - void Drive(); void ShowUTC(BOOL show); BOOL LoadUT(); void GetpfFrameData(); @@ -252,11 +138,18 @@ int m_imgWidth; int m_nBytes; LPBYTE m_pData; - HBRUSH m_hGrayBrush; - bool m_pens; - HPEN m_hPen[QUANTIZATION]; public: afx_msg void OnTvnSelchangedMsgTree(NMHDR *pNMHDR, LRESULT *pResult); +public: + afx_msg void OnBnClickedButton1(); +public: + afx_msg void OnBnClickedButton2(); +public: + afx_msg void OnBnClickedButton3(); +public: + afx_msg void OnBnClickedButton4(); +public: + afx_msg void OnBnClickedButton5(); }; //{{AFX_INSERT_LOCATION}} Added: trunk/usarsim/Tools/SimpleUI/Robot.cpp =================================================================== --- trunk/usarsim/Tools/SimpleUI/Robot.cpp (rev 0) +++ trunk/usarsim/Tools/SimpleUI/Robot.cpp 2007-12-04 20:52:26 UTC (rev 880) @@ -0,0 +1,238 @@ +/* Robot.cpp: Main code to control the robot. + This is the BotController below + + Design + +(simulation) +BotViewer <----> BotController <---(Gamebot)---> WorldServer + +(or real robot) +Observer ::: BotController <---(Gamebot)---> Robot ::: World + +At present, SimpleUI contains both the BotViewer and BotController. +The intent is to split them. +The BotController includes + Robot.cpp, Sense.cpp, Robot.h, MessageParser.cpp, MessageParser.h + as well as RNDF/MDF reader and future files for navigation and planning. +The BotController should be independent of the operating system and designed +to run on a microcontroller. +All other SimpleUI files go to the BotViewer. +*/ + +#include "stdafx.h" +#include "Robot.h" + +//============================================================================= +CRobot::CRobot() +{ + Initialize(); +} +//============================================================================= +CRobot::CRobot(CSensed *pTree) +{ + Initialize(); + m_pTree = pTree; + m_pTree->SetRows(&m_sonar_row, &m_range_row); + +} +//============================================================================= +CRobot::~CRobot() +{ + Close(); +} +//============================================================================= +void CRobot::Close() +{ + fclose(pLog); + if (m_arIn) { + delete m_arIn; + m_arIn=NULL; + } + if (m_arOut) { + delete m_arOut; + m_arOut=NULL; + } + if (m_cmdFile) { + delete m_cmdFile; + m_cmdFile=NULL; + } +} +//============================================================================= +void CRobot::Initialize() +{ + EstimatedNorth = (float) 47.17; + EstimatedEast = (float) -55.7; + SpeedNorth = 0; + SpeedEast = 0; + AccelNorth = 0; + AccelEast = 0; + TopSpeed = 5; + m_arOut = NULL; + m_cmdFile = NULL; + m_arIn = NULL; + m_pTree = NULL; + for (int i = 0; i 0) + pLog = oldLog; +} + +//============================================================================= +int CRobot::OpenFiles(CString model, CString position, + CCmdSocket *cmdSocket) +{ + + m_cmdFile = new CSocketFile(cmdSocket); + m_arIn = new CArchive(m_cmdFile, CArchive::load); + m_arOut = new CArchive(m_cmdFile, CArchive::store); + if(!m_arOut) + return 0x10; + CString cmd; + cmd.Format("INIT {ClassName USARBot.%s} {Location %s}\r\n", + model, position); + LogData(cmd); + try { + m_arOut->WriteString(cmd); + m_arOut->Flush(); + }catch (CException* e) { + e->Delete(); + return 0x20; + } + m_pTree->DrawGraphics( RANGE_SCALE, &m_depth[0][0]); + + return 0; +} +//============================================================================== +void CRobot::LogData(CString str) +{ + fprintf (pLog, "%s\n", str); +} +//============================================================================= +void CRobot::Lights(bool on) +{ + CString cmd; + if (m_arOut==NULL) return; + if (on) + { + cmd = "DRIVE {Light True}\r\n"; + } + else + { + cmd = "DRIVE {Light False}\r\n"; + } + m_arOut->WriteString(cmd); + LogData (cmd); + m_arOut->Flush(); +} +//============================================================================= +void CRobot::Trace(bool on) +{ + CString cmd; + if (m_arOut==NULL) return; + if (on) + { + cmd = "TRACE {On True} {Interval 0.1} {Color 2}\r\n"; + } + else + { + cmd = "TRACE {On False}\r\n"; + } + m_arOut->WriteString(cmd); + LogData (cmd); + m_arOut->Flush(); +} +//============================================================================= +void CRobot::Drive(BYTE steer, int mode, float speed, float turn) +{ + CString cmd; + if (m_arOut==NULL) return; + switch (steer){ + case DRIVE_ACKERMAN: + switch (mode){ + case DR_FORWARD: + cmd.Format("DRIVE {Speed %f} {FrontSteer %f}\r\n",speed, turn); + break; + case DR_BACKWARD: + cmd.Format("DRIVE {Speed -%f} {FrontSteer -%f}\r\n",speed, turn); + break; + case DR_LEFT: + cmd.Format("DRIVE {Speed %f} {FrontSteer %f}\r\n",speed, turn); + break; + case DR_RIGHT: + cmd.Format("DRIVE {Speed %f} {FrontSteer -%f}\r\n",speed,turn); + break; + case DR_STOP: + cmd = "DRIVE {Speed 0} \r\n"; + break; + default: + cmd = ""; + } + break; + + default: + case DRIVE_SKID: + switch (mode){ + case DR_FORWARD: + cmd.Format("DRIVE {Left %f} {Right %f}\r\n",speed,speed); + break; + case DR_BACKWARD: + cmd.Format("DRIVE {Left -%f} {Right -%f}\r\n",speed,speed); + break; + case DR_LEFT: + cmd.Format("DRIVE {Left -%f} {Right %f}\r\n",speed,speed); + break; + case DR_RIGHT: + cmd.Format("DRIVE {Left %f} {Right -%f}\r\n",speed,speed); + break; + case DR_STOP: + cmd = "DRIVE {Left 0} {Right 0}\r\n"; + break; + default: + cmd = ""; + } + break; + } + m_arOut->WriteString(cmd); + LogData(cmd); + m_arOut->Flush(); +} +//============================================================================= +void CRobot::Camera(float pan, float tilt) +{ + CString cmd; + + if (m_arOut==NULL) return; + +// MISPKG {Name CameraPanTilt} {Link 1}{Value 3.1415} {Link 2][Value -0.1} + cmd.Format("MISPKG {Name CameraPanTilt} {Link 1} {Value %f} {Link 2} {Value %f}\r\n", + pan, tilt); + m_arOut->WriteString(cmd); + LogData(cmd); + m_arOut->Flush(); +} +//============================================================================= +void CRobot::Planner(int behavior) +{ + switch (behavior) { + case 1: + default: + /* drive forward and stop */ + break; + case 2: + /* drive on a curve */ + break; + case 3: + /* drive following the RNDF from where we are */ + break; + case 4: + /* calibrate sensors */ + break; + case 5: + /* drive to a GPS waypoint */ + break; + } +} Property changes on: trunk/usarsim/Tools/SimpleUI/Robot.cpp ___________________________________________________________________ Name: svn:executable + * Added: trunk/usarsim/Tools/SimpleUI/Robot.h =================================================================== --- trunk/usarsim/Tools/SimpleUI/Robot.h (rev 0) +++ trunk/usarsim/Tools/SimpleUI/Robot.h 2007-12-04 20:52:26 UTC (rev 880) @@ -0,0 +1,76 @@ +#if !defined(ROBOT_H) +#define ROBOT_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Robot.h : header file +// + +#include "CmdSocket.h" // Added by ClassView +#include "MessageParser.h" +#include "Tree.h" +class CRobot; +class CSensed; + +///////////////////////////////////////////////////////////////////////////// +// CRobot is the robot controller + +class CRobot +{ +private: + + float Path[4]; // present Hermite curve segment (m) parameterized by 0<= t <= 1 + // [0] start point, [1] end point, [2] start tangent, [3] end tangent + float NextPath[4]; // NextPath[0] = Path[1]; NextPath[2] = Path[3] + float TopSpeed; // How fast we want to go on Path[] (m/s) + float EstimatedNorth; // where we think we are (m) + float EstimatedEast; + float SpeedNorth; // best guess of present velocity (m/s) + float SpeedEast; + float AccelNorth; // Estimated present acceleration + float AccelEast; + CSocketFile * m_cmdFile; + CArchive * m_arIn; + CArchive * m_arOut; + FILE * pLog; + CSensed *m_pTree; + // m_depth[row][0] is number of items in row + // m_depth has first row for sonar or IR + // next for range sensors + // Remainer for 3D range sensor. + float m_depth[LIDAR_ROW][LIDAR_COL+1]; + int m_sonar_row; // the row of m_depth to start storing sonar data + int m_range_row; // start of range data in m_depth + + void Initialize(); + +public: + CRobot(); + CRobot(CSensed *pTree); + void Drive(BYTE steer, int mode, float speed, float turn=0); + int OpenFiles(CString model, CString position, + CCmdSocket *cmdSocket); + void LogData(CString str); + void Lights(bool on); + void Trace(bool on); + void Camera(float pan, float tilt); + ~CRobot(); + void Close(); + void ProcessMsgData(); + void UpdateMsgTree(CString str); + void UpdateStatus(CString str); + void UpdateCamera(CString str); + void UpdateSonar(CString str); + void UpdateRangeScan(CString str); + void UpdateGraphics(CString str, int range); + void UpdateOdometry(CString str); + void UpdateGPS(CString str); + void UpdateGroundTruth(CString str); + void UpdateINU(CString str); +// void Pilot(); + void Planner(int behavior); +// void Navigator(); +// void Detector(); +}; +#endif // ROBOT_H \ No newline at end of file Property changes on: trunk/usarsim/Tools/SimpleUI/Robot.h ___________________________________________________________________ Name: svn:executable + * Added: trunk/usarsim/Tools/SimpleUI/Sense.cpp =================================================================== --- trunk/usarsim/Tools/SimpleUI/Sense.cpp (rev 0) +++ trunk/usarsim/Tools/SimpleUI/Sense.cpp 2007-12-04 20:52:26 UTC (rev 880) @@ -0,0 +1,318 @@ +// Sense.cpp: Process Gamebots SEN messages + +#include "stdafx.h" +#include "SimpleUI.h" +#include "Robot.h" +#include "ControlDlg.h" + +void CRobot::ProcessMsgData() +{ + CString str; + int process=1; + + do { + m_arIn->ReadString(str); + UpdateMsgTree(str); + LogData(str); + Sleep(1); + }while(!m_arIn->IsBufferEmpty()); +} +//============================================================================= +void CRobot::UpdateMsgTree(CString str) +{ + if (str.Find("STA",0)==0) { + + UpdateStatus( str ); + + } + else if (str.Find("MISSTA", 0)==0) { + if (str.Find("{Name CameraPanTilt}",0)>=0) { + UpdateCamera( str ); + }} + else if (str.Find("SEN",0)==0) + { + if (str.Find("{Type LIDAR}",0)>=0) { + UpdateRangeScan( str ); + UpdateGraphics( str, RANGE_3D ); + } + else if(str.Find("{Type RangeScanner}",0)>=0) { + UpdateRangeScan( str ); + UpdateGraphics( str, RANGE_SCAN ); + } + else if (str.Find("{Type Sonar}",0)>=0) { + UpdateSonar( str ); + UpdateGraphics( str, RANGE_SONAR ); + } + else if (str.Find("{Type IR}",0)>=0) { + UpdateSonar( str ); + UpdateGraphics( str, RANGE_IR ); + } + else if (str.Find("{Type Odometry}",0)>=0) { + UpdateOdometry( str ); + } + else if (str.Find("{Type INS}",0)>=0) { + UpdateINU( str ); + } + else if (str.Find("{Type GPS}",0)>=0) { + UpdateGPS( str ); + } + else if (str.Find("{Type GroundTruth}",0)>=0) { + UpdateGroundTruth( str ); + } + else + m_pTree->PutOther( str ); + } + else { + CString tmp = "Other: " + str; + m_pTree->PutOther( tmp ); + } + +} +//============================================================================= +void CRobot::UpdateStatus(CString str) +{ +/* STA {Type GroundVehicle} {Time 1515.54} {FrontSteer 0.0000} {RearSteer 0.0000} + {LightToggle False} {LightIntensity 0} {Battery 1200} {View -1} */ + CString time, light, fuel; + CString rot, loc, vel; + int count=3; + + time = "Time:"+CMessageParser::GetString("Time",str); + + light.Format("Light: On=%s Intensity=%d", + (LPCSTR)CMessageParser::GetString("LightToggle",str), + CMessageParser::GetInt("LightIntensity",str)); + + fuel.Format("Fuel(%%):%d",(int)CMessageParser::GetFloat("Battery",str)); + + m_pTree->PutStatus(time, light, fuel); + +} + +//============================================================================= +void CRobot::UpdateCamera(CString str) +{ + /* MISSTA {Time 1515.76} {Name CameraPanTilt} {Link 1} {Value 0.0000} {Torque -20.00} + {Link 2} {Value 0.0000} {Torque -20.00} + Had been: + MISSTA {Time 4341.34} {Name CameraPanTilt} {Link1 0.00,-20.00} {Link2 0.00,-20.00} + */ + CString panTorque, tiltTorque, panTilt; + CString pan, tilt; + int count=1; + int start=0; + int end =0; + float float2[2]; + + start = str.Find("Link"); + if (start < 0) + return; + int length = str.GetLength() - start - 4; + CString rest = str.Right(length); + CMessageParser::GetFloats("Value",rest,',',&count,float2); + CMessageParser::GetFloats("Torque",rest,',',&count,float2+1); + panTorque.Format("Pan =%6.2f (Rad); torque=%6.2f",float2[0],float2[1]); + pan.Format(" Pan =%6.2f", float2[0]); + + start = rest.Find("Link"); + if (start < 0) + return; + length = rest.GetLength() - start - 4; + str = rest.Right(length); + CMessageParser::GetFloats("Value",str,',',&count,float2); + CMessageParser::GetFloats("Torque",str,',',&count,float2+1); + tiltTorque.Format(" Tilt =%6.2f (Rad); torque=%6.2f",float2[0],float2[1]); + tilt.Format("Tilt =%6.2f", float2[0]); + + panTilt = "Camera: " + pan + ", " + tilt; + m_pTree->PutCamera(panTilt, panTorque, tiltTorque); +} + +//============================================================================= +void CRobot::UpdateSonar(CString str) +{ + CString tmp[32], sonar="Sonar:"; + const char *pChar; + int pos1=0, pos2=0, count=0; + while (pos1>=0 && count<32) { + tmp[count++] = CMessageParser::GetString("Name",str, pos1, pos2); + pos1 = pos2; + } + if (pos1<0) count--; + m_depth[m_sonar_row][0] = (float) count; + m_pTree->PutSonarCount(count); + + for (int i=0;iPutSonarLine(tmp[i], i); + } + m_pTree->PutSonarLine(sonar, -1); + +} +//============================================================================= +void CRobot::UpdateRangeScan(CString str) +{ + /* + SEN {Time 511.94} {Type RangeScanner} {Name Scanner1} {Resolution 0.0174} + {FOV 3.1415} {Range 20.0000,19.9903,20.0000,20.0000,20.0000,20.0000, + 19.9868,19.9946,20.0000,20.0000,19.9969,20.0000,20.0000,20.0000,20.0000, + 20.0000,19.9875,20.0000,19.9954,20.0000,19.9973,19.9973,20.0000,19.9809, + 19.9935,19.9819,20.0000,20.0000,19.9899,19.9973,19.9823,19.9940,19.9938, + 19.9856,20.0000,20.0000,20.0000,19.9878,20.0000,20.0000,19.9891,19.9952, + 19.9905,19.9976,19.9959,20.0000,19.9930,19.9943,20.0000,20.0000,20.0000, + 19.9811,19.9906,20.0000,20.0000,19.9937,19.9911,20.0000,19.9831,19.9973, + 19.9861,19.9826,19.9924,20.0000,20.0000,19.9959,20.0000,19.9993,19.9826, + 19.9816,20.0000,20.0000,20.0000,20.0000,20.0000,20.0000,19.9990,20.0000, + 20.0000,19.9828,19.9903,20.0000,20.0000,20.0000,20.0000,20.0000,19.9831, + 20.0000,20.0000,20.0000,20.0000,19.9989,19.9833,19.9958,19.9865,20.0000, + 19.9867,20.0000,20.0000,20.0000,20.0000,20.0000,20.0000,20.0000,20.0000, + 19.9831,19.9839,19.9975,19.9827,19.9872,19.9979,20.0000,19.9877,20.0000, + 20.0000,19.9915,19.9887,19.9903,20.0000,20.0000,19.9950,20.0000,19.9846, + 19.9802,20.0000,19.9882,20.0000,20.0000,19.9873,18.9922,15.4983,13.1021, + 11.3225,10.0221,8.9622,8.1160,7.4080,6.8297,6.3202,5.8914,5.5086,5.1866, + 4.9034,4.6398,4.4134,4.2047,4.0152,3.8472,3.6852,3.5415,3.4175,3.2956, + 3.1792,3.0765,2.9832,2.8936,2.8057,2.7298,2.6573,2.5860,2.5266,2.4643, + 2.4061,2.3549,2.3038,2.2541,2.2111,2.1658,2.1286,2.0886,2.0511,2.0191, + 1.9859,1.9557,1.9218,1.8937,1.8702,1.8425,1.8201,1.7939,1.7732} + */ + + CString dataStr = "Ranges("; + dataStr += CMessageParser::GetString("Name",str) +"):" + + CMessageParser::GetString("Range",str); + m_pTree->PutLidarLine(dataStr, -1); + + int count = 256; + CMessageParser::GetFloats("Range",str,',',&count,&m_depth[m_range_row][1]); + m_depth[m_range_row][0] = (float) count; + int lines = count/8; + int lastLn = count%8; + if (lastLn) lines+=1; + m_pTree->PutLidarCount(lines); + + lines-=1; + for (int i=0;iPutLidarLine(dataStr, i); + } + if (lines>=0) { + if (lastLn==0) lastLn = 8; + CString data; + dataStr = "Data: "; + for (int i=0;iPutLidarLine(dataStr, lines); + } + +} +//============================================================================= +void CRobot::UpdateGraphics(CString str, int range) +// A graphical representation of a ranging instrument +{ + CString name; + unsigned int r; // temporary indices + unsigned int row = 0, col = 0; // number of items in lidar scan + + // Grab the data + if( range == RANGE_3D) + { + for (r = 0; r < LIDAR_ROW; r++) + { + name.Format("Range%-i", r); + int count = LIDAR_COL; + + // Capture the Lidar readings + CMessageParser::GetFloats(name,str,',',&count,&m_depth[r][1]); + m_depth[r][0] = (float) count; + if (count > 1) + { + col = (count-col)? count: col; + row++; + } + } + col--; + } + m_pTree->DrawGraphics( range, &m_depth[0][0]); +} +//============================================================================= +void CRobot::UpdateOdometry(CString str) +{ + CString name ="Odometry:"; + CString data; + int num=2; + int pos1=0, pos2=0; + float float3[3]; + + name += CMessageParser::GetString("Name",str, pos1, pos2); + CMessageParser::GetFloats("Pose",str,',',&num,float3); + data.Format("Position(m): X=%6.2f Y=%6.2f ",float3[0],float3[1]); + m_pTree->PutOdometry(name, data); +} +//============================================================================= +void CRobot::UpdateGPS(CString str) +{ + CString name ="GPS:"; + CString data; + int num=3; + int pos1=0, pos2=0; + int lat[3], lon[3]; + + name += CMessageParser::GetString("Name",str, pos1, pos2); + + CMessageParser::GetInts("Latitude",str,',',&num,lat); + CMessageParser::GetInts("Longitude",str,',',&num,lon); + // assume North America + lon[0] = -lon[0]; + data.Format("Lat=%iN%02i.%04i, Long=%iW%02i.%04i", + lat[0], lat[1], lat[2], lon[0], lon[1], lon[2]); + m_pTree->PutGPS(name, data); +} +//============================================================================= +void CRobot::UpdateGroundTruth(CString str) +{ +// SEN {Time 1515.7579} {Type GroundTruth} {Name GroundTruth} @@ Diff output truncated at 60000 characters. @@ From tk at edam.speech.cs.cmu.edu Tue Dec 4 16:03:07 2007 From: tk at edam.speech.cs.cmu.edu (tk@edam.speech.cs.cmu.edu) Date: Tue, 4 Dec 2007 16:03:07 -0500 Subject: [TeamTalk 345]: [881] trunk/moast-bth: 1) New haness for running moast on multiple machines . Message-ID: <200712042103.lB4L37Z0030355@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071204/5c495697/attachment-0001.html -------------- next part -------------- Modified: trunk/moast-bth/TeamTalkSimulator/Makefile =================================================================== --- trunk/moast-bth/TeamTalkSimulator/Makefile 2007-12-04 20:52:26 UTC (rev 880) +++ trunk/moast-bth/TeamTalkSimulator/Makefile 2007-12-04 21:03:07 UTC (rev 881) @@ -1,67 +1,71 @@ -MOASTLIB_DIR = ../moast -BOEINGLIB_DIR = ../boeingLib -PRIMITIVECOMM_DIR = ../PrimitiveComm - -DEFS = -DDEFAULT_NML_FILE=\"$(MOASTLIB_DIR)/etc/moast.nml\" \ - -DDEFAULT_INI_FILE=\"$(MOASTLIB_DIR)/etc/moast.nml\" -INCLUDES = -I. -I$(MOASTLIB_DIR)/include -I$(RCSLIB_DIR)/include \ - -I$(PRIMITIVECOMM_DIR) -I$(BOEINGLIB_DIR)/boeing -LDFLAGS = -L$(MOASTLIB_DIR)/lib -L$(RCSLIB_DIR)/lib -LDLIBS = -lmoast -lrcs -lposemath -lm #-lwsock32 - -VERBOSE = 1 - -DEP_ECHO = @echo Dependency: $@ -CC_ECHO = @echo Compiling: $@ -LINK_ECHO = @echo Linking: $@ -CLEAN_ECHO = @echo Cleaning. - -ifneq ($(VERBOSE), 1) - Q := @ -endif - -CPPFLAGS = $(DEFS) $(INCLUDES) -CXXFLAGS = -g -Wall -O0 -CXXCOMPILE = $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ - -OBJECTS = TeamTalkSimulator.o robot.o imageClient.o - -EXECUTABLES = TeamTalkSimulator - -all: $(EXECUTABLES) - -# Include the dependencies --include $(OBJECTS:.o=.d) - -TeamTalkSimulator: $(PRIMITIVECOMM_DIR)/libboeingrobotserver.a $(OBJECTS) - @rm -f TeamTalkSimulatedBot - $(CXXLINK) $(OBJECTS) $(PRIMITIVECOMM_DIR)/libboeingrobotserver.a $(LDLIBS) - -$(PRIMITIVECOMM_DIR)/libboeingrobotserver.a: force - $(MAKE) -C $(PRIMITIVECOMM_DIR) all - -# Compilation rule -%.o: %.cc - $(CC_ECHO) - $(Q)$(CXXCOMPILE) -o $@ $< - -%.o: %.cpp - $(CC_ECHO) - $(Q)$(CXXCOMPILE) -o $@ $< - -# Dependency generation rule -%.d: %.cc - $(DEP_ECHO) - $(Q)$(CXX) -c $(CPPFLAGS) -MM $< | ../fixdepend $(dir $<) > $@ - -%.d: %.cpp - $(DEP_ECHO) - $(Q)$(CXX) -c $(CPPFLAGS) -MM $< | ../fixdepend $(dir $<) > $@ - -# Clean rule -clean: - $(MAKE) -C $(PRIMITIVECOMM_DIR) clean - rm -f *.o *.d $(EXECUTABLES) - +MOASTLIB_DIR = ../moast +BOEINGLIB_DIR = ../boeingLib +PRIMITIVECOMM_DIR = ../PrimitiveComm + +DEFS = -DDEFAULT_NML_FILE=\"$(MOASTLIB_DIR)/etc/moast.nml\" \ + -DDEFAULT_INI_FILE=\"$(MOASTLIB_DIR)/etc/moast.nml\" +INCLUDES = -I. -I$(MOASTLIB_DIR)/include -I$(RCSLIB_DIR)/include \ + -I$(PRIMITIVECOMM_DIR) -I$(BOEINGLIB_DIR)/boeing +LDFLAGS = -L$(MOASTLIB_DIR)/lib -L$(RCSLIB_DIR)/lib +LDLIBS = -lmoast -lrcs -lposemath -lm + +VERBOSE = 1 + +DEP_ECHO = @echo Dependency: $@ +CC_ECHO = @echo Compiling: $@ +LINK_ECHO = @echo Linking: $@ +CLEAN_ECHO = @echo Cleaning. + +ifneq ($(VERBOSE), 1) + Q := @ +endif + +CPPFLAGS = $(DEFS) $(INCLUDES) +CXXFLAGS = -g -Wall -O0 +CXXCOMPILE = $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) +CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ + +TTSIMOBJECTS = TeamTalkSimulator.o robot.o imageClient.o +ROBOSIMOBJECTS = robotSimulator.o robot.o imageClient.o +OBJECTS = $(TTSIMOBJECTS) $(ROBOSIMOBJECTS) + +EXECUTABLES = TeamTalkSimulator robotSimulator + +all: $(EXECUTABLES) + +# Include the dependencies +-include $(OBJECTS:.o=.d) + +TeamTalkSimulator: $(PRIMITIVECOMM_DIR)/libboeingrobotserver.a $(TTSIMOBJECTS) + $(CXXLINK) $(TTSIMOBJECTS) $(PRIMITIVECOMM_DIR)/libboeingrobotserver.a $(LDLIBS) + +robotSimulator: $(PRIMITIVECOMM_DIR)/libboeingrobotserver.a $(ROBOSIMOBJECTS) + $(CXXLINK) $(ROBOSIMOBJECTS) $(PRIMITIVECOMM_DIR)/libboeingrobotserver.a $(LDLIBS) + +$(PRIMITIVECOMM_DIR)/libboeingrobotserver.a: force + $(MAKE) -C $(PRIMITIVECOMM_DIR) all + +# Compilation rule +%.o: %.cc + $(CC_ECHO) + $(Q)$(CXXCOMPILE) -o $@ $< + +%.o: %.cpp + $(CC_ECHO) + $(Q)$(CXXCOMPILE) -o $@ $< + +# Dependency generation rule +%.d: %.cc + $(DEP_ECHO) + $(Q)$(CXX) -c $(CPPFLAGS) -MM $< | ../fixdepend $(dir $<) > $@ + +%.d: %.cpp + $(DEP_ECHO) + $(Q)$(CXX) -c $(CPPFLAGS) -MM $< | ../fixdepend $(dir $<) > $@ + +# Clean rule +clean: + $(MAKE) -C $(PRIMITIVECOMM_DIR) clean + rm -f *.o *.d $(EXECUTABLES) + force: ; \ No newline at end of file Added: trunk/moast-bth/TeamTalkSimulator/Simulator.pl =================================================================== --- trunk/moast-bth/TeamTalkSimulator/Simulator.pl (rev 0) +++ trunk/moast-bth/TeamTalkSimulator/Simulator.pl 2007-12-04 21:03:07 UTC (rev 881) @@ -0,0 +1,103 @@ +#!/usr/bin/perl + +use strict; +use File::Spec; + +require 'util.pl'; + +my $MOAST_BTH=File::Spec->rel2abs(File::Spec->updir); +my $BOTSCRIPT=File::Spec->rel2abs('runBot.pl'); + +#remove old log files +unlink glob "$MOAST_BTH/log/*"; + +my @robots = &get_bots('peerfile.txt'); +$SIG{QUIT} = $SIG{INT} = $SIG{TERM} = \&signal_children; +my $num_bots = scalar @robots; + +print $/; +print "ticket: $ENV{'PBS_JOBID'}$/"; + +my %ini; +&readINI('Simulator.ini', \%ini); + +my $hoststring; +open(STATUS, "qstat -f $ENV{'PBS_JOBID'}|"); +$hoststring = (split(/ = /,(grep(/exec_host =/, ))[0]))[1]; +chomp $hoststring; +my @hosts = split(/\+/, $hoststring); +die "Needed $num_bots" if(scalar @hosts != $num_bots); +foreach(0..$#robots) { + my $host = shift @hosts; + $host =~ s|/.*||; + ${$robots[$_]}{'host'} = $host; +} + +foreach(@robots) { + my $cmd = "ssh ${$_}{'host'} $BOTSCRIPT --moast-bth=$MOAST_BTH --id=${$_}{'id'} --type=${$_}{'type'} --name=${$_}{'name'}"; + $cmd .= " --display=$ini{'DISPLAY'}" if $defined $ini{'DISPLAY'}; + print $cmd, $/; + ${$_}{'pid'} = &spawn($cmd); + ${$_}{'remotepid'} = &getremotepid($_); #required due to ssh bug +} + +print &render_bots(@robots); + +#wait for them to all exit +my $done; +do { + $done = 1; + my $kid = waitpid(-1, 0); + last if $kid == -1; + foreach(@robots) { + my $pid = ${$_}{'pid'}; + if($pid) { + if($kid == $pid) { + ${$_}{'pid'} = 0; + } else { + $done = 0; + } + } + } +} while !$done; + +exit; + +sub signal_children { + my $signal = shift; + &killremotes; #required because of ssh bug + #otherwise we would just kill our children as in the code below + #my @active_children = grep($_, map(${$_}{'pid'}, @robots)); + #kill $signal, @active_children if scalar @active_children; +} + +#we need this because ssh doesn't pass signals when there's no tty +#it should be fixed in the next version of openssh +#see https://bugzilla.mindrot.org/show_bug.cgi?id=396 +sub getremotepid { + my $robot = shift; + my $logfile = "$MOAST_BTH/log/${$robot}{'name'}.out"; + my $remotepid; + do { + sleep 1; + print "looking$/"; + next if !-e $logfile; + print "found$/"; + next if !open(LOG, $logfile); + chop($remotepid = ); + print "got: $remotepid$/"; + } until defined $remotepid; + close LOG; + return $remotepid; +} + +sub killremotes { + foreach(@robots) { + my $remotepid = ${$_}{'remotepid'}; + next if !$remotepid; + my $host = ${$_}{'host'}; + next if !$host; + system("ssh $host kill $remotepid"); + } +} + Property changes on: trunk/moast-bth/TeamTalkSimulator/Simulator.pl ___________________________________________________________________ Name: svn:executable + * Modified: trunk/moast-bth/TeamTalkSimulator/TeamTalkSimulator.cc =================================================================== --- trunk/moast-bth/TeamTalkSimulator/TeamTalkSimulator.cc 2007-12-04 20:52:26 UTC (rev 880) +++ trunk/moast-bth/TeamTalkSimulator/TeamTalkSimulator.cc 2007-12-04 21:03:07 UTC (rev 881) @@ -1,474 +1,468 @@ -/** TeamTalkSimulatedBot - * Author: TK Harris - * - * Simulated Boeing robots in the usarsim environment. - * - * Created: 2006/9/11 - **/ - -#include -#include -#include //for initial map kludge - -#include -#include -#include -#include - -using namespace std; - -#define DEBUG 1 - -#include "robot.h" -#include -#include -#include -#include - -#include -#include "moastTypes.hh" // MOAST_NML_BUFFER_NAME_LEN -#include "moastNmlOffsets.hh" // NAV_DATA_BASE, etc. -#include "sectMobPL.hh" // secMobPL_format() - -static RCS_CMD_CHANNEL *sectMobPLCmdBuf = NULL; -static RCS_STAT_CHANNEL *sectMobPLStatBuf = NULL; -static RCS_CMD_CHANNEL *sectMobPLCfgBuf = NULL; -static RCS_STAT_CHANNEL *sectMobPLSetBuf = NULL; -static SectMobPLStat *sectMobPLStatPtr; -static SectMobPLSet *sectMobPLSetPtr; - -map robots; - -#ifndef DEFAULT_NML_FILE -#define DEFAULT_NML_FILE "moast.nml" -#endif -#ifndef DEFAULT_INI_FILE -#define DEFAULT_INI_FILE "moast.ini" -#endif - -#define THIS_PROCESS "sectShell" -static string MAP_DUMP; - -char nml_file_default[] = DEFAULT_NML_FILE; -char *nml_file_env; -char *NML_FILE = NULL; -char ini_file_default[] = DEFAULT_INI_FILE; -char *ini_file_env; -char *INI_FILE = NULL; -int bufnum = 1; - -string moast_bin; - -/****************** MAP STUFF *********************/ - -static unsigned char* conveyedMap; -static unsigned char* currentMap = (unsigned char*)malloc(500000); -static unsigned char* diffMap; -static int mapWidth, mapHeight; -static int mapXOffset, mapYOffset; -static Boeing::MsgMap* msgMap = (Boeing::MsgMap*)malloc(500000); - -void readMapFile() { - //we're going to do this a lot, so just open once - -} - -void sendFullMap(Boeing::MapServer *mserver) { - readMapFile(); - Boeing::MsgMap::MsgMapFactory(Boeing::MAP_X_MAJOR, - msgMap, currentMap, mapWidth*mapHeight, - 0, 0, mapWidth, mapHeight); - //debug << "raw: " << msgMap->map[0] - // << " rl: " << ((msgMap->map[0]&0xFFFFFF00)>>8) - // << " rv: " << (msgMap->map[0]&0x000000FF) << endl; - mserver->sendFullMap(msgMap); -} - -void sendDiffMap(Boeing::MapServer *mserver) { - readMapFile(); - Boeing::MsgMap::MsgMapFactory(Boeing::MAP_X_MAJOR, - msgMap, diffMap, mapWidth*mapHeight, - 0, 0, mapWidth, mapHeight); - //debug << "raw: " << msgMap->map[0] - // << " rl: " << ((msgMap->map[0]&0xFFFFFF00)>>8) - // << " rv: " << (msgMap->map[0]&0x000000FF) << endl; - mserver->sendDiffMap(msgMap); -} - -void* readMapRequests(void *m) { - bool subscribed = false; - int updatePeriod = 1; - - Boeing::MapServer *mserver = (Boeing::MapServer*)m; - for(;;) { - const Boeing::MsgMapServer *msg = mserver->getNextMessage(); - if(msg) { - switch(msg->hdr.type) { - case Boeing::MAP_SUBSCRIBE: - sendFullMap(mserver); - subscribed = true; - break; - case Boeing::MAP_KEEPALIVE: - break; - case Boeing::MAP_ACK: - break; - case Boeing::MAP_UNSUBSCRIBE: - subscribed = false; - break; - default: - error << "unknown or unhandled msgtype: " << msg->hdr.type << endl; - } - } else { - if(subscribed) - //sendDiffMap(mserver); - sendFullMap(mserver); - } - sleep(updatePeriod); - } -} - -/*************************** END MAP STUFF ****************************/ - -void* readTrades(void *t) { - Boeing::TraderServer *tserver = (Boeing::TraderServer *) t; - for(;;) { - const Boeing::MsgTraderServer *msg = tserver->getNextMessage(); - if(!msg) { - //debug << "getNextMessage is NULL" << endl; - sleep(1000); - continue; - } - - sectMobPLStatBuf->read(); - sectMobPLSetBuf->read(); - - if(msg->hdr.type != Boeing::TRADER_TASK) { - error << "don't know what to do with header type " << msg->hdr.type << endl; - continue; - } - debug << "got: " << msg->msg_task.task << endl; - istringstream task(msg->msg_task.task); - string token; - task >> token; - if(token != "search") { - error << "don't know how to deal with command " << token << endl; - continue; - } - float x, y; - while(task >> x) { - if(!(task >> y)) break; - for(map::iterator i = robots.begin(); i != robots.end(); i++) { - if(i->first == "bashful") i->second->setFollow("clyde"); - else if(i->first == "clyde") i->second->stackGoal(x, y); - } - } - } -} - -void readMapData() { - ifstream f(MAP_DUMP.c_str()); - if(!f) { - error << " can't open map" << endl; - return; - } - string token; - if((f >> token).fail() || token != "P6") { - error << " expected P6: " << token << endl; - return; - } - //int oldMapWidth = mapWidth; - //int oldMapHeight = mapHeight; - if((f >> mapWidth >> mapHeight).fail() || mapWidth <= 0 || mapHeight <= 0) { - error << " expected mapWidth: " - << mapWidth << " mapHeight: " << mapHeight << endl; - return; - } - if((f >> token).fail() || token != "255") { - error << " expected 255: " << token << endl; - return; - } - ignoreToEndOfLine(f); - for(int j=0; j failed to read at (" << i << ' ' << j << ')' << endl; - return; - } - if(r == '\0' && g == '\0' && b == '\0') { - //unknown - currentMap[j*mapWidth+i] = 0x40; - } else if(r == '\255' && g == '\0' && b == '\0') { - //obstacle - currentMap[j*mapWidth+i] = 0xff; - } else if(r == '\255' && g == '\255' && b == '\255') { - //unknown - currentMap[j*mapWidth+i] = 0x00; - } else { - error << " unknown encoding at (" << i << ' ' << j << "): (" << (unsigned int)r << ' ' << (unsigned int)g << ' ' << (unsigned int)b << ')' << endl; - return; - } - } - } -} - -static int NmlSvrPid = 0; -static int SectMobPLPid = 0; -static void sigint_handler(int sig) { - for(map::const_iterator i=robots.begin(); i!=robots.end(); i++) { - delete i->second; //deleting the robot kills the asociated moast procs - } - if(SectMobPLPid) kill(SectMobPLPid, SIGINT); - if(NmlSvrPid) kill(NmlSvrPid, SIGINT); - signal(SIGINT, SIG_DFL); //reset sigint handler - kill(getpid(), SIGINT); //kill yourself -} - -static int cleanupSectMobPLNmlBuffers(void) -{ - if (NULL != sectMobPLCmdBuf) - delete sectMobPLCmdBuf; - if (NULL != sectMobPLStatBuf) - delete sectMobPLStatBuf; - if (NULL != sectMobPLSetBuf) - delete sectMobPLSetBuf; - if (NULL != sectMobPLCfgBuf) - delete sectMobPLCfgBuf; - - sectMobPLStatBuf = NULL; - sectMobPLSetBuf = NULL; - sectMobPLCmdBuf = NULL; - sectMobPLCfgBuf = NULL; - - return 0; -} - -static void mapDump() { - sectMobPLStatBuf->read(); - sectMobPLSetBuf->read(); - - SectMobPLCfgDumpWM dump = SectMobPLCfgDumpWM(); - dump.turnOn = 1; - dump.serial_number = sectMobPLSetPtr->echo_serial_number + 1; - dump.skip = 5; - dump.dumpContinuous = true; - MAP_DUMP.copy(dump.fileName, MOAST_FILE_NAME_LEN); - sectMobPLCfgBuf->write(&dump); -} - -static int initSectMobPLNmlBuffers(char *config_file, int bufnum) { - cleanupSectMobPLNmlBuffers(); - - { - ostringstream chanName; - chanName << SECT_MOB_PL_CMD_NAME << bufnum; - sectMobPLCmdBuf = - new RCS_CMD_CHANNEL(sectMobPL_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - if (!sectMobPLCmdBuf->valid()) { - delete sectMobPLCmdBuf; - sectMobPLCmdBuf = 0; - return 1; - } - } - - { - ostringstream chanName; - chanName << SECT_MOB_PL_STAT_NAME << bufnum; - sectMobPLStatBuf = - new RCS_STAT_CHANNEL(sectMobPL_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - if (!sectMobPLStatBuf->valid()) { - delete sectMobPLStatBuf; - sectMobPLStatBuf = 0; - return 1; - } - } - - { - ostringstream chanName; - chanName << SECT_MOB_PL_CFG_NAME << bufnum; - sectMobPLCfgBuf = - new RCS_CMD_CHANNEL(sectMobPL_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - if (!sectMobPLCfgBuf->valid()) { - delete sectMobPLCfgBuf; - sectMobPLCfgBuf = 0; - return 1; - } - } - - { - ostringstream chanName; - chanName << SECT_MOB_PL_CMD_NAME << bufnum; - sectMobPLSetBuf = - new RCS_STAT_CHANNEL(sectMobPL_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - if (!sectMobPLSetBuf->valid()) { - delete sectMobPLSetBuf; - sectMobPLSetBuf = 0; - return 1; - } - } - - return 0; -} - -int initSectionControl() { - if (NULL == NML_FILE) { - nml_file_env = getenv("CONFIG_NML"); - if (NULL != nml_file_env) { - NML_FILE = nml_file_env; - } else { - NML_FILE = nml_file_default; - } - } - - // ditto for the .ini file - if (NULL == INI_FILE) { - ini_file_env = getenv("CONFIG_INI"); - if (NULL != ini_file_env) { - INI_FILE = ini_file_env; - } else { - INI_FILE = ini_file_default; - } - } - - // initial allocate all the buffers - int retval = initSectMobPLNmlBuffers(NML_FILE, bufnum); - - if (retval) { - fatal << "TeamTalkSimulator: Can't allocate NML buffers" << endl; - return 1; - } - - // set up our convenient pointer to status and settings - sectMobPLStatPtr = (SectMobPLStat *) sectMobPLStatBuf->get_address(); - sectMobPLSetPtr = (SectMobPLSet *) sectMobPLSetBuf->get_address(); - - sectMobPLStatBuf->read(); - sectMobPLSetBuf->read(); - - // set up init command - SectMobPLCmdInit sectInit = SectMobPLCmdInit(); - sectInit.serial_number = sectMobPLStatPtr->echo_serial_number + 1; - sectInit.vehList_length = robots.size(); - sectInit.subordinate = VEHICLE; - for(int i=0; iwrite(§Init); - - return 0; -} - -int main(int argc, char *argv[]) -{ - DebugStream::threashold_ = DebugStream::D; //give me all debug messages - - //register sigint handler - signal(SIGINT, sigint_handler); - - { - ostringstream o; - o << "/tmp/" << getuid() << "-SectMobPLDispOutput.ppm"; - MAP_DUMP = o.str(); - } - - string name = "tester"; - string peerfile; - for(int i=1; i args; - args.push_back("-s"); - NmlSvrPid = spawn(false, moast_bin, "moastNmlSvr", args); - sleep(3); - - if(!peerfile.empty()) { - int robot_count = 1; - debug << "adding robots from " << peerfile << endl; - ifstream Frobotips(peerfile.c_str()); - if(!Frobotips) { - error << "problem opening " << peerfile << endl; - throw exception(); - } - string rname; - while(Frobotips >> rname) { - if(rname.at(0) == '#') { - ignoreToEndOfLine(Frobotips); - continue; - } - toupper(rname); - if(rname == "MAPSERVER" || rname == "OPTRADER") { - ignoreToEndOfLine(Frobotips); - continue; - } - string rip; - Frobotips >> rip; - string::size_type i = rip.find(':'); - if(i != string::npos) { - unsigned short port = atoi(string(rip, i+1, rip.size()-i-1).c_str()); - robots[rname] = new Robot(&robots, rname, robot_count++, port); - debug << "added " << rname << '@' << port << endl; - } else { - robots[rname] = new Robot(&robots, rname, robot_count++); - debug << "added " << rname << endl; - } - ignoreToEndOfLine(Frobotips); - } - } - if(robots.empty()) robots[name] = new Robot(&robots, name, 1); - - //initialize section control - args.clear(); - args.push_back("-r.2"); - SectMobPLPid = spawn(false, moast_bin, "sectMobPL", args); - sleep(5); - initSectionControl(); - mapDump(); - - //start the trader - Boeing::TraderServer tserver; - tserver.open(); - //handle trading messages - pthread_t tradeThread_; - pthread_create(&tradeThread_, NULL, readTrades, (void *) &tserver); - - readMapData(); - //start the map server - Boeing::MapServer mserver; - mserver.open(); - //handle trading messages - pthread_t mapThread_; - pthread_create(&mapThread_, NULL, readMapRequests, (void *) &mserver); - - //wait for all of the threads to terminate - info << "wait for thread termination...\n" << endl; - pthread_join(tradeThread_, NULL); - pthread_join(mapThread_, NULL); - //should probably also be waiting for robot server handles here - return 0; - -} +/** TeamTalkSimulatedBot + * Author: TK Harris + * + * Simulated Boeing robots in the usarsim environment. + * + * Created: 2006/9/11 + **/ + +#include +#include +#include //for initial map kludge + +#include +#include +#include +#include + +using namespace std; + +#define DEBUG 1 + +#include "robot.h" +#include +#include +#include +#include + +#include +#include "moastTypes.hh" // MOAST_NML_BUFFER_NAME_LEN +#include "moastNmlOffsets.hh" // NAV_DATA_BASE, etc. +#include "sectMobPL.hh" // secMobPL_format() + +static RCS_CMD_CHANNEL *sectMobPLCmdBuf = NULL; +static RCS_STAT_CHANNEL *sectMobPLStatBuf = NULL; +static RCS_CMD_CHANNEL *sectMobPLCfgBuf = NULL; +static RCS_STAT_CHANNEL *sectMobPLSetBuf = NULL; +static SectMobPLStat *sectMobPLStatPtr; +static SectMobPLSet *sectMobPLSetPtr; + +map robots; + +#ifndef DEFAULT_NML_FILE +#define DEFAULT_NML_FILE "moast.nml" +#endif +#ifndef DEFAULT_INI_FILE +#define DEFAULT_INI_FILE "moast.ini" +#endif + +#define THIS_PROCESS "sectShell" +static string MAP_DUMP; + +char nml_file_default[] = DEFAULT_NML_FILE; +char *nml_file_env; +char *NML_FILE = NULL; +char ini_file_default[] = DEFAULT_INI_FILE; +char *ini_file_env; +char *INI_FILE = NULL; +int bufnum = 1; + +string moast_bin; + +/****************** MAP STUFF *********************/ + +static unsigned char* conveyedMap; +static unsigned char* currentMap = (unsigned char*)malloc(500000); +static unsigned char* diffMap; +static int mapWidth, mapHeight; +static int mapXOffset, mapYOffset; +static Boeing::MsgMap* msgMap = (Boeing::MsgMap*)malloc(500000); + +void readMapFile() { + //we're going to do this a lot, so just open once + +} + +void sendFullMap(Boeing::MapServer *mserver) { + readMapFile(); + Boeing::MsgMap::MsgMapFactory(Boeing::MAP_X_MAJOR, + msgMap, currentMap, mapWidth*mapHeight, + 0, 0, mapWidth, mapHeight); + mserver->sendFullMap(msgMap); +} + +void sendDiffMap(Boeing::MapServer *mserver) { + readMapFile(); + Boeing::MsgMap::MsgMapFactory(Boeing::MAP_X_MAJOR, + msgMap, diffMap, mapWidth*mapHeight, + 0, 0, mapWidth, mapHeight); + mserver->sendDiffMap(msgMap); +} + +void* readMapRequests(void *m) { + bool subscribed = false; + int updatePeriod = 1; + + Boeing::MapServer *mserver = (Boeing::MapServer*)m; + for(;;) { + const Boeing::MsgMapServer *msg = mserver->getNextMessage(); + if(msg) { + switch(msg->hdr.type) { + case Boeing::MAP_SUBSCRIBE: + sendFullMap(mserver); + subscribed = true; + break; + case Boeing::MAP_KEEPALIVE: + break; + case Boeing::MAP_ACK: + break; + case Boeing::MAP_UNSUBSCRIBE: + subscribed = false; + break; + default: + error << "unknown or unhandled msgtype: " << msg->hdr.type << endl; + } + } else { + if(subscribed) + //sendDiffMap(mserver); + sendFullMap(mserver); + } + sleep(updatePeriod); + } +} + +/*************************** END MAP STUFF ****************************/ + +void* readTrades(void *t) { + Boeing::TraderServer *tserver = (Boeing::TraderServer *) t; + for(;;) { + const Boeing::MsgTraderServer *msg = tserver->getNextMessage(); + if(!msg) { + //debug << "getNextMessage is NULL" << endl; + sleep(1000); + continue; + } + + sectMobPLStatBuf->read(); + sectMobPLSetBuf->read(); + + if(msg->hdr.type != Boeing::TRADER_TASK) { + error << "don't know what to do with header type " << msg->hdr.type << endl; + continue; + } + debug << "got: " << msg->msg_task.task << endl; + istringstream task(msg->msg_task.task); + string token; + task >> token; + if(token != "search") { + error << "don't know how to deal with command " << token << endl; + continue; + } + float x, y; + while(task >> x) { + if(!(task >> y)) break; + for(map::iterator i = robots.begin(); i != robots.end(); i++) { + if(i->first == "bashful") i->second->setFollow("clyde"); + else if(i->first == "clyde") i->second->stackGoal(x, y); + } + } + } +} + +void readMapData() { + ifstream f(MAP_DUMP.c_str()); + if(!f) { + error << " can't open map" << endl; + return; + } + string token; + if((f >> token).fail() || token != "P6") { + error << " expected P6: " << token << endl; + return; + } + //int oldMapWidth = mapWidth; + //int oldMapHeight = mapHeight; + if((f >> mapWidth >> mapHeight).fail() || mapWidth <= 0 || mapHeight <= 0) { + error << " expected mapWidth: " + << mapWidth << " mapHeight: " << mapHeight << endl; + return; + } + if((f >> token).fail() || token != "255") { + error << " expected 255: " << token << endl; + return; + } + ignoreToEndOfLine(f); + for(int j=0; j failed to read at (" << i << ' ' << j << ')' << endl; + return; + } + if(r == '\0' && g == '\0' && b == '\0') { + //unknown + currentMap[j*mapWidth+i] = 0x40; + } else if(r == '\255' && g == '\0' && b == '\0') { + //obstacle + currentMap[j*mapWidth+i] = 0xff; + } else if(r == '\255' && g == '\255' && b == '\255') { + //unknown + currentMap[j*mapWidth+i] = 0x00; + } else { + error << " unknown encoding at (" << i << ' ' << j << "): (" << (unsigned int)r << ' ' << (unsigned int)g << ' ' << (unsigned int)b << ')' << endl; + return; + } + } + } +} + +static int NmlSvrPid = 0; +static int SectMobPLPid = 0; +static void sigint_handler(int sig) { + for(map::const_iterator i=robots.begin(); i!=robots.end(); i++) { + delete i->second; //deleting the robot kills the asociated moast procs + } + if(SectMobPLPid) kill(SectMobPLPid, SIGINT); + if(NmlSvrPid) kill(NmlSvrPid, SIGINT); + signal(SIGINT, SIG_DFL); //reset sigint handler + kill(getpid(), SIGINT); //kill yourself +} + +static int cleanupSectMobPLNmlBuffers(void) +{ + if (NULL != sectMobPLCmdBuf) + delete sectMobPLCmdBuf; + if (NULL != sectMobPLStatBuf) + delete sectMobPLStatBuf; + if (NULL != sectMobPLSetBuf) + delete sectMobPLSetBuf; + if (NULL != sectMobPLCfgBuf) + delete sectMobPLCfgBuf; + + sectMobPLStatBuf = NULL; + sectMobPLSetBuf = NULL; + sectMobPLCmdBuf = NULL; + sectMobPLCfgBuf = NULL; + + return 0; +} + +static void mapDump() { + sectMobPLStatBuf->read(); + sectMobPLSetBuf->read(); + + SectMobPLCfgDumpWM dump = SectMobPLCfgDumpWM(); + dump.turnOn = 1; + dump.serial_number = sectMobPLSetPtr->echo_serial_number + 1; + dump.skip = 5; + dump.dumpContinuous = true; + MAP_DUMP.copy(dump.fileName, MOAST_FILE_NAME_LEN); + sectMobPLCfgBuf->write(&dump); +} + +static int initSectMobPLNmlBuffers(char *config_file, int bufnum) { + cleanupSectMobPLNmlBuffers(); + + { + ostringstream chanName; + chanName << SECT_MOB_PL_CMD_NAME << bufnum; + sectMobPLCmdBuf = + new RCS_CMD_CHANNEL(sectMobPL_format, chanName.str().c_str(), + THIS_PROCESS, config_file); + if (!sectMobPLCmdBuf->valid()) { + delete sectMobPLCmdBuf; + sectMobPLCmdBuf = 0; + return 1; + } + } + + { + ostringstream chanName; + chanName << SECT_MOB_PL_STAT_NAME << bufnum; + sectMobPLStatBuf = + new RCS_STAT_CHANNEL(sectMobPL_format, chanName.str().c_str(), + THIS_PROCESS, config_file); + if (!sectMobPLStatBuf->valid()) { + delete sectMobPLStatBuf; + sectMobPLStatBuf = 0; + return 1; + } + } + + { + ostringstream chanName; + chanName << SECT_MOB_PL_CFG_NAME << bufnum; + sectMobPLCfgBuf = + new RCS_CMD_CHANNEL(sectMobPL_format, chanName.str().c_str(), + THIS_PROCESS, config_file); + if (!sectMobPLCfgBuf->valid()) { + delete sectMobPLCfgBuf; + sectMobPLCfgBuf = 0; + return 1; + } + } + + { + ostringstream chanName; + chanName << SECT_MOB_PL_CMD_NAME << bufnum; + sectMobPLSetBuf = + new RCS_STAT_CHANNEL(sectMobPL_format, chanName.str().c_str(), + THIS_PROCESS, config_file); + if (!sectMobPLSetBuf->valid()) { + delete sectMobPLSetBuf; + sectMobPLSetBuf = 0; + return 1; + } + } + + return 0; +} + +int initSectionControl() { + if (NULL == NML_FILE) { + nml_file_env = getenv("CONFIG_NML"); + if (NULL != nml_file_env) { + NML_FILE = nml_file_env; + } else { + NML_FILE = nml_file_default; + } + } + + // ditto for the .ini file + if (NULL == INI_FILE) { + ini_file_env = getenv("CONFIG_INI"); + if (NULL != ini_file_env) { + INI_FILE = ini_file_env; + } else { + INI_FILE = ini_file_default; + } + } + + // initial allocate all the buffers + int retval = initSectMobPLNmlBuffers(NML_FILE, bufnum); + + if (retval) { + fatal << "TeamTalkSimulator: Can't allocate NML buffers" << endl; + return 1; + } + + // set up our convenient pointer to status and settings + sectMobPLStatPtr = (SectMobPLStat *) sectMobPLStatBuf->get_address(); + sectMobPLSetPtr = (SectMobPLSet *) sectMobPLSetBuf->get_address(); + + sectMobPLStatBuf->read(); + sectMobPLSetBuf->read(); + + // set up init command + SectMobPLCmdInit sectInit = SectMobPLCmdInit(); + sectInit.serial_number = sectMobPLStatPtr->echo_serial_number + 1; + sectInit.vehList_length = robots.size(); + sectInit.subordinate = VEHICLE; + for(int i=0; iwrite(§Init); + + return 0; +} + +int main(int argc, char *argv[]) +{ + DebugStream::threashold_ = DebugStream::D; //give me all debug messages + + //register sigint handler + signal(SIGINT, sigint_handler); + + { + ostringstream o; + o << "/tmp/" << getuid() << "-SectMobPLDispOutput.ppm"; + MAP_DUMP = o.str(); + } + + string name = "tester"; + string peerfile; + for(int i=1; i args; + args.push_back("-s"); + NmlSvrPid = spawn(false, moast_bin, "moastNmlSvr", args); + sleep(3); + + if(!peerfile.empty()) { + int robot_count = 1; + debug << "adding robots from " << peerfile << endl; + ifstream Frobotips(peerfile.c_str()); + if(!Frobotips) { + error << "problem opening " << peerfile << endl; + throw exception(); + } + string rname; + while(Frobotips >> rname) { + if(rname.at(0) == '#') { + ignoreToEndOfLine(Frobotips); + continue; + } + toupper(rname); + if(rname == "MAPSERVER" || rname == "OPTRADER") { + ignoreToEndOfLine(Frobotips); + continue; + } + string rip; + Frobotips >> rip; + string::size_type i = rip.find(':'); + if(i != string::npos) { + unsigned short port = atoi(string(rip, i+1, rip.size()-i-1).c_str()); + robots[rname] = new Robot(robot_count++, port); + debug << "added " << rname << '@' << port << endl; + } else { + robots[rname] = new Robot(robot_count++); + debug << "added " << rname << endl; + } + ignoreToEndOfLine(Frobotips); + } + } + if(robots.empty()) robots[name] = new Robot(1); + + //initialize section control + args.clear(); + args.push_back("-r.2"); + SectMobPLPid = spawn(false, moast_bin, "sectMobPL", args); + sleep(5); + initSectionControl(); + mapDump(); + + //start the trader + Boeing::TraderServer tserver; + tserver.open(); + //handle trading messages + pthread_t tradeThread_; + pthread_create(&tradeThread_, NULL, readTrades, (void *) &tserver); + + readMapData(); + //start the map server + Boeing::MapServer mserver; + mserver.open(); + //handle trading messages + pthread_t mapThread_; + pthread_create(&mapThread_, NULL, readMapRequests, (void *) &mserver); + + //wait for all of the threads to terminate + info << "wait for thread termination...\n" << endl; + pthread_join(tradeThread_, NULL); + pthread_join(mapThread_, NULL); + //should probably also be waiting for robot server handles here + return 0; + +} Modified: trunk/moast-bth/TeamTalkSimulator/imageClient.cc =================================================================== --- trunk/moast-bth/TeamTalkSimulator/imageClient.cc 2007-12-04 20:52:26 UTC (rev 880) +++ trunk/moast-bth/TeamTalkSimulator/imageClient.cc 2007-12-04 21:03:07 UTC (rev 881) @@ -1,219 +1,219 @@ -#include -#include -#include -#include -#include -#include -#include //for connect_with_timeout - -#include - -#include - -#include "imageClient.h" - -using namespace std; - -ImageClientException::ImageClientException() throw() {} -const char* ImageClientException::what() const throw() { - return "can't connect to image server"; -} - -int ImageClient::connect_with_timeout(int sockfd, const struct sockaddr* serv_addr, - socklen_t addrlen, int timeout) { - - // code borrowed from HAL http://www.developerweb.net/forum/showthread.php?p=13486 - - // Set non-blocking - long arg; - if((arg = fcntl(sockfd, F_GETFL, NULL)) < 0) { - error << "Error fcntl(..., F_GETFL) (" << strerror(errno) << ')' << endl; - return errno; - } - arg |= O_NONBLOCK; - if( fcntl(sockfd, F_SETFL, arg) < 0) { - error << "Error fcntl(..., F_SETFL) (" << strerror(errno) << ')' << endl; - return errno; - } - - // Trying to connect with timeout - int res = connect(sockfd, serv_addr, addrlen); - if (res < 0) { - if (errno == EINPROGRESS) { - do { - fd_set myset; - struct timeval tv; - tv.tv_sec = timeout; - tv.tv_usec = 0; - FD_ZERO(&myset); - FD_SET(sockfd, &myset); - res = select(sockfd+1, NULL, &myset, NULL, &tv); - if (res < 0 && errno != EINTR) { - error << "Error connecting " << errno << " - " << strerror(errno) << endl; - return errno; - } - else if (res > 0) { - // Socket selected for write - socklen_t lon = sizeof(int); - int valopt; - if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon) < 0) { - error << "Error in getsockopt() " << errno << " - " << strerror(errno) << endl; - return errno; - } - // Check the value returned... - if (valopt) { - error << "Error in delayed connection() " << errno << " - " << strerror(valopt) << endl; - return errno; - } - break; - } - else { - //error << "Timeout in select() - Cancelling!" << endl; - return ETIMEDOUT; - } - } while (1); - } - else { - error << "Error connecting " << errno << " - " << strerror(errno) << endl; - return errno; - } - } - // Set to blocking mode again... - if( (arg = fcntl(sockfd, F_GETFL, NULL)) < 0) { - error << "Error fcntl(..., F_GETFL) (" << strerror(errno) << ')' << endl; - return errno; - } - arg &= (~O_NONBLOCK); - if( fcntl(sockfd, F_SETFL, arg) < 0) { - error << "Error fcntl(..., F_SETFL) (" << strerror(errno) << ')' << endl; - return errno; - } - return 0; -} - -ImageClient::ImageClient(const string& host, unsigned short port) - : sockfd(0), image_(NULL), image_size_(0) -{ - struct sockaddr_in serv_addr; - struct hostent *hostptr; - - if(!(hostptr = gethostbyname(host.c_str()))) { - error << "socket error: cannot find host " << host << endl; - throw ImageClientException(); - } - - memset((char *) &serv_addr, 0, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - memcpy((char *) &serv_addr.sin_addr, - hostptr->h_addr_list[0], - hostptr->h_length); - serv_addr.sin_port = htons(port); - - if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - return; - } - - if (connect_with_timeout(sockfd, (struct sockaddr*) &serv_addr, sizeof(serv_addr), 3)) { - perror("connect"); - throw ImageClientException(); - } - - //getImage_(); -} - -ImageClient::ImageClient(const string& host, unsigned short port, - int* image_size, const unsigned char*& image) - : sockfd(0), image_(NULL), image_size_(0) -{ - struct sockaddr_in serv_addr; - struct hostent *hostptr; - - if(!(hostptr = gethostbyname(host.c_str()))) { - error << "socket error: cannot find host " << host << endl; - return; - } - - memset((char *) &serv_addr, 0, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - memcpy((char *) &serv_addr.sin_addr, - hostptr->h_addr_list[0], - hostptr->h_length); - serv_addr.sin_port = htons(port); - - if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - return; - } - - //debug << "about to connect" << endl; - if (connect(sockfd, (struct sockaddr*) &serv_addr, sizeof(serv_addr)) < 0) { - perror("connect"); - return; - } - //debug << "connected" << endl; - - //if((*image_size = getImage_()) > 0) image = image_; -} - -ImageClient::~ImageClient() { - delete image_; - close(sockfd); -} - -int ImageClient::getImage_() { - char iType; - debug << "reading image type" << endl; - if(!readn(&iType)) { - error << "problem getting image type" << endl; - return -1; - } - debug << "Image Type is " << (int)iType << endl; - if((int)iType < 1 || (int)iType > 5) { - error << "can't deal with image of type " << (int)iType << endl; - return -1; - } - // for names images -- not yet supported - //char iName[16]; - //if(!readn(&iName)) { - // error << "problem reading image name" << endl; - // return -1; - //} - //debug << "image name is " << iName << endl; - if(!readn(&image_size_)) { - error << "problem getting image size" << endl; - return -1; - } - image_size_ = ntohl(image_size_); - debug << "image size is " << image_size_ << endl; - if(image_size_ <= 0) { - error << "bad image size: " << image_size_ << endl; - return -1; - } - - if(image_ == NULL) { - image_ = (unsigned char*)malloc(max_image_size_ = image_size_); - } - else if(image_size_ > max_image_size_) { - image_ = (unsigned char*)realloc(image_, max_image_size_ = image_size_); - } - if(!readn(image_, image_size_)) { - error << "problem getting image" << endl; - return -1; - } - return image_size_; -} - -int ImageClient::getImage(const unsigned char*& imagePtr) { - char ack[] = {'O', 'k', '\n', '\r'}; - debug << "sending ack" << endl; - send(sockfd, ack, 4, 0); - - if(getImage_() <= 0) { - cerr << "cannot get image" << endl; - return -1; - } - imagePtr = image_; - return image_size_; -} - +#include +#include +#include +#include +#include +#include +#include //for connect_with_timeout + +#include + +#include + +#include "imageClient.h" + +using namespace std; + +ImageClientException::ImageClientException() throw() {} +const char* ImageClientException::what() const throw() { + return "can't connect to image server"; +} + +int ImageClient::connect_with_timeout(int sockfd, const struct sockaddr* serv_addr, + socklen_t addrlen, int timeout) { + + // code borrowed from HAL http://www.developerweb.net/forum/showthread.php?p=13486 + + // Set non-blocking + long arg; + if((arg = fcntl(sockfd, F_GETFL, NULL)) < 0) { + error << "Error fcntl(..., F_GETFL) (" << strerror(errno) << ')' << endl; + return errno; + } + arg |= O_NONBLOCK; + if( fcntl(sockfd, F_SETFL, arg) < 0) { + error << "Error fcntl(..., F_SETFL) (" << strerror(errno) << ')' << endl; + return errno; + } + + // Trying to connect with timeout + int res = connect(sockfd, serv_addr, addrlen); + if (res < 0) { + if (errno == EINPROGRESS) { + do { + fd_set myset; + struct timeval tv; + tv.tv_sec = timeout; + tv.tv_usec = 0; + FD_ZERO(&myset); + FD_SET(sockfd, &myset); + res = select(sockfd+1, NULL, &myset, NULL, &tv); + if (res < 0 && errno != EINTR) { + error << "Error connecting " << errno << " - " << strerror(errno) << endl; + return errno; + } + else if (res > 0) { + // Socket selected for write + socklen_t lon = sizeof(int); + int valopt; + if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon) < 0) { + error << "Error in getsockopt() " << errno << " - " << strerror(errno) << endl; + return errno; + } + // Check the value returned... + if (valopt) { + error << "Error in delayed connection() " << errno << " - " << strerror(valopt) << endl; + return errno; + } + break; + } + else { + //error << "Timeout in select() - Cancelling!" << endl; + return ETIMEDOUT; + } + } while (1); + } + else { + error << "Error connecting " << errno << " - " << strerror(errno) << endl; + return errno; + } + } + // Set to blocking mode again... + if( (arg = fcntl(sockfd, F_GETFL, NULL)) < 0) { + error << "Error fcntl(..., F_GETFL) (" << strerror(errno) << ')' << endl; + return errno; + } + arg &= (~O_NONBLOCK); + if( fcntl(sockfd, F_SETFL, arg) < 0) { + error << "Error fcntl(..., F_SETFL) (" << strerror(errno) << ')' << endl; + return errno; + } + return 0; +} + +ImageClient::ImageClient(const string& host, unsigned short port) + : sockfd(0), image_(NULL), image_size_(0) +{ + struct sockaddr_in serv_addr; + struct hostent *hostptr; + + if(!(hostptr = gethostbyname(host.c_str()))) { + error << "socket error: cannot find host " << host << endl; + throw ImageClientException(); + } + + memset((char *) &serv_addr, 0, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + memcpy((char *) &serv_addr.sin_addr, + hostptr->h_addr_list[0], + hostptr->h_length); + serv_addr.sin_port = htons(port); + + if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + perror("socket"); + return; + } + + if (connect_with_timeout(sockfd, (struct sockaddr*) &serv_addr, sizeof(serv_addr), 3)) { + perror("connect"); + throw ImageClientException(); + } + + //getImage_(); +} + +ImageClient::ImageClient(const string& host, unsigned short port, + int* image_size, const unsigned char*& image) + : sockfd(0), image_(NULL), image_size_(0) +{ + struct sockaddr_in serv_addr; + struct hostent *hostptr; + + if(!(hostptr = gethostbyname(host.c_str()))) { + error << "socket error: cannot find host " << host << endl; + return; + } + + memset((char *) &serv_addr, 0, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + memcpy((char *) &serv_addr.sin_addr, + hostptr->h_addr_list[0], + hostptr->h_length); + serv_addr.sin_port = htons(port); + + if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + perror("socket"); + return; + } + + //debug << "about to connect" << endl; + if (connect(sockfd, (struct sockaddr*) &serv_addr, sizeof(serv_addr)) < 0) { + perror("connect"); + return; + } + //debug << "connected" << endl; + + //if((*image_size = getImage_()) > 0) image = image_; +} + +ImageClient::~ImageClient() { + delete image_; + close(sockfd); +} + +int ImageClient::getImage_() { + char iType; + debug << "reading image type" << endl; + if(!readn(&iType)) { + error << "problem getting image type" << endl; + return -1; + } + debug << "Image Type is " << (int)iType << endl; + if((int)iType < 1 || (int)iType > 5) { + error << "can't deal with image of type " << (int)iType << endl; + return -1; + } + // for names images -- not yet supported + //char iName[16]; + //if(!readn(&iName)) { + // error << "problem reading image name" << endl; + // return -1; + //} + //debug << "image name is " << iName << endl; + if(!readn(&image_size_)) { + error << "problem getting image size" << endl; + return -1; + } + image_size_ = ntohl(image_size_); + debug << "image size is " << image_size_ << endl; + if(image_size_ <= 0) { + error << "bad image size: " << image_size_ << endl; + return -1; + } + + if(image_ == NULL) { + image_ = (unsigned char*)malloc(max_image_size_ = image_size_); + } + else if(image_size_ > max_image_size_) { + image_ = (unsigned char*)realloc(image_, max_image_size_ = image_size_); + } + if(!readn(image_, image_size_)) { + error << "problem getting image" << endl; + return -1; + } + return image_size_; +} + +int ImageClient::getImage(const unsigned char*& imagePtr) { + char ack[] = {'O', 'k', '\n', '\r'}; + debug << "sending ack" << endl; + send(sockfd, ack, 4, 0); + + if(getImage_() <= 0) { + cerr << "cannot get image" << endl; + return -1; + } + imagePtr = image_; + return image_size_; +} + Modified: trunk/moast-bth/TeamTalkSimulator/imageClient.h =================================================================== --- trunk/moast-bth/TeamTalkSimulator/imageClient.h 2007-12-04 20:52:26 UTC (rev 880) +++ trunk/moast-bth/TeamTalkSimulator/imageClient.h 2007-12-04 21:03:07 UTC (rev 881) @@ -1,56 +1,56 @@ -#ifndef IMAGE_CLIENT_H -#define IMAGE_CLIENT_H - -#include -#include - -#include - -#ifndef WIN32 -#include -#include -#include -#endif - -class ImageClientException : public exception { - public: - ImageClientException() throw(); - const char* what() const throw(); -}; - -class ImageClient { - protected: - int sockfd; - unsigned char* image_; - int image_size_; - int max_image_size_; - - template bool readn(C* datum, int n=1) const { - if(n <= 0) return true; - int s = n*sizeof(C); - int i = 0; - int rv; - do { - i += rv = recv(sockfd, ((char*)datum)+i, s-i, 0); - //cerr << "read: " << rv << " bytes" << endl; - if(rv < 0) { - perror("recv"); - return false; - } - } while(i +#include + +#include + +#ifndef WIN32 +#include +#include +#include +#endif + +class ImageClientException : public exception { + public: + ImageClientException() throw(); + const char* what() const throw(); +}; + +class ImageClient { + protected: + int sockfd; + unsigned char* image_; + int image_size_; + int max_image_size_; + + template bool readn(C* datum, int n=1) const { + if(n <= 0) return true; + int s = n*sizeof(C); + int i = 0; + int rv; + do { + i += rv = recv(sockfd, ((char*)datum)+i, s-i, 0); + //cerr << "read: " << rv << " bytes" << endl; + if(rv < 0) { + perror("recv"); + return false; + } + } while(irel2abs('runBot.pl'); +require 'util.pl'; + +my $SCRIPT = 'Simulator.pl'; unlink glob "$SCRIPT.*"; -my @robots = &get_bots('peerfile.txt'); -my $num_bots = scalar @robots; +my $num_bots = scalar &get_bots('peerfile.txt'); -my $ticket = `qsub -q i686 -l nodes=$num_bots $SCRIPT`; +&writeINI('simulator.ini', {'DISPLAY' => $ENV{'DISPLAY'}}); + +my $ticket = `qsub -l nodes=$num_bots $SCRIPT`; chomp $ticket; -print "ticket: $ticket$/"; -my $hoststring; -do { - sleep 1; - open(STATUS, "qstat -f $ticket|"); - $hoststring = (split(/ = /,(grep(/exec_host =/, ))[0]))[1]; -} until ($hoststring); -chomp $hoststring; -my @hosts; -foreach(split(/\+/, $hoststring)) { - s|/.*||; - push @hosts, $_; -} -die "Needed $num_bots" if(scalar @hosts != $num_bots); -for(0..$#robots) { - ${$robots[$_]}{'host'} = $hosts[$_]; -} -print &render_bots(@robots); +print $ticket; +print STDERR $/; -foreach(@robots) { - my %robot = %$_; - my $cmd = "ssh $robot{'host'} $BOTSCRIPT -type=$robot{'type'} -name=$robot{'name'}"; - print $cmd, $/; - system $cmd; -} +exit; -sub get_bots { - my $peerfile = shift; - open(PEERS, $peerfile) || die "Can't open peerfile: $peerfile"; - - my @robots; - while() { - next if /^\#/ || !/\S/; - my @tokens = split; - my $name = $tokens[0]; - next if $name eq 'optrader' || $name eq 'mapserver'; - my %robot; - $robot{'name'} = $name; - my @addr = split(':', $tokens[1]); - $robot{'ip'} = $addr[0]; - $robot{'port'} = $addr[1] if scalar @addr == 2; - $robot{'voice'} = $tokens[2]; - $robot{'type'} = $tokens[3]; - push @robots, \%robot; - } - return @robots; -} - -sub render_bots { - my @robots = @_; - my $ret_string; - foreach(@robots) { - my %robot = %{$_}; - for(keys %robot) { - $ret_string .= "$_: $robot{$_} "; - } - $ret_string .= $/; - } - return $ret_string; -} Modified: trunk/moast-bth/TeamTalkSimulator/robot.cc =================================================================== --- trunk/moast-bth/TeamTalkSimulator/robot.cc 2007-12-04 20:52:26 UTC (rev 880) +++ trunk/moast-bth/TeamTalkSimulator/robot.cc 2007-12-04 21:03:07 UTC (rev 881) @@ -1,695 +1,629 @@ -#include -//#include - -#include -#include -#include - -#include -#include - -#include "robot.h" - -#include - -#ifndef DEFAULT_NML_FILE -#define DEFAULT_NML_FILE "moast.nml" -#endif -#ifndef DEFAULT_INI_FILE -#define DEFAULT_INI_FILE "moast.ini" -#endif - -#define THIS_PROCESS "TeamTalkSimulator" - -using namespace std; - -const unsigned int shift = 6; -const unsigned int mask = ~0U << (sizeof(unsigned int)*8 - shift); -extern string moast_bin; - -void Robot::abortWorkingMsg() -{ - if(!working_msg) return; - server_->sendAborted(working_msg->getTaskID()); - delete working_msg; - working_msg = NULL; -} - -void Robot::checkWorkingMsg() -{ - if(!working_msg) return; - if(work_level == VEHWORK) { - if(statP->echo_serial_number < work_serial) return; - else if(statP->echo_serial_number > work_serial) { - abortWorkingMsg(); - } else if(statP->status == RCS_DONE) { - debug << "trying to send " << working_msg->getTaskID() << " succeeded" << endl; - server_->sendDone(working_msg->getTaskID(), true); - delete working_msg; - working_msg = NULL; - } else if(statP->status == RCS_ERROR) { - server_->sendDone(working_msg->getTaskID(), false); - delete working_msg; - working_msg = NULL; - } - } else if(work_level == AMWORK) { - if(amStatP->echo_serial_number < work_serial) return; - else if(amStatP->echo_serial_number > work_serial) { - abortWorkingMsg(); - } else if(amStatP->status == RCS_DONE) { - server_->sendDone(working_msg->getTaskID(), true); - delete working_msg; - working_msg = NULL; - } else if(amStatP->status == RCS_ERROR) { - server_->sendDone(working_msg->getTaskID(), false); - delete working_msg; - working_msg = NULL; - } - } else { - error << "unknown work level" << endl; - return; - } -} - -int Robot::cleanupVehMobPLNmlBuffers(void) -{ - if (NULL != vehMobPLCmdBuf) - delete vehMobPLCmdBuf; - if (NULL != vehMobPLStatBuf) - delete vehMobPLStatBuf; - if (NULL != vehMobPLSetBuf) - delete vehMobPLSetBuf; - if (NULL != vehMobPLCfgBuf) - delete vehMobPLCfgBuf; - if (NULL != navDataExtBuf) - delete navDataExtBuf; - - vehMobPLStatBuf = NULL; - vehMobPLSetBuf = NULL; - vehMobPLCmdBuf = NULL; - vehMobPLCfgBuf = NULL; - navDataExtBuf = NULL; - - return 0; -} - -int Robot::initVehMobPLNmlBuffers(char *config_file, int bufnum) -{ - debug << "cleaning up nmlbuffers" << endl; - cleanupVehMobPLNmlBuffers(); - - { - ostringstream chanName; - chanName << VEH_MOB_PL_CMD_NAME << bufnum; - vehMobPLCmdBuf = - new RCS_CMD_CHANNEL(vehMobPL_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!vehMobPLCmdBuf->valid()) { - delete vehMobPLCmdBuf; - vehMobPLCmdBuf = 0; - return 1; - } - - { - ostringstream chanName; - chanName << PRIM_MOB_JA_CMD_NAME << bufnum; - primMobJACmdBuf = - new RCS_CMD_CHANNEL(primMobJA_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!primMobJACmdBuf->valid()) { - delete primMobJACmdBuf; - primMobJACmdBuf = 0; - return 1; - } - - { - ostringstream chanName; - chanName << AM_MOB_JA_CMD_NAME << bufnum; - amMobJACmdBuf = - new RCS_CMD_CHANNEL(amMobJA_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!amMobJACmdBuf->valid()) { - delete amMobJACmdBuf; - amMobJACmdBuf = 0; - return 1; - } - - { - ostringstream chanName; - chanName << VEH_MOB_PL_STAT_NAME << bufnum; - vehMobPLStatBuf = - new RCS_STAT_CHANNEL(vehMobPL_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!vehMobPLStatBuf->valid()) { - delete vehMobPLStatBuf; - vehMobPLStatBuf = 0; - return 1; - } - - { - ostringstream chanName; - chanName << PRIM_MOB_JA_STAT_NAME << bufnum; - primMobJAStatBuf = - new RCS_STAT_CHANNEL(primMobJA_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!primMobJAStatBuf->valid()) { - delete primMobJAStatBuf; - primMobJAStatBuf = 0; - return 1; - } - - { - ostringstream chanName; - chanName << AM_MOB_JA_STAT_NAME << bufnum; - amMobJAStatBuf = - new RCS_STAT_CHANNEL(amMobJA_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!amMobJAStatBuf->valid()) { - delete amMobJAStatBuf; - amMobJAStatBuf = 0; - return 1; - } - - { - ostringstream chanName; - chanName << VEH_MOB_PL_CFG_NAME << bufnum; - vehMobPLCfgBuf = - new RCS_CMD_CHANNEL(vehMobPL_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!vehMobPLCfgBuf->valid()) { - delete vehMobPLCfgBuf; - vehMobPLCfgBuf = 0; - return 1; - } - - { - ostringstream chanName; - chanName << VEH_MOB_PL_SET_NAME << bufnum; - vehMobPLSetBuf = - new RCS_STAT_CHANNEL(vehMobPL_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!vehMobPLSetBuf->valid()) { - delete vehMobPLSetBuf; - vehMobPLSetBuf = 0; - return 1; - } - - { - ostringstream chanName; - chanName << NAV_DATA_EXT_NAME << bufnum; - navDataExtBuf = - new NML(navDataExt_format, chanName.str().c_str(), - THIS_PROCESS, config_file); - } - if (!navDataExtBuf->valid()) { - delete navDataExtBuf; - navDataExtBuf = 0; - return 1; - } - - return 0; -} - -template static inline char* rcs_stat_to_string(const C& s) { - switch(s) { - case RCS_DONE: return "RCS_DONE"; - case RCS_EXEC: return "RCS_EXEC"; - case RCS_ERROR: return "RCS_ERROR"; - case UNINITIALIZED_STATUS: return "UNINITIALIZED_STATUS"; - } - return "?"; -} - -ostream& operator<<(ostream& out, const PM_CARTESIAN& tran) { - return out << "[x=" << tran.x << " y=" << tran.y << " z=" << tran.z << ']'; -} - -ostream& operator<<(ostream& out, const PM_ROTATION_MATRIX& rot) { - PM_RPY rpy(rot); - return out << "[r=" << rpy.r << " p=" << rpy.p << " y=" << rpy.y << ']'; -} - -ostream& operator<<(ostream& out, const PM_HOMOGENEOUS& pose) { - return out << "[tran=" << pose.tran << " rot=" << pose.rot << ']'; -} - -ostream& Robot::printStat(ostream& out) const { - return out << "command_type: " - << vehMobPL_symbol_lookup(statP->command_type) << endl - << "echo_serial_number: " << statP->echo_serial_number << endl - << "prim serial number: " << primStatP->echo_serial_number << endl - << "am serial number: " << amStatP->echo_serial_number << endl - << "status: " - << rcs_stat_to_string(statP->status) << endl - << "state: " << statP->state << endl - << "line: " << statP->line << endl - << "source_line: " << statP->source_line << endl - << "source_file: " << statP->source_file << endl - << "heartbeat: " << statP->heartbeat << endl - << "set cycleTime: " << setP->cycleTime << endl - << "actual cycleTime: " << statP->cycleTime << endl - << "plan cost: " << statP->planCost << endl - << "debug: " << setP->debug << endl - << "pose: " << pose << endl - << "message: " << statP->message << endl; -} - -/* -void readImage(const char* file) { - ifstream i(file, ios::in|ios::binary|ios::ate); - if(!i.is_open()) { - cerr << "file: " << file << " not found" << endl; - return; - } - image_size = i.tellg(); - char *memblock = new char[image_size]; - i.seekg(0, ios::beg); - i.read(memblock, image_size); - image = (unsigned char*) memblock; -} -*/ - -float mod(const float& a, const float& b) { - int whole_divisions = (int)(a/b); - return a - whole_divisions*b; -} - -static float canonical_angle(const float& f) { - float retval = mod(f,(2*(float)PI)); - return retval<0? retval+2*(float)PI: retval; -} - -unsigned int Hash (string const& s) -{ - unsigned int result = 0; - for (unsigned int i = 0; s [i] != 0; ++i) - result = (result & mask) ^ (result << shift) ^ s [i]; - return result; -} - -float Robot::turn(float goal_r, float r) { - float diff = mod((goal_r-r), (2*(float)PI)); - if(diff > PI) return diff-2*(float)PI; - if(diff < -PI) return diff+2*(float)PI; - return diff; -} - -void* Robot::simulate(void *thisp) { - Robot* me = (Robot*) thisp; - - sleep(5); - me->vehMobPLStatBuf->read(); - me->vehMobPLSetBuf->read(); - me->primMobJAStatBuf->read(); - me->amMobJAStatBuf->read(); - me->navDataExtBuf->read(); - - me->printStat(cerr); - - debug << "entering for loop" << endl; - //EnterCriticalSection(&me->CriticalSection); - for(int i;;i++) { - //LeaveCriticalSection(&me->CriticalSection); - do { - const Boeing::MsgCmd *bmsg; - while(me->server_->isConnected() && - (bmsg = me->server_->getNextMessage())) { - Msg* msg = Msg::interpretBoeingPacket(string(bmsg->buff, 1000)); - if(!msg) { - warn << me->sim_index << ": got NULL message" << endl; - break; - } - if(dynamic_cast(msg)) { - //debug << me->sim_index << ": got message: " << msg->render() << endl; - } else { - info << me->sim_index << ": got message: " << msg->render() << endl; - //me->printStat(cerr); - } - me->vehMobPLStatBuf->read(); - me->vehMobPLSetBuf->read(); - me->primMobJAStatBuf->read(); - me->amMobJAStatBuf->read(); - me->navDataExtBuf->read(); - me->callback(msg, NULL); - delete msg; - } - sleep(updatePeriod); - me->vehMobPLStatBuf->read(); - me->vehMobPLSetBuf->read(); - me->primMobJAStatBuf->read(); - me->amMobJAStatBuf->read(); - me->navDataExtBuf->read(); - me->checkWorkingMsg(); - //} while(!TryEnterCriticalSection(&me->CriticalSection)); - } while(true); - /* - if(me->action == SHUTDOWN) break; - if(me->action == PAUSED) continue; - if(me->action == WAITING) { - if(me->goals.empty()) continue; - me->setGoal(me->goals.top().first, me->goals.top().second); - } - if(me->action == GO_TO_GOAL || me->action == FOLLOWING) { - //goal is revisited each step when following - if(me->action == FOLLOWING) { - map::const_iterator i = me->robots->find(me->followee); - if(i == me->robots->end()) throw exception(); - me->goal_x = i->second->x; - me->goal_y = i->second->y; - } - - //calculate difference between cur_pos and goal - float x_vec = me->goal_x-me->x; - float y_vec = me->goal_y-me->y; @@ Diff output truncated at 60000 characters. @@ From bfrisch at edam.speech.cs.cmu.edu Mon Dec 24 13:12:18 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Mon, 24 Dec 2007 13:12:18 -0500 Subject: [TeamTalk 346]: [882] trunk: 1) Adding Agent Smith to begin work of using Agent Smith instead of the current non-animated being . Message-ID: <200712241812.lBOICIsE019227@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071224/4f7c14ab/attachment.html -------------- next part -------------- Modified: trunk/TeamTalk/Agents/PenDecoder/nbproject/project.properties =================================================================== --- trunk/TeamTalk/Agents/PenDecoder/nbproject/project.properties 2007-12-04 21:03:07 UTC (rev 881) +++ trunk/TeamTalk/Agents/PenDecoder/nbproject/project.properties 2007-12-24 18:12:16 UTC (rev 882) @@ -16,10 +16,12 @@ dist.dir=dist dist.jar=${dist.dir}/PenDecoder.jar dist.javadoc.dir=${dist.dir}/javadoc +excludes= file.reference.bsh-core-2.0b4.jar=bsh-core-2.0b4.jar file.reference.bsh-util-2.0b4.jar=bsh-util-2.0b4.jar file.reference.galaxy.jar=${Env-OLYMPUS_ROOT}/Libraries/Galaxy/contrib/MITRE/bindings/java/lib/galaxy.jar file.reference.PenDecoder-src=src +includes=** jar.compress=false javac.classpath=\ ${file.reference.bsh-core-2.0b4.jar}:\ Modified: trunk/TeamTalk/TeamTalkBuild.bat =================================================================== --- trunk/TeamTalk/TeamTalkBuild.bat 2007-12-04 21:03:07 UTC (rev 881) +++ trunk/TeamTalk/TeamTalkBuild.bat 2007-12-24 18:12:16 UTC (rev 882) @@ -6,7 +6,7 @@ IF "%BUILD_CONF%"=="" SET BUILD_CONF=Release :: If Netbeans is updated change the NetBeans version to the current version of NetBeans as the default folder name will likely change. -SET NetBeansVer=5.5.1 +SET NetBeansVer=6.0 IF "%CYGWIN_DIR%"=="" SET CYGWIN_DIR=C:\cygwin :: Check to make sure the file is not running with a wrong working directory @@ -96,7 +96,7 @@ :ANTCHK echo Looking for NetBeans... -FOR %%d in (C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, A, B) DO IF EXIST "%%d:\Program Files\netbeans-%NetBeansVer%\ide7\ant\bin\ant.bat" goto NB%%d +FOR %%d in (C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, A, B) DO IF EXIST "%%d:\Program Files\NetBeans %NetBeansVer%\java1\ant\bin\ant.bat" goto NB%%d goto NETBEANSERROR :NBA @@ -179,7 +179,7 @@ :Ant Compilation :JBUILD -CALL "%NetBeansDrive%:\Program Files\netbeans-%NetBeansVer%\ide7\ant\bin\ant.bat" -buildfile Agents\PenDecoder\build.xml +CALL "%NetBeansDrive%:\Program Files\NetBeans %NetBeansVer%\java1\ant\bin\ant.bat" -buildfile Agents\PenDecoder\build.xml pause :Compile Added: trunk/usarsim/Animations/smith.ukx =================================================================== (Binary files differ) Property changes on: trunk/usarsim/Animations/smith.ukx ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/usarsim/System/smith.upl =================================================================== --- trunk/usarsim/System/smith.upl (rev 0) +++ trunk/usarsim/System/smith.upl 2007-12-24 18:12:16 UTC (rev 882) @@ -0,0 +1,2 @@ +[Public] +Player=(DefaultName="Smith",Mesh=smith.smith,species=xGame.SPECIES_Merc,BodySkin=smithskins.smithbody,FaceSkin=smithskins.smithhead,Portrait=smithskins.smithportrait,Text=Xplayers.smith,Sex=Male,Menu="SP",FavoriteWeapon=xWeapons.FlakCannon,Aggressiveness=+1.5,bJumpy=1,CombatStyle=+0.6,Accuracy=+1.0,Ragdoll=Male) \ No newline at end of file Added: trunk/usarsim/Textures/smithskins.utx =================================================================== (Binary files differ) Property changes on: trunk/usarsim/Textures/smithskins.utx ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From bfrisch at edam.speech.cs.cmu.edu Mon Dec 24 13:51:10 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Mon, 24 Dec 2007 13:51:10 -0500 Subject: [TeamTalk 347]: [883] trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc: 1) Setting TreasureHunterPawn.uc to use Agent Smith. Message-ID: <200712241851.lBOIpA5G019267@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071224/474e84ca/attachment.html -------------- next part -------------- Modified: trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc =================================================================== --- trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc 2007-12-24 18:12:16 UTC (rev 882) +++ trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc 2007-12-24 18:51:10 UTC (rev 883) @@ -6,8 +6,14 @@ DrawScale=1.8 // Animation subset - Mesh=SkeletalMesh'UDN_CharacterModels_K.GenericMale' - + Mesh=SkeletalMesh'smith.smith' + species=xGame.SPECIES_Merc + BodySkin=smithskins.smithbody + FaceSkin=smithskins.smithhead + Portrait=smithskins.smithportrait + Text=Xplayers.smith + Sex=Male + Ragdoll=Male BaseEyeHeight=+00150.000000 EyeHeight=+00150.000000 CollisionRadius=+00061.200000 From bfrisch at edam.speech.cs.cmu.edu Mon Dec 24 15:58:54 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Mon, 24 Dec 2007 15:58:54 -0500 Subject: [TeamTalk 348]: [884] trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc: 1) Now the new in testing pawn code compiles. Message-ID: <200712242058.lBOKws99019440@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071224/0af833ee/attachment.html -------------- next part -------------- Modified: trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc =================================================================== --- trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc 2007-12-24 18:51:10 UTC (rev 883) +++ trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc 2007-12-24 20:58:54 UTC (rev 884) @@ -7,14 +7,8 @@ // Animation subset Mesh=SkeletalMesh'smith.smith' - species=xGame.SPECIES_Merc - BodySkin=smithskins.smithbody - FaceSkin=smithskins.smithhead - Portrait=smithskins.smithportrait - Text=Xplayers.smith - Sex=Male - Ragdoll=Male - BaseEyeHeight=+00150.000000 + + BaseEyeHeight=+00150.000000 EyeHeight=+00150.000000 CollisionRadius=+00061.200000 CollisionHeight=+00203.000000 From bfrisch at edam.speech.cs.cmu.edu Mon Dec 24 18:50:57 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Mon, 24 Dec 2007 18:50:57 -0500 Subject: [TeamTalk 349]: [885] trunk/TeamTalk/TeamTalkBuild.bat: 1) Now NetBeans 6. 0 path is retrieved from the registry. Message-ID: <200712242350.lBONovSu019695@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071224/bc928930/attachment.html -------------- next part -------------- Modified: trunk/TeamTalk/TeamTalkBuild.bat =================================================================== --- trunk/TeamTalk/TeamTalkBuild.bat 2007-12-24 20:58:54 UTC (rev 884) +++ trunk/TeamTalk/TeamTalkBuild.bat 2007-12-24 23:50:57 UTC (rev 885) @@ -5,8 +5,6 @@ IF "%BUILD_TYPE%"=="" SET BUILD_TYPE=Build IF "%BUILD_CONF%"=="" SET BUILD_CONF=Release -:: If Netbeans is updated change the NetBeans version to the current version of NetBeans as the default folder name will likely change. -SET NetBeansVer=6.0 IF "%CYGWIN_DIR%"=="" SET CYGWIN_DIR=C:\cygwin :: Check to make sure the file is not running with a wrong working directory @@ -40,7 +38,7 @@ if "%VSTemp%"=="" goto VSWEND if not "%VSHome%"=="" set VSHome=%VSHome%\ for /f "delims=\" %%x in ("%VSTemp%") do set VSHome=%VSHome%%%x - for /f "tokens=1,* delims=\" %%x in ("%VSTemp%") do set VSTemp=%%y + for /f "tokens=1,* delims=\" %%y in ("%VSTemp%") do set VSTemp=%%y goto VSWHILE :VSWEND set VSTemp= @@ -85,7 +83,7 @@ if "%JavaTemp%"=="" goto WEND if not "%JAVA_HOME%"=="" set JAVA_HOME=%JAVA_HOME%\ for /f "delims=\" %%x in ("%JavaTemp%") do set JAVA_HOME=%JAVA_HOME%%%x - for /f "tokens=1,* delims=\" %%x in ("%JavaTemp%") do set JavaTemp=%%y + for /f "tokens=1,* delims=\" %%y in ("%JavaTemp%") do set JavaTemp=%%y goto WHILE :WEND set JavaTemp= @@ -94,92 +92,38 @@ :: Test the java path to see if there really is a javac.exe IF NOT EXIST "%JAVA_HOME%\bin\javac.exe" goto JAVAERROR -:ANTCHK +:ANTCHK - To Find NetBeans' 6.0 Ant Version echo Looking for NetBeans... -FOR %%d in (C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, A, B) DO IF EXIST "%%d:\Program Files\NetBeans %NetBeansVer%\java1\ant\bin\ant.bat" goto NB%%d -goto NETBEANSERROR +:: Find the current (most recent) Java version +start /w regedit /e reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\nbi-nb-base-6.0.0.0.200711261600" +type reg1.txt | %windir%\system32\find.exe "InstallLocation" > reg2.txt +if errorlevel 1 goto NETBEANSERROR +for /f "tokens=2 delims==" %%x in (reg2.txt) do set NBPathTemp=%%~x +if errorlevel 1 goto NETBEANSERROR -:NBA -SET NetBeansDrive=A -goto Ant -:NBB -SET NetBeansDrive=B -goto Ant -:NBC -SET NetBeansDrive=C -goto Ant -:NBD -SET NetBeansDrive=D -goto Ant -:NBE -SET NetBeansDrive=E -goto Ant -:NBF -SET NetBeansDrive=F -goto Ant -:NBG -SET NetBeansDrive=G -goto Ant -:NBH -SET NetBeansDrive=H -goto Ant -:NBI -SET NetBeansDrive=I -goto Ant -:NBJ -SET NetBeansDrive=J -goto Ant -:NBK -SET NetBeansDrive=K -goto Ant -:NBL -SET NetBeansDrive=L -goto Ant -:NBM -SET NetBeansDrive=M -goto Ant -:NBN -SET NetBeansDrive=N -goto Ant -:NBO -SET NetBeansDrive=O -goto Ant -:NBP -SET NetBeansDrive=P -goto Ant -:NBQ -SET NetBeansDrive=Q -goto Ant -:NBR -SET NetBeansDrive=R -goto Ant -:NBS -SET NetBeansDrive=S -goto Ant -:NBT -SET NetBeansDrive=T -goto Ant -:NBU -SET NetBeansDrive=U -goto Ant -:NBV -SET NetBeansDrive=V -goto Ant -:NBW -SET NetBeansDrive=W -goto Ant -:NBX -SET NetBeansDrive=X -goto Ant -:NBY -SET NetBeansDrive=Y -goto Ant -:NBZ -SET NetBeansDrive=Z +del reg1.txt +del reg2.txt -:Ant Compilation -:JBUILD -CALL "%NetBeansDrive%:\Program Files\NetBeans %NetBeansVer%\java1\ant\bin\ant.bat" -buildfile Agents\PenDecoder\build.xml + + +:: Convert double backslashes to single backslashes +set JAVA_HOME= +:WHILE + if "%NBPathTemp%"=="" goto WEND + if not "%NetBeansPath%"=="" set JAVA_HOME=%NetBeansPath%\ + for /f "delims=\" %%x in ("%NBPathTemp%") do set JAVA_HOME=%NetBeansPath%%%x + for /f "tokens=1,* delims=\" %%y in ("%NBPathTemp%") do set NBPathTemp=%%y + goto WHILE +:WEND +set NBPathTemp= +echo NetBeans Path (per registy) = %NetBeansPath% + +:: Test the java path to see if there really is a javac.exe +IF NOT EXIST "%JAVA_HOME%\bin\javac.exe" goto JAVAERROR + + +:Ant Compilation of PenDecoder using NetBeans 6.0 +CALL "%NetBeansPath%\java1\ant\bin\ant.bat" -buildfile Agents\PenDecoder\build.xml pause :Compile @@ -211,10 +155,12 @@ :NETBEANSERROR echo The Pen Decoder can not be built because the location of NetBeans %NetBeansVer% can not be determined. +echo Is it installed? goto Pause :ErrorNoOlympus echo Please set the OLYMPUS_ROOT environment variable to your Olympus installation root. +echo You can do this by running the OlympusBuild.bat script in your Olympus directory. goto Pause :Error message that says that the script was run outside of the TeamTalk directory. @@ -230,4 +176,5 @@ SET BUILD_TYPE= SET BUILD_CONF= SET NetBeansVer= +SET NetBeansDrive= pause From bfrisch at edam.speech.cs.cmu.edu Tue Dec 25 15:57:39 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Tue, 25 Dec 2007 15:57:39 -0500 Subject: [TeamTalk 350]: [886] trunk/TeamTalk/TeamTalkBuild.bat: 1) Bug fixes in TeamTalkBuild. bat to make the program execution calls and registry searches successfully. Message-ID: <200712252057.lBPKvdZv025126@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071225/d4db8b18/attachment.html -------------- next part -------------- Modified: trunk/TeamTalk/TeamTalkBuild.bat =================================================================== --- trunk/TeamTalk/TeamTalkBuild.bat 2007-12-24 23:50:57 UTC (rev 885) +++ trunk/TeamTalk/TeamTalkBuild.bat 2007-12-25 20:57:38 UTC (rev 886) @@ -1,12 +1,12 @@ @echo off -title TeamTalk Code Build - Win32 - IF "%BUILD_TYPE%"=="" SET BUILD_TYPE=Build IF "%BUILD_CONF%"=="" SET BUILD_CONF=Release IF "%CYGWIN_DIR%"=="" SET CYGWIN_DIR=C:\cygwin +title TeamTalk Code %BUILD_TYPE% - Win32 %BUILD_CONF% + :: Check to make sure the file is not running with a wrong working directory IF NOT EXIST TeamTalkBuild.bat goto Error IF NOT EXIST TeamTalk.sln goto Error @@ -38,7 +38,7 @@ if "%VSTemp%"=="" goto VSWEND if not "%VSHome%"=="" set VSHome=%VSHome%\ for /f "delims=\" %%x in ("%VSTemp%") do set VSHome=%VSHome%%%x - for /f "tokens=1,* delims=\" %%y in ("%VSTemp%") do set VSTemp=%%y + for /f "tokens=1,* delims=\" %%x in ("%VSTemp%") do set VSTemp=%%y goto VSWHILE :VSWEND set VSTemp= @@ -76,19 +76,18 @@ if errorlevel 1 goto JAVAERROR del reg1.txt del reg2.txt - +echo %JavaTemp% = Java Temp :: Convert double backslashes to single backslashes set JAVA_HOME= -:WHILE - if "%JavaTemp%"=="" goto WEND +:JAVA_WHILE + if "%JavaTemp%"=="" goto JAVA_WEND if not "%JAVA_HOME%"=="" set JAVA_HOME=%JAVA_HOME%\ for /f "delims=\" %%x in ("%JavaTemp%") do set JAVA_HOME=%JAVA_HOME%%%x - for /f "tokens=1,* delims=\" %%y in ("%JavaTemp%") do set JavaTemp=%%y - goto WHILE -:WEND + for /f "tokens=1,* delims=\" %%x in ("%JavaTemp%") do set JavaTemp=%%y + goto JAVA_WHILE +:JAVA_WEND set JavaTemp= echo Java home path (per registy) = %JAVA_HOME% - :: Test the java path to see if there really is a javac.exe IF NOT EXIST "%JAVA_HOME%\bin\javac.exe" goto JAVAERROR @@ -99,29 +98,24 @@ type reg1.txt | %windir%\system32\find.exe "InstallLocation" > reg2.txt if errorlevel 1 goto NETBEANSERROR for /f "tokens=2 delims==" %%x in (reg2.txt) do set NBPathTemp=%%~x +echo NBPathTemp = %NBPathTemp% if errorlevel 1 goto NETBEANSERROR del reg1.txt del reg2.txt - - :: Convert double backslashes to single backslashes -set JAVA_HOME= -:WHILE - if "%NBPathTemp%"=="" goto WEND - if not "%NetBeansPath%"=="" set JAVA_HOME=%NetBeansPath%\ - for /f "delims=\" %%x in ("%NBPathTemp%") do set JAVA_HOME=%NetBeansPath%%%x - for /f "tokens=1,* delims=\" %%y in ("%NBPathTemp%") do set NBPathTemp=%%y - goto WHILE -:WEND +set NetBeansPath= +:NBWHILE + if "%NBPathTemp%"=="" goto NBWEND + if not "%NetBeansPath%"=="" set NetBeansPath=%NetBeansPath%\ + for /f "delims=\" %%x in ("%NBPathTemp%") do set NetBeansPath=%NetBeansPath%%%x + for /f "tokens=1,* delims=\" %%x in ("%NBPathTemp%") do set NBPathTemp=%%y + goto NBWHILE +:NBWEND set NBPathTemp= echo NetBeans Path (per registy) = %NetBeansPath% -:: Test the java path to see if there really is a javac.exe -IF NOT EXIST "%JAVA_HOME%\bin\javac.exe" goto JAVAERROR - - :Ant Compilation of PenDecoder using NetBeans 6.0 CALL "%NetBeansPath%\java1\ant\bin\ant.bat" -buildfile Agents\PenDecoder\build.xml pause @@ -133,7 +127,7 @@ :MakeLM echo Now Executing MakeLM -set TeamTalkRoot="%CD%" +set TeamTalkRoot=%CD% cd "%OLYMPUS_ROOT%\Tools\MakeLM" echo perl makelm.pl --resourcesdir "%TeamTalkRoot%\Resources" --projectname TeamTalk perl makelm.pl --resourcesdir "%TeamTalkRoot%\Resources" --projectname TeamTalk @@ -142,7 +136,7 @@ GOTO Pause :VSERROR -echo Can't find Visual Studio 8.0. Is it installed? +echo Can't find Visual Studio 8.0 (2005). Is it installed? goto Pause :CYGERROR @@ -161,6 +155,9 @@ :ErrorNoOlympus echo Please set the OLYMPUS_ROOT environment variable to your Olympus installation root. echo You can do this by running the OlympusBuild.bat script in your Olympus directory. +echo +echo If you have already run OlympusBuild.bat, you may need to restart your computer +echo and run this script again. goto Pause :Error message that says that the script was run outside of the TeamTalk directory. From bfrisch at edam.speech.cs.cmu.edu Tue Dec 25 16:59:47 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Tue, 25 Dec 2007 16:59:47 -0500 Subject: [TeamTalk 351]: [887] trunk/TeamTalk: 1) Moving AlwaysOnTop. exe to the Tools directory that was previously empty. Message-ID: <200712252159.lBPLxlP4025202@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071225/56056010/attachment.html -------------- next part -------------- Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java =================================================================== --- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java 2007-12-25 20:57:38 UTC (rev 886) +++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/PenDecoderServer.java 2007-12-25 21:59:47 UTC (rev 887) @@ -98,7 +98,7 @@ * This function is called when evidence of "treasure" comes up. * We set an "object" in the bot tracker. * @param f The Galaxy frame with the trasure information. - * @ return The unmodified Galaxy frame. + * @return The unmodified Galaxy frame. * @return An unmodified Galaxy frame. */ public GFrame serverOpInfoUpdate(GFrame f) { Deleted: trunk/TeamTalk/AlwaysOnTop.exe =================================================================== (Binary files differ) Modified: trunk/TeamTalk/TeamTalk.sln =================================================================== --- trunk/TeamTalk/TeamTalk.sln 2007-12-25 20:57:38 UTC (rev 886) +++ trunk/TeamTalk/TeamTalk.sln 2007-12-25 21:59:47 UTC (rev 887) @@ -191,12 +191,12 @@ {93C8F5F8-6C43-4179-9B9F-A31AA6438513}.Publish|Win32.Build.0 = Release|Win32 {93C8F5F8-6C43-4179-9B9F-A31AA6438513}.Release|Win32.ActiveCfg = Release|Win32 {93C8F5F8-6C43-4179-9B9F-A31AA6438513}.Release|Win32.Build.0 = Release|Win32 - {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Debug|Win32.ActiveCfg = SwiftDebug|Win32 - {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Debug|Win32.Build.0 = SwiftDebug|Win32 - {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Publish|Win32.ActiveCfg = SwiftRelease|Win32 - {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Publish|Win32.Build.0 = SwiftRelease|Win32 - {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Release|Win32.ActiveCfg = SwiftRelease|Win32 - {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Release|Win32.Build.0 = SwiftRelease|Win32 + {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Debug|Win32.ActiveCfg = SAPIDebug|Win32 + {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Debug|Win32.Build.0 = SAPIDebug|Win32 + {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Publish|Win32.ActiveCfg = SAPIRelease|Win32 + {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Publish|Win32.Build.0 = SAPIRelease|Win32 + {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Release|Win32.ActiveCfg = SAPIRelease|Win32 + {9CDBFBA5-F7EB-432F-A7CF-2E80322FE2ED}.Release|Win32.Build.0 = SAPIRelease|Win32 {58282A64-D289-455D-8FBE-FAD6F3FF1760}.Debug|Win32.ActiveCfg = Debug|Win32 {58282A64-D289-455D-8FBE-FAD6F3FF1760}.Debug|Win32.Build.0 = Debug|Win32 {58282A64-D289-455D-8FBE-FAD6F3FF1760}.Publish|Win32.ActiveCfg = Release|Win32 Modified: trunk/TeamTalk/TeamTalkVirtRun.bat =================================================================== --- trunk/TeamTalk/TeamTalkVirtRun.bat 2007-12-25 20:57:38 UTC (rev 886) +++ trunk/TeamTalk/TeamTalkVirtRun.bat 2007-12-25 21:59:47 UTC (rev 887) @@ -5,7 +5,7 @@ REM Check to make sure the file is not running with a wrong working directory IF NOT EXIST Configurations\DesktopConfiguration\startlist-virtual.config goto ErrorWrongWorkingDirectory -START AlwaysOnTop Unreal 0 +START Tools\AlwaysOnTop Unreal 0 TeamTalkRun.bat :ErrorWrongWorkingDirectory Copied: trunk/TeamTalk/Tools/AlwaysOnTop.exe (from rev 881, trunk/TeamTalk/AlwaysOnTop.exe) =================================================================== (Binary files differ) From bfrisch at edam.speech.cs.cmu.edu Tue Dec 25 18:42:40 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Tue, 25 Dec 2007 18:42:40 -0500 Subject: [TeamTalk 352]: [888] trunk/TeamTalk: 1) Removing now useless echos from TeamTalkBuild.bat Message-ID: <200712252342.lBPNgegI025309@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071225/fc4c69bf/attachment-0001.html -------------- next part -------------- Modified: trunk/TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config =================================================================== --- trunk/TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config 2007-12-25 21:59:47 UTC (rev 887) +++ trunk/TeamTalk/Configurations/DesktopConfiguration/startlist-desktop.config 2007-12-25 23:42:38 UTC (rev 888) @@ -34,7 +34,7 @@ ############### Olympus Generic Processes ####################### -PROCESS: $OLYMPUS_BIN\KalliopeSwift -maxconns 6 -config swift.cfg +PROCESS: $OLYMPUS_BIN\KalliopeSAPI -maxconns 6 -config swift.cfg PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Kalliope Modified: trunk/TeamTalk/Configurations/DesktopConfiguration/startlist-virtual.config =================================================================== --- trunk/TeamTalk/Configurations/DesktopConfiguration/startlist-virtual.config 2007-12-25 21:59:47 UTC (rev 887) +++ trunk/TeamTalk/Configurations/DesktopConfiguration/startlist-virtual.config 2007-12-25 23:42:38 UTC (rev 888) @@ -1,6 +1,7 @@ -#directories -EXPAND: $GC_HOME ..\..\Libraries\Galaxy -EXPAND: $MITRE_ROOT $GC_HOME\contrib\MITRE +EXPAND: $OLYMPUS_ROOT %OLYMPUS_ROOT +EXPAND: $OLYMPUS_BIN $OLYMPUS_ROOT/Bin/x86-nt +EXPAND: $UT2004 %UT2K4_ROOT% + EXPAND: $TEAMTALK ..\.. EXPAND: $CONFIGURATION $TEAMTALK\Configurations\DesktopConfiguration EXPAND: $AGENTS $TEAMTALK\Agents @@ -10,28 +11,21 @@ EXPAND: $RESOURCES $TEAMTALK\Resources EXPAND: $GRAMMAR $RESOURCES\Grammar EXPAND: $DECODER $RESOURCES\DecoderConfig -EXPAND: $UT2004 C:\UT2004 -#programs EXPAND: $JAVAEXE java EXPAND: $PERL perl -#other config -EXPAND: $BTHSIM_SERVER rampsold.speech.cs.cmu.edu +TITLE: TeamTalk Virtual System -TITLE: TeamTalk +############### TeamTalk Specific Processes ###################### -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: $JAVAEXE -classpath dist/lib/bsh-core-2.0b4.jar;dist/lib/bsh-util-2.0b4.jar;dist/PenDecoder.jar;dist/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: $BIN\TeamTalkBackend -verbosity 1 -maxconns 6 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 @@ -39,28 +33,40 @@ PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Rosetta -PROCESS: $BIN\NlgServer2.exe -maxconns 6 -nlghost localhost +############### Olympus Generic Processes ####################### + +PROCESS: $OLYMPUS_BIN\KalliopeSAPI -maxconns 6 -config swift.cfg PROCESS_MONITOR_ARGS: --start +PROCESS_TITLE: Kalliope + +PROCESS: $OLYMPUS_BIN\NlgServer -maxconns 6 -nlghost localhost +PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: NLGServer -PROCESS: $BIN\phoenix2.exe -maxconns 6 -grammardir $GRAMMAR -grammarfn $GRAMMAR\TeamTalk.net +PROCESS: $OLYMPUS_BIN\phoenix -maxconns 6 -grammardir $GRAMMAR -grammarfn $GRAMMAR\TeamTalk.net PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Phoenix -PROCESS: $BIN\Audio_Server-DEBUG.exe -maxconns 6 -sps 16000 -engine_list sphinx_engines.txt +PROCESS: $OLYMPUS_BIN\AudioServer -maxconns 6 -config AudioServer.cfg PROCESS_MONITOR_ARGS: --start -PROCESS_TITLE: Audio_Server +PROCESS_TITLE: AudioServer -PROCESS: $BIN\Sphinx_Engine -name male -argfn male-16khz.arg -port 9990 +PROCESS: $OLYMPUS_BIN\PocketSphinxEngine -name desktop -argfn desktop.arg -port 9990 PROCESS_WORKDIR: $DECODER PROCESS_MONITOR_ARGS: --start -PROCESS_TITLE: Sphinx_Male +PROCESS_TITLE: PocketSphinx -PROCESS: $GC_HOME\bin\x86-nt\HUB.exe -verbosity 3 -pgm_file TeamTalk-hub-desktop-skeleton.pgm +PROCESS: $OLYMPUS_BIN\HUB -verbosity 3 -pgm_file TeamTalk-hub-desktop-skeleton.pgm PROCESS_MONITOR_ARGS: --start PROCESS_TITLE: Hub +PROCESS: $OLYMPUS_BIN\Apollo -maxconns 6 -config Apollo.cfg +PROCESS_MONITOR_ARGS: --start +PROCESS_TITLE: Apollo + +############### Virtual System Process ####################### PROCESS: $UT2004\System\UT2004 $BTHSIM_SERVER?quickstart=true PROCESS_WORKDIR: $UT2004\System PROCESS_MONITOR_ARGS: --start -PROCESS_TITLE: BTH Sim Client \ No newline at end of file +PROCESS_TITLE: BTH Sim Client + Modified: trunk/TeamTalk/TeamTalkBuild.bat =================================================================== --- trunk/TeamTalk/TeamTalkBuild.bat 2007-12-25 21:59:47 UTC (rev 887) +++ trunk/TeamTalk/TeamTalkBuild.bat 2007-12-25 23:42:38 UTC (rev 888) @@ -76,7 +76,7 @@ if errorlevel 1 goto JAVAERROR del reg1.txt del reg2.txt -echo %JavaTemp% = Java Temp + :: Convert double backslashes to single backslashes set JAVA_HOME= :JAVA_WHILE @@ -98,7 +98,6 @@ type reg1.txt | %windir%\system32\find.exe "InstallLocation" > reg2.txt if errorlevel 1 goto NETBEANSERROR for /f "tokens=2 delims==" %%x in (reg2.txt) do set NBPathTemp=%%~x -echo NBPathTemp = %NBPathTemp% if errorlevel 1 goto NETBEANSERROR del reg1.txt Modified: trunk/TeamTalk/TeamTalkRun.bat =================================================================== --- trunk/TeamTalk/TeamTalkRun.bat 2007-12-25 21:59:47 UTC (rev 887) +++ trunk/TeamTalk/TeamTalkRun.bat 2007-12-25 23:42:38 UTC (rev 888) @@ -1,6 +1,6 @@ @echo off -TITLE TeamTalk Lanucher for Win32 +TITLE TeamTalk %Launcher_Type% Lanucher for Win32 REM Which configuration IF "%RunTimeConfig%"=="" SET RunTimeConfig=startlist-desktop Modified: trunk/TeamTalk/TeamTalkVirtRun.bat =================================================================== --- trunk/TeamTalk/TeamTalkVirtRun.bat 2007-12-25 21:59:47 UTC (rev 887) +++ trunk/TeamTalk/TeamTalkVirtRun.bat 2007-12-25 23:42:38 UTC (rev 888) @@ -1,13 +1,47 @@ @echo off -SET RunTimeConfig=startlist-virtual +TITLE TeamTalk Virtual System Lanucher for Win32 -REM Check to make sure the file is not running with a wrong working directory IF NOT EXIST Configurations\DesktopConfiguration\startlist-virtual.config goto ErrorWrongWorkingDirectory +echo Looking for Unreal Tournament 2004... +:: Find the location of Unreal Tournament 2004 +start /w regedit /e reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\Unreal Technology\Installed Apps\UT2004" +type reg1.txt | %windir%\system32\find.exe "Folder" > reg2.txt +if errorlevel 1 goto UT2K4ERROR +for /f "tokens=2 delims==" %%x in (reg2.txt) do set UTPathTemp=%%~x +if errorlevel 1 goto UT2K4ERROR +del reg1.txt +del reg2.txt + +:: Convert double backslashes to single backslashes +set UTPath= +:UTWHILE + if "%UTPathTemp%"=="" goto UTWEND + if not "%UTPath%"=="" set UTPath=%UTPath%\ + for /f "delims=\" %%x in ("%UTPathTemp%") do set UTPath=%UTPath%%%x + for /f "tokens=1,* delims=\" %%x in ("%UTPathTemp%") do set UTPathTemp=%%y + goto UTWHILE +:UTWEND +set UTPathTemp= +echo Unreal Tournament 2004 Path (per registy) = %UTPath% + +reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v UT2K4_ROOT /d "%UTPath%" /f + +REM Check to make sure the file is not running with a wrong working directory +SET RunTimeConfig=startlist-virtual +SET LauncherType=Virtual System + +CALL TeamTalkRun.bat + START Tools\AlwaysOnTop Unreal 0 -TeamTalkRun.bat +:UT2K4ERROR (Unreal Tournament 2004 was not found on the computer) +echo Unreal Tournament 2004 was not found on the computer. +echo Running non-virtual TeamTalk. + +TeamTalkrun.bat + :ErrorWrongWorkingDirectory echo. echo This script must be run with the current directory being that of the script. @@ -16,3 +50,6 @@ echo. echo If this is not the case, please contact bfrisch at gmail.com. echo. + +:pause script exectution before exiting +pause \ No newline at end of file From bfrisch at edam.speech.cs.cmu.edu Wed Dec 26 16:59:46 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Wed, 26 Dec 2007 16:59:46 -0500 Subject: [TeamTalk 353]: [889] trunk/usarsim/TreasureHunt/Classes: 1) Switching to using xPawn' s animations (this works!) Message-ID: <200712262159.lBQLxkgo027782@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071226/3a4bab0c/attachment.html -------------- next part -------------- Modified: trunk/usarsim/TreasureHunt/Classes/FemaleTreasureHunterPawn.uc =================================================================== --- trunk/usarsim/TreasureHunt/Classes/FemaleTreasureHunterPawn.uc 2007-12-25 23:42:38 UTC (rev 888) +++ trunk/usarsim/TreasureHunt/Classes/FemaleTreasureHunterPawn.uc 2007-12-26 21:59:45 UTC (rev 889) @@ -2,9 +2,28 @@ defaultproperties { - // Size of all female hunters is the same + // Size of female hunter DrawScale=1.65 // Animation subset Mesh=SkeletalMesh'UDN_CharacterModels_K.GenericFemale' + + 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=+00800.000000 + JumpZ=+00630.000000 + bWantsToCrouch = true + bCanCrouch=true + bCanClimbLadders=true + bCanPickupInventory=true + bNetNotify=true + + RequiredEquipment(0)="" + RequiredEquipment(1)="" } \ No newline at end of file Modified: trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc =================================================================== --- trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc 2007-12-25 23:42:38 UTC (rev 888) +++ trunk/usarsim/TreasureHunt/Classes/MaleTreasureHunterPawn.uc 2007-12-26 21:59:45 UTC (rev 889) @@ -2,11 +2,11 @@ defaultproperties { - // Size of all male hunter is the same - DrawScale=1.8 + // Size of all male hunter is different from Female Treasure Hunter due to different mesh + DrawScale=5.0 // Animation subset - Mesh=SkeletalMesh'smith.smith' + Mesh=Mesh'smith.smith' BaseEyeHeight=+00150.000000 EyeHeight=+00150.000000 @@ -16,6 +16,30 @@ CrouchRadius=+00061.200000 GroundSpeed=+00800.000000 AirSpeed=+00800.000000 - WaterSpeed=+00400.000000 + WaterSpeed=+00800.000000 JumpZ=+00630.000000 + bWantsToCrouch = true + bCanCrouch=true + bCanClimbLadders=true + bCanPickupInventory=true + bNetNotify=true + + + Skins(0)=Texture'smithskins.smithbody' + Skins(1)=Texture'smithskins.smithhead' + Species=class'xGame.SPECIES_Merc' + SoundGroupClass=class'xMercMaleSoundGroup' + GibGroupClass=class'xJuggGibGroup' + + RequiredEquipment(0)="" + RequiredEquipment(1)="" + + IdleWeaponAnim=Idle_Rest + IdleHeavyAnim=Idle_Rest + IdleRifleAnim=Idle_Rest + FireHeavyRapidAnim=Idle_Rest + FireHeavyBurstAnim=Idle_Rest + FireRifleRapidAnim=Idle_Rest + FireRifleBurstAnim=Idle_Rest + } \ No newline at end of file Modified: trunk/usarsim/TreasureHunt/Classes/TreasureHunterPawn.uc =================================================================== --- trunk/usarsim/TreasureHunt/Classes/TreasureHunterPawn.uc 2007-12-25 23:42:38 UTC (rev 888) +++ trunk/usarsim/TreasureHunt/Classes/TreasureHunterPawn.uc 2007-12-26 21:59:45 UTC (rev 889) @@ -1,4 +1,4 @@ -Class TreasureHunterPawn extends UnrealPawn; +Class TreasureHunterPawn extends xPawn; defaultproperties { From bfrisch at edam.speech.cs.cmu.edu Wed Dec 26 17:17:23 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Wed, 26 Dec 2007 17:17:23 -0500 Subject: [TeamTalk 354]: [890] trunk/usarsim/System/copy_bins.bat: 1) Adding a script that given a path to a shared directory will copy all of the the built USARSim binaries to the local Unreal Tournament system directory . Message-ID: <200712262217.lBQMHNPu027815@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071226/aa9ef628/attachment.html -------------- next part -------------- Added: trunk/usarsim/System/copy_bins.bat =================================================================== --- trunk/usarsim/System/copy_bins.bat (rev 0) +++ trunk/usarsim/System/copy_bins.bat 2007-12-26 22:17:23 UTC (rev 890) @@ -0,0 +1,39 @@ +:: Given a UNC Path this script will copy all recently built binary files from the server. + +if not exist ut2004.exe goto Error + +if %1=="" echo Usage copy_bins.bat UNCPathToServer +if %1=="/?" echo Usage copy_bins.bat UNCPathToServer +if %1=="\?" echo Usage copy_bins.bat UNCPathToServer + +echo Copying built code from %1 + +copy %1\TreasureHunt.u TreasureHunt.u +copy %1\TreasureHunt.ucl TreasureHunt.ucl + +copy %1\USARBot.u USARBot.u +copy %1\USARBot.ucl USARBot.ucl + +copy %1\USARBotAPI.u USARBotAPI.u +copy %1\USARBotAPI.u USARBotAPI.ucl + +copy %1\USARMisPkg.u USARMisPkg.u + +copy %1\USARModels.u USARModels.u + +copy %1\USARVictims.u USARVictims.u + +echo Copy complete. +goto pause + +:Error message that says that the script was run outside of the TeamTalk directory. +echo. +echo This script must be run with the current directory being that of the script. +echo (For example, click directly on the script in Windows Explorer instead of +echo entering the full path to the script at the command prompt.) +echo. +echo If this is not the case, please contact bfrisch at gmail.com. +echo. + +:pause +pause \ No newline at end of file From bfrisch at edam.speech.cs.cmu.edu Wed Dec 26 17:48:42 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Wed, 26 Dec 2007 17:48:42 -0500 Subject: [TeamTalk 355]: [891] trunk/usarsim/System/copy_bins.bat: 1) Improvements to the batch script and bug fixes Message-ID: <200712262248.lBQMmgRf028210@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071226/4a1f6b3e/attachment.html -------------- next part -------------- Modified: trunk/usarsim/System/copy_bins.bat =================================================================== --- trunk/usarsim/System/copy_bins.bat 2007-12-26 22:17:23 UTC (rev 890) +++ trunk/usarsim/System/copy_bins.bat 2007-12-26 22:48:40 UTC (rev 891) @@ -1,28 +1,39 @@ :: Given a UNC Path this script will copy all recently built binary files from the server. +if "%1"=="" echo Usage copy_bins.bat UNCPathToServer +if "%1"=="/?" echo Usage copy_bins.bat UNCPathToServer +if "%1"=="\?" echo Usage copy_bins.bat UNCPathToServer + if not exist ut2004.exe goto Error -if %1=="" echo Usage copy_bins.bat UNCPathToServer -if %1=="/?" echo Usage copy_bins.bat UNCPathToServer -if %1=="\?" echo Usage copy_bins.bat UNCPathToServer +if not exist "%1\TreasureHunt.u" goto WrongServer +if not exist "%1\TreasureHunt.ucl" goto WrongServer +if not exist "%1\USARBot.u" goto WrongServer +if not exist "%1\USARBot.ucl" goto WrongServer +if not exist "%1\USARBotAPI.u" goto WrongServer +if not exist "%1\USARBotAPI.ucl" goto WrongServer +if not exist "%1\USARMisPkg.u" goto WrongServer +if not exist "%1\USARModels.u" goto WrongServer echo Copying built code from %1 -copy %1\TreasureHunt.u TreasureHunt.u -copy %1\TreasureHunt.ucl TreasureHunt.ucl +copy "%1\USARVictims.u" USARVictims.u -copy %1\USARBot.u USARBot.u -copy %1\USARBot.ucl USARBot.ucl +copy "%1\TreasureHunt.u" /B TreasureHunt.u /B +copy "%1\TreasureHunt.ucl" /B TreasureHunt.ucl /B -copy %1\USARBotAPI.u USARBotAPI.u -copy %1\USARBotAPI.u USARBotAPI.ucl +copy "%1\USARBot.u" /B USARBot.u /B +copy "%1\USARBot.ucl" /B USARBot.ucl /B -copy %1\USARMisPkg.u USARMisPkg.u +copy "%1\USARBotAPI.u" /B USARBotAPI.u +copy "%1\USARBotAPI.u" /B USARBotAPI.ucl /B -copy %1\USARModels.u USARModels.u +copy "%1\USARMisPkg.u" /B USARMisPkg.u /B -copy %1\USARVictims.u USARVictims.u +copy "%1\USARModels.u" /B USARModels.u /B +copy "%1\USARVictims.u" /B USARVictims.u /B + echo Copy complete. goto pause @@ -33,7 +44,12 @@ echo entering the full path to the script at the command prompt.) echo. echo If this is not the case, please contact bfrisch at gmail.com. -echo. +echo. +goto pause +:WrongServer Path specified +echo The given server path does not contain all of the necessary binary files. + + :pause pause \ No newline at end of file From bfrisch at edam.speech.cs.cmu.edu Thu Dec 27 15:50:51 2007 From: bfrisch at edam.speech.cs.cmu.edu (bfrisch@edam.speech.cs.cmu.edu) Date: Thu, 27 Dec 2007 15:50:51 -0500 Subject: [TeamTalk 356]: [892] trunk/usarsim/System/copy_bins.bat: 1) Setting echo off in copy_bins. bat Message-ID: <200712272050.lBRKopGZ030333@edam.speech.cs.cmu.edu> An HTML attachment was scrubbed... URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071227/ae3c28f3/attachment.html -------------- next part -------------- Modified: trunk/usarsim/System/copy_bins.bat =================================================================== --- trunk/usarsim/System/copy_bins.bat 2007-12-26 22:48:40 UTC (rev 891) +++ trunk/usarsim/System/copy_bins.bat 2007-12-27 20:50:49 UTC (rev 892) @@ -1,5 +1,9 @@ -:: Given a UNC Path this script will copy all recently built binary files from the server. + at echo off +:: Given a Path this script will copy all recently built binary files from the server. +:: Note: CMD.exe by default does not support UNC paths, so it is recommended that you mount the shared system directory of UT2004 as its own drive +:: If you are intersted in changing this see: http://support.microsoft.com/kb/156276 (though I have had mixed sucess with this) + if "%1"=="" echo Usage copy_bins.bat UNCPathToServer if "%1"=="/?" echo Usage copy_bins.bat UNCPathToServer if "%1"=="\?" echo Usage copy_bins.bat UNCPathToServer