00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- 00002 00003 this file is part of rcssserver3D 00004 Fri May 9 2003 00005 Copyright (C) 2002,2003 Koblenz University 00006 Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group 00007 $Id: monitortest.cpp,v 1.6 2004/12/21 19:42:04 rollmark Exp $ 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; version 2 of the License. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00022 #include "monitortest.h" 00023 00024 #include <sstream> 00025 #include <zeitgeist/logserver/logserver.h> 00026 #include <oxygen/sceneserver/sceneserver.h> 00027 #include <oxygen/sceneserver/scene.h> 00028 #include <oxygen/sceneserver/transform.h> 00029 #include <netinet/in.h> 00030 00031 using namespace oxygen; 00032 using namespace std; 00033 using namespace boost; 00034 00035 MonitorTest::MonitorTest() : MonitorSystem() 00036 { 00037 } 00038 00039 MonitorTest::~MonitorTest() 00040 { 00041 } 00042 00043 bool MonitorTest::ConstructInternal() 00044 { 00045 GetLog()->Normal() << "a monitortest was created." << endl; 00046 return true; 00047 } 00048 00049 void 00050 MonitorTest::ParseMonitorMessage(const std::string& data) 00051 { 00052 GetLog()->Debug() << "MonitorTest received " << data << " from monitor\n"; 00053 } 00054 00055 00056 string MonitorTest::GetMonitorInfo(const PredicateList& /*pList*/) 00057 { 00058 /* GetLog()->Debug() << "**** (MonitorTest::GetMonitorInfo)\n"; 00059 return ("(agent 0.3 1.4 0.2)");*/ 00060 00061 shared_ptr<SceneServer> sceneServer = 00062 shared_dynamic_cast<SceneServer>(GetCore()->Get("/sys/server/scene")); 00063 00064 if (sceneServer.get() == 0) 00065 { 00066 GetLog()->Error() << "(MonitorTest) cannot get SceneServer\n"; 00067 return ""; 00068 } 00069 00070 TLeafList transformList; 00071 shared_ptr<Scene> activeScene = sceneServer->GetActiveScene(); 00072 activeScene->GetChildrenSupportingClass("AgentAspect", transformList, true); 00073 00074 stringstream ss; 00075 00076 for (TLeafList::iterator i = transformList.begin(); 00077 i != transformList.end(); ++i) 00078 { 00079 shared_ptr<Transform> j = shared_static_cast<Transform>(*i); 00080 const salt::Vector3f& pos = j->GetWorldTransform().Pos(); 00081 00082 ss << "(agent " << pos[0] << " " << pos[1] << " " << pos[2] << ")"; 00083 } 00084 00085 ss << endl; 00086 00087 return ss.str(); 00088 } 00089 00090 string MonitorTest::GetMonitorHeaderInfo(const PredicateList& /*pList*/) 00091 { 00092 return ""; 00093 } 00094 00095