From: <he...@us...> - 2009-12-29 19:07:44
|
Revision: 129 http://simspark.svn.sourceforge.net/simspark/?rev=129&view=rev Author: hedayat Date: 2009-12-29 19:07:35 +0000 (Tue, 29 Dec 2009) Log Message: ----------- Add ~/.simspark directory to resource search path Added new effector: AgentSyncEffector (syn command) Added Sync Mode to the simulator Added an option to run the server in simulation time mode instead of real time mode Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/RELEASE trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp trunk/spark/lib/oxygen/agentaspect/agentaspect.h trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp trunk/spark/lib/oxygen/simulationserver/agentcontrol.h trunk/spark/lib/oxygen/simulationserver/agentcontrol_c.cpp trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp trunk/spark/lib/oxygen/simulationserver/netcontrol.h trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp trunk/spark/lib/zeitgeist/scriptserver/scriptserver.h trunk/spark/lib/zeitgeist/zeitgeist.cpp trunk/spark/plugin/CMakeLists.txt trunk/spark/spark/spark.rb Added Paths: ----------- trunk/spark/plugin/agentsynceffector/ trunk/spark/plugin/agentsynceffector/CMakeLists.txt trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp trunk/spark/plugin/agentsynceffector/agentsynceffector.h trunk/spark/plugin/agentsynceffector/agentsynceffector_c.cpp trunk/spark/plugin/agentsynceffector/export.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/ChangeLog 2009-12-29 19:07:35 UTC (rev 129) @@ -1,3 +1,46 @@ +2009-12-29 Hedayat Vatankhah <he...@gr...> + + * lib/zeitgeist/zeitgeist.cpp (Zeitgeist::RunInitScript): + - call SetupDotDir() so that ~/.simspark directory will be searched for + resource files (e.g. scripts) + + * lib/zeitgeist/scriptserver/scriptserver.h: + * lib/zeitgeist/scriptserver/scriptserver.cpp: + - added SetupDotDir() function to create dot dir and add it to resource + search locations + + * lib/oxygen/simulationserver/netcontrol.h: + * lib/oxygen/simulationserver/netcontrol.cpp: + - added the option to block for awhile (1 second) in ReadMessages if no + messages are available + + * spark/spark.rb: + - added new option useRealTime to select between running in real time and + simulation time running modes + - added new option agentSyncMode which can be set to run in sync mode + - loading agentsynceffector module + + * lib/oxygen/simulationserver/agentcontrol.h: + * lib/oxygen/simulationserver/agentcontrol.cpp: + * lib/oxygen/simulationserver/agentcontrol_c.cpp: + - added "Sync mode" in which agentcontrol will block until all connected + agents tell it to proceed + + * plugin/agentsynceffector/CMakeLists.txt: + * plugin/agentsynceffector/export.cpp: + * plugin/agentsynceffector/agentsynceffector.h: + * plugin/agentsynceffector/agentsynceffector.cpp: + * plugin/agentsynceffector/agentsynceffector_c.cpp: + * plugin/CMakeLists.txt: + - a new effector: AgentSyncEffector + + * lib/oxygen/agentaspect/agentaspect.h: + * lib/oxygen/agentaspect/agentaspect.cpp: + - added mIsSynced property to show if the agent is synced with the server + + * RELEASE: + - some new release notes + 2009-10-31 Hedayat Vatankhah <he...@gr...> * lib/oxygen/simulationserver/simulationserver.h: Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/RELEASE 2009-12-29 19:07:35 UTC (rev 129) @@ -11,7 +11,19 @@ sense data of the last cycle. So, any commands which is sent by agents after receiving new sense data will be executed in the next cycle, not the current one. This results in a more deterministic behavior, and agents' - efficiency should not change between remote and local runs considerably. + efficiency should not change between remote and local runs considerably. + - An Accelerometer sensor + - Fixed some rendering bugs (agents not visible through goals) + - A "Sync Mode" operation is introduced. In this mode, the server will not + advance to the next cycle untill all connected agents send a "syn" command + to the server. You can use this mode by setting "agentSyncMode" to true in + simspark.rb (or spark.rb) + - Simulator will run in simulation time mode instead of real time + if "useRealTime" variable is set to false in simspark.rb (or spark.rb) + - To make changes to most of the resource files (e.g. simspark.rb), you can + create a copy in ~/.simspark directory and make desired changes there. The + directory structure of the original files should be preserved (e.g. + rsg/agent/nao/nao.rgs) You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp =================================================================== --- trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -27,7 +27,7 @@ using namespace salt; using namespace std; -AgentAspect::AgentAspect() : Transform() +AgentAspect::AgentAspect() : Transform(), mIsSynced(true) { SetName("agentAspect"); mID = -1; @@ -168,3 +168,8 @@ return added; } + +bool AgentAspect::IsSynced() const +{ + return mIsSynced || mPerceptorCycle < 5; +} Modified: trunk/spark/lib/oxygen/agentaspect/agentaspect.h =================================================================== --- trunk/spark/lib/oxygen/agentaspect/agentaspect.h 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/agentaspect/agentaspect.h 2009-12-29 19:07:35 UTC (rev 129) @@ -68,6 +68,12 @@ //! @return the unique ID for the agent aspect inline int ID() const { return mID; } + /** @return if the agent is in sync with the server in Sync mode*/ + bool IsSynced() const; + + /** sets the synchronization status of the agent */ + void SetSynced(bool synced) { mIsSynced = synced; } + protected: typedef std::map<std::string, boost::shared_ptr<Effector> > TEffectorMap; @@ -76,9 +82,12 @@ private: int mID; + /** indicates how many times the QueryPerceptors be called */ unsigned int mPerceptorCycle; + /** show if the agent is in sync with the server (in Sync mode) */ + bool mIsSynced; }; DECLARE_CLASS(AgentAspect); Modified: trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -20,6 +20,7 @@ #include "agentcontrol.h" #include "simulationserver.h" #include "netmessage.h" +#include <set> #include <zeitgeist/logserver/logserver.h> #include <oxygen/agentaspect/agentaspect.h> @@ -28,7 +29,7 @@ using namespace boost; using namespace std; -AgentControl::AgentControl() : NetControl() +AgentControl::AgentControl() : NetControl(), mSyncMode(false) { mLocalAddr.setPort(3100); } @@ -77,57 +78,60 @@ void AgentControl::StartCycle() { - NetControl::StartCycle(); + do + { + NetControl::StartCycle(); - if ( - (mGameControlServer.get() == 0) || - (mNetMessage.get() == 0) - ) - { - return; - } + if ( + (mGameControlServer.get() == 0) || + (mNetMessage.get() == 0) + ) + { + return; + } - // pass all received messages on to the GameControlServer - for ( - TBufferMap::iterator iter = mBuffers.begin(); - iter != mBuffers.end(); - ++iter - ) - { - shared_ptr<NetBuffer>& netBuff = (*iter).second; - if ( - (netBuff.get() == 0) || - (netBuff->IsEmpty()) - ) - { - continue; - } + // pass all received messages on to the GameControlServer + for ( + TBufferMap::iterator iter = mBuffers.begin(); + iter != mBuffers.end(); + ++iter + ) + { + shared_ptr<NetBuffer>& netBuff = (*iter).second; + if ( + (netBuff.get() == 0) || + (netBuff->IsEmpty()) + ) + { + continue; + } - // lookup the client entry corresponding for the buffer - // entry - TAddrMap::iterator clientIter = mClients.find(netBuff->GetAddr()); - if (clientIter == mClients.end()) - { - continue; - } - shared_ptr<Client>& client = (*clientIter).second; + // lookup the client entry corresponding for the buffer + // entry + TAddrMap::iterator clientIter = mClients.find(netBuff->GetAddr()); + if (clientIter == mClients.end()) + { + continue; + } + shared_ptr<Client>& client = (*clientIter).second; - // lookup the AgentAspect node correspoding to the client - shared_ptr<AgentAspect> agent = - mGameControlServer->GetAgentAspect(client->id); - if (agent.get() == 0) - { - continue; - } + // lookup the AgentAspect node correspoding to the client + shared_ptr<AgentAspect> agent = + mGameControlServer->GetAgentAspect(client->id); + if (agent.get() == 0) + { + continue; + } - // parse and immediately realize the action - string message; - while (mNetMessage->Extract(netBuff,message)) - { - agent->RealizeActions - (mGameControlServer->Parse(client->id,message)); - } - } + // parse and immediately realize the action + string message; + while (mNetMessage->Extract(netBuff,message)) + { + agent->RealizeActions + (mGameControlServer->Parse(client->id,message)); + } + } + } while (!AgentsAreSynced()); } void AgentControl::SenseAgent() @@ -184,6 +188,10 @@ { continue; } + if (mSyncMode) + { + agent->SetSynced(false); + } shared_ptr<PredicateList> senseList = agent->QueryPerceptors(); mClientSenses[client->id] = parser->Generate(senseList); @@ -195,3 +203,47 @@ mNetMessage->PrepareToSend(mClientSenses[client->id]); } } + +void AgentControl::SetSyncMode(bool syncMode) +{ + mSyncMode = syncMode; + if (mSyncMode) + { + BlockOnReadMessages(true); + GetLog()->Normal() + << "(AgentControl) Running in sync mode.\n"; + } + else + { + BlockOnReadMessages(false); + GetLog()->Normal() + << "(AgentControl) Running in normal mode.\n"; + } +} + +bool AgentControl::AgentsAreSynced() +{ + if (mSyncMode) + { + set<rcss::net::Addr> closedClients(mCloseClients.begin(), + mCloseClients.end()); + + for ( + TAddrMap::const_iterator iter = mClients.begin(); + iter != mClients.end(); + ++iter + ) + { + if (closedClients.find(iter->first) != closedClients.end()) + continue; + + shared_ptr<AgentAspect> agent = + mGameControlServer->GetAgentAspect(iter->second->id); + if (agent && !agent->IsSynced()) + { + return false; + } + } + } + return true; +} Modified: trunk/spark/lib/oxygen/simulationserver/agentcontrol.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/agentcontrol.h 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/agentcontrol.h 2009-12-29 19:07:35 UTC (rev 129) @@ -53,14 +53,28 @@ /** generates sense updates for all connected agents */ virtual void EndCycle(); + /** sets the AgentControl's sync mode */ + void SetSyncMode(bool syncMode); + protected: virtual void OnLink(); + /** returns if the agents are synced with the srever */ + bool AgentsAreSynced(); + protected: /** cached reference to the GameControlServer */ CachedPath<GameControlServer> mGameControlServer; + /** stores sense information to be sent to the clients after receiving + * their commands + */ std::vector<std::string> mClientSenses; + + /** indicates if we should wait for the agents to let the simulation + * proceed to the next cycle + */ + bool mSyncMode; }; DECLARE_CLASS(AgentControl); Modified: trunk/spark/lib/oxygen/simulationserver/agentcontrol_c.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/agentcontrol_c.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/agentcontrol_c.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -22,7 +22,21 @@ using namespace oxygen; using namespace std; +FUNCTION(AgentControl, setSyncMode) +{ + bool inSet; + + if ((in.GetSize() != 1) || (!in.GetValue(in[0], inSet))) + { + return false; + } + + obj->SetSyncMode(inSet); + return true; +} + void CLASS(AgentControl)::DefineClass() { DEFINE_BASECLASS(oxygen/NetControl); + DEFINE_FUNCTION(setSyncMode); } Modified: trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -43,6 +43,7 @@ mSocketType = ST_TCP; mLocalAddr = Addr(INADDR_ANY, INADDR_ANY); mClientId = 1; + mReadTimeout = 0; } NetControl::~NetControl() @@ -512,7 +513,7 @@ FD_SET(fd,&readfds); timeval time; - time.tv_sec = 0; + time.tv_sec = mReadTimeout; time.tv_usec = 0; for(;;) @@ -525,6 +526,7 @@ #endif int ret = select(maxFd, &readfds, 0, 0, &time); + time.tv_sec = 0; if (ret == 0) { @@ -596,14 +598,16 @@ } // test for pending fragments + int timeout = mReadTimeout; for(;;) { timeval time; - time.tv_sec = 0; + time.tv_sec = timeout; time.tv_usec = 0; fd_set test_fds = client_fds; int ret = select(maxFd+1, &test_fds, 0, 0, &time); + timeout = 0; if (ret == 0) { @@ -660,3 +664,15 @@ } } } + +void NetControl::BlockOnReadMessages(bool block) +{ + if (block) + { + mReadTimeout = 1; + } + else + { + mReadTimeout = 0; + } +} Modified: trunk/spark/lib/oxygen/simulationserver/netcontrol.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/netcontrol.h 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/netcontrol.h 2009-12-29 19:07:35 UTC (rev 129) @@ -124,6 +124,11 @@ static boost::shared_ptr<rcss::net::Socket> CreateSocket(ESocketType type); + /** if set true, ReadMessages call will not return immediately if there + * is no messages to read and it'll wait a little for incomming messages + */ + void BlockOnReadMessages(bool block); + protected: /** returns a human readable description of the socket type and port*/ @@ -198,6 +203,9 @@ /** the next available unique client id */ int mClientId; + + /** indicates how much ReadMessages should wait for new messages */ + int mReadTimeout; }; DECLARE_CLASS(NetControl); Modified: trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp =================================================================== --- trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -445,6 +445,18 @@ } bool +ScriptServer::SetupDotDir() +{ + string dotDir; + if (GetDotDirName(dotDir) && CreateDotDir(dotDir)) + { + GetFile()->AddResourceLocation(dotDir); + return true; + } + return false; +} + +bool ScriptServer::ConstructInternal() { if (! Leaf::ConstructInternal()) Modified: trunk/spark/lib/zeitgeist/scriptserver/scriptserver.h =================================================================== --- trunk/spark/lib/zeitgeist/scriptserver/scriptserver.h 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/zeitgeist/scriptserver/scriptserver.h 2009-12-29 19:07:35 UTC (rev 129) @@ -144,6 +144,9 @@ /** returns the context, the ScriptServer operates in */ boost::shared_ptr<CoreContext> GetContext() const; + /** creates dot directory and adds it to resource search paths */ + bool SetupDotDir(); + /** constructs the ZeitgeistObject corresponding to a given leaf */ static GCValue GetZeitgeistObject(boost::shared_ptr<Leaf> leaf); Modified: trunk/spark/lib/zeitgeist/zeitgeist.cpp =================================================================== --- trunk/spark/lib/zeitgeist/zeitgeist.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/zeitgeist/zeitgeist.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -72,6 +72,7 @@ // setup the dot directory in the script server mCore->GetScriptServer()->SetDotName(dotName); + mCore->GetScriptServer()->SetupDotDir(); // run the zeitgeist init script mCore->GetScriptServer()->RunInitScript Modified: trunk/spark/plugin/CMakeLists.txt =================================================================== --- trunk/spark/plugin/CMakeLists.txt 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/plugin/CMakeLists.txt 2009-12-29 19:07:35 UTC (rev 129) @@ -10,6 +10,7 @@ endif (APPLE AND USE_COREFOUNDATION) add_subdirectory(accelerometer) +add_subdirectory(agentsynceffector) add_subdirectory(filesystemstd) add_subdirectory(filesystemzip) add_subdirectory(forceeffector) Added: trunk/spark/plugin/agentsynceffector/CMakeLists.txt =================================================================== --- trunk/spark/plugin/agentsynceffector/CMakeLists.txt (rev 0) +++ trunk/spark/plugin/agentsynceffector/CMakeLists.txt 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,19 @@ + +########### next target ############### + +set(agentsynceffector_LIB_SRCS + export.cpp + agentsynceffector.cpp + agentsynceffector.h + agentsynceffector_c.cpp +) + +add_library(agentsynceffector MODULE ${agentsynceffector_LIB_SRCS}) + +target_link_libraries(agentsynceffector ${spark_libs}) + +if (NOT APPLE) + set_target_properties(agentsynceffector PROPERTIES VERSION 0.0.0 SOVERSION 0) +endif (NOT APPLE) + +install(TARGETS agentsynceffector DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) Added: trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp =================================================================== --- trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp (rev 0) +++ trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,87 @@ +/* -*- mode: c++; c-basic-indent: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id: forceeffector.cpp 19 2008-12-19 18:12:56Z hedayat $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "agentsynceffector.h" +#include <zeitgeist/logserver/logserver.h> +#include <oxygen/gamecontrolserver/actionobject.h> +#include <oxygen/agentaspect/agentaspect.h> + +using namespace boost; +using namespace oxygen; + +AgentSyncEffector::AgentSyncEffector() : oxygen::Effector() +{ +} + +AgentSyncEffector::~AgentSyncEffector() +{ +} + +bool AgentSyncEffector::Realize(boost::shared_ptr<ActionObject> action) +{ + bool res = Effector::Realize(action); + + if (mAgentAspect) + { + mAgentAspect->SetSynced(true); + } + return res; +} + +shared_ptr<ActionObject> +AgentSyncEffector::GetActionObject(const Predicate& predicate) +{ + if (predicate.name != GetPredicate()) + { + GetLog()->Error() << "ERROR: (AgentSyncEffector) invalid predicate" + << predicate.name << "\n"; + return shared_ptr<ActionObject>(); + } + + return shared_ptr<ActionObject>(new ActionObject(GetPredicate())); +} + +void AgentSyncEffector::OnLink() +{ + mAgentAspect = GetAgentAspect(); + + if (mAgentAspect.get() == 0) + { + GetLog()->Error() + << "ERROR: (AgentSyncEffector) cannot get the AgentAspect object\n"; + return; + } + + mAgentAspect = mAgentAspect->FindParentSupportingClass<AgentAspect>().lock(); + if (mAgentAspect.get() == 0) + { + GetLog()->Error() + << "ERROR: (AgentSyncEffector) cannot get the grand parent AgentAspect" + " object\n"; + return; + } +} + +void AgentSyncEffector::OnUnlink() +{ + mAgentAspect.reset(); +} Added: trunk/spark/plugin/agentsynceffector/agentsynceffector.h =================================================================== --- trunk/spark/plugin/agentsynceffector/agentsynceffector.h (rev 0) +++ trunk/spark/plugin/agentsynceffector/agentsynceffector.h 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,55 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef AGENTSYNCEFFECTOR_H +#define AGENTSYNCEFFECTOR_H + +#include <oxygen/agentaspect/effector.h> + +class AgentSyncEffector : public oxygen::Effector +{ +public: + AgentSyncEffector(); + virtual ~AgentSyncEffector(); + + /** realize the sync action asap */ + virtual bool Realize(boost::shared_ptr<oxygen::ActionObject> action); + + /** returns the name of the predicate this effector implements. */ + virtual std::string GetPredicate() { return "syn"; } + + /** constructs an Actionobject, describing a predicate */ + virtual boost::shared_ptr<oxygen::ActionObject> + GetActionObject(const oxygen::Predicate& predicate); + + /** setup the reference to the agent aspect node */ + virtual void OnLink(); + + /** remove the reference to the agent aspect node */ + virtual void OnUnlink(); + +private: + boost::shared_ptr<oxygen::AgentAspect> mAgentAspect; +}; + +DECLARE_CLASS(AgentSyncEffector); + +#endif // AGENTSYNCEFFECTOR_H Added: trunk/spark/plugin/agentsynceffector/agentsynceffector_c.cpp =================================================================== --- trunk/spark/plugin/agentsynceffector/agentsynceffector_c.cpp (rev 0) +++ trunk/spark/plugin/agentsynceffector/agentsynceffector_c.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,31 @@ +/* -*- mode: c++; c-basic-indent: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "agentsynceffector.h" + +using namespace boost; +using namespace oxygen; + +void CLASS(AgentSyncEffector)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/Effector); +} Added: trunk/spark/plugin/agentsynceffector/export.cpp =================================================================== --- trunk/spark/plugin/agentsynceffector/export.cpp (rev 0) +++ trunk/spark/plugin/agentsynceffector/export.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,28 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "agentsynceffector.h" +#include <zeitgeist/zeitgeist.h> + +ZEITGEIST_EXPORT_BEGIN() + ZEITGEIST_EXPORT(AgentSyncEffector); +ZEITGEIST_EXPORT_END() Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/spark/spark.rb 2009-12-29 19:07:35 UTC (rev 129) @@ -19,6 +19,9 @@ # the name of the default bundle that contains the default InputSystem $defaultInputSystemBundle = 'inputsdl' +# if simulator should run in real time rather than simulation time +$useRealTime = true + # (OpenGL rendering) # @@ -34,6 +37,7 @@ $agentStep = 0.02 $agentType = 'tcp' $agentPort = 3100 +$agentSyncMode = false # (MonitorControl) constants # @@ -294,6 +298,7 @@ if (agentControl != nil) agentControl.setServerPort($agentPort) agentControl.setStep($agentStep) + agentControl.setSyncMode($agentSyncMode) end if ($agentType == 'udp') @@ -402,6 +407,12 @@ # add the input control node simulationServer.initControlNode('kerosin/InputControl','InputControl') end + + # set timing mode (real time vs simulation time) + inputControl = get($serverPath+'simulation/InputControl') + if (inputControl != nil) + inputControl.setAdvanceTime($useRealTime) + end end def sparkSetupTrain() @@ -616,3 +627,5 @@ # importBundle "accelerometer" + +importBundle "agentsynceffector" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |