You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(20) |
Feb
(11) |
Mar
(6) |
Apr
(5) |
May
(4) |
Jun
(7) |
Jul
(9) |
Aug
(11) |
Sep
|
Oct
(4) |
Nov
(13) |
Dec
(21) |
2010 |
Jan
(23) |
Feb
(32) |
Mar
(6) |
Apr
(2) |
May
(10) |
Jun
(15) |
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
(1) |
Dec
(16) |
2011 |
Jan
(1) |
Feb
(5) |
Mar
(19) |
Apr
(13) |
May
(4) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(4) |
Feb
(8) |
Mar
(2) |
Apr
(6) |
May
(13) |
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(15) |
Apr
(2) |
May
(4) |
Jun
(17) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(6) |
Jun
(6) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(6) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
(7) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <he...@us...> - 2011-03-27 22:01:40
|
Revision: 266 http://simspark.svn.sourceforge.net/simspark/?rev=266&view=rev Author: hedayat Date: 2011-03-27 22:01:34 +0000 (Sun, 27 Mar 2011) Log Message: ----------- Only print error messages on stderr to prevent excessive logging Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/rcssmonitor3d/rcssmonitor3d.rb Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2011-03-27 21:47:57 UTC (rev 265) +++ trunk/rcssserver3d/ChangeLog 2011-03-27 22:01:34 UTC (rev 266) @@ -1,3 +1,8 @@ +2011-03-28 Hedayat Vatankhah <hed...@gm...> + + * rcssmonitor3d/rcssmonitor3d.rb: + - only log error messages to output (a small cleanup for 0.6.5 release) + 2011-03-26 Hedayat Vatankhah <hed...@gm...> * NEWS: Modified: trunk/rcssserver3d/rcssmonitor3d/rcssmonitor3d.rb =================================================================== --- trunk/rcssserver3d/rcssmonitor3d/rcssmonitor3d.rb 2011-03-27 21:47:57 UTC (rev 265) +++ trunk/rcssserver3d/rcssmonitor3d/rcssmonitor3d.rb 2011-03-27 22:01:34 UTC (rev 266) @@ -41,7 +41,7 @@ # sparkResetLogging() -sparkLogAllToCerr() +sparkLogErrorToCerr() # sparkLogAllToFile('./spark.txt') # sparkLogDebugToCerr() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-27 21:48:03
|
Revision: 265 http://simspark.svn.sourceforge.net/simspark/?rev=265&view=rev Author: hedayat Date: 2011-03-27 21:47:57 +0000 (Sun, 27 Mar 2011) Log Message: ----------- * Fixed log player running issues Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp trunk/spark/spark/spark.rb Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/ChangeLog 2011-03-27 21:47:57 UTC (rev 265) @@ -1,3 +1,25 @@ +2011-03-28 Hedayat Vatankhah <hed...@gm...> + + * plugin/sparkmonitor/sparkmonitorlogfileserver.cpp + (SparkMonitorLogFileServer::StartCycle): + - don't do anything in StartCycle() before time 0.1. it is a workaround a + random crash which might be because of some kind of initialization delay + + * spark/spark.rb: + - set adjust speed mode for both monitor and log player to prevent + waisting any time trying to catch up in physics update (which they don't + have at all)! + +2011-03-27 Hedayat Vatankhah <hed...@gm...> + + * plugin/sparkmonitor/sparkmonitorlogfileserver.h: + * plugin/sparkmonitor/sparkmonitorlogfileserver.cpp: + * plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp: + - call mActiveScene's SetModified() and UpdateCache() so that it shows the + field again + - remove mStepDelay, it is not needed as the timing is controlled by the + simulation server + 2011-03-26 Hedayat Vatankhah <hed...@gm...> * plugin/sexpparser/sexpparser.h: Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp 2011-03-27 21:47:57 UTC (rev 265) @@ -42,7 +42,6 @@ { mPause = false; mForwardStep = false; - mStepDelay = 0; mBackwardPlayback = false; mSexpMemory = init_sexp_memory(); } @@ -112,6 +111,9 @@ void SparkMonitorLogFileServer::StartCycle() { + // work around a random crash! + if (GetTime() < 0.1) + return; if (mPause && !mForwardStep) { @@ -139,12 +141,6 @@ ParseMessage(msg); } -#ifdef WIN32 - Sleep(mStepDelay / 1000); -#else - usleep(mStepDelay); -#endif - mForwardStep = false; } @@ -229,6 +225,7 @@ } mActiveScene = mSceneServer->GetActiveScene(); + mActiveScene->UpdateCache(); if (mActiveScene.get() == 0) { @@ -271,6 +268,7 @@ mSceneImporter->ParseScene(string(pcont->lastPos), mManagedScene, boost::shared_ptr<ParameterList>()); + mActiveScene->SetModified(true); destroy_sexp(mSexpMemory, sexp_custom); destroy_continuation(mSexpMemory, pcont); Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h 2011-03-27 21:47:57 UTC (rev 265) @@ -62,9 +62,6 @@ /** backward play the log file back */ void BackwardPlayback(); - /** set the length of delay between steps */ - void SetStepDelay(int delay){ mStepDelay = delay; } - protected: /** parses a received message */ void ParseMessage(const std::string& msg); @@ -107,9 +104,6 @@ /** line numbers storage */ std::stack<unsigned> linePositions; - /** the length of delay between seteps */ - int mStepDelay; - bool mBackwardPlayback; /** cached reference to the script server */ Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp 2011-03-27 21:47:57 UTC (rev 265) @@ -40,25 +40,9 @@ return true; } -FUNCTION(SparkMonitorLogFileServer, setStepDelay) -{ - int inDelay; - - if ( - (in.GetSize() != 1) || - (! in.GetValue(in[0], inDelay)) - ) - { - return false; - } - - obj->SetStepDelay(inDelay); - return true; -} - FUNCTION(SparkMonitorLogFileServer, pauseMode) { - if (in.GetSize() != 0) + if (in.GetSize() != 0) { return false; } @@ -69,7 +53,7 @@ FUNCTION(SparkMonitorLogFileServer, stepForward) { - if (in.GetSize() != 0) + if (in.GetSize() != 0) { return false; } @@ -80,7 +64,7 @@ FUNCTION(SparkMonitorLogFileServer, stepBackward) { - if (in.GetSize() != 0) + if (in.GetSize() != 0) { return false; } @@ -91,7 +75,7 @@ FUNCTION(SparkMonitorLogFileServer, playBackward) { - if (in.GetSize() != 0) + if (in.GetSize() != 0) { return false; } @@ -109,5 +93,4 @@ DEFINE_FUNCTION(stepForward); DEFINE_FUNCTION(stepBackward); DEFINE_FUNCTION(playBackward); - DEFINE_FUNCTION(setStepDelay); } Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/spark/spark.rb 2011-03-27 21:47:57 UTC (rev 265) @@ -198,6 +198,10 @@ simulationServer = sparkGetSimulationServer() if (simulationServer != nil) simulationServer.setMultiThreads(false) + + # set auto speed adjust mode. + simulationServer.setAdjustSpeed(true) + simulationServer.setMaxStepsPerCyle(1) end monitorClient = sparkCreate('SparkMonitorClient', $serverPath+'simulation/SparkMonitorClient') @@ -229,6 +233,10 @@ if (simulationServer != nil) simulationServer.setMultiThreads(false) + # set auto speed adjust mode. + simulationServer.setAdjustSpeed(true) + simulationServer.setMaxStepsPerCyle(1) + monitorClient = sparkCreate('SparkMonitorLogFileServer', $serverPath+'simulation/SparkMonitorLogFileServer') monitorClient.setFileName($logPlayerFile) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-26 02:16:43
|
Revision: 264 http://simspark.svn.sourceforge.net/simspark/?rev=264&view=rev Author: hedayat Date: 2011-03-26 02:16:36 +0000 (Sat, 26 Mar 2011) Log Message: ----------- * S-Expression library is now thread-safe. It was the source of crashes in multi-threaded mode Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp trunk/spark/plugin/rubysceneimporter/rubysceneimporter.h trunk/spark/plugin/sexpparser/sexpparser.cpp trunk/spark/plugin/sexpparser/sexpparser.h trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorclient.h trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h trunk/spark/utility/sfsexp/io.c trunk/spark/utility/sfsexp/parser.c trunk/spark/utility/sfsexp/sexp.c trunk/spark/utility/sfsexp/sexp.h trunk/spark/utility/sfsexp/sexp_ops.c trunk/spark/utility/sfsexp/sexp_ops.h Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/ChangeLog 2011-03-26 02:16:36 UTC (rev 264) @@ -1,5 +1,24 @@ 2011-03-26 Hedayat Vatankhah <hed...@gm...> + * plugin/sexpparser/sexpparser.h: + * plugin/sexpparser/sexpparser.cpp: + * plugin/rubysceneimporter/rubysceneimporter.h: + * plugin/rubysceneimporter/rubysceneimporter.cpp: + * plugin/sparkmonitor/sparkmonitorclient.h: + * plugin/sparkmonitor/sparkmonitorclient.cpp: + * plugin/sparkmonitor/sparkmonitorlogfileserver.h: + * plugin/sparkmonitor/sparkmonitorlogfileserver.cpp: + - updated to be compatible with the reentrant s-expression library + + * utility/sfsexp/sexp.h: + * utility/sfsexp/sexp.c: + * utility/sfsexp/parser.c: + * utility/sfsexp/io.c: + * utility/sfsexp/sexp_ops.c: + * utility/sfsexp/sexp_ops.h: + - s-expression library is now reentrant and thread-safe. solves many + crashes in multi-threaded mode + * NEWS: * RELEASE: - updated for 0.2.2 release Modified: trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp =================================================================== --- trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp 2011-03-26 02:16:36 UTC (rev 264) @@ -86,10 +86,12 @@ mUpdateSceneDict = false; InitTranslationTable(); + mSexpMemory = init_sexp_memory(); } RubySceneImporter::~RubySceneImporter() { + destroy_sexp_memory(mSexpMemory); } void RubySceneImporter::SetUnlinkOnCompleteScenes(bool unlink) @@ -180,7 +182,8 @@ { // parse s-expressions pcont_t* pcont = init_continuation(const_cast<char*>(scene)); - sexp_t* sexp = iparse_sexp(const_cast<char*>(scene),size,pcont); + sexp_t* sexp = iparse_sexp(mSexpMemory, + const_cast<char*>(scene), size, pcont); // read scene magic and version if ( @@ -190,16 +193,16 @@ (mVersionMinor != 1) ) { - destroy_sexp(sexp); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp); + destroy_continuation(mSexpMemory, pcont); return false; } // advance to next sexpression- the scene graph PushParameter(parameter); - destroy_sexp(sexp); - sexp = iparse_sexp(const_cast<char*>(scene),size,pcont); + destroy_sexp(mSexpMemory, sexp); + sexp = iparse_sexp(mSexpMemory, const_cast<char*>(scene), size, pcont); if (sexp == 0) { @@ -223,8 +226,8 @@ ReadDeltaGraph(sexp,root) : ReadGraph(sexp,root); - destroy_sexp(sexp); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp); + destroy_continuation(mSexpMemory, pcont); InvokeMethods(); PopParameter(); @@ -489,7 +492,7 @@ { return false; } - } + } else { if (! EvalParameter(sexp->list, atom)) Modified: trunk/spark/plugin/rubysceneimporter/rubysceneimporter.h =================================================================== --- trunk/spark/plugin/rubysceneimporter/rubysceneimporter.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/rubysceneimporter/rubysceneimporter.h 2011-03-26 02:16:36 UTC (rev 264) @@ -140,6 +140,9 @@ /** the abbreviaton table */ TTranslationTable mTranslationTable; + + /** the s-expression library memory management object */ + sexp_mem_t *mSexpMemory; }; DECLARE_CLASS(RubySceneImporter); Modified: trunk/spark/plugin/sexpparser/sexpparser.cpp =================================================================== --- trunk/spark/plugin/sexpparser/sexpparser.cpp 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sexpparser/sexpparser.cpp 2011-03-26 02:16:36 UTC (rev 264) @@ -30,10 +30,12 @@ SexpParser::SexpParser() : BaseParser() { + mSexpMemory = init_sexp_memory(); } SexpParser::~SexpParser() { + destroy_sexp_memory(mSexpMemory); } boost::shared_ptr<PredicateList> @@ -49,16 +51,18 @@ char* c = const_cast<char*>(input.c_str()); pcont_t* pcont = init_continuation(c); - sexp_t* sexp = iparse_sexp(c,static_cast<int>(input.size()),pcont); + sexp_t* sexp = iparse_sexp(mSexpMemory, c, static_cast<int>(input.size()), + pcont); while (sexp != 0) { SexpToPredicate(predList,sexp); - destroy_sexp(sexp); - sexp = iparse_sexp(c,static_cast<int>(input.size()),pcont); + destroy_sexp(mSexpMemory, sexp); + sexp = iparse_sexp(mSexpMemory, c, static_cast<int>(input.size()), + pcont); } - destroy_continuation(pcont); + destroy_continuation(mSexpMemory, pcont); return predList; } Modified: trunk/spark/plugin/sexpparser/sexpparser.h =================================================================== --- trunk/spark/plugin/sexpparser/sexpparser.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sexpparser/sexpparser.h 2011-03-26 02:16:36 UTC (rev 264) @@ -48,6 +48,10 @@ void PredicateToString(std::stringstream& ss, const oxygen::Predicate& predicate); + +private: + /** the s-expression library memory management object */ + sexp_mem_t *mSexpMemory; }; DECLARE_CLASS(SexpParser); Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp 2011-03-26 02:16:36 UTC (rev 264) @@ -38,10 +38,12 @@ SparkMonitorClient::SparkMonitorClient() : NetClient() { + mSexpMemory = init_sexp_memory(); } SparkMonitorClient::~SparkMonitorClient() { + destroy_sexp_memory(mSexpMemory); } void SparkMonitorClient::OnLink() @@ -192,7 +194,7 @@ mActiveScene = mSceneServer->GetActiveScene(); mActiveScene->UpdateCache(); - + if (mActiveScene.get() == 0) { return; @@ -220,12 +222,12 @@ char* msgBuf = const_cast<char*>(msg.c_str()); pcont_t* pcont = init_continuation(msgBuf); - sexp_t* sexp_custom = iparse_sexp(msgBuf,msg.size(),pcont); + sexp_t* sexp_custom = iparse_sexp(mSexpMemory, msgBuf, msg.size(), pcont); if (sexp_custom == 0) { - destroy_sexp(sexp_custom); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp_custom); + destroy_continuation(mSexpMemory, pcont); return; } @@ -234,9 +236,9 @@ mSceneImporter->ParseScene(string(pcont->lastPos), mManagedScene, boost::shared_ptr<ParameterList>()); - + mActiveScene->SetModified(true); - destroy_sexp(sexp_custom); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp_custom); + destroy_continuation(mSexpMemory, pcont); } Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorclient.h =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorclient.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorclient.h 2011-03-26 02:16:36 UTC (rev 264) @@ -72,6 +72,9 @@ /** the root node of the managed scene */ boost::shared_ptr<oxygen::BaseNode> mManagedScene; + + /** the s-expression library memory management object */ + sexp_mem_t *mSexpMemory; }; DECLARE_CLASS(SparkMonitorClient); Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp 2011-03-26 02:16:36 UTC (rev 264) @@ -44,10 +44,12 @@ mForwardStep = false; mStepDelay = 0; mBackwardPlayback = false; + mSexpMemory = init_sexp_memory(); } SparkMonitorLogFileServer::~SparkMonitorLogFileServer() { + destroy_sexp_memory(mSexpMemory); } void SparkMonitorLogFileServer::OnLink() @@ -136,7 +138,7 @@ { ParseMessage(msg); } - + #ifdef WIN32 Sleep(mStepDelay / 1000); #else @@ -225,7 +227,7 @@ { return; } - + mActiveScene = mSceneServer->GetActiveScene(); if (mActiveScene.get() == 0) @@ -255,12 +257,12 @@ char* msgBuf = const_cast<char*>(msg.c_str()); pcont_t* pcont = init_continuation(msgBuf); - sexp_t* sexp_custom = iparse_sexp(msgBuf,msg.size(),pcont); + sexp_t* sexp_custom = iparse_sexp(mSexpMemory, msgBuf, msg.size(), pcont); if (sexp_custom == 0) { - destroy_sexp(sexp_custom); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp_custom); + destroy_continuation(mSexpMemory, pcont); return; } @@ -270,8 +272,8 @@ mManagedScene, boost::shared_ptr<ParameterList>()); - destroy_sexp(sexp_custom); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp_custom); + destroy_continuation(mSexpMemory, pcont); } void Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h 2011-03-26 02:16:36 UTC (rev 264) @@ -114,6 +114,9 @@ /** cached reference to the script server */ boost::shared_ptr<zeitgeist::ScriptServer> mScriptServer; + + /** the s-expression library memory management object */ + sexp_mem_t *mSexpMemory; }; DECLARE_CLASS(SparkMonitorLogFileServer); Modified: trunk/spark/utility/sfsexp/io.c =================================================================== --- trunk/spark/utility/sfsexp/io.c 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/io.c 2011-03-26 02:16:36 UTC (rev 264) @@ -66,17 +66,17 @@ /** * */ -void destroy_iowrap(sexp_iowrap_t *iow) { +void destroy_iowrap(sexp_mem_t *smem, sexp_iowrap_t *iow) { if (iow == NULL) return; /* idiot */ - destroy_continuation(iow->cc); + destroy_continuation(smem, iow->cc); free(iow); } /** * */ -sexp_t *read_one_sexp(sexp_iowrap_t *iow) { +sexp_t *read_one_sexp(sexp_mem_t *smem, sexp_iowrap_t *iow) { sexp_t *sx = NULL; if (iow->cnt == 0) { @@ -84,7 +84,7 @@ if (iow->cnt == 0) return NULL; } - iow->cc = cparse_sexp(iow->buf,iow->cnt,iow->cc); + iow->cc = cparse_sexp(smem, iow->buf,iow->cnt,iow->cc); while (iow->cc->last_sexp == NULL) { if (iow->cc->error != 0) { @@ -97,7 +97,7 @@ if (iow->cnt == 0) return NULL; - iow->cc = cparse_sexp(iow->buf,iow->cnt,iow->cc); + iow->cc = cparse_sexp(smem, iow->buf,iow->cnt,iow->cc); } sx = iow->cc->last_sexp; Modified: trunk/spark/utility/sfsexp/parser.c =================================================================== --- trunk/spark/utility/sfsexp/parser.c 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/parser.c 2011-03-26 02:16:36 UTC (rev 264) @@ -70,48 +70,33 @@ parse_data_t; /** - * parse_data_t stack - similar malloc prevention to sexp_t_cache. - */ -faststack_t *pd_cache; - -/** - * The global <I>sexp_t_cache</I> is a faststack implementing a cache of - * pre-alloced s-expression element entities. Odds are a user should never - * touch this. If you do, you're on your own. This is used internally by - * the parser and related code to store unused but allocated sexp_t elements. - * This should be left alone and manipulated only by the sexp_t_allocate and - * sexp_t_deallocate functions. Touching the stack is bad. - */ -faststack_t *sexp_t_cache; - -/** * sexp_t allocation */ #ifdef _NO_MEMORY_MANAGEMENT_ sexp_t * -sexp_t_allocate() { +sexp_t_allocate(smem) { sexp_t *sx = (sexp_t *) calloc(1, sizeof(sexp_t)); assert(sx != NULL); return(sx); } #else sexp_t * -sexp_t_allocate() { +sexp_t_allocate(sexp_mem_t *smem) { sexp_t *sx; stack_lvl_t *l; - if (sexp_t_cache == NULL) { - sexp_t_cache = make_stack(); + if (smem->sexp_t_cache == NULL) { + smem->sexp_t_cache = make_stack(); sx = (sexp_t *)malloc(sizeof(sexp_t)); assert(sx != NULL); sx->next = sx->list = NULL; } else { - if (empty_stack(sexp_t_cache)) { + if (empty_stack(smem->sexp_t_cache)) { sx = (sexp_t *)malloc(sizeof(sexp_t)); assert(sx != NULL); sx->next = sx->list = NULL; } else { - l = pop(sexp_t_cache); + l = pop(smem->sexp_t_cache); sx = (sexp_t *)l->data; } } @@ -130,8 +115,8 @@ } #else void -sexp_t_deallocate(sexp_t *s) { - if (sexp_t_cache == NULL) sexp_t_cache = make_stack(); +sexp_t_deallocate(sexp_mem_t *smem, sexp_t *s) { + if (smem->sexp_t_cache == NULL) smem->sexp_t_cache = make_stack(); if (s == NULL) return; @@ -142,39 +127,39 @@ s->val = NULL; - sexp_t_cache = push(sexp_t_cache, s); + smem->sexp_t_cache = push(smem->sexp_t_cache, s); } #endif /** * cleanup the sexp library. Note this is implemented HERE since we need - * to know about pd_cache, which is local to this file. + * to know about smem->pd_cache, which is local to this file. */ #ifdef _NO_MEMORY_MANAGEMENT_ void sexp_cleanup() { } #else -void sexp_cleanup() { +void sexp_cleanup(sexp_mem_t *smem) { stack_lvl_t *l; - if (pd_cache != NULL) { - l = pd_cache->top; + if (smem->pd_cache != NULL) { + l = smem->pd_cache->top; while (l != NULL) { free(l->data); l = l->below; } - destroy_stack(pd_cache); - pd_cache = NULL; + destroy_stack(smem->pd_cache); + smem->pd_cache = NULL; } - if (sexp_t_cache != NULL) { - l = sexp_t_cache->top; + if (smem->sexp_t_cache != NULL) { + l = smem->sexp_t_cache->top; while (l != NULL) { free(l->data); l = l->below; } - destroy_stack(sexp_t_cache); - sexp_t_cache = NULL; + destroy_stack(smem->sexp_t_cache); + smem->sexp_t_cache = NULL; } } #endif @@ -183,20 +168,20 @@ * allocation */ parse_data_t * -pd_allocate() { +pd_allocate(sexp_mem_t *smem) { parse_data_t *p; stack_lvl_t *l; - if (pd_cache == NULL) { - pd_cache = make_stack(); + if (smem->pd_cache == NULL) { + smem->pd_cache = make_stack(); p = (parse_data_t *)malloc(sizeof(parse_data_t)); assert(p!=NULL); } else { - if (empty_stack(pd_cache)) { + if (empty_stack(smem->pd_cache)) { p = (parse_data_t *)malloc(sizeof(parse_data_t)); assert(p!=NULL); } else { - l = pop(pd_cache); + l = pop(smem->pd_cache); p = (parse_data_t *)l->data; } } @@ -208,10 +193,10 @@ * de-allocation */ void -pd_deallocate(parse_data_t *p) { - if (pd_cache == NULL) pd_cache = make_stack(); +pd_deallocate(sexp_mem_t *smem, parse_data_t *p) { + if (smem->pd_cache == NULL) smem->pd_cache = make_stack(); - pd_cache = push(pd_cache, p); + smem->pd_cache = push(smem->pd_cache, p); } /** @@ -220,7 +205,7 @@ * buffers, stacks, etc.. */ void -destroy_continuation (pcont_t * pc) +destroy_continuation (sexp_mem_t *smem, pcont_t * pc) { stack_lvl_t *lvl; parse_data_t *lvl_data; @@ -244,11 +229,11 @@ */ if (lvl_data != NULL) { lvl_data->lst = NULL; - destroy_sexp(lvl_data->fst); + destroy_sexp(smem, lvl_data->fst); lvl_data->fst = NULL; /* free(lvl_data); */ - pd_deallocate(lvl_data); + pd_deallocate(smem, lvl_data); lvl->data = lvl_data = NULL; } @@ -283,17 +268,17 @@ * than one will act up. */ sexp_t * -parse_sexp (char *s, int len) +parse_sexp (sexp_mem_t *smem, char *s, int len) { pcont_t *pc = NULL; sexp_t *sx = NULL; if (len < 1 || s == NULL) return NULL; /* empty string - return */ - pc = cparse_sexp (s, len, pc); + pc = cparse_sexp (smem, s, len, pc); sx = pc->last_sexp; - destroy_continuation(pc); + destroy_continuation(smem, pc); return sx; } @@ -343,7 +328,7 @@ * repeated calls. */ sexp_t * -iparse_sexp (char *s, int len, pcont_t *cc) { +iparse_sexp (sexp_mem_t *smem, char *s, int len, pcont_t *cc) { pcont_t *pc; sexp_t *sx = NULL; @@ -356,7 +341,7 @@ } /* call the parser */ - pc = cparse_sexp(s,len,cc); + pc = cparse_sexp(smem, s,len,cc); if (cc->last_sexp != NULL) { sx = cc->last_sexp; @@ -376,7 +361,7 @@ * Continuation based parser - the guts of the package. */ pcont_t * -cparse_sexp (char *str, int len, pcont_t *lc) +cparse_sexp (sexp_mem_t *smem, char *str, int len, pcont_t *lc) { char *t, *s; register unsigned int binexpected = 0; @@ -567,7 +552,7 @@ /* open paren */ depth++; - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_LIST; @@ -577,7 +562,7 @@ if (stack->height < 1) { - data = pd_allocate(); + data = pd_allocate(smem); assert(data!=NULL); data->fst = data->lst = sx; push (stack, data); @@ -592,7 +577,7 @@ data->lst = sx; } - data = pd_allocate(); + data = pd_allocate(smem); assert(data!=NULL); data->fst = data->lst = NULL; push (stack, data); @@ -637,7 +622,7 @@ data = (parse_data_t *) lvl->data; sx = data->fst; /* free (data); */ - pd_deallocate(data); + pd_deallocate(smem, data); lvl->data = NULL; if (stack->top != NULL) @@ -672,7 +657,7 @@ data = (parse_data_t *) lvl->data; sx = data->fst; /* free (data); */ - pd_deallocate(data); + pd_deallocate(smem, data); lvl->data = NULL; } cc->last_sexp = sx; @@ -707,7 +692,7 @@ vcur[0] = '\0'; val_used++; - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_VALUE; @@ -839,7 +824,7 @@ vcur[0] = '\0'; val_used++; - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_VALUE; @@ -994,7 +979,7 @@ { state = 1; vcur[0] = '\0'; - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_VALUE; @@ -1165,7 +1150,7 @@ if (binread == binexpected) { /* state = 1 -- create a sexp_t and head back */ - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_VALUE; @@ -1239,7 +1224,7 @@ data = (parse_data_t *) lvl->data; sx = data->fst; /* free (data); */ - pd_deallocate(data); + pd_deallocate(smem, data); lvl->data = NULL; } cc->last_sexp = sx; Modified: trunk/spark/utility/sfsexp/sexp.c =================================================================== --- trunk/spark/utility/sfsexp/sexp.c 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/sexp.c 2011-03-26 02:16:36 UTC (rev 264) @@ -41,27 +41,41 @@ #define snprintf _snprintf #endif +sexp_mem_t *init_sexp_memory() +{ + sexp_mem_t *smem = malloc(sizeof(sexp_mem_t)); + smem->pd_cache = NULL; + smem->sexp_t_cache = NULL; + return smem; +} + +void destroy_sexp_memory(sexp_mem_t *smem) +{ + if (smem) + free(smem); +} + /** * Recursively walk an s-expression and free it. */ void -destroy_sexp (sexp_t * s) +destroy_sexp (sexp_mem_t *smem, sexp_t * s) { if (s == NULL) return; if (s->ty == SEXP_LIST) - destroy_sexp (s->list); + destroy_sexp (smem, s->list); if (s->ty == SEXP_VALUE && s->val != NULL) free(s->val); s->val = NULL; - destroy_sexp (s->next); + destroy_sexp (smem, s->next); s->next = s->list = NULL; - sexp_t_deallocate(s); + sexp_t_deallocate(smem, s); } /** @@ -69,7 +83,7 @@ * representation of the s-expression. Fills the buffer. */ int -print_sexp (char *buf, int size, sexp_t * sx) +print_sexp (sexp_mem_t *smem, char *buf, int size, sexp_t * sx) { int retval; int sz; @@ -86,7 +100,7 @@ return -1; } - fakehead = sexp_t_allocate(); + fakehead = sexp_t_allocate(smem); assert(fakehead!=NULL); /* duplicate the head to prevent going down a sx->next path @@ -302,7 +316,7 @@ } destroy_stack (stack); - sexp_t_deallocate(fakehead); + sexp_t_deallocate(smem, fakehead); return retval; } @@ -312,7 +326,7 @@ * representation of the s-expression. Fills the buffer. */ int -print_sexp_cstr (CSTRING **s, sexp_t *sx, int ss, int gs) +print_sexp_cstr (sexp_mem_t *smem, CSTRING **s, sexp_t *sx, int ss, int gs) { int retval; char *tc; @@ -333,7 +347,7 @@ _s = snew(ss); sgrowsize(gs); - fakehead = sexp_t_allocate(); + fakehead = sexp_t_allocate(smem); assert(fakehead!=NULL); /* duplicate the head to prevent going down a sx->next path @@ -457,7 +471,7 @@ retval = _s->curlen; destroy_stack (stack); - sexp_t_deallocate(fakehead); + sexp_t_deallocate(smem, fakehead); return retval; } @@ -465,8 +479,8 @@ /** * Allocate a new sexp_t element representing a list. */ -sexp_t *new_sexp_list(sexp_t *l) { - sexp_t *sx = sexp_t_allocate(); +sexp_t *new_sexp_list(sexp_mem_t *smem, sexp_t *l) { + sexp_t *sx = sexp_t_allocate(smem); sx->ty = SEXP_LIST; @@ -482,8 +496,8 @@ /** * allocate a new sexp_t element representing a value */ -sexp_t *new_sexp_atom(char *buf, int bs) { - sexp_t *sx = sexp_t_allocate(); +sexp_t *new_sexp_atom(sexp_mem_t *smem, char *buf, int bs) { + sexp_t *sx = sexp_t_allocate(smem); sx->ty = SEXP_VALUE; Modified: trunk/spark/utility/sfsexp/sexp.h =================================================================== --- trunk/spark/utility/sfsexp/sexp.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/sexp.h 2011-03-26 02:16:36 UTC (rev 264) @@ -200,6 +200,24 @@ /* STRUCTURES */ /*============*/ +typedef struct sexp_mem +{ + /** + * parse_data_t stack - similar malloc prevention to sexp_t_cache. + */ + faststack_t *pd_cache; + + /** + * The global <I>sexp_t_cache</I> is a faststack implementing a cache of + * pre-alloced s-expression element entities. Odds are a user should never + * touch this. If you do, you're on your own. This is used internally by + * the parser and related code to store unused but allocated sexp_t elements. + * This should be left alone and manipulated only by the sexp_t_allocate and + * sexp_t_deallocate functions. Touching the stack is bad. + */ + faststack_t *sexp_t_cache; +} sexp_mem_t; + /** * An s-expression is represented as a linked structure of elements, * where each element is either an <I>atom</I> or <I>list</I>. An @@ -550,14 +568,14 @@ * sexp_t_deallocate to deallocate them and put them in the pool.</I> * Also, if the stack has not been initialized yet, this does so. */ - sexp_t *sexp_t_allocate(); + sexp_t *sexp_t_allocate(sexp_mem_t *smem); /** * given a malloc'd sexp_t element, put it back into the already-allocated * element stack. This method will allocate a stack if one has not been * allocated already. */ - void sexp_t_deallocate(sexp_t *s); + void sexp_t_deallocate(sexp_mem_t *smem, sexp_t *s); /** * In the event that someone wants us to release ALL of the memory used @@ -565,7 +583,7 @@ * this, the caches will be persistent for the lifetime of the library * user. */ - void sexp_cleanup(); + void sexp_cleanup(sexp_mem_t *smem); /** * print a sexp_t struct as a string in the LISP style. If the buffer @@ -575,7 +593,7 @@ * value is -1 and the contents of the buffer should not be assumed to * contain any useful information. */ - int print_sexp(char *loc, int size, sexp_t *e); + int print_sexp(sexp_mem_t *smem, char *loc, int size, sexp_t *e); /** * print a sexp_t structure to a buffer, growing it as necessary instead @@ -583,17 +601,17 @@ * to tune for performance reasons are <tt>ss</tt> and <tt>gs</tt> - the * buffer start size and growth size. */ - int print_sexp_cstr(CSTRING **s, sexp_t *e, int ss, int gs); + int print_sexp_cstr(sexp_mem_t *smem, CSTRING **s, sexp_t *e, int ss, int gs); /** * Allocate a new sexp_t element representing a list. */ - sexp_t *new_sexp_list(sexp_t *l); + sexp_t *new_sexp_list(sexp_mem_t *smem, sexp_t *l); /** * allocate a new sexp_t element representing a value */ - sexp_t *new_sexp_atom(char *buf, int bs); + sexp_t *new_sexp_atom(sexp_mem_t *smem, char *buf, int bs); /** * create an initial continuation for parsing the given string @@ -604,7 +622,7 @@ * destroy a continuation. This involves cleaning up what it contains, * and cleaning up the continuation itself. */ - void destroy_continuation (pcont_t * pc); + void destroy_continuation (sexp_mem_t *smem, pcont_t * pc); /** * create an IO wrapper structure around a file descriptor. @@ -614,7 +632,7 @@ /** * destroy an IO wrapper structure */ - void destroy_iowrap(sexp_iowrap_t *iow); + void destroy_iowrap(sexp_mem_t *smem, sexp_iowrap_t *iow); /** * given and IO wrapper handle, read one s-expression off of it. this @@ -622,24 +640,24 @@ * guarantee that under the covers an IO read actually is occuring. * returning null implies no s-expression was able to be read. */ - sexp_t *read_one_sexp(sexp_iowrap_t *iow); + sexp_t *read_one_sexp(sexp_mem_t *smem, sexp_iowrap_t *iow); /** * wrapper around parser for compatibility. */ - sexp_t *parse_sexp(char *s, int len); + sexp_t *parse_sexp(sexp_mem_t *smem, char *s, int len); /** * wrapper around parser for friendlier continuation use * pre-condition : continuation (cc) is NON-NULL! */ - sexp_t *iparse_sexp(char *s, int len, pcont_t *cc); + sexp_t *iparse_sexp(sexp_mem_t *smem, char *s, int len, pcont_t *cc); /** * given a LISP style s-expression string, parse it into a set of * connected sexp_t structures. */ - pcont_t *cparse_sexp(char *s, int len, pcont_t *pc); + pcont_t *cparse_sexp(sexp_mem_t *smem, char *s, int len, pcont_t *pc); /** * given a sexp_t structure, free the memory it uses (and recursively free @@ -649,8 +667,11 @@ * pre-allocated elements. This is an optimization to speed up the * parser to eliminate wasteful free and re-malloc calls. */ - void destroy_sexp(sexp_t *s); + void destroy_sexp(sexp_mem_t *smem, sexp_t *s); + sexp_mem_t *init_sexp_memory(); + void destroy_sexp_memory(sexp_mem_t *smem); + /* this is for C++ users */ #ifdef __cplusplus } Modified: trunk/spark/utility/sfsexp/sexp_ops.c =================================================================== --- trunk/spark/utility/sfsexp/sexp_ops.c 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/sexp_ops.c 2011-03-26 02:16:36 UTC (rev 264) @@ -121,12 +121,12 @@ /** * Copy an s-expression. */ -sexp_t *copy_sexp(sexp_t *s) { +sexp_t *copy_sexp(sexp_mem_t *smem, sexp_t *s) { sexp_t *snew; if (s == NULL) return NULL; - snew = sexp_t_allocate(); + snew = sexp_t_allocate(smem); assert(snew != NULL); snew->ty = s->ty; @@ -143,11 +143,11 @@ strcpy(snew->val,s->val); snew->list = NULL; } else { - snew->list = copy_sexp(s->list); + snew->list = copy_sexp(smem, s->list); } snew->line = s->line; - snew->next = copy_sexp(s->next); + snew->next = copy_sexp(smem, s->next); return snew; } @@ -156,31 +156,31 @@ * Cons: Concatenate two s-expressions together, without references to the * originals. */ -sexp_t *cons_sexp(sexp_t *r, sexp_t *l) { +sexp_t *cons_sexp(sexp_mem_t *smem, sexp_t *r, sexp_t *l) { sexp_t *cr, *cl, *t; - cr = copy_sexp(r); + cr = copy_sexp(smem, r); if (cr->ty == SEXP_VALUE) { fprintf(stderr,"Cannot cons non-lists.\n"); - destroy_sexp(cr); + destroy_sexp(smem, cr); return NULL; } else { t = cr->list; while (t != NULL && t->next != NULL) t = t->next; } - cl = copy_sexp(l); + cl = copy_sexp(smem, l); if (cl->ty == SEXP_LIST) { if (t != NULL && cl != NULL) { t->next = cl->list; /* free(cl); */ /* memory leak fix: SMJ, 4/24/2002 */ - sexp_t_deallocate(cl); + sexp_t_deallocate(smem, cl); } } else { fprintf(stderr,"Cannot cons non-lists.\n"); - destroy_sexp(cr); - destroy_sexp(cl); + destroy_sexp(smem, cr); + destroy_sexp(smem, cl); return NULL; } @@ -190,7 +190,7 @@ /** * car: similar to head, except this is a copy and not just a reference. */ -sexp_t *car_sexp(sexp_t *s) { +sexp_t *car_sexp(sexp_mem_t *smem, sexp_t *s) { sexp_t *cr, *ocr; /* really dumb - calling on null */ @@ -206,14 +206,14 @@ } /* ocr = (sexp_t *)malloc(sizeof(sexp_t));*/ - ocr = sexp_t_allocate(); + ocr = sexp_t_allocate(smem); assert(ocr != NULL); ocr->ty = SEXP_LIST; ocr->next = NULL; /* allocate the new sexp_t */ /* cr = (sexp_t *)malloc(sizeof(sexp_t)); */ - cr = sexp_t_allocate(); + cr = sexp_t_allocate(smem); assert(cr != NULL); ocr->list = cr; @@ -226,7 +226,7 @@ } else { cr->ty = SEXP_LIST; cr->next = NULL; - cr->list = copy_sexp(s->list->list); + cr->list = copy_sexp(smem, s->list->list); } return ocr; @@ -235,7 +235,7 @@ /** * cdr: similar to tail, except this is a copy and not just a reference. */ -sexp_t *cdr_sexp(sexp_t *s) { +sexp_t *cdr_sexp(sexp_mem_t *smem, sexp_t *s) { sexp_t *cd; /* really dumb */ @@ -251,12 +251,12 @@ } /* cd = (sexp_t *)malloc(sizeof(sexp_t)); */ - cd = sexp_t_allocate(); + cd = sexp_t_allocate(smem); assert(cd != NULL); cd->ty = SEXP_LIST; cd->next = NULL; - cd->list = copy_sexp(s->list->next); + cd->list = copy_sexp(smem, s->list->next); cd->line = s->line; return cd; } Modified: trunk/spark/utility/sfsexp/sexp_ops.h =================================================================== --- trunk/spark/utility/sfsexp/sexp_ops.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/sexp_ops.h 2011-03-26 02:16:36 UTC (rev 264) @@ -47,22 +47,22 @@ /*========*/ /* MACROS */ /*========*/ - + /** * Return the head of a list \a s by reference, not copy. */ #define hd_sexp(s) ((s)->list) - + /** * Return the tail of a list \a s by reference, not copy. */ -#define tl_sexp(s) ((s)->list->next) - +#define tl_sexp(s) ((s)->list->next) + /** * Return the element following the argument \a s. */ #define next_sexp(s) ((s)->next) - + /** * Reset the continuation \a c by setting the \c lastPos pointer to * \c NULL. @@ -71,11 +71,11 @@ /** * Find an atom in a sexpression data structure and return a pointer to - * it. Return NULL if the string doesn't occur anywhere as an atom. + * it. Return NULL if the string doesn't occur anywhere as an atom. * This is a depth-first search algorithm. */ sexp_t *find_sexp(char *name, sexp_t *start); - + /** * Breadth first search for s-expressions. Depth first search will find * the first occurance of a string in an s-expression by basically finding @@ -93,30 +93,30 @@ * to the end of the ->next linked list from that point. */ int sexp_list_length(sexp_t *sx); - + /** * Copy an s-expression. This is a deep copy - so the resulting s-expression * shares no pointers with the original. The new one can be changed without * damaging the contents of the original. */ - sexp_t *copy_sexp(sexp_t *s); - + sexp_t *copy_sexp(sexp_mem_t *smem, sexp_t *s); + /** * Cons: Concatenate two s-expressions together, without references to the * originals. */ - sexp_t *cons_sexp(sexp_t *r, sexp_t *l); - + sexp_t *cons_sexp(sexp_mem_t *smem, sexp_t *r, sexp_t *l); + /** * car: Like hd(), but returning a copy of the head, not a reference to it. */ - sexp_t *car_sexp(sexp_t *s); - + sexp_t *car_sexp(sexp_mem_t *smem, sexp_t *s); + /** * cdr: Like tl(), but returning a copy of the tail, not a reference to it. */ - sexp_t *cdr_sexp(sexp_t *s); - + sexp_t *cdr_sexp(sexp_mem_t *smem, sexp_t *s); + #ifdef __cplusplus } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-25 22:43:21
|
Revision: 263 http://simspark.svn.sourceforge.net/simspark/?rev=263&view=rev Author: hedayat Date: 2011-03-25 22:43:15 +0000 (Fri, 25 Mar 2011) Log Message: ----------- * updated RELEASE and NEWS for 0.2.2 release * A small cleanup: SimulationServer::AdvanceTime() is now protected and InputControl don't try to advance time be default Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/NEWS trunk/spark/RELEASE trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/spark/spark.rb Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/ChangeLog 2011-03-25 22:43:15 UTC (rev 263) @@ -1,3 +1,22 @@ +2011-03-26 Hedayat Vatankhah <hed...@gm...> + + * NEWS: + * RELEASE: + - updated for 0.2.2 release + + * lib/kerosin/inputserver/inputcontrol.cpp (InputControl::InputControl): + - turn off advancing the time by InputControl(since it no longer works in + the new timing system). In fact, all timing code should be removed from + InputControl/InputSystem/InputServer and InputSystemSDL. + + * spark/spark.rb: + - removed the code to turn off InputControl's timing functionality as it + is off be default now + + * lib/oxygen/simulationserver/simulationserver.h (SimulationServer): + - made AdvanceTime() method protected: it is not expected to be called + externally anymore + 2011-03-25 Hedayat Vatankhah <hed...@gm...> * lib/oxygen/simulationserver/simulationserver.h (SimulationServer): Modified: trunk/spark/NEWS =================================================================== --- trunk/spark/NEWS 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/NEWS 2011-03-25 22:43:15 UTC (rev 263) @@ -1,3 +1,21 @@ +[0.2.2] +This release features many small enhancements which will benefit users. +It contains many bug fixes and performance improvements, in addition to +fixing some compilation issues. The behavior of ACC perceptor has been slightly +changed, and the multi-threaded mode should work without any known bugs. +Support for the camera sensor is improved too. More details are as follows: + +- ACC sensor provides raw data without any pre-processing + -- You can apply the following filter to 'RawACC' value received from the + simulator to get ACC value as what you'd receive in previous versions: + ACC = 0.9 * ACC + (0.1) * RawACC +- Using base64 encoding for camera perceptor +- Fixed bugs in multi-threaded mode. +- Compilation fixes +- HingePerceptor can report torque +- Better Performance +- New timing system result in more cleaner code and prevent wasting CPU time + [0.2.1] This release of simspark is prepared for RoboCup 2010 competitions in Singapore. In this release you can find some bug and compilation fixes, improved Windows Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/RELEASE 2011-03-25 22:43:15 UTC (rev 263) @@ -7,11 +7,15 @@ Support for the camera sensor is improved too. More details are as follows: - ACC sensor provides raw data without any pre-processing + -- You can apply the following filter to 'RawACC' value received from the + simulator to get ACC value as what you'd receive in previous versions: + ACC = 0.9 * ACC + (0.1) * RawACC - Using base64 encoding for camera perceptor - Fixed bugs in multi-threaded mode. - Compilation fixes - HingePerceptor can report torque - Better Performance +- New timing system result in more cleaner code and prevent wasting CPU time You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp =================================================================== --- trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp 2011-03-25 22:43:15 UTC (rev 263) @@ -35,7 +35,7 @@ mDeltaTime = 0; mHorSens = 0.3f; mVertSens = 0.3f; - mAdvanceTime = true; + mAdvanceTime = false; mMouseLook = false; } @@ -229,11 +229,12 @@ } } - if (mAdvanceTime) - { - // pass the delta time on to the SimulationServer - GetSimulationServer()->AdvanceTime(mDeltaTime); - } + // No longer works +// if (mAdvanceTime) +// { +// // pass the delta time on to the SimulationServer +// GetSimulationServer()->AdvanceTime(mDeltaTime); +// } } float Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-25 22:43:15 UTC (rev 263) @@ -58,7 +58,7 @@ public: SimulationServer(); - ~SimulationServer(); + virtual ~SimulationServer(); /** exits the simulation on the next simulation step */ static void Quit(); @@ -78,11 +78,6 @@ /** returns the simulation time step */ virtual float GetSimStep(); - /** increases the accumulated time since the last simulation step, - but does not step the simulation - */ - virtual void AdvanceTime(float deltaTime); - /** returns the accumulated time since the last simulation step */ virtual float GetSumDeltaTime(); @@ -158,6 +153,11 @@ protected: virtual void OnLink(); + /** increases the accumulated time since the last simulation step, + but does not step the simulation + */ + virtual void AdvanceTime(float deltaTime); + /** advances the simulation mSumDeltaTime seconds. If mSimStep is nonzero this is done in discrete steps */ virtual void Step(); Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/spark/spark.rb 2011-03-25 22:43:15 UTC (rev 263) @@ -413,12 +413,6 @@ # 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(false) - end end def sparkSetupTimer(timerSystem = $defaultTimerSystem) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-25 22:36:25
|
Revision: 262 http://simspark.svn.sourceforge.net/simspark/?rev=262&view=rev Author: hedayat Date: 2011-03-25 22:36:19 +0000 (Fri, 25 Mar 2011) Log Message: ----------- Updated RELEASE and NEWS notes for 0.6.5 release Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/NEWS trunk/rcssserver3d/RELEASE Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2011-03-25 00:54:16 UTC (rev 261) +++ trunk/rcssserver3d/ChangeLog 2011-03-25 22:36:19 UTC (rev 262) @@ -1,3 +1,9 @@ +2011-03-26 Hedayat Vatankhah <hed...@gm...> + + * NEWS: + * RELEASE: + - updated for 0.6.5 release + 2011-03-25 Hedayat Vatankhah <hed...@gm...> * rcssserver3d/CMakeLists.txt: Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2011-03-25 00:54:16 UTC (rev 261) +++ trunk/rcssserver3d/NEWS 2011-03-25 22:36:19 UTC (rev 262) @@ -1,3 +1,35 @@ +[0.6.5] +This release comes with a number of enhancements and some bug fixes. Most +notably, the automated referee is improved to prevent many agents to collide +with each other which is required for running games with more players. Also, to +better suite the field for running 9 vs 9 games, the field size is increased +and it is 21x14 now. There are some visual improvements and minor enhancements +to improve the general experience with the simulator. Finally, simspark.rb is +renamed to rcssserver3d.rb for more consistency. + +* New touch rules: +The automated referee now enforces two new rules to better prevent crowding and +a high number of collisions in 9 vs 9 games: +- If an agent is in touch with more than 2 agents (including himself), and he + wasn't in such a situation in the previous time step - which means he is the + last to join the group - he is relocated outside of the field. +- If it is not clear which agent joined the group last, e.g. when 3 players + were all separate at time t, but were all touching each other in time t + 1, + an agent is chosen at random for relocation. + +* Other Enhancements: +- Visual improvements in rcssmonitor3d: new field texture, colored team names + and scores +- Set different agent and monitor ports with --agent-port and --server-port +- Bigger field size: 21x14 +- Updated PDF documentation +- Bug fixes, specially in the automated referee +- New Trainer command (killsim) to terminate the simulator +- Compilation fixes +- Nao robots now sense visual information about field lines by default +- Now you should change the value of enableRealTimeMode variable in + rcssserver3d.rb if you want to turn off using real time mode + [0.6.4] This release is supposed to be the final version of rcssserver3d for RoboCup 2010 in Singapore. The release includes a referee patch contributed Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2011-03-25 00:54:16 UTC (rev 261) +++ trunk/rcssserver3d/RELEASE 2011-03-25 22:36:19 UTC (rev 262) @@ -5,7 +5,8 @@ with each other which is required for running games with more players. Also, to better suite the field for running 9 vs 9 games, the field size is increased and it is 21x14 now. There are some visual improvements and minor enhancements -to improve the general experience with the simulator. +to improve the general experience with the simulator. Finally, simspark.rb is +renamed to rcssserver3d.rb for more consistency. * New touch rules: The automated referee now enforces two new rules to better prevent crowding and @@ -27,6 +28,8 @@ - New Trainer command (killsim) to terminate the simulator - Compilation fixes - Nao robots now sense visual information about field lines by default +- Now you should change the value of enableRealTimeMode variable in + rcssserver3d.rb if you want to turn off using real time mode You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-25 00:54:23
|
Revision: 261 http://simspark.svn.sourceforge.net/simspark/?rev=261&view=rev Author: hedayat Date: 2011-03-25 00:54:16 +0000 (Fri, 25 Mar 2011) Log Message: ----------- * Added TimerSystemSDL * Added Id SVN keyword to the new files * Some cleanups Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/lib/kerosin/inputserver/us.scan.rb trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/plugin/CMakeLists.txt trunk/spark/plugin/timersystemboost/timersystemboost.cpp Added Paths: ----------- trunk/spark/plugin/timersystemsdl/ trunk/spark/plugin/timersystemsdl/CMakeLists.txt trunk/spark/plugin/timersystemsdl/export.cpp trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp trunk/spark/plugin/timersystemsdl/timersystemsdl.h trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp Property Changed: ---------------- trunk/spark/lib/oxygen/simulationserver/timersystem.h trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp trunk/spark/plugin/timersystemboost/CMakeLists.txt trunk/spark/plugin/timersystemboost/export.cpp trunk/spark/plugin/timersystemboost/timersystemboost.cpp trunk/spark/plugin/timersystemboost/timersystemboost.h trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/ChangeLog 2011-03-25 00:54:16 UTC (rev 261) @@ -1,3 +1,22 @@ +2011-03-25 Hedayat Vatankhah <hed...@gm...> + + * lib/oxygen/simulationserver/simulationserver.h (SimulationServer): + - modify SetAutoTimeMode() documents to reflect new changes + + * plugin/timersystemboost/timersystemboost.cpp: + - small cleanups + + * plugin/timersystemsdl/timersystemsdl.h: + * plugin/timersystemsdl/timersystemsdl.cpp: + * plugin/timersystemsdl/timersystemsdl_c.cpp: + * plugin/timersystemsdl/export.cpp: + * plugin/timersystemsdl/CMakeLists.txt: + - added TimerSystemSDL based on inputsdl/timersdl implementation to replace + it. + + * lib/kerosin/inputserver/us.scan.rb: + - added a missing comma! + 2011-03-24 Hedayat Vatankhah <hed...@gm...> * spark/CMakeLists.txt: Modified: trunk/spark/lib/kerosin/inputserver/us.scan.rb =================================================================== --- trunk/spark/lib/kerosin/inputserver/us.scan.rb 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/lib/kerosin/inputserver/us.scan.rb 2011-03-25 00:54:16 UTC (rev 261) @@ -65,7 +65,7 @@ theInputSystem.addCode (Input.IC_KP8, 'kp8', '8'[0], '8'[0], 0); theInputSystem.addCode (Input.IC_KP9, 'kp9', '9'[0], '9'[0], 0); theInputSystem.addCode (Input.IC_KP_DECIMAL, 'kp_decimal', '.'[0], '.'[0], 0); - theInputSystem.addCode (Input.IC_KP_DIVIDE, 'kp_divide' '/'[0], '/'[0], 0); + theInputSystem.addCode (Input.IC_KP_DIVIDE, 'kp_divide', '/'[0], '/'[0], 0); theInputSystem.addCode (Input.IC_KP_MULTIPLY,'kp_multiply', '*'[0], '*'[0], 0); theInputSystem.addCode (Input.IC_KP_MINUS, 'kp_minus', '-'[0], '-'[0], 0); theInputSystem.addCode (Input.IC_KP_PLUS, 'kp_plus', '+'[0], '+'[0], 0); Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-25 00:54:16 UTC (rev 261) @@ -98,8 +98,8 @@ /** sets the auto time mode of the SimulationServer. if set to true the SimulationServer automatically advances the simulation mSimStep time every cycle, this is the default - mode. Otherwise a registered ControlNode takes the - responsibility to do so (by calling AdvanceTime regularly) + mode. Otherwise a TimerSystem must provide SimulationServer with + timing features. */ void SetAutoTimeMode(bool set); Property changes on: trunk/spark/lib/oxygen/simulationserver/timersystem.h ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/spark/plugin/CMakeLists.txt =================================================================== --- trunk/spark/plugin/CMakeLists.txt 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/plugin/CMakeLists.txt 2011-03-25 00:54:16 UTC (rev 261) @@ -31,6 +31,7 @@ add_subdirectory(sceneeffector) add_subdirectory(soundsystemfmod) add_subdirectory(timersystemboost) +add_subdirectory(timersystemsdl) if (APPLE) if (DEVEL) add_subdirectory(imageperceptor) Property changes on: trunk/spark/plugin/timersystemboost/CMakeLists.txt ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/spark/plugin/timersystemboost/export.cpp ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/spark/plugin/timersystemboost/timersystemboost.cpp =================================================================== --- trunk/spark/plugin/timersystemboost/timersystemboost.cpp 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/plugin/timersystemboost/timersystemboost.cpp 2011-03-25 00:54:16 UTC (rev 261) @@ -40,10 +40,11 @@ void TimerSystemBoost::WaitFromLastQueryUntil(float deadline) { int milliseconds = round(deadline * 1000); + boost::thread::sleep(mLastQueryTime + + boost::posix_time::milliseconds(milliseconds)); + // GetLog()->Debug() << "(TimerSystemBoost) Waiting for " << deadline // << " seconds or " << milliseconds << " millisecs\n"; - boost::thread::sleep(mLastQueryTime + - boost::posix_time::milliseconds(milliseconds)); // GetLog()->Debug() << "CURRENT TIME: " << boost::get_system_time() << '\n'; } Property changes on: trunk/spark/plugin/timersystemboost/timersystemboost.cpp ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/spark/plugin/timersystemboost/timersystemboost.h ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/CMakeLists.txt =================================================================== --- trunk/spark/plugin/timersystemsdl/CMakeLists.txt (rev 0) +++ trunk/spark/plugin/timersystemsdl/CMakeLists.txt 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,19 @@ +########### next target ############### + +set(timersystemsdl_LIB_SRCS + export.cpp + timersystemsdl.cpp + timersystemsdl_c.cpp + timersystemsdl.h +) + +include_directories(${SDL_INCLUDE_DIR}) +add_library(timersystemsdl MODULE ${timersystemsdl_LIB_SRCS}) + +target_link_libraries(timersystemsdl ${spark_libs}) + +if (NOT APPLE) + set_target_properties(timersystemsdl PROPERTIES VERSION 0.0.0 SOVERSION 0) +endif (NOT APPLE) + +install(TARGETS timersystemsdl DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) Property changes on: trunk/spark/plugin/timersystemsdl/CMakeLists.txt ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/export.cpp =================================================================== --- trunk/spark/plugin/timersystemsdl/export.cpp (rev 0) +++ trunk/spark/plugin/timersystemsdl/export.cpp 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,27 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 "timersystemsdl.h" +#include <zeitgeist/zeitgeist.h> + + using namespace oxygen; +ZEITGEIST_EXPORT_BEGIN() + ZEITGEIST_EXPORT(TimerSystemSDL); +ZEITGEIST_EXPORT_END() Property changes on: trunk/spark/plugin/timersystemsdl/export.cpp ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp =================================================================== --- trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp (rev 0) +++ trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,73 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 "timersystemsdl.h" +#include <zeitgeist/logserver/logserver.h> +#include <SDL.h> + +using namespace oxygen; + +void TimerSystemSDL::Initialize() +{ + if (!SDL_WasInit(SDL_INIT_TIMER)) + { + if (SDL_Init(SDL_INIT_TIMER) < 0) + { + GetLog()->Error() << "ERROR: (TimerSystemSDL) SDL Timer not initialized!\n"; + } + } + + mLastTicks = SDL_GetTicks(); +} + +float TimerSystemSDL::GetTimeSinceLastQuery() +{ + unsigned int ticks = SDL_GetTicks(); + + // FIXME: ticks might wrap + unsigned int timeDiff = ticks - mLastTicks; + mLastTicks = ticks; + + return timeDiff / 1000.0f; +} + +void TimerSystemSDL::WaitFromLastQueryUntil(float deadline) +{ + int milliseconds = round(deadline * 1000); + int expectedTime = mLastTicks + milliseconds; + + int delayTime = expectedTime - SDL_GetTicks(); + while (delayTime > 0) + { + SDL_Delay(delayTime); + // sometimes, even with the above SDL_Delay() call we will not reach + // the desired delay; so we check if we've actually reched the desired + // time + delayTime = expectedTime - SDL_GetTicks(); + } + +// GetLog()->Debug() << "(TimerSystemSDL) Waiting for " << deadline +// << " seconds or " << milliseconds << " millisecs\n"; +// GetLog()->Debug() << "CURRENT TIME: " << SDL_GetTicks() << '\n'; +} + +//void TimerSystemSDL::Finalize() +//{ +//} Property changes on: trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/timersystemsdl.h =================================================================== --- trunk/spark/plugin/timersystemsdl/timersystemsdl.h (rev 0) +++ trunk/spark/plugin/timersystemsdl/timersystemsdl.h 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,61 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 OXYGEN_SDLTIMERSYSTEM_H +#define OXYGEN_SDLTIMERSYSTEM_H + +#include <oxygen/simulationserver/timersystem.h> + +namespace oxygen +{ +/** \class TimerSystemSDL is a timer system based on SDL timing facilities + */ +class TimerSystemSDL: public TimerSystem +{ +public: + /** initialize the timer system. It is called once at the beginning of a + * simulation. + */ + virtual void Initialize(); + + /** \return the elapsed time since the last call of this function or since + * the initialization for the first call. + */ + virtual float GetTimeSinceLastQuery(); + + /** waits until \param deadline seconds is passed since the last call to + * GetTimeSinceLastQuery(). If that is already passed, it'll return + * immediately. + */ + virtual void WaitFromLastQueryUntil(float deadline); + + /** this is called at the end of the simulation */ + virtual void Finalize() {} + +private: + /** the last time GetTimeSinceLastQuery is called or zero on Initialize() */ + unsigned long mLastTicks; +}; + +DECLARE_CLASS(TimerSystemSDL); + +} // namespace oxygen + +#endif // OXYGEN_SDLTIMERSYSTEM_H Property changes on: trunk/spark/plugin/timersystemsdl/timersystemsdl.h ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp =================================================================== --- trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp (rev 0) +++ trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,28 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 "timersystemsdl.h" + +using namespace oxygen; + +void CLASS(TimerSystemSDL)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/TimerSystem); +} Property changes on: trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp ___________________________________________________________________ Added: svn:keywords + Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-25 00:29:14
|
Revision: 260 http://simspark.svn.sourceforge.net/simspark/?rev=260&view=rev Author: hedayat Date: 2011-03-25 00:29:08 +0000 (Fri, 25 Mar 2011) Log Message: ----------- Renamed simspark.rb to rcssserver3d.rb for consistency. Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/doc/users/rcssmonitor3d.tex trunk/rcssserver3d/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/rcssserver3d/main.cpp Added Paths: ----------- trunk/rcssserver3d/rcssserver3d/rcssserver3d.rb Removed Paths: ------------- trunk/rcssserver3d/rcssserver3d/simspark.rb Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2011-03-24 20:25:24 UTC (rev 259) +++ trunk/rcssserver3d/ChangeLog 2011-03-25 00:29:08 UTC (rev 260) @@ -1,3 +1,11 @@ +2011-03-25 Hedayat Vatankhah <hed...@gm...> + + * rcssserver3d/CMakeLists.txt: + * rcssserver3d/main.cpp: + * rcssserver3d/rcssserver3d.rb: + * doc/users/rcssmonitor3d.tex: + - rename: simspark.rb -> rcssserver3d.rb + 2011-03-24 Hedayat Vatankhah <hed...@gm...> * plugin/soccer/CMakeLists.txt: Modified: trunk/rcssserver3d/doc/users/rcssmonitor3d.tex =================================================================== --- trunk/rcssserver3d/doc/users/rcssmonitor3d.tex 2011-03-24 20:25:24 UTC (rev 259) +++ trunk/rcssserver3d/doc/users/rcssmonitor3d.tex 2011-03-25 00:29:08 UTC (rev 260) @@ -7,7 +7,7 @@ \section{Internal Monitor} The internal monitor implementation is part of the SimSpark server. It -is enabled in the \texttt{simspark.rb} setup script by enabling the +is enabled in the \texttt{rcssserver3d.rb} setup script by enabling the rendering and input plugins of the server. To do so please uncomment the lines \texttt{sparkSetupRendering()} and \texttt{sparkSetupInput()}, i.e. remove the leading \texttt{'\#'} comment markers. Modified: trunk/rcssserver3d/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/rcssserver3d/CMakeLists.txt 2011-03-24 20:25:24 UTC (rev 259) +++ trunk/rcssserver3d/rcssserver3d/CMakeLists.txt 2011-03-25 00:29:08 UTC (rev 260) @@ -27,7 +27,7 @@ ########### install files ############### -install(FILES simspark.rb soccersim.rb naosoccersim.rb +install(FILES rcssserver3d.rb soccersim.rb naosoccersim.rb internalsoccermonitor.rb internalsoccerbindings.rb DESTINATION ${DATADIR}/${CMAKE_PROJECT_NAME}) Modified: trunk/rcssserver3d/rcssserver3d/main.cpp =================================================================== --- trunk/rcssserver3d/rcssserver3d/main.cpp 2011-03-24 20:25:24 UTC (rev 259) +++ trunk/rcssserver3d/rcssserver3d/main.cpp 2011-03-25 00:29:08 UTC (rev 260) @@ -47,7 +47,7 @@ public: SimSpark(const std::string& relPathPrefix) : Spark(relPathPrefix), - mScriptPath("simspark.rb") + mScriptPath("rcssserver3d.rb") {}; /** called once after Spark finished it's init */ @@ -84,7 +84,7 @@ << "\nusage: rcssserver3d [options] [script]\n" << "\noptions:\n" << " --help\t\t\t print this message.\n" - << " --script-path PATH\t set the script path (simspark.rb path).\n" + << " --script-path PATH\t set the script path (rcssserver3d.rb path).\n" << "--agent-port PORTNUM\t port for agents to connect to.\n" << "--server-port PORTNUM\t port for monitors to connect to.\n" << "\n"; Copied: trunk/rcssserver3d/rcssserver3d/rcssserver3d.rb (from rev 257, trunk/rcssserver3d/rcssserver3d/simspark.rb) =================================================================== --- trunk/rcssserver3d/rcssserver3d/rcssserver3d.rb (rev 0) +++ trunk/rcssserver3d/rcssserver3d/rcssserver3d.rb 2011-03-25 00:29:08 UTC (rev 260) @@ -0,0 +1,84 @@ +# +# rcssserver3d.rb +# + +# toggle log file recording +$recordLogfile = false + +# toggle the internal monitor +$enableInternalMonitor = false + +# toggle the real time mode +$enableRealTimeMode = true + +sparkSetupServer() +if ($enableInternalMonitor) + sparkSetupRendering() +end +sparkSetupInput() + +if ($enableRealTimeMode) + sparkSetupTimer() +end + +# sparkAddFPSCamera($scenePath+'camera', +# -10,-10,5,15,248,4,false,2,10,10) + +# let spark create a default camera +if ($enableInternalMonitor) + sparkAddFPSCamera( + $scenePath+'camera', + x = 0, + y = -4, + z = 0.6, + vAngle = 10.0, + hAngle = 10.0, + maxSpeed = 1.5, + accel = 40.0, + drag = 4, + addCollider = false, + colliderRadius = 2.0 + ) +end + +# setup default input bindings +run "scripts/bindings.rb" + +# setup default materials common to all simulations +run "scripts/materials.rb" + +# +# uncomment for logging setup (see spark.rb for reference) +# + +sparkResetLogging() +sparkLogErrorToCerr() +#sparkLogAllToCerr() +#sparkLogAllToFile('spark.txt') +#sparkLogDebugToCerr() + +# +# uncomment any of the following to run a simulation +# + +# create an arena with a bunch of boxes and spheres +# scene = get($scenePath) +# scene.importScene('rsg/boxspheres/simspark.rsg') + +# create an arena to test various joint bodies +# scene = get($scenePath) +# scene.importScene('rsg/jointtest/simspark.rsg') + +# source soccersim.rb to run the soccer simulation +#run "soccersim.rb" +run "naosoccersim.rb" + +# setup the integrated agent +#sparkSetupTrain() +#addIntegratedAgent('SoccerbotBehavior',1) + +# setup game state info rendering for the internal monitor +# source soccersim.rb to run the soccer simulation +if ($enableInternalMonitor) + run "internalsoccermonitor.rb" +end Deleted: trunk/rcssserver3d/rcssserver3d/simspark.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/simspark.rb 2011-03-24 20:25:24 UTC (rev 259) +++ trunk/rcssserver3d/rcssserver3d/simspark.rb 2011-03-25 00:29:08 UTC (rev 260) @@ -1,84 +0,0 @@ -# -# simspark.rb -# - -# toggle log file recording -$recordLogfile = false - -# toggle the internal monitor -$enableInternalMonitor = false - -# toggle the real time mode -$enableRealTimeMode = true - -sparkSetupServer() -if ($enableInternalMonitor) - sparkSetupRendering() -end -sparkSetupInput() - -if ($enableRealTimeMode) - sparkSetupTimer() -end - -# sparkAddFPSCamera($scenePath+'camera', -# -10,-10,5,15,248,4,false,2,10,10) - -# let spark create a default camera -if ($enableInternalMonitor) - sparkAddFPSCamera( - $scenePath+'camera', - x = 0, - y = -4, - z = 0.6, - vAngle = 10.0, - hAngle = 10.0, - maxSpeed = 1.5, - accel = 40.0, - drag = 4, - addCollider = false, - colliderRadius = 2.0 - ) -end - -# setup default input bindings -run "scripts/bindings.rb" - -# setup default materials common to all simulations -run "scripts/materials.rb" - -# -# uncomment for logging setup (see spark.rb for reference) -# - -sparkResetLogging() -sparkLogErrorToCerr() -#sparkLogAllToCerr() -#sparkLogAllToFile('spark.txt') -#sparkLogDebugToCerr() - -# -# uncomment any of the following to run a simulation -# - -# create an arena with a bunch of boxes and spheres -# scene = get($scenePath) -# scene.importScene('rsg/boxspheres/simspark.rsg') - -# create an arena to test various joint bodies -# scene = get($scenePath) -# scene.importScene('rsg/jointtest/simspark.rsg') - -# source soccersim.rb to run the soccer simulation -#run "soccersim.rb" -run "naosoccersim.rb" - -# setup the integrated agent -#sparkSetupTrain() -#addIntegratedAgent('SoccerbotBehavior',1) - -# setup game state info rendering for the internal monitor -# source soccersim.rb to run the soccer simulation -if ($enableInternalMonitor) - run "internalsoccermonitor.rb" -end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-24 20:25:30
|
Revision: 259 http://simspark.svn.sourceforge.net/simspark/?rev=259&view=rev Author: hedayat Date: 2011-03-24 20:25:24 +0000 (Thu, 24 Mar 2011) Log Message: ----------- * Removing FindDevIL in favor of cmake's own module * Do not print error message for unused variables Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/plugin/soccer/CMakeLists.txt trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateitem.cpp trunk/rcssserver3d/plugin/soccermonitor/CMakeLists.txt trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Removed Paths: ------------- trunk/rcssserver3d/cmake/FindDevIL.cmake Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2011-03-24 18:08:49 UTC (rev 258) +++ trunk/rcssserver3d/ChangeLog 2011-03-24 20:25:24 UTC (rev 259) @@ -1,5 +1,18 @@ 2011-03-24 Hedayat Vatankhah <hed...@gm...> + * plugin/soccer/CMakeLists.txt: + * plugin/soccermonitor/CMakeLists.txt: + - fixed to use CMake's own FindDevIL module + + * plugin/soccer/gamestateaspect/gamestateitem.cpp + (GameStateItem::GetInitialPredicates): + - do not try to send obsolete variables: AgentMass and AgentMaxSpeed + + * rcssserver3d/naosoccersim.rb: + - added MaxTouchGroupSize variable + - added a BorderSize variable to stop simulator from complaining for + missing variable + * CMakeLists.txt: - updated PACKAGE_VERSION to 0.6.5 for the next release Deleted: trunk/rcssserver3d/cmake/FindDevIL.cmake =================================================================== --- trunk/rcssserver3d/cmake/FindDevIL.cmake 2011-03-24 18:08:49 UTC (rev 258) +++ trunk/rcssserver3d/cmake/FindDevIL.cmake 2011-03-24 20:25:24 UTC (rev 259) @@ -1,124 +0,0 @@ -# -Try to find DevIL (developer image) library -# formerly known as OpenIL, see -# http://openil.sourceforge.net -# -# Once run this will define: -# -# DevIL_FOUND -# DevIL_INCLUDE_DIR -# DevIL_LIBRARIES -# -# Jan Woetzel 12/2005. -# -# www.mip.informatik.uni-kiel.de/~jw -# -------------------------------- - -# base dirs: -SET(DevIL_POSSIBLE_ROOT_PATHS - ${DevIL_ROOT_DIR} - $ENV{DevIL_ROOT_DIR} - ${DevIL_DIR} - $ENV{DevIL_DIR} - ${DEVIL_DIR} - $ENV{DEVIL_DIR} - ${DEVIL_HOME} - $ENV{DEVIL_HOME} - "$ENV{EXTERN_LIBS_DIR}/DevIL" - $ENV{EXTRA_DIR} - $ENV{EXTRA} - $ENV{ProgramFiles}/DevIL - /usr/local/ - /usr/ - /opt/net/gcc41/DevIL - /opt/net/gcc33/DevIL - C:/library/DevIL - "C:/Program Files/DevIL" - "C:/Program Files (x86)/DevIL" - C:/DevIL - ) - -# appended -SET(DevIL_POSSIBLE_INCDIR_SUFFIXES - include - DevIL/include ) -SET(DevIL_POSSIBLE_LIBDIR_SUFFIXES - lib - lib64 - ) - - - -FIND_PATH(DevIL_INCLUDE_DIR - NAMES IL/il.h - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_INCDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_INCLUDE_DIR=${DevIL_INCLUDE_DIR}") - - -FIND_LIBRARY(DevIL_LIBRARY_IL - NAMES DevIL devil DevIL IL - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_IL=${DevIL_LIBRARY_IL}") - -FIND_LIBRARY(DevIL_LIBRARY_ILU - NAMES ILU ilu Ilu - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_ILU=${DevIL_LIBRARY_ILU}") - -FIND_LIBRARY(DevIL_LIBRARY_ILUT - NAMES ILUT ilu Ilut - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_ILUT=${DevIL_LIBRARY_ILUT}") - - - -# -------------------------------- - -IF (DevIL_INCLUDE_DIR) - IF (DevIL_LIBRARY_IL) - IF (DevIL_LIBRARY_ILU)# AND DevIL_LIBRARY_ILUT) - - SET(DevIL_FOUND TRUE) - SET(DevIL_LIBRARIES - ${DevIL_LIBRARY_IL} - ${DevIL_LIBRARY_ILU}) - IF (DevIL_LIBRARY_ILUT) - SET(DevIL_LIBRARIES ${DevIL_LIBRARIES} ${DevIL_LIBRARY_ILUT}) - ENDIF (DevIL_LIBRARY_ILUT) - - # get the link directory for rpath to be used with LINK_DIRECTORIES: - GET_FILENAME_COMPONENT(DevIL_LINK_DIRECTORIES ${DevIL_LIBRARY_IL} PATH) - - ENDIF(DevIL_LIBRARY_ILU)# AND DevIL_LIBRARY_ILUT) - ENDIF(DevIL_LIBRARY_IL) -ENDIF (DevIL_INCLUDE_DIR) - - -MARK_AS_ADVANCED( - DevIL_INCLUDE_DIR - DevIL_LIBRARY_IL - DevIL_LIBRARY_ILU - DevIL_LIBRARY_ILUT - DevIL_LIBRARIES - ) - - -# ========================================== -IF(NOT DevIL_FOUND) - # make FIND_PACKAGE friendly - IF(NOT DevIL_FIND_QUIETLY) - IF(DevIL_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "DevIL required, please specify it's location.") - ELSE(DevIL_FIND_REQUIRED) - MESSAGE(STATUS "ERROR: DevIL was not found.") - ENDIF(DevIL_FIND_REQUIRED) - ENDIF(NOT DevIL_FIND_QUIETLY) -ENDIF(NOT DevIL_FOUND) - -# backward compatibility -SET(DEVIL_FOUND ${DevIL_FOUND}) -SET(DEVIL_LIBRARIES ${DevIL_LIBRARIES}) -SET(DEVIL_INCLUDE_DIR ${DevIL_INCLUDE_DIR}) Modified: trunk/rcssserver3d/plugin/soccer/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/plugin/soccer/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) +++ trunk/rcssserver3d/plugin/soccer/CMakeLists.txt 2011-03-24 20:25:24 UTC (rev 259) @@ -126,7 +126,7 @@ ) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) add_library(soccer MODULE ${soccer_LIB_SRCS} ${soccer_LIB_HDRS}) Modified: trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateitem.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateitem.cpp 2011-03-24 18:08:49 UTC (rev 258) +++ trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateitem.cpp 2011-03-24 20:25:24 UTC (rev 259) @@ -75,9 +75,9 @@ PutFloatParam("WaitBeforeKickOff",pList); // agent parameter - PutFloatParam("AgentMass",pList); +// PutFloatParam("AgentMass",pList); PutFloatParam("AgentRadius",pList); - PutFloatParam("AgentMaxSpeed",pList); +// PutFloatParam("AgentMaxSpeed",pList); // ball parameter PutFloatParam("BallRadius",pList); Modified: trunk/rcssserver3d/plugin/soccermonitor/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) +++ trunk/rcssserver3d/plugin/soccermonitor/CMakeLists.txt 2011-03-24 20:25:24 UTC (rev 259) @@ -19,7 +19,7 @@ ) include_directories(${CMAKE_SOURCE_DIR}/plugin ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) add_library(soccermonitor MODULE ${soccermonitor_LIB_SRCS} ${soccermonitor_LIB_HDRS}) Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2011-03-24 18:08:49 UTC (rev 258) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2011-03-24 20:25:24 UTC (rev 259) @@ -50,6 +50,7 @@ addSoccerVar('GoalKickDist', 1.0) addSoccerVar('AutomaticKickOff', false) addSoccerVar('WaitBeforeKickOff', 2.0) +addSoccerVar('BorderSize', 0.0) # prevent complaining about missing variable # agent parameters addSoccerVar('AgentRadius', 0.4) @@ -59,12 +60,13 @@ addSoccerVar('BallMass',0.026) # soccer rule parameters -addSoccerVar('RuleGoalPauseTime',3.0) -addSoccerVar('RuleKickInPauseTime',1.0) -addSoccerVar('RuleHalfTime',5.0 * 60) -addSoccerVar('RuleDropBallTime',15) +addSoccerVar('RuleGoalPauseTime', 3.0) +addSoccerVar('RuleKickInPauseTime', 1.0) +addSoccerVar('RuleHalfTime', 5.0 * 60) +addSoccerVar('RuleDropBallTime', 15) addSoccerVar('SingleHalfTime', false) -addSoccerVar('UseOffside',false) +addSoccerVar('UseOffside', false) +addSoccerVar('MaxTouchGroupSize', 2) # auto ref parameters FCP 2010 addSoccerVar('NotStandingMaxTime',30) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-24 18:08:56
|
Revision: 258 http://simspark.svn.sourceforge.net/simspark/?rev=258&view=rev Author: hedayat Date: 2011-03-24 18:08:49 +0000 (Thu, 24 Mar 2011) Log Message: ----------- Removing our own FindDevIL and relying on CMake's own module Modified Paths: -------------- trunk/spark/CMakeLists.txt trunk/spark/ChangeLog trunk/spark/lib/kerosin/CMakeLists.txt trunk/spark/spark/CMakeLists.txt trunk/spark/test/fonttest/CMakeLists.txt trunk/spark/test/inputtest/CMakeLists.txt trunk/spark/test/scenetest/CMakeLists.txt Removed Paths: ------------- trunk/spark/cmake/FindDevIL.cmake Modified: trunk/spark/CMakeLists.txt =================================================================== --- trunk/spark/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -201,7 +201,7 @@ install(DIRECTORY "${Boost_LIBRARY_DIRS}/" DESTINATION ${THLIBDIR} FILES_MATCHING PATTERN "*.dll") - string(REGEX REPLACE "(.*)\\.lib" "\\1.dll" DevIL_DLL "${DevIL_LIBRARY_IL}") + string(REGEX REPLACE "(.*)\\.lib" "\\1.dll" DevIL_DLL "${IL_LIBRARIES}") if (EXISTS ${DevIL_DLL}) install(PROGRAMS ${DevIL_DLL} DESTINATION ${THLIBDIR}) endif (EXISTS ${DevIL_DLL}) Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/ChangeLog 2011-03-24 18:08:49 UTC (rev 258) @@ -1,5 +1,12 @@ 2011-03-24 Hedayat Vatankhah <hed...@gm...> + * spark/CMakeLists.txt: + * lib/kerosin/CMakeLists.txt: + * test/fonttest/CMakeLists.txt: + * test/inputtest/CMakeLists.txt: + * test/scenetest/CMakeLists.txt: + - fixed to use CMake's own FindDevIL module + * plugin/timersystemboost/timersystemboost.h: * plugin/timersystemboost/timersystemboost.cpp: * plugin/timersystemboost/timersystemboost_c.cpp: Deleted: trunk/spark/cmake/FindDevIL.cmake =================================================================== --- trunk/spark/cmake/FindDevIL.cmake 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/cmake/FindDevIL.cmake 2011-03-24 18:08:49 UTC (rev 258) @@ -1,124 +0,0 @@ -# -Try to find DevIL (developer image) library -# formerly known as OpenIL, see -# http://openil.sourceforge.net -# -# Once run this will define: -# -# DevIL_FOUND -# DevIL_INCLUDE_DIR -# DevIL_LIBRARIES -# -# Jan Woetzel 12/2005. -# -# www.mip.informatik.uni-kiel.de/~jw -# -------------------------------- - -# base dirs: -SET(DevIL_POSSIBLE_ROOT_PATHS - ${DevIL_ROOT_DIR} - $ENV{DevIL_ROOT_DIR} - ${DevIL_DIR} - $ENV{DevIL_DIR} - ${DEVIL_DIR} - $ENV{DEVIL_DIR} - ${DEVIL_HOME} - $ENV{DEVIL_HOME} - "$ENV{EXTERN_LIBS_DIR}/DevIL" - $ENV{EXTRA_DIR} - $ENV{EXTRA} - $ENV{ProgramFiles}/DevIL - /usr/local/ - /usr/ - /opt/net/gcc41/DevIL - /opt/net/gcc33/DevIL - C:/library/DevIL - "C:/Program Files/DevIL" - "C:/Program Files (x86)/DevIL" - C:/DevIL - ) - -# appended -SET(DevIL_POSSIBLE_INCDIR_SUFFIXES - include - DevIL/include ) -SET(DevIL_POSSIBLE_LIBDIR_SUFFIXES - lib - lib64 - ) - - - -FIND_PATH(DevIL_INCLUDE_DIR - NAMES IL/il.h - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_INCDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_INCLUDE_DIR=${DevIL_INCLUDE_DIR}") - - -FIND_LIBRARY(DevIL_LIBRARY_IL - NAMES DevIL devil DevIL IL - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_IL=${DevIL_LIBRARY_IL}") - -FIND_LIBRARY(DevIL_LIBRARY_ILU - NAMES ILU ilu Ilu - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_ILU=${DevIL_LIBRARY_ILU}") - -FIND_LIBRARY(DevIL_LIBRARY_ILUT - NAMES ILUT ilu Ilut - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_ILUT=${DevIL_LIBRARY_ILUT}") - - - -# -------------------------------- - -IF (DevIL_INCLUDE_DIR) - IF (DevIL_LIBRARY_IL) - IF (DevIL_LIBRARY_ILU)# AND DevIL_LIBRARY_ILUT) - - SET(DevIL_FOUND TRUE) - SET(DevIL_LIBRARIES - ${DevIL_LIBRARY_IL} - ${DevIL_LIBRARY_ILU}) - IF (DevIL_LIBRARY_ILUT) - SET(DevIL_LIBRARIES ${DevIL_LIBRARIES} ${DevIL_LIBRARY_ILUT}) - ENDIF (DevIL_LIBRARY_ILUT) - - # get the link directory for rpath to be used with LINK_DIRECTORIES: - GET_FILENAME_COMPONENT(DevIL_LINK_DIRECTORIES ${DevIL_LIBRARY_IL} PATH) - - ENDIF(DevIL_LIBRARY_ILU)# AND DevIL_LIBRARY_ILUT) - ENDIF(DevIL_LIBRARY_IL) -ENDIF (DevIL_INCLUDE_DIR) - - -MARK_AS_ADVANCED( - DevIL_INCLUDE_DIR - DevIL_LIBRARY_IL - DevIL_LIBRARY_ILU - DevIL_LIBRARY_ILUT - DevIL_LIBRARIES - ) - - -# ========================================== -IF(NOT DevIL_FOUND) - # make FIND_PACKAGE friendly - IF(NOT DevIL_FIND_QUIETLY) - IF(DevIL_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "DevIL required, please specify it's location.") - ELSE(DevIL_FIND_REQUIRED) - MESSAGE(STATUS "ERROR: DevIL was not found.") - ENDIF(DevIL_FIND_REQUIRED) - ENDIF(NOT DevIL_FIND_QUIETLY) -ENDIF(NOT DevIL_FOUND) - -# backward compatibility -SET(DEVIL_FOUND ${DevIL_FOUND}) -SET(DEVIL_LIBRARIES ${DevIL_LIBRARIES}) -SET(DEVIL_INCLUDE_DIR ${DevIL_INCLUDE_DIR}) Modified: trunk/spark/lib/kerosin/CMakeLists.txt =================================================================== --- trunk/spark/lib/kerosin/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/lib/kerosin/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -118,11 +118,11 @@ ) include_directories(${CMAKE_SOURCE_DIR}/lib ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) add_library(kerosin ${kerosin_LIB_SRCS} ${kerosin_LIB_HDRS}) -target_link_libraries(kerosin ${FREETYPE_LIBRARIES} ${DevIL_LIBRARIES} +target_link_libraries(kerosin ${FREETYPE_LIBRARIES} ${IL_LIBRARIES} ${SDL_LIBRARY} ${OPENGL_LIBRARIES} ${kerosin_require_libs}) set_target_properties(kerosin PROPERTIES VERSION ${KEROSIN_VERSION} Modified: trunk/spark/spark/CMakeLists.txt =================================================================== --- trunk/spark/spark/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/spark/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -6,7 +6,7 @@ ) include_directories(${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/utility ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) add_library(spark ${spark_LIB_SRCS}) Modified: trunk/spark/test/fonttest/CMakeLists.txt =================================================================== --- trunk/spark/test/fonttest/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/test/fonttest/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -6,7 +6,7 @@ ) include_directories(${SDL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) add_executable(fonttest ${fonttest_SRCS}) Modified: trunk/spark/test/inputtest/CMakeLists.txt =================================================================== --- trunk/spark/test/inputtest/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/test/inputtest/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -6,7 +6,7 @@ ) include_directories(${SDL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) add_executable(inputtest ${inputtest_SRCS}) Modified: trunk/spark/test/scenetest/CMakeLists.txt =================================================================== --- trunk/spark/test/scenetest/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/test/scenetest/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -9,7 +9,7 @@ ) include_directories(${SDL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) if (NOT WIN32) add_executable(scenetest ${scenetest_SRCS}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-24 16:29:41
|
Revision: 257 http://simspark.svn.sourceforge.net/simspark/?rev=257&view=rev Author: hedayat Date: 2011-03-24 16:29:33 +0000 (Thu, 24 Mar 2011) Log Message: ----------- * Preparing for the next release * Using the new timer system * Adding a macro containing simulator version, used in rcssserver3d instead of the hard coded one Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/rcssmonitor3d/rcssmonitor3d.rb trunk/rcssserver3d/rcssserver3d/main.cpp trunk/rcssserver3d/rcssserver3d/simspark.rb trunk/rcssserver3d/rcssserver3d_config.h.cmake Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) +++ trunk/rcssserver3d/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.4") +set(PACKAGE_VERSION "0.6.5") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2011-03-24 16:21:36 UTC (rev 256) +++ trunk/rcssserver3d/ChangeLog 2011-03-24 16:29:33 UTC (rev 257) @@ -1,26 +1,41 @@ +2011-03-24 Hedayat Vatankhah <hed...@gm...> + + * CMakeLists.txt: + - updated PACKAGE_VERSION to 0.6.5 for the next release + + * rcssserver3d_config.h.cmake: + - added a RCSS_VERSION constant to store rcssserver3d version + + * rcssserver3d/main.cpp (SimSpark::PrintGreeting): + - use RCSS_VERSION instead of the hard coded version number + + * rcssserver3d/simspark.rb: + * rcssmonitor3d/rcssmonitor3d.rb: + - use the new sparkSetupTimer() + 2011-03-23 Hedayat Vatankhah <hed...@gm...> * RELEASE: - - Updated release information for the next release + - updated release information for the next release * data/rsg/agent/nao/naoneckhead.rsg: - - Enable sensing field lines by default + - enable sensing field lines by default 2011-02-10 Sander van Dijk <sgv...@gm...> * rcssserver3d/rcssserver3d/main.cpp - - Set different agent and monitor ports with --agent-posrt and --server-port + - set different agent and monitor ports with --agent-posrt and --server-port * /trunk/rcssserver3d/data/textures/rcs-naofield.png - - New field texture + - new field texture 2011-01-13 Hedayat Vatankhah <hed...@gm...> * cmake/UseLATEX.cmake: - - Updated to version 1.7.2 + - updated to version 1.7.2 * plugin/soccermonitor/CMakeLists.txt: - - Link OpenGL libraries to fix MacOSX compile issue(Thanks to Giuliani) + - link OpenGL libraries to fix MacOSX compile issue(Thanks to Giuliani) 2010-12-14 Yuan Xu <xu...@in...> * rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp @@ -72,7 +87,7 @@ * rcssserver3d/naosoccersim.rb: * plugin/soccer/soccerruleaspect/soccerruleaspect.h: * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp: - - Added the simple referee patch from FCPortugal team (thanks to + - added the simple referee patch from FCPortugal team (thanks to Luis Paulo Reis) 2010-02-28 Marian Buchta <mar...@gm...> @@ -446,5 +461,5 @@ * plugin/soccer/pantilteffector/pantilteffector.cpp: * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp: * plugin/soccer/agentstateperceptor/agentstateperceptor.cpp: - - Replaced make_shared() with .lock() function call.(fixed compilation + - replaced make_shared() with .lock() function call.(fixed compilation error with recent boost versions.) Modified: trunk/rcssserver3d/rcssmonitor3d/rcssmonitor3d.rb =================================================================== --- trunk/rcssserver3d/rcssmonitor3d/rcssmonitor3d.rb 2011-03-24 16:21:36 UTC (rev 256) +++ trunk/rcssserver3d/rcssmonitor3d/rcssmonitor3d.rb 2011-03-24 16:29:33 UTC (rev 257) @@ -4,6 +4,7 @@ sparkSetupRendering() sparkSetupInput() +sparkSetupTimer() if ($logPlayerMode == true) sparkSetupMonitorLogPlayer() Modified: trunk/rcssserver3d/rcssserver3d/main.cpp =================================================================== --- trunk/rcssserver3d/rcssserver3d/main.cpp 2011-03-24 16:21:36 UTC (rev 256) +++ trunk/rcssserver3d/rcssserver3d/main.cpp 2011-03-24 16:29:33 UTC (rev 257) @@ -69,7 +69,8 @@ void SimSpark::PrintGreeting() { GetLog()->Normal() - << "rcssserver3d (formerly simspark), a monolithic simulator 0.6.1\n" + << "rcssserver3d (formerly simspark), a monolithic simulator " + RCSS_VERSION"\n" << "Copyright (C) 2004 Markus Rollmann, \n" << "Universität Koblenz.\n" << "Copyright (C) 2004-2009, " @@ -131,7 +132,7 @@ return false; } } - + } return true; Modified: trunk/rcssserver3d/rcssserver3d/simspark.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/simspark.rb 2011-03-24 16:21:36 UTC (rev 256) +++ trunk/rcssserver3d/rcssserver3d/simspark.rb 2011-03-24 16:29:33 UTC (rev 257) @@ -8,12 +8,19 @@ # toggle the internal monitor $enableInternalMonitor = false +# toggle the real time mode +$enableRealTimeMode = true + sparkSetupServer() if ($enableInternalMonitor) sparkSetupRendering() end sparkSetupInput() +if ($enableRealTimeMode) + sparkSetupTimer() +end + # sparkAddFPSCamera($scenePath+'camera', # -10,-10,5,15,248,4,false,2,10,10) Modified: trunk/rcssserver3d/rcssserver3d_config.h.cmake =================================================================== --- trunk/rcssserver3d/rcssserver3d_config.h.cmake 2011-03-24 16:21:36 UTC (rev 256) +++ trunk/rcssserver3d/rcssserver3d_config.h.cmake 2011-03-24 16:29:33 UTC (rev 257) @@ -4,4 +4,6 @@ #cmakedefine HAVE_ARPA_INET_H 1 -#define RCSS_BUNDLE_PATH "${BUNDLE_PATH}" \ No newline at end of file +#define RCSS_BUNDLE_PATH "${BUNDLE_PATH}" + +#define RCSS_VERSION "${PACKAGE_VERSION}" \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-24 16:21:43
|
Revision: 256 http://simspark.svn.sourceforge.net/simspark/?rev=256&view=rev Author: hedayat Date: 2011-03-24 16:21:36 +0000 (Thu, 24 Mar 2011) Log Message: ----------- * Prepared for a new release (updating version numbers) * Added a new timer architecture based on a TimerSystem concept. It is now handled completely separate from SimControlNodes. * Added TimerSystemBoost which is based on Boost timing facilities. Modified Paths: -------------- trunk/spark/CMakeLists.txt trunk/spark/ChangeLog trunk/spark/lib/oxygen/CMakeLists.txt trunk/spark/lib/oxygen/oxygen.cpp trunk/spark/lib/oxygen/oxygen.h trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/lib/oxygen/simulationserver/simulationserver_c.cpp trunk/spark/plugin/CMakeLists.txt trunk/spark/spark/spark.rb Added Paths: ----------- trunk/spark/lib/oxygen/simulationserver/timersystem.h trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp trunk/spark/plugin/timersystemboost/ trunk/spark/plugin/timersystemboost/CMakeLists.txt trunk/spark/plugin/timersystemboost/export.cpp trunk/spark/plugin/timersystemboost/timersystemboost.cpp trunk/spark/plugin/timersystemboost/timersystemboost.h trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp Modified: trunk/spark/CMakeLists.txt =================================================================== --- trunk/spark/CMakeLists.txt 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(simspark CXX C) -set(PACKAGE_VERSION "0.2.1") +set(PACKAGE_VERSION "0.2.2") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) @@ -143,11 +143,11 @@ set(SALT_SO_VERSION 0) set(SALT_VERSION ${SALT_SO_VERSION}.3.2) set(ZEITGEIST_SO_VERSION 3) -set(ZEITGEIST_VERSION ${ZEITGEIST_SO_VERSION}.1.1) -set(OXYGEN_SO_VERSION 4) +set(ZEITGEIST_VERSION ${ZEITGEIST_SO_VERSION}.1.2) +set(OXYGEN_SO_VERSION 5) set(OXYGEN_VERSION ${OXYGEN_SO_VERSION}.0.0) -set(KEROSIN_SO_VERSION 1) -set(KEROSIN_VERSION ${KEROSIN_SO_VERSION}.1.1) +set(KEROSIN_SO_VERSION 2) +set(KEROSIN_VERSION ${KEROSIN_SO_VERSION}.0.0) set(SPARK_SO_VERSION 0) set(SPARK_VERSION ${SPARK_SO_VERSION}.0.1) set(RCSSNET_SO_VERSION 0) Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/ChangeLog 2011-03-24 16:21:36 UTC (rev 256) @@ -1,3 +1,42 @@ +2011-03-24 Hedayat Vatankhah <hed...@gm...> + + * plugin/timersystemboost/timersystemboost.h: + * plugin/timersystemboost/timersystemboost.cpp: + * plugin/timersystemboost/timersystemboost_c.cpp: + * plugin/timersystemboost/export.cpp: + * plugin/timersystemboost/CMakeLists.txt: + - Added TimerSystemBoost which uses Boost facilities for timing + + * plugin/CMakeLists.txt: + - Added timersystemboost to the list of plugins + - Reordering the list of plugins to make it sorted again + + * CMakeLists.txt: + - Prepare for 0.2.2 release: changed the version number and update library + versions + + * spark/spark.rb: + - Disable old style timer and add sparkSetupTimer() function for + setting up a timer system + + * lib/oxygen/simulationserver/simulationserver.h: + * lib/oxygen/simulationserver/simulationserver.cpp: + * lib/oxygen/simulationserver/simulationserver_c.cpp: + - Use TimerSystem for timing + - Added InitTimerSystem() to setup a timer system for simulation server + - Fixed a few spelling errors + - Added SyncTime() method which is responsible for updating mSumDeltaTime + using a TimerSystem or simulator's internal clock. + - Using Step() in multi-threaded mode in addition to the single threaded + mode. Looks like that there is no need to differentiate any more. + + * lib/oxygen/oxygen.cpp: + * lib/oxygen/oxygen.h: + * lib/oxygen/CMakeLists.txt: + * lib/oxygen/simulationserver/timersystem.h: + * lib/oxygen/simulationserver/timersystem_c.cpp: + - Added a new TimerSystem mechanism to control simulator timing + 2011-03-23 Hedayat Vatankhah <hed...@gm...> * RELEASE: Modified: trunk/spark/lib/oxygen/CMakeLists.txt =================================================================== --- trunk/spark/lib/oxygen/CMakeLists.txt 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) @@ -110,6 +110,7 @@ simulationserver/netmessage.h simulationserver/netbuffer.h simulationserver/traincontrol.h + simulationserver/timersystem.h geometryserver/geometryserver.h geometryserver/meshexporter.h geometryserver/meshimporter.h @@ -260,6 +261,7 @@ simulationserver/netbuffer.cpp simulationserver/traincontrol.cpp simulationserver/traincontrol_c.cpp + simulationserver/timersystem_c.cpp geometryserver/geometryserver.h geometryserver/geometryserver.cpp geometryserver/geometryserver_c.cpp Modified: trunk/spark/lib/oxygen/oxygen.cpp =================================================================== --- trunk/spark/lib/oxygen/oxygen.cpp 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/oxygen.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -44,6 +44,7 @@ zg.GetCore()->RegisterClassObject(new CLASS(MonitorControl), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(MonitorLogger), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(TrainControl), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(TimerSystem), "oxygen/"); // geometry zg.GetCore()->RegisterClassObject(new CLASS(GeometryServer), "oxygen/"); Modified: trunk/spark/lib/oxygen/oxygen.h =================================================================== --- trunk/spark/lib/oxygen/oxygen.h 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/oxygen.h 2011-03-24 16:21:36 UTC (rev 256) @@ -90,6 +90,7 @@ #include <oxygen/simulationserver/monitorcontrol.h> #include <oxygen/simulationserver/monitorlogger.h> #include <oxygen/simulationserver/traincontrol.h> +#include <oxygen/simulationserver/timersystem.h> #include <oxygen/geometryserver/geometryserver.h> #include <oxygen/geometryserver/meshexporter.h> Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -21,6 +21,7 @@ */ #include "simulationserver.h" #include "simcontrolnode.h" +#include "timersystem.h" #include <zeitgeist/logserver/logserver.h> #include <signal.h> #include <algorithm> @@ -183,6 +184,33 @@ return true; } +/** creates and registers a new TimerSystem to the SimulationServer */ +bool SimulationServer::InitTimerSystem(const std::string& className) +{ + if (mTimerSystem) + { + GetLog()->Error() << "(SimulationServer) ERROR: " + << "Another timer system already in use!\n"; + return false; + } + + mTimerSystem = shared_dynamic_cast<TimerSystem>(GetCore()->New(className)); + SetAutoTimeMode(false); + + if (!mTimerSystem) + { + GetLog()->Error() << "(SimulationServer) ERROR: " + << "Unable to create '" << className << "'\n"; + return false; + } + + GetLog()->Normal() + << "(SimulationServer) TimerSystem '" + << className << "' registered\n"; + + return true; +} + boost::shared_ptr<SimControlNode> SimulationServer::GetControlNode(const string& controlName) { @@ -237,7 +265,6 @@ mSimTime += mSumDeltaTime; mSumDeltaTime = 0; } -// usleep(10000); } void SimulationServer::ControlEvent(EControlEvent event) @@ -305,6 +332,11 @@ mArgV = argv; ControlEvent(CE_Init); + + if (mTimerSystem) + { + mTimerSystem->Initialize(); + } } void SimulationServer::Run(int argc, char** argv) @@ -312,25 +344,26 @@ Init(argc, argv); GetLog()->Normal() << "(SimulationServer) entering runloop\n"; - boost::shared_ptr<SimControlNode> inputCtr = GetControlNode("InputControl"); - - if ( mMultiThreads ) + if ( !mAutoTime && !mTimerSystem ) { - GetLog()->Normal()<< "(SimulationServer) running in multi-threads\n"; - RunMultiThreaded(inputCtr); + GetLog()->Error()<< "(SimulationServer) ERROR: can not get" + " any TimerSystem objects.\n"; } else { - GetLog()->Normal()<< "(SimulationServer) running in single thread\n"; - if ( !mAutoTime && inputCtr.get() == 0 ) + if ( mMultiThreads ) { - GetLog()->Error()<< "(SimulationServer) ERROR: can not get InputControl\n"; + GetLog()->Normal()<< "(SimulationServer) running in " + "multi-threaded mode\n"; + RunMultiThreaded(); } else { + GetLog()->Normal()<< "(SimulationServer) running in single " + "thread mode\n"; while (! mExit) { - Cycle(inputCtr); + Cycle(); } } } @@ -338,7 +371,7 @@ Done(); } -void SimulationServer::Cycle(boost::shared_ptr<SimControlNode> &inputCtr) +void SimulationServer::Cycle() { ++mCycle; @@ -347,26 +380,18 @@ ControlEvent(CE_ActAgent); Step(); - if (mAutoTime) - { - AdvanceTime(mSimStep); - } - else - { - if (inputCtr.get() != 0) - { - while (int(mSumDeltaTime*100) < int(mSimStep*100)) - { - inputCtr->StartCycle();// advance the time - } - } - } + SyncTime(); ControlEvent(CE_EndCycle); } void SimulationServer::Done() { + if (mTimerSystem) + { + mTimerSystem->Finalize(); + } + ControlEvent(CE_Done); mArgC = 0; @@ -392,17 +417,8 @@ return mSceneServer.get(); } -void SimulationServer::RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr) +void SimulationServer::RunMultiThreaded() { - if (mSimStep == 0) - { - GetLog()->Error() << "(SimulationServer) ERROR: multi-threaded " - << "mode supports descreet simulations only.\n"; - return; - } - - boost::thread_group ctrThrdGroup; - // count valid SimControlNodes. int count = 1; for ( TLeafList::iterator iter=begin(); iter != end(); ++iter ) @@ -413,6 +429,7 @@ mThreadBarrier = new barrier(count); // create new threads for each SimControlNode + boost::thread_group ctrThrdGroup; for ( TLeafList::iterator iter=begin(); iter != end(); ++iter ) { boost::shared_ptr<SimControlNode> ctrNode = shared_dynamic_cast<SimControlNode>(*iter); @@ -433,51 +450,19 @@ mThreadBarrier->wait(); if (mExit) mExitThreads = true; - - // Wait for SimControlNodes' acts at the begining of a cycle + + // Wait for SimControlNodes' acts at the beginning of a cycle mThreadBarrier->wait(); - finalDelta = initDelta = mSumDeltaTime; + Step(); + SyncTime(); - mSceneServer->PrePhysicsUpdate(mSimStep); - mSceneServer->PhysicsUpdate(mSimStep); - - if (mAutoTime) - { - AdvanceTime(mSimStep); - } - - else - { - if (inputCtr.get() != 0) - { - while (int(mSumDeltaTime*100) < int(mSimStep*100)) - { - inputCtr->StartCycle();// advance the time - } - } - } - - UpdateDeltaTimeAfterStep(finalDelta); - - float finalStep = mSimStep; - while (int(finalDelta*100) >= int(mSimStep*100)) - { - mSceneServer->PhysicsUpdate(mSimStep); - UpdateDeltaTimeAfterStep(finalDelta); - finalStep += mSimStep; - } - mSceneServer->PostPhysicsUpdate(); - mGameControlServer->Update(finalStep); - mSimTime += finalStep; - if (renderControl && renderControl->GetTime() - mSimTime < 0.005f ) renderControl->EndCycle(); // End Cycle - mThreadBarrier->wait(); - mSumDeltaTime -= initDelta - finalDelta; + mThreadBarrier->wait(); } // wait for threads @@ -493,16 +478,15 @@ return; } - bool isInputControl = (controlNode->GetName() == "InputControl"); bool isRenderControl = (controlNode->GetName() == "RenderControl"); bool newCycle = false; while (!mExitThreads) { mThreadBarrier->wait(); - + newCycle = false; - if ( controlNode->GetTime() - mSimTime <= 0.005f && !isInputControl) + if ( controlNode->GetTime() - mSimTime <= 0.005f) { newCycle = true; controlNode->StartCycle(); @@ -552,3 +536,16 @@ else deltaTime -= mSimStep; } + +inline void SimulationServer::SyncTime() +{ + if (mAutoTime) + { + AdvanceTime(mSimStep); + } + else + { + mTimerSystem->WaitFromLastQueryUntil(mSimStep - mSumDeltaTime); + AdvanceTime(mTimerSystem->GetTimeSinceLastQuery()); + } +} Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-24 16:21:36 UTC (rev 256) @@ -32,6 +32,7 @@ namespace oxygen { class SimControlNode; +class TimerSystem; class OXYGEN_API SimulationServer : public zeitgeist::Node { @@ -90,6 +91,10 @@ SimulationServer */ bool InitControlNode(const std::string& className, const std::string& name); + /** creates a new TimerSystem of type \param className to be used as + * the simulator's internal timer */ + bool InitTimerSystem(const std::string& className); + /** sets the auto time mode of the SimulationServer. if set to true the SimulationServer automatically advances the simulation mSimStep time every cycle, this is the default @@ -114,8 +119,9 @@ /** init the runloop and all registered control nodes */ virtual void Init(int argc = 0, char** argv = 0); - /** go through on cycle of the runloop, i.e. sense, act, step */ - virtual void Cycle(boost::shared_ptr<SimControlNode> &inputCtr); + /** go through on cycle of the runloop (single threaded mode), i.e. sense, + * act, step */ + virtual void Cycle(); /** shutdown server and all registered control nodes */ virtual void Done(); @@ -131,7 +137,7 @@ /** returns the cached GameControlServer reference */ boost::shared_ptr<GameControlServer> GetGameControlServer(); - /** returns thr cached SceneServer reference */ + /** returns the cached SceneServer reference */ boost::shared_ptr<SceneServer> GetSceneServer(); /** returns the current simulation cycle */ @@ -167,15 +173,20 @@ static void CatchSignal(int sig_num); /** the multi-threaded runloop of the simulation */ - void RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr); + void RunMultiThreaded(); /** the thread function which controls a single SimControlNode in * multi-threaded mode. */ void SimControlThread(boost::shared_ptr<SimControlNode> controlNode); - /** updates mSumDeltaTime after a step in descreet simulations */ + /** updates mSumDeltaTime after a step in discreet simulations */ void UpdateDeltaTimeAfterStep(float &deltaTime); + /** updates the accumulated time since last simulation step using the + * specified timing method: it might use simulator's own clock (if mAutoTime + * is true) or a TimerSystem provided using InitTimerSystem() */ + void SyncTime(); + protected: /** the argc parameter passed to Run() */ int mArgC; @@ -230,6 +241,9 @@ /** barrier object for synchronizing threads in multi-threaded mode */ boost::barrier *mThreadBarrier; + + /** the timer system to control the simulation */ + boost::shared_ptr<TimerSystem> mTimerSystem; }; DECLARE_CLASS(SimulationServer); Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver_c.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver_c.cpp 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver_c.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -45,10 +45,24 @@ return false; } - return obj->InitControlNode(inClassName,inName); + return obj->InitControlNode(inClassName, inName); } +FUNCTION(SimulationServer,initTimerSystem) +{ + string inClassName; + if ( + (in.GetSize() != 1) || + (! in.GetValue(in[0],inClassName)) + ) + { + return false; + } + + return obj->InitTimerSystem(inClassName); +} + FUNCTION(SimulationServer, getTime) { return obj->GetTime(); @@ -156,6 +170,7 @@ DEFINE_BASECLASS(zeitgeist/Node); DEFINE_FUNCTION(quit); DEFINE_FUNCTION(initControlNode); + DEFINE_FUNCTION(initTimerSystem); DEFINE_FUNCTION(getTime); DEFINE_FUNCTION(resetTime); DEFINE_FUNCTION(setSimStep); Added: trunk/spark/lib/oxygen/simulationserver/timersystem.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/timersystem.h (rev 0) +++ trunk/spark/lib/oxygen/simulationserver/timersystem.h 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,59 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 OXYGEN_TIMERSYSTEM_H +#define OXYGEN_TIMERSYSTEM_H + +#include <zeitgeist/class.h> +#include <zeitgeist/leaf.h> + +namespace oxygen +{ +/** \class TimerSystem defines the interface for an external timer to control + * the simulation. + */ +class TimerSystem: public zeitgeist::Leaf +{ +public: + /** initialize the timer system. It is called once at the beginning of a + * simulation. + */ + virtual void Initialize() = 0; + + /** \return the elapsed time since the last call of this function or since + * the initialization for the first call. + */ + virtual float GetTimeSinceLastQuery() = 0; + + /** waits until \param deadline seconds is passed since the last call to + * GetTimeSinceLastQuery(). If that is already passed, it'll return + * immediately. + */ + virtual void WaitFromLastQueryUntil(float deadline) = 0; + + /** this is called at the end of the simulation */ + virtual void Finalize() {} +}; + +DECLARE_ABSTRACTCLASS(TimerSystem); + +} // namespace oxygen + +#endif // OXYGEN_TIMERSYSTEM_H Added: trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp (rev 0) +++ trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,28 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 "timersystem.h" + +using namespace oxygen; + +void CLASS(TimerSystem)::DefineClass() +{ + DEFINE_BASECLASS(zeitgeist/Leaf); +} Modified: trunk/spark/plugin/CMakeLists.txt =================================================================== --- trunk/spark/plugin/CMakeLists.txt 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/plugin/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) @@ -11,25 +11,26 @@ add_subdirectory(accelerometer) add_subdirectory(agentsynceffector) +add_subdirectory(collisionperceptor) add_subdirectory(filesystemstd) add_subdirectory(filesystemzip) add_subdirectory(forceeffector) add_subdirectory(gyrorateperceptor) add_subdirectory(inputsdl) +add_subdirectory(inputwx) add_subdirectory(objimporter) add_subdirectory(odeimps) add_subdirectory(openglsyssdl) +add_subdirectory(openglsyswx) add_subdirectory(perfectvisionperceptor) -add_subdirectory(collisionperceptor) -add_subdirectory(sexpparser) add_subdirectory(rosimporter) add_subdirectory(rubysceneimporter) +add_subdirectory(sexpparser) add_subdirectory(sparkmonitor) add_subdirectory(sparkagent) add_subdirectory(sceneeffector) add_subdirectory(soundsystemfmod) -add_subdirectory(inputwx) -add_subdirectory(openglsyswx) +add_subdirectory(timersystemboost) if (APPLE) if (DEVEL) add_subdirectory(imageperceptor) Added: trunk/spark/plugin/timersystemboost/CMakeLists.txt =================================================================== --- trunk/spark/plugin/timersystemboost/CMakeLists.txt (rev 0) +++ trunk/spark/plugin/timersystemboost/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,18 @@ +########### next target ############### + +set(timersystemboost_LIB_SRCS + export.cpp + timersystemboost.cpp + timersystemboost_c.cpp + timersystemboost.h +) + +add_library(timersystemboost MODULE ${timersystemboost_LIB_SRCS}) + +target_link_libraries(timersystemboost ${spark_libs}) + +if (NOT APPLE) + set_target_properties(timersystemboost PROPERTIES VERSION 0.0.0 SOVERSION 0) +endif (NOT APPLE) + +install(TARGETS timersystemboost DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) Added: trunk/spark/plugin/timersystemboost/export.cpp =================================================================== --- trunk/spark/plugin/timersystemboost/export.cpp (rev 0) +++ trunk/spark/plugin/timersystemboost/export.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,27 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 "timersystemboost.h" +#include <zeitgeist/zeitgeist.h> + + using namespace oxygen; +ZEITGEIST_EXPORT_BEGIN() + ZEITGEIST_EXPORT(TimerSystemBoost); +ZEITGEIST_EXPORT_END() Added: trunk/spark/plugin/timersystemboost/timersystemboost.cpp =================================================================== --- trunk/spark/plugin/timersystemboost/timersystemboost.cpp (rev 0) +++ trunk/spark/plugin/timersystemboost/timersystemboost.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,52 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 "timersystemboost.h" +#include <boost/date_time/posix_time/posix_time.hpp> +#include <zeitgeist/logserver/logserver.h> + +using namespace oxygen; + +void TimerSystemBoost::Initialize() +{ + mLastQueryTime = boost::get_system_time(); +} + +float TimerSystemBoost::GetTimeSinceLastQuery() +{ + boost::system_time currentTime = boost::get_system_time(); + boost::posix_time::time_duration timeDiff = currentTime - mLastQueryTime; + mLastQueryTime = currentTime; + return timeDiff.total_milliseconds() / 1000.0f; +} + +void TimerSystemBoost::WaitFromLastQueryUntil(float deadline) +{ + int milliseconds = round(deadline * 1000); +// GetLog()->Debug() << "(TimerSystemBoost) Waiting for " << deadline +// << " seconds or " << milliseconds << " millisecs\n"; + boost::thread::sleep(mLastQueryTime + + boost::posix_time::milliseconds(milliseconds)); +// GetLog()->Debug() << "CURRENT TIME: " << boost::get_system_time() << '\n'; +} + +//void TimerSystemBoost::Finalize() +//{ +//} Added: trunk/spark/plugin/timersystemboost/timersystemboost.h =================================================================== --- trunk/spark/plugin/timersystemboost/timersystemboost.h (rev 0) +++ trunk/spark/plugin/timersystemboost/timersystemboost.h 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,62 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 OXYGEN_BOOSTTIMERSYSTEM_H +#define OXYGEN_BOOSTTIMERSYSTEM_H + +#include <boost/thread/thread.hpp> +#include <oxygen/simulationserver/timersystem.h> + +namespace oxygen +{ +/** \class TimerSystemBoost is a timer system based on Boost timing facilities + */ +class TimerSystemBoost: public TimerSystem +{ +public: + /** initialize the timer system. It is called once at the beginning of a + * simulation. + */ + virtual void Initialize(); + + /** \return the elapsed time since the last call of this function or since + * the initialization for the first call. + */ + virtual float GetTimeSinceLastQuery(); + + /** waits until \param deadline seconds is passed since the last call to + * GetTimeSinceLastQuery(). If that is already passed, it'll return + * immediately. + */ + virtual void WaitFromLastQueryUntil(float deadline); + + /** this is called at the end of the simulation */ + virtual void Finalize() {} + +private: + /** the last time GetTimeSinceLastQuery is called or zero on Initialize() */ + boost::system_time mLastQueryTime; +}; + +DECLARE_CLASS(TimerSystemBoost); + +} // namespace oxygen + +#endif // OXYGEN_BOOSTTIMERSYSTEM_H Added: trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp =================================================================== --- trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp (rev 0) +++ trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,28 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 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 "timersystemboost.h" + +using namespace oxygen; + +void CLASS(TimerSystemBoost)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/TimerSystem); +} Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/spark/spark.rb 2011-03-24 16:21:36 UTC (rev 256) @@ -10,7 +10,7 @@ $scenePath = '/usr/scene/' $serverPath = '/sys/server/' -# (Inputsystem) +# (Input system) # # the default InputSystem used to read keyboard, mouse and timer input @@ -19,9 +19,15 @@ # 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 +# (Timer system) +# +# the default TimerSystem used to control the simulation timing +$defaultTimerSystem = 'TimerSystemBoost' + +# the name of the default bundle that contains the default TimerSystem +$defaultTimerSystemBundle = 'timersystemboost' + # (OpenGL rendering) # @@ -394,7 +400,7 @@ inputServer.init(inputSystem) # add devices - inputServer.createDevice('Timer') + #inputServer.createDevice('Timer') inputServer.createDevice('Keyboard') inputServer.createDevice('Mouse') end @@ -411,10 +417,27 @@ # set timing mode (real time vs simulation time) inputControl = get($serverPath+'simulation/InputControl') if (inputControl != nil) - inputControl.setAdvanceTime($useRealTime) + inputControl.setAdvanceTime(false) end end +def sparkSetupTimer(timerSystem = $defaultTimerSystem) + print "(spark.rb) sparkSetupTimer\n" + print "(spark.rb) using TimerSystem '" + timerSystem + "'\n" + + # setup the Boost timer system + if (timerSystem == $defaultTimerSystem) + importBundle($defaultTimerSystemBundle) + end + + # + # register timer system to the simulation server + simulationServer = sparkGetSimulationServer() + if (simulationServer != nil) + simulationServer.initTimerSystem(timerSystem) + end +end + def sparkSetupTrain() #print "(spark.rb) sparkSetupTrain\n" # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-23 09:57:17
|
Revision: 255 http://simspark.svn.sourceforge.net/simspark/?rev=255&view=rev Author: hedayat Date: 2011-03-23 09:57:11 +0000 (Wed, 23 Mar 2011) Log Message: ----------- Updated Release information Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/RELEASE Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-23 09:12:27 UTC (rev 254) +++ trunk/spark/ChangeLog 2011-03-23 09:57:11 UTC (rev 255) @@ -1,3 +1,8 @@ +2011-03-23 Hedayat Vatankhah <hed...@gm...> + + * RELEASE: + - Updated release information for the next release + 2010-12-15 Yuan Xu <xu...@in...> * plugin/imageperceptor/CMakeLists.txt * plugin/imageperceptor/export.cpp Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2011-03-23 09:12:27 UTC (rev 254) +++ trunk/spark/RELEASE 2011-03-23 09:57:11 UTC (rev 255) @@ -1,18 +1,17 @@ -RELEASE News of simspark-0.2.1 +RELEASE News of simspark-0.2.2 -This release of simspark is prepared for RoboCup 2010 competitions in Singapore. -In this release you can find some bug and compilation fixes, improved Windows -support and some new features such as the potential of using different -physical simulation engines. +This release features many small enhancements which will benefit users. +It contains many bug fixes and performance improvements, in addition to +fixing some compilation issues. The behavior of ACC perceptor has been slightly +changed, and the multi-threaded mode should work without any known bugs. +Support for the camera sensor is improved too. More details are as follows: -* New features: - - The core physics system does no longer depend on ODE (Thanks to Andreas). - ODE implementation is now provided as a plugin. - -* Fixes: - - Compilation fixes on newer compilers (VS 2010) - - Fixed some bugs on 64 bit systems and in multi-threaded mode. It is (hopefully) - possible to run multi-threaded games while logging is enabled +- ACC sensor provides raw data without any pre-processing +- Using base64 encoding for camera perceptor +- Fixed bugs in multi-threaded mode. +- Compilation fixes +- HingePerceptor can report torque +- Better Performance You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-23 09:12:33
|
Revision: 254 http://simspark.svn.sourceforge.net/simspark/?rev=254&view=rev Author: hedayat Date: 2011-03-23 09:12:27 +0000 (Wed, 23 Mar 2011) Log Message: ----------- Enable sensing field lines in RestrictedVisionPerceptor Update release notes for the next release Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/RELEASE trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2011-03-21 22:27:45 UTC (rev 253) +++ trunk/rcssserver3d/ChangeLog 2011-03-23 09:12:27 UTC (rev 254) @@ -1,3 +1,11 @@ +2011-03-23 Hedayat Vatankhah <hed...@gm...> + + * RELEASE: + - Updated release information for the next release + + * data/rsg/agent/nao/naoneckhead.rsg: + - Enable sensing field lines by default + 2011-02-10 Sander van Dijk <sgv...@gm...> * rcssserver3d/rcssserver3d/main.cpp Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2011-03-21 22:27:45 UTC (rev 253) +++ trunk/rcssserver3d/RELEASE 2011-03-23 09:12:27 UTC (rev 254) @@ -1,26 +1,32 @@ -RELEASE News of rcssserver3d-0.6.4 +RELEASE News of rcssserver3d-0.6.5 -This release is supposed to be the final version of rcssserver3d for -RoboCup 2010 in Singapore. The release includes a referee patch contributed -by FCPortugal team which enforces some rules to avoid crowding of many players -in a small area and to penalize ill-behaved players. Additionally, this -release comes with some more facilities for a human referee to control the game -and individual players in the field. +This release comes with a number of enhancements and some bug fixes. Most +notably, the automated referee is improved to prevent many agents to collide +with each other which is required for running games with more players. Also, to +better suite the field for running 9 vs 9 games, the field size is increased +and it is 21x14 now. There are some visual improvements and minor enhancements +to improve the general experience with the simulator. -* New keys in rcssmonitor3d: -- n: Cycle through agents. A red marker disc shows which agent is currently - selected -- e: Clear selection -- lctrl+s: Go into specific-agent-selection-mode. A specific agent can now be - selected by pressing l or r and then a number. So the sequence 'lctrl+s, l, 4' - selects the agent with uniform number 4 of the left team -- m: Move selected agent FreeKickDist meters back -- x: Kill selected agent +* New touch rules: +The automated referee now enforces two new rules to better prevent crowding and +a high number of collisions in 9 vs 9 games: +- If an agent is in touch with more than 2 agents (including himself), and he + wasn't in such a situation in the previous time step - which means he is the + last to join the group - he is relocated outside of the field. +- If it is not clear which agent joined the group last, e.g. when 3 players + were all separate at time t, but were all touching each other in time t + 1, + an agent is chosen at random for relocation. -* Other changes: -- Improved referee to enforce more fair games -- Visual Studio 2010 compilation fixes -- Agents can sense field lines if enabled (currently disabled) - +* Other Enhancements: +- Visual improvements in rcssmonitor3d: new field texture, colored team names + and scores +- Set different agent and monitor ports with --agent-port and --server-port +- Bigger field size: 21x14 +- Updated PDF documentation +- Bug fixes, specially in the automated referee +- New Trainer command (killsim) to terminate the simulator +- Compilation fixes +- Nao robots now sense visual information about field lines by default + You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg 2011-03-21 22:27:45 UTC (rev 253) +++ trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg 2011-03-23 09:12:27 UTC (rev 254) @@ -92,6 +92,7 @@ (setStaticSenseAxis false) (addNoise true) (setInterval 3) + (setSenseLine true) ) ;; (nd Transform This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-03-21 22:27:52
|
Revision: 253 http://simspark.svn.sourceforge.net/simspark/?rev=253&view=rev Author: sgvandijk Date: 2011-03-21 22:27:45 +0000 (Mon, 21 Mar 2011) Log Message: ----------- - New touch rules Modified Paths: -------------- trunk/rcssserver3d/data/rsg/agent/nao/contactjointhandler.rsg trunk/rcssserver3d/plugin/soccer/CMakeLists.txt trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h trunk/rcssserver3d/plugin/soccer/export.cpp trunk/rcssserver3d/plugin/soccer/soccerbase/soccerbase.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h Added Paths: ----------- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/ trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp Modified: trunk/rcssserver3d/data/rsg/agent/nao/contactjointhandler.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/contactjointhandler.rsg 2011-03-14 23:16:57 UTC (rev 252) +++ trunk/rcssserver3d/data/rsg/agent/nao/contactjointhandler.rsg 2011-03-21 22:27:45 UTC (rev 253) @@ -16,4 +16,8 @@ (setContactSlipMode true) (setContactSlip 5e-3) ) -) \ No newline at end of file + (nd AgentCollisionHandler + (setName handler) + ) + +) Modified: trunk/rcssserver3d/plugin/soccer/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/plugin/soccer/CMakeLists.txt 2011-03-14 23:16:57 UTC (rev 252) +++ trunk/rcssserver3d/plugin/soccer/CMakeLists.txt 2011-03-21 22:27:45 UTC (rev 253) @@ -46,6 +46,7 @@ hmdp_effector/hmdpperceptor.h hmdp_effector/naospecific.h line/line.h + agentcollisionhandler/agentcollisionhandler.h ) set(soccer_LIB_SRCS @@ -120,6 +121,8 @@ hmdp_effector/naospecific.cpp line/line.cpp line/line_c.cpp + agentcollisionhandler/agentcollisionhandler.cpp + agentcollisionhandler/agentcollisionhandler_c.cpp ) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${FREETYPE_INCLUDE_DIRS} Added: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp (rev 0) +++ trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp 2011-03-21 22:27:45 UTC (rev 253) @@ -0,0 +1,60 @@ +#include "agentcollisionhandler.h" +#include <oxygen/agentaspect/agentaspect.h> + +using namespace oxygen; + +void AgentCollisionHandler::OnLink() +{ +} + +void AgentCollisionHandler::HandleCollision(boost::shared_ptr<Collider> collidee, GenericContact& contact) +{ + if (!mAgentState.get()) + { + mAgentState = FindAgentState(this); + if (!mAgentState.get()) + { + GetLog()->Error() << + "(AgentCollisionHandler) Could not find own AgentState\n"; + return; + } + } + + boost::shared_ptr<AgentState> other = FindAgentState(collidee.get()); + if (other.get()) + { + boost::shared_ptr<TouchGroup> myGroup = mAgentState->GetTouchGroup(); + boost::shared_ptr<TouchGroup> otherGroup = other->GetTouchGroup(); + + // Check if not already in same group + if (myGroup == otherGroup) + return; + + // Insert agents into group with lowest index + // This ensures assignment uniqueness + if (myGroup < otherGroup) + { + myGroup->insert(otherGroup->begin(), otherGroup->end()); + otherGroup->clear(); + other->SetTouchGroup(myGroup); + } + else + { + otherGroup->insert(myGroup->begin(), myGroup->end()); + myGroup->clear(); + mAgentState->SetTouchGroup(otherGroup); + } + } +} + +boost::shared_ptr<AgentState> AgentCollisionHandler::FindAgentState(BaseNode* node) +{ + boost::shared_ptr<AgentAspect> agentAspect + = node->FindParentSupportingClass<AgentAspect>().lock(); + if (!agentAspect.get()) + { + return boost::shared_ptr<AgentState>(); + } + + return boost::shared_static_cast<AgentState>(agentAspect->FindChildSupportingClass<AgentState>(true)); +} Added: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h (rev 0) +++ trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h 2011-03-21 22:27:45 UTC (rev 253) @@ -0,0 +1,62 @@ +/* -*- 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: recorderhandler.h 176 2010-02-25 12:19:37Z a-held $ + + 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 AGENTCOLLISIONHANDLER_H +#define AGENTCOLLISIONHANDLER_H + +#include <oxygen/oxygen_defines.h> +#include <oxygen/physicsserver/collisionhandler.h> +#include <oxygen/physicsserver/collider.h> +#include <agentstate/agentstate.h> +#include <boost/enable_shared_from_this.hpp> + +/** \class AgentCollisionHandler is a CollisionHandler that passes + collision information of the Collider it belongs to to the owning + AgentState. +*/ +class AgentCollisionHandler : public oxygen::CollisionHandler +{ +public: + AgentCollisionHandler() : oxygen::CollisionHandler() {}; + virtual ~AgentCollisionHandler() {}; + + virtual void OnLink(); + + /** Adds to collision list if \collidee is part of another agent + + \param collidee is the geom ID of the colliders collision + partner + + \param holds the contact points between the two affected geoms + as returned from the ODE dCollide function + */ + virtual void HandleCollision + (boost::shared_ptr<oxygen::Collider> collidee, oxygen::GenericContact& contact); + +private: + boost::shared_ptr<AgentState> FindAgentState(BaseNode* node); + + boost::shared_ptr<AgentState> mAgentState; +}; + + DECLARE_CLASS(AgentCollisionHandler); + +#endif // AGENTCOLLISIONHANDLER_H Added: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp (rev 0) +++ trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp 2011-03-21 22:27:45 UTC (rev 253) @@ -0,0 +1,30 @@ +/* -*- 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: recorderhandler_c.cpp 176 2010-02-25 12:19:37Z a-held $ + + 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 "agentcollisionhandler.h" + +void CLASS(AgentCollisionHandler)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/CollisionHandler); +} + + Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2011-03-14 23:16:57 UTC (rev 252) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2011-03-21 22:27:45 UTC (rev 253) @@ -36,7 +36,8 @@ mHearDecay(2), mHearMateCap(2), mHearOppCap(2), mIfSelfMsg(false), mIfMateMsg(false), mIfOppMsg(false), - mSelected(false) + mSelected(false), + mOldTouchGroup(new TouchGroup), mTouchGroup(new TouchGroup) { // set mID and mUniformNumber into a joint state SetUniformNumber(0); @@ -258,3 +259,28 @@ { mSelected = false; } + +void +AgentState::NewTouchGroup() +{ + mOldTouchGroup = mTouchGroup; + mTouchGroup = boost::shared_ptr<TouchGroup>(new TouchGroup()); +} + +boost::shared_ptr<TouchGroup> +AgentState::GetOldTouchGroup() +{ + return mOldTouchGroup; +} + +void +AgentState::SetTouchGroup(boost::shared_ptr<TouchGroup> group) +{ + mTouchGroup = group; +} + +boost::shared_ptr<TouchGroup> +AgentState::GetTouchGroup() +{ + return mTouchGroup; +} Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2011-03-14 23:16:57 UTC (rev 252) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2011-03-21 22:27:45 UTC (rev 253) @@ -30,6 +30,10 @@ class RigidBody; } +class AgentState; + +typedef std::set<boost::shared_ptr<AgentState> > TouchGroup; + class AgentState : public ObjectState { // @@ -91,10 +95,27 @@ bool GetMessage(std::string& msg, float& direction, bool teamMate); bool GetSelfMessage(std::string& msg); + /** Whether agent is selected */ bool IsSelected() const; + + /** Select agent */ void Select(bool s = true); + + /** Unselect agent */ void UnSelect(); + /** Backup old touch group and create new empty one */ + void NewTouchGroup(); + + /** Get the touch group of the previous step */ + boost::shared_ptr<TouchGroup> GetOldTouchGroup(); + + /** Get the current touch group */ + boost::shared_ptr<TouchGroup> GetTouchGroup(); + + /** Set the current touch group */ + void SetTouchGroup(boost::shared_ptr<TouchGroup> group); + protected: /** team index */ TTeamIndex mTeamIndex; @@ -138,7 +159,12 @@ /** is there any message from oponnent */ bool mIfOppMsg; + /** is this agent selected */ bool mSelected; + + boost::shared_ptr<TouchGroup> mOldTouchGroup; + boost::shared_ptr<TouchGroup> mTouchGroup; + protected: virtual void UpdateHierarchyInternal(); virtual void OnUnlink(); Modified: trunk/rcssserver3d/plugin/soccer/export.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/export.cpp 2011-03-14 23:16:57 UTC (rev 252) +++ trunk/rcssserver3d/plugin/soccer/export.cpp 2011-03-21 22:27:45 UTC (rev 253) @@ -54,6 +54,7 @@ #include "hmdp_effector/hmdpeffector.h" #include "hmdp_effector/hmdpperceptor.h" #include "line/line.h" +#include "agentcollisionhandler/agentcollisionhandler.h" ZEITGEIST_EXPORT_BEGIN() ZEITGEIST_EXPORT(SoccerControlAspect); @@ -90,5 +91,6 @@ ZEITGEIST_EXPORT(HMDPPerceptor); ZEITGEIST_EXPORT(HMDPEffector); ZEITGEIST_EXPORT(Line); + ZEITGEIST_EXPORT(AgentCollisionHandler); ZEITGEIST_EXPORT_END() Modified: trunk/rcssserver3d/plugin/soccer/soccerbase/soccerbase.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerbase/soccerbase.h 2011-03-14 23:16:57 UTC (rev 252) +++ trunk/rcssserver3d/plugin/soccer/soccerbase/soccerbase.h 2011-03-21 22:27:45 UTC (rev 253) @@ -62,7 +62,7 @@ class SoccerBase { public: - typedef std::list<boost::shared_ptr<AgentState> > TAgentStateList; + typedef std::vector<boost::shared_ptr<AgentState> > TAgentStateList; typedef std::map<int, boost::shared_ptr<AgentState> > TAgentStateMap; public: Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2011-03-14 23:16:57 UTC (rev 252) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2011-03-21 22:27:45 UTC (rev 253) @@ -30,6 +30,7 @@ #include <gamestateaspect/gamestateaspect.h> #include <ballstateaspect/ballstateaspect.h> #include <agentstate/agentstate.h> +#include <algorithm> using namespace oxygen; using namespace boost; @@ -63,6 +64,7 @@ mMinOppDistance(0), // min dist for closest Opponent to ball in order to use repositions for 2nd, 3rd player mMin2PlDistance(0), // min dist for second closest of team before being repositioned mMin3PlDistance(0), // min dist for third closest of team before being repositioned + mMaxTouchGroupSize(1000), mMaxFaultTime(0.0) // maximum time allowed for a player to commit a positional fault before being repositioned { mFreeKickPos = Vector3f(0.0,0.0,mBallRadius); @@ -98,12 +100,18 @@ CalculateDistanceArrays(TI_RIGHT); // Calculates distance arrays for right team AnalyseFaults(TI_LEFT); // Analyses simple faults for the left team AnalyseFaults(TI_RIGHT); // Analyses simple faults for the right team + AnalyseTouchGroups(TI_LEFT); + AnalyseTouchGroups(TI_RIGHT); // Only apply rules during play-on if (playMode == PM_PlayOn) { ClearPlayersAutomatic(TI_LEFT); // enforce standing and not overcrowding rules for left team ClearPlayersAutomatic(TI_RIGHT); // enforce standing and not overcrowding rules for right team } + + // Reset touch groups + ResetTouchGroups(TI_LEFT); + ResetTouchGroups(TI_RIGHT); } } @@ -129,7 +137,7 @@ // Process agent state: standing, sitted, laying down, ... void -SoccerRuleAspect::processAgentState(salt::Vector3f pos, int unum, TTeamIndex idx) +SoccerRuleAspect::ProcessAgentState(salt::Vector3f pos, int unum, TTeamIndex idx) { float groundZVal = 0.15; //bellow this player is on the ground float middleZVal = 0.25; //abovce this player is standing (or trying...) @@ -184,7 +192,7 @@ { if (idx == TI_NONE || mBallState.get() == 0) return; - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; @@ -196,7 +204,7 @@ ownGoalPos = Vector3f(mFieldLength/2.0, 0.0, 0.0); boost::shared_ptr<oxygen::Transform> agent_aspect; - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; numPlInsideOwnArea[idx] = 0; closestPlayer[idx] = 1; @@ -246,7 +254,7 @@ playerInsideOwnArea[unum][idx] = 0; // Process agent state: standing, sitted, laying down, ... - processAgentState(agentPos, unum, idx); + ProcessAgentState(agentPos, unum, idx); } // compute rank of distance to ball @@ -255,6 +263,42 @@ SimpleOrder(distGArr, ordGArr, idx); } +void SoccerRuleAspect::AnalyseTouchGroups(TTeamIndex idx) +{ + if (idx == TI_NONE || mBallState.get() == 0) + return; + SoccerBase::TAgentStateList agent_states; + if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) + return; + + random_shuffle(agent_states.begin(), agent_states.end()); + SoccerBase::TAgentStateList::iterator i = agent_states.begin(); + for (; i != agent_states.end(); ++i) + { + // Wasn't touching before, joined group making group too large + if ((*i)->GetOldTouchGroup()->size() == 1 && (*i)->GetTouchGroup()->size() > mMaxTouchGroupSize) + { + playerFaultTime[(*i)->GetUniformNumber()][idx]++; + // Remove player from touch group so no more agents are replaced + (*i)->GetTouchGroup()->erase(*i); + } + } +} + +void SoccerRuleAspect::ResetTouchGroups(TTeamIndex idx) +{ + SoccerBase::TAgentStateList agent_states; + if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) + return; + + SoccerBase::TAgentStateList::const_iterator i; + for (i = agent_states.begin(); i != agent_states.end(); i++) + { + (*i)->NewTouchGroup(); + (*i)->GetTouchGroup()->insert(*i); + } +} + // Analyse Faults and Creates Fault Time Array void SoccerRuleAspect::AnalyseFaults(TTeamIndex idx) { @@ -316,14 +360,15 @@ salt::Vector3f SoccerRuleAspect::RepositionOutsidePos(salt::Vector3f posIni, int unum, TTeamIndex idx) { - salt::Vector3f pos; - float fac=1.0; - if (unum > 6) unum = 7 -unum; //because of teams that use numbers 7-11 - if (posIni.y()<1.5) fac = 1.0; else fac = -1.0; //for visualization purposes - if (idx==TI_LEFT) pos = Vector3f(-(7-unum)*0.6, 6.5*fac, 1.0); - else pos = Vector3f((7-unum)*0.6, 6.5*fac, 1.0); - //cout << "*********Player Repos Num: " << unum << " Team: " << idx << " Pos: " << pos << endl; - return pos; + salt::Vector3f pos; + // Choose x side based on team + float xFac = idx == TI_LEFT ? -0.6 : 0.6; + // Choose side on oppisite side of field + float yFac = posIni.y() < 0 ? 1.0 : -1.0; + + pos = Vector3f(xFac * (7 - unum), (mFieldWidth / 2 + 0.5) * yFac, 1.0); + + return pos; } @@ -334,20 +379,20 @@ if (idx == TI_NONE || mBallState.get() == 0) return; - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; salt::Vector3f ballPos = mBallBody->GetPosition(); boost::shared_ptr<oxygen::Transform> agent_aspect; - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) { SoccerBase::GetTransformParent(**i, agent_aspect); Vector3f agentPos = agent_aspect->GetWorldTransform().Pos(); - int unum = (*i)->GetUniformNumber(); + int unum = (*i)->GetUniformNumber(); if (playerFaultTime[unum][idx] > mMaxFaultTime / 0.02) { // I am not a very good soccer player... I am violating the rules... @@ -367,13 +412,13 @@ { if (idx == TI_NONE || mBallState.get() == 0) return; - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; salt::BoundingSphere sphere(pos, radius); boost::shared_ptr<oxygen::Transform> agent_aspect; - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) { SoccerBase::GetTransformParent(**i, agent_aspect); @@ -412,12 +457,12 @@ float min_dist, TTeamIndex idx) { if (idx == TI_NONE || mBallState.get() == 0) return; - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; boost::shared_ptr<oxygen::Transform> agent_aspect; - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) { SoccerBase::GetTransformParent(**i, agent_aspect); @@ -457,7 +502,7 @@ ClearPlayers(Vector3f(0,0,0), mFreeKickDist, mFreeKickMoveDist,opp); // move the kick off team to own half field and the center circle - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; @@ -470,7 +515,7 @@ } boost::shared_ptr<oxygen::Transform> agent_aspect; - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; float freeKickDist2 = mFreeKickDist*mFreeKickDist; for (i = agent_states.begin(); i != agent_states.end(); ++i) { @@ -504,12 +549,12 @@ SoccerRuleAspect::ClearSelectedPlayers() { float min_dist = mFreeKickMoveDist; - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE)) return; boost::shared_ptr<oxygen::Transform> agent_aspect; - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) { SoccerBase::GetTransformParent(**i, agent_aspect); @@ -1256,6 +1301,7 @@ SoccerBase::GetSoccerVar(*this,"MinOppDistance",mMinOppDistance); SoccerBase::GetSoccerVar(*this,"Min2PlDistance",mMin2PlDistance); SoccerBase::GetSoccerVar(*this,"Min3PlDistance",mMin3PlDistance); + SoccerBase::GetSoccerVar(*this,"MaxTouchGroupSize",mMaxTouchGroupSize); //SoccerBase::GetSoccerVar(*this,"MaxFaultTime",mMaxFaultTime); @@ -1284,13 +1330,13 @@ SoccerRuleAspect::Broadcast(const string& message, const Vector3f& pos, int number, TTeamIndex idx) { - TAgentStateList agent_states; + SoccerBase::TAgentStateList agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) { return; } - TAgentStateList opponent_agent_states; + SoccerBase::TAgentStateList opponent_agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), opponent_agent_states, SoccerBase::OpponentTeam(idx))) { @@ -1308,7 +1354,7 @@ boost::shared_ptr<RigidBody> agent_body; for ( - TAgentStateList::const_iterator it = agent_states.begin(); + SoccerBase::TAgentStateList::const_iterator it = agent_states.begin(); it != agent_states.end(); it++ ) @@ -1653,13 +1699,13 @@ boost::shared_ptr<AgentState> agentState) { if (idx == TI_NONE || mBallState.get() == 0) return; - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; salt::BoundingSphere sphere(pos, radius); boost::shared_ptr<oxygen::Transform> agent_aspect; - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) { if (agentState == (*i)) @@ -1704,11 +1750,11 @@ void SoccerRuleAspect::ResetAgentSelection() { - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE)) { - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) (*i)->UnSelect(); } @@ -1717,13 +1763,13 @@ void SoccerRuleAspect::SelectNextAgent() { - std::list<boost::shared_ptr<AgentState> > agent_states; + SoccerBase::TAgentStateList agent_states; bool selectNext = false; if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE) && agent_states.size() > 0) { boost::shared_ptr<AgentState> first = agent_states.front(); - std::list<boost::shared_ptr<AgentState> >::const_iterator i; + SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) { if ((*i)->IsSelected()) Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2011-03-14 23:16:57 UTC (rev 252) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2011-03-21 22:27:45 UTC (rev 253) @@ -76,36 +76,44 @@ */ //salt::Vector3f RepositionInsidePos(salt::Vector3f initPos, int unum, TTeamIndex idx, float distance); - /** New rules for repositioning players that commit faults - */ - void ClearPlayersAutomatic(TTeamIndex idx); + /** New rules for repositioning players that commit faults + */ + void ClearPlayersAutomatic(TTeamIndex idx); - /** Calculates distance arrays needed for repositioning players - */ - void CalculateDistanceArrays(TTeamIndex idx); + /** Calculates distance arrays needed for repositioning players + */ + void CalculateDistanceArrays(TTeamIndex idx); - /** Calculates ordering on a distance vector */ - void SimpleOrder(float dArr[][3], int oArr[][3], TTeamIndex idx); + /** Calculates ordering on a distance vector */ + void SimpleOrder(float dArr[][3], int oArr[][3], TTeamIndex idx); - /** Agent state concerining standing, laying down on the ground are processed - */ - void processAgentState(salt::Vector3f pos, int unum, TTeamIndex idx); + /** Agent state concerining standing, laying down on the ground are processed + */ + void ProcessAgentState(salt::Vector3f pos, int unum, TTeamIndex idx); - /** Reset the fault time counter for all players and also other counters - */ - void ResetFaultCounter(TTeamIndex idx); + /** Reset the fault time counter for all players and also other counters + */ + void ResetFaultCounter(TTeamIndex idx); - /** Reset the fault time counter for a given player - */ - void ResetFaultCounterPlayer(int unum, TTeamIndex idx); + /** Reset the fault time counter for a given player + */ + void ResetFaultCounterPlayer(int unum, TTeamIndex idx); - /**Analyse Faults from players and increase fault counter of offending players - */ - void AnalyseFaults(TTeamIndex idx); + /**Analyse Faults from players and increase fault counter of offending players + */ + void AnalyseFaults(TTeamIndex idx); - /** Automatic Referee that clears players that violate the rules - */ - void AutomaticSimpleReferee(TPlayMode playMode); + /** Check whether too many agents are touching + */ + void AnalyseTouchGroups(TTeamIndex idx); + + /** Reset the touch groups + */ + void ResetTouchGroups(TTeamIndex idx); + + /** Automatic Referee that clears players that violate the rules + */ + void AutomaticSimpleReferee(TPlayMode playMode); /** broadcast a said message to all players \param message said message- @@ -302,6 +310,8 @@ float mMinOppDistance; /** maximum number of players of the defending team that may be inside own penalty area */ int mMaxPlayersInsideOwnArea; + /** maximum number of players that may be in a single touch group */ + int mMaxTouchGroupSize; /** maximum time allowed for a player to commit a positional fault before being repositioned */ int mMaxFaultTime; /* Useful arrays for dealing with agent state an faults */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-03-14 23:17:04
|
Revision: 252 http://simspark.svn.sourceforge.net/simspark/?rev=252&view=rev Author: sgvandijk Date: 2011-03-14 23:16:57 +0000 (Mon, 14 Mar 2011) Log Message: ----------- - New field size - Players thrown out of panelty area, and wrong kickin side switch bug should be fixed Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2011-03-04 00:46:44 UTC (rev 251) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2011-03-14 23:16:57 UTC (rev 252) @@ -86,17 +86,25 @@ void SoccerRuleAspect::AutomaticSimpleReferee(TPlayMode playMode) { - if (playMode != PM_PlayOn) { - ResetFaultCounter(TI_LEFT); ResetFaultCounter(TI_RIGHT); //only using automatic refereing in PlayOn - } - else { - CalculateDistanceArrays(TI_LEFT); // Calculates distance arrays for left team - CalculateDistanceArrays(TI_RIGHT); // Calculates distance arrays for right team - AnalyseFaults(TI_LEFT); // Analyses simple faults for the left team - AnalyseFaults(TI_RIGHT); // Analyses simple faults for the right team - ClearPlayersAutomatic(TI_LEFT); // enforce standing and not overcrowding rules for left team - ClearPlayersAutomatic(TI_RIGHT); // enforce standing and not overcrowding rules for right team + // Reset counters before kickoff + if (playMode == PM_BeforeKickOff) + { + ResetFaultCounter(TI_LEFT); + ResetFaultCounter(TI_RIGHT); } + else + { + CalculateDistanceArrays(TI_LEFT); // Calculates distance arrays for left team + CalculateDistanceArrays(TI_RIGHT); // Calculates distance arrays for right team + AnalyseFaults(TI_LEFT); // Analyses simple faults for the left team + AnalyseFaults(TI_RIGHT); // Analyses simple faults for the right team + // Only apply rules during play-on + if (playMode == PM_PlayOn) + { + ClearPlayersAutomatic(TI_LEFT); // enforce standing and not overcrowding rules for left team + ClearPlayersAutomatic(TI_RIGHT); // enforce standing and not overcrowding rules for right team + } + } } @@ -123,42 +131,44 @@ void SoccerRuleAspect::processAgentState(salt::Vector3f pos, int unum, TTeamIndex idx) { - float groundZVal = 0.15; //bellow this player is on the ground - float middleZVal = 0.25; //abovce this player is standing (or trying...) + float groundZVal = 0.15; //bellow this player is on the ground + float middleZVal = 0.25; //abovce this player is standing (or trying...) - //increase player not standing if it is not in upward position and inside of field - if (pos.z() < middleZVal && fabs(pos.y())< mFieldWidth/2 + 0.1) { - playerNotStanding[unum][idx]++; - playerStanding[unum][idx]=0; //player not standing - } + //increase player not standing if it is not in upward position and inside of field + if (pos.z() < middleZVal && fabs(pos.y())< mFieldWidth / 2 + 0.1) + { + playerNotStanding[unum][idx]++; + playerStanding[unum][idx] = 0; //player not standing + } - //increase player near ground if it is very low and inside of field - if (pos.z() < groundZVal && fabs(pos.y())< mFieldWidth/2 + 0.1) { - playerGround[unum][idx]++; - } + //increase player near ground if it is very low and inside of field + if (pos.z() < groundZVal && fabs(pos.y())< mFieldWidth / 2 + 0.1) + { + playerGround[unum][idx]++; + } - //increase player standing or at least trying... Reset ground - if (pos.z() >= middleZVal) { - playerStanding[unum][idx]++; - playerGround[unum][idx]=0; - } + //increase player standing or at least trying... Reset ground + if (pos.z() >= middleZVal) + { + playerStanding[unum][idx]++; + playerGround[unum][idx] = 0; + } - //Player standing for some cycles (0.5 seconds) reset not standing count - if (playerStanding[unum][idx] > 0.5/0.02) { - playerNotStanding[unum][idx]=0; - } - -// if (playerGround[unum][idx] > 0/0.02) -// cout << "On the Ground Unum" << unum << " Team: " << idx << " Time: " << playerGround[unum][idx] << -// " z= " << pos.z() << endl; //debug + //Player standing for some cycles (0.5 seconds) reset not standing count + if (playerStanding[unum][idx] > 0.5 / 0.02) { + playerNotStanding[unum][idx] = 0; + } } // Calculates ordering on a distance vector void SoccerRuleAspect::SimpleOrder(float dArr[][3], int oArr[][3], TTeamIndex idx) { - for(int t1=1; t1<=10; t1++) - for(int t2=t1+1; t2<=11; t2++) - if (dArr[t1][idx] >= dArr[t2][idx]) oArr[t1][idx]++; else oArr[t2][idx]++; + for(int t1 = 1; t1 <= 10; t1++) + for(int t2 = t1 + 1; t2 <= 11; t2++) + if (dArr[t1][idx] >= dArr[t2][idx]) + oArr[t1][idx]++; + else + oArr[t2][idx]++; // DEBUG // if (dArr[1][idx]<1000.0) { @@ -172,53 +182,71 @@ // Calculate Distance arrays and ordering to the ball and own goal void SoccerRuleAspect::CalculateDistanceArrays(TTeamIndex idx) { - if (idx == TI_NONE || mBallState.get() == 0) return; + if (idx == TI_NONE || mBallState.get() == 0) + return; std::list<boost::shared_ptr<AgentState> > agent_states; - if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; + if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) + return; salt::Vector3f ballPos = mBallBody->GetPosition(); - salt::Vector3f ownGoalPos = Vector3f(-mFieldLength/2.0, 0.0, 0.0); - if (idx==TI_RIGHT) ownGoalPos = Vector3f(mFieldLength/2.0, 0.0, 0.0); //own goal position + salt::Vector3f ownGoalPos; + if (idx == TI_LEFT) + ownGoalPos = Vector3f(-mFieldLength/2.0, 0.0, 0.0); + else + ownGoalPos = Vector3f(mFieldLength/2.0, 0.0, 0.0); + boost::shared_ptr<oxygen::Transform> agent_aspect; std::list<boost::shared_ptr<AgentState> >::const_iterator i; - numPlInsideOwnArea[idx] = 0; closestPlayer[idx]=1; closestPlayerDist[idx]=1000.0; - for(int t=1; t<=11; t++) { - distArr[t][idx]=1000.0; ordArr[t][idx]=1; distGArr[t][idx]=1000.0; ordGArr[t][idx]=1; + numPlInsideOwnArea[idx] = 0; + closestPlayer[idx] = 1; + closestPlayerDist[idx] = 1000.0; + for(int t = 1; t <= 11; t++) + { + distArr[t][idx]=1000.0; + ordArr[t][idx]=1; + distGArr[t][idx]=1000.0; + ordGArr[t][idx]=1; } - for (i = agent_states.begin(); i != agent_states.end(); ++i) { + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { SoccerBase::GetTransformParent(**i, agent_aspect); Vector3f agentPos = agent_aspect->GetWorldTransform().Pos(); int unum = (*i)->GetUniformNumber(); - distArr[unum][idx] = sqrt((agentPos.x()-ballPos.x())*(agentPos.x()-ballPos.x()) + - (agentPos.y()-ballPos.y())*(agentPos.y()-ballPos.y())); - distGArr[unum][idx] = sqrt((agentPos.x()-ownGoalPos.x())*(agentPos.x()-ownGoalPos.x()) + - (agentPos.y()-ownGoalPos.y())*(agentPos.y()-ownGoalPos.y())); + distArr[unum][idx] = sqrt((agentPos.x()-ballPos.x())*(agentPos.x()-ballPos.x()) + + (agentPos.y()-ballPos.y())*(agentPos.y()-ballPos.y())); + distGArr[unum][idx] = sqrt((agentPos.x()-ownGoalPos.x())*(agentPos.x()-ownGoalPos.x()) + + (agentPos.y()-ownGoalPos.y())*(agentPos.y()-ownGoalPos.y())); // determine closest player - if (distArr[unum][idx] < closestPlayerDist[idx]) { - closestPlayerDist[idx] = distArr[unum][idx]; closestPlayer[idx] = unum; - } + if (distArr[unum][idx] < closestPlayerDist[idx]) + { + closestPlayerDist[idx] = distArr[unum][idx]; + closestPlayer[idx] = unum; + } // save player inside area state in previous cycle - prevPlayerInsideOwnArea[unum][idx] = playerInsideOwnArea[unum][idx]; + prevPlayerInsideOwnArea[unum][idx] = playerInsideOwnArea[unum][idx]; // determine number of players inside area and set inside area state of player if (idx == TI_LEFT && mLeftPenaltyArea.Contains(Vector2f(agentPos.x(), agentPos.y())) || - idx == TI_RIGHT && mRightPenaltyArea.Contains(Vector2f(agentPos.x(), agentPos.y()))) { - numPlInsideOwnArea[idx]++; - playerInsideOwnArea[unum][idx] = 1; + idx == TI_RIGHT && mRightPenaltyArea.Contains(Vector2f(agentPos.x(), agentPos.y()))) + { + numPlInsideOwnArea[idx]++; + playerInsideOwnArea[unum][idx] = 1; - //goalie is not repositioned when inside own area... - if (unum == 1) { - distGArr[unum][idx] = 0.0; - } - } - else playerInsideOwnArea[unum][idx] = 0; + //goalie is not repositioned when inside own area... + if (unum == 1) + { + distGArr[unum][idx] = 0.0; + } + } + else + playerInsideOwnArea[unum][idx] = 0; // Process agent state: standing, sitted, laying down, ... - processAgentState(agentPos, unum, idx); + processAgentState(agentPos, unum, idx); } // compute rank of distance to ball @@ -230,75 +258,58 @@ // Analyse Faults and Creates Fault Time Array void SoccerRuleAspect::AnalyseFaults(TTeamIndex idx) { - TTeamIndex idx2; if (idx == TI_LEFT) idx2 = TI_RIGHT; else idx2 = TI_LEFT; //Other team - for(int unum=1; unum<=11; unum++) { - - //I am the third closest player but i am too near the ball (and not the goalie) - if ( unum!=1 && closestPlayerDist[idx2] < mMinOppDistance && - (distArr[unum][idx] <= mMin3PlDistance+0.01 && ordArr[unum][idx] == 3)) - { - playerFaultTime[unum][idx]++; //increase player fault time - //cout << "Min3Dist " << mMin3PlDistance << " activated - player " << unum << " to be repositioned \n"; - } - else - //I am the second closest player but i am too near the ball (and not the goalie) - if( unum!=1 && closestPlayerDist[idx2] < mMinOppDistance && - distArr[unum][idx] <= mMin2PlDistance+0.01 && ordArr[unum][idx] == 2 ) - { - playerFaultTime[unum][idx]++; //increase player fault time - //cout << "Min2Dist " << mMin2PlDistance << " activated - player " << unum << " to be repositioned \n"; - } - else - // too many players inside my own penalty area and Im am the last one to enter or - // the last one to enter was the goalie and I am the one further away from own goal - if( (numPlInsideOwnArea[idx] > mMaxPlayersInsideOwnArea && unum !=1 && playerInsideOwnArea[unum][idx] == 1 && - (prevPlayerInsideOwnArea[unum][idx] == 0 || - prevPlayerInsideOwnArea[1][idx] == 0 && - playerInsideOwnArea[1][idx] == 1 && - mMaxPlayersInsideOwnArea + 1 == ordGArr[unum][idx]))) - { - playerFaultTime[unum][idx]++; //increase player fault time - //cout << "MaxPlInPenalty " << mMaxPlayersInsideOwnArea << " activated - player " - // << unum << " to be repositioned " << " ord " << ordGArr[unum][idx] << "\n"; - } - else - //I am a field player and on the ground for too much time - if ( unum!=1 && playerGround[unum][idx] > mGroundMaxTime/0.02 ) - { - playerFaultTime[unum][idx]++; //increase player fault time - //cout << "GroundMaxTime " << mGroundMaxTime << " activated - player " - // << unum << " to be repositioned " << "\n"; - } - else - // I am a field player and I am not standing for too much time - if( unum!=1 && playerNotStanding[unum][idx] > mNotStandingMaxTime/0.02 ) - { - playerFaultTime[unum][idx]++; //increase player fault time - //cout << "StandMaxTime " << mNotStandingMaxTime << " activated - player " - // << unum << " to be repositioned " << "\n"; - } + TTeamIndex idx2; + if (idx == TI_LEFT) + idx2 = TI_RIGHT; + else + idx2 = TI_LEFT; //Other team - else - //I am the goalie and I am on the ground for too much time - if ( unum==1 && - playerGround[unum][idx] > mGoalieGroundMaxTime/0.02 ) - { - playerFaultTime[unum][idx]++; //increase player fault time - //cout << "GoalieGroundMaxTime " << mGoalieGroundMaxTime << " activated - player " - // << unum << " to be repositioned " << "\n"; - } - else - //I am the goalie and I and not standing for too much time - if ( unum == 1 && playerNotStanding[unum][idx] > mGoalieNotStandingMaxTime/0.02) - { - playerFaultTime[unum][idx]++; //increase player fault time - //cout << "GoalieStandMaxTime " << mGoalieNotStandingMaxTime << " activated - player " - // << unum << " to be repositioned " << "\n"; - } - else { - playerFaultTime[unum][idx]=0; //reset player fault time - } - + for(int unum=1; unum<=11; unum++) + { + // I am the third closest player but i am too near the ball (and not the goalie) + if (unum != 1 && closestPlayerDist[idx2] < mMinOppDistance && + (distArr[unum][idx] <= mMin3PlDistance + 0.01 && ordArr[unum][idx] == 3)) + { + playerFaultTime[unum][idx]++; + } + // I am the second closest player but i am too near the ball (and not the goalie) + else if(unum != 1 && closestPlayerDist[idx2] < mMinOppDistance && + distArr[unum][idx] <= mMin2PlDistance + 0.01 && ordArr[unum][idx] == 2 ) + { + playerFaultTime[unum][idx]++; + } + // Too many players inside my own penalty area and Im am the last one to enter or + // the last one to enter was the goalie and I am the one further away from own goal + else if((numPlInsideOwnArea[idx] > mMaxPlayersInsideOwnArea && unum != 1 && playerInsideOwnArea[unum][idx] == 1 && + (prevPlayerInsideOwnArea[unum][idx] == 0 || + (prevPlayerInsideOwnArea[1][idx] == 0 && playerInsideOwnArea[1][idx] == 1 && mMaxPlayersInsideOwnArea + 1 == ordGArr[unum][idx])))) + { + playerFaultTime[unum][idx]++; + } + // I am a field player and on the ground for too much time + else if (unum != 1 && playerGround[unum][idx] > mGroundMaxTime / 0.02) + { + playerFaultTime[unum][idx]++; + } + // I am a field player and I am not standing for too much time + else if(unum!=1 && playerNotStanding[unum][idx] > mNotStandingMaxTime / 0.02) + { + playerFaultTime[unum][idx]++; + } + // I am the goalie and I am on the ground for too much time + else if (unum == 1 && playerGround[unum][idx] > mGoalieGroundMaxTime / 0.02) + { + playerFaultTime[unum][idx]++; + } + // I am the goalie and I and not standing for too much time + else if (unum == 1 && playerNotStanding[unum][idx] > mGoalieNotStandingMaxTime / 0.02) + { + playerFaultTime[unum][idx]++; + } + else + { + playerFaultTime[unum][idx]=0; + } } } @@ -320,28 +331,32 @@ void SoccerRuleAspect::ClearPlayersAutomatic(TTeamIndex idx) { - if (idx == TI_NONE || mBallState.get() == 0) return; + if (idx == TI_NONE || mBallState.get() == 0) + return; std::list<boost::shared_ptr<AgentState> > agent_states; - if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; + if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) + return; salt::Vector3f ballPos = mBallBody->GetPosition(); boost::shared_ptr<oxygen::Transform> agent_aspect; std::list<boost::shared_ptr<AgentState> >::const_iterator i; - for (i = agent_states.begin(); i != agent_states.end(); ++i) { + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { SoccerBase::GetTransformParent(**i, agent_aspect); Vector3f agentPos = agent_aspect->GetWorldTransform().Pos(); int unum = (*i)->GetUniformNumber(); - if (playerFaultTime[unum][idx] > mMaxFaultTime/0.02) { - // I am not a very good soccer player... I am violating the rules... + if (playerFaultTime[unum][idx] > mMaxFaultTime / 0.02) + { + // I am not a very good soccer player... I am violating the rules... salt::Vector3f new_pos = RepositionOutsidePos(ballPos, unum, idx); - //Calculate my Reposition pos outside of the field + //Calculate my Reposition pos outside of the field SoccerBase::MoveAgent(agent_aspect, new_pos); - //Oh my God!! I am flying!! I am going outside of the field - ResetFaultCounterPlayer(unum, idx); - //cout << "*********Player Repos Num: " << unum << " Team: " << team << " Pos: " << new_pos << endl; + //Oh my God!! I am flying!! I am going outside of the field + ResetFaultCounterPlayer(unum, idx); + //cout << "*********Player Repos Num: " << unum << " Team: " << team << " Pos: " << new_pos << endl; } } } @@ -665,7 +680,7 @@ // after the first agent touches the ball move to PM_PLAY_ON. the // time when the agent last touches the ball must be after the - // change to the KickIn mode + // change to the KickIn mode *plus* pause time boost::shared_ptr<AgentAspect> agent; TTime time; if (! mBallState->GetLastCollidingAgent(agent,time)) @@ -675,7 +690,7 @@ } TTime lastChange = mGameState->GetLastModeChange(); - if (time > lastChange) + if (time > lastChange + mKickInPauseTime) { mGameState->SetPlayMode(PM_PlayOn); GetLog()->Error() << "ERROR: (SoccerRuleAspect) " << "Set Playmode to playon\n"; @@ -745,7 +760,7 @@ } TTime lastChange = mGameState->GetLastModeChange(); - if (time > lastChange) + if (time > lastChange + mKickInPauseTime) { mGameState->SetPlayMode(PM_PlayOn); GetLog()->Error() << "ERROR: (SoccerRuleAspect) " << "Set Playmode to playon\n"; @@ -794,7 +809,7 @@ TTime lastChange = mGameState->GetLastModeChange(); // if the team with the goal kick touched the ball and the ball is // outside the penalty area, we switch to play on. - if (time > lastChange) + if (time > lastChange + mKickInPauseTime) { Vector2f pos(mBallBody->GetPosition().x(), mBallBody->GetPosition().y()); @@ -840,7 +855,7 @@ // after the first agent touches the ball move to PM_PLAY_ON. the // time when the agent last touches the ball must be after the - // change to the KickIn mode + // change to the KickIn mode *plus* pause time boost::shared_ptr<AgentAspect> agent; TTime time; if (! mBallState->GetLastCollidingAgent(agent,time)) @@ -849,7 +864,7 @@ } TTime lastChange = mGameState->GetLastModeChange(); - if (time > lastChange) + if (time > lastChange + mKickInPauseTime) { mGameState->SetPlayMode(PM_PlayOn); } else Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2011-03-04 00:46:44 UTC (rev 251) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2011-03-14 23:16:57 UTC (rev 252) @@ -37,8 +37,8 @@ end # the soccer field dimensions in meters -addSoccerVar('FieldLength', 18.0) -addSoccerVar('FieldWidth', 12.0) +addSoccerVar('FieldLength', 21.0) +addSoccerVar('FieldWidth', 14.0) addSoccerVar('FieldHeight', 40.0) addSoccerVar('GoalWidth', 2.1) addSoccerVar('GoalDepth', 0.6) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-03-04 00:46:53
|
Revision: 251 http://simspark.svn.sourceforge.net/simspark/?rev=251&view=rev Author: sgvandijk Date: 2011-03-04 00:46:44 +0000 (Fri, 04 Mar 2011) Log Message: ----------- - Start of RCCMonitor (needs different name perhaps): gives agent state info Modified Paths: -------------- branches/rcctrainer/rcssserver3d/plugin/soccer/CMakeLists.txt branches/rcctrainer/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp branches/rcctrainer/rcssserver3d/plugin/soccer/agentstate/agentstate.h branches/rcctrainer/rcssserver3d/plugin/soccer/export.cpp branches/rcctrainer/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp Added Paths: ----------- branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/ branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor.cpp branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor.h branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor_c.cpp Modified: branches/rcctrainer/rcssserver3d/plugin/soccer/CMakeLists.txt =================================================================== --- branches/rcctrainer/rcssserver3d/plugin/soccer/CMakeLists.txt 2011-03-02 19:40:24 UTC (rev 250) +++ branches/rcctrainer/rcssserver3d/plugin/soccer/CMakeLists.txt 2011-03-04 00:46:44 UTC (rev 251) @@ -46,6 +46,7 @@ hmdp_effector/hmdpperceptor.h hmdp_effector/naospecific.h line/line.h + rccmonitor/rccmonitor.h ) set(soccer_LIB_SRCS @@ -120,6 +121,8 @@ hmdp_effector/naospecific.cpp line/line.cpp line/line_c.cpp + rccmonitor/rccmonitor.cpp + rccmonitor/rccmonitor_c.cpp ) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${FREETYPE_INCLUDE_DIRS} Modified: branches/rcctrainer/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- branches/rcctrainer/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2011-03-02 19:40:24 UTC (rev 250) +++ branches/rcctrainer/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2011-03-04 00:46:44 UTC (rev 251) @@ -154,9 +154,10 @@ } void -AgentState::AddSelfMessage(const string& msg) +AgentState::AddSelfMessage(const string& msg, float timeStamp) { mSelfMsg = msg; + mSelfMsgTimeStamp = timeStamp; mIfSelfMsg = true; } @@ -200,9 +201,9 @@ } bool -AgentState::GetSelfMessage(string& msg) +AgentState::GetSelfMessage(string& msg, bool check) { - if (! mIfSelfMsg) + if (check && ! mIfSelfMsg) { return false; } @@ -213,6 +214,12 @@ return true; } +float +AgentState::GetSelfMessageTimeStamp() +{ + return mSelfMsgTimeStamp; +} + void AgentState::UpdateHierarchyInternal() { Modified: branches/rcctrainer/rcssserver3d/plugin/soccer/agentstate/agentstate.h =================================================================== --- branches/rcctrainer/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2011-03-02 19:40:24 UTC (rev 250) +++ branches/rcctrainer/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2011-03-04 00:46:44 UTC (rev 251) @@ -85,12 +85,13 @@ /** Add a new message to the list */ void AddMessage(const std::string& msg, float direction, bool teamMate); - void AddSelfMessage(const std::string& msg); + void AddSelfMessage(const std::string& msg, float timeStamp); /** Get the first message from the list */ bool GetMessage(std::string& msg, float& direction, bool teamMate); - bool GetSelfMessage(std::string& msg); - + bool GetSelfMessage(std::string& msg, bool check = true); + float GetSelfMessageTimeStamp(); + bool IsSelected() const; void Select(bool s = true); void UnSelect(); @@ -111,6 +112,9 @@ /** self message */ std::string mSelfMsg; + /** time stamp of self message */ + float mSelfMsgTimeStamp; + /** team-mate's message */ std::string mMateMsg; float mMateMsgDir; Modified: branches/rcctrainer/rcssserver3d/plugin/soccer/export.cpp =================================================================== --- branches/rcctrainer/rcssserver3d/plugin/soccer/export.cpp 2011-03-02 19:40:24 UTC (rev 250) +++ branches/rcctrainer/rcssserver3d/plugin/soccer/export.cpp 2011-03-04 00:46:44 UTC (rev 251) @@ -54,6 +54,7 @@ #include "hmdp_effector/hmdpeffector.h" #include "hmdp_effector/hmdpperceptor.h" #include "line/line.h" +#include "rccmonitor/rccmonitor.h" ZEITGEIST_EXPORT_BEGIN() ZEITGEIST_EXPORT(SoccerControlAspect); @@ -90,5 +91,6 @@ ZEITGEIST_EXPORT(HMDPPerceptor); ZEITGEIST_EXPORT(HMDPEffector); ZEITGEIST_EXPORT(Line); + ZEITGEIST_EXPORT(RCCMonitor); ZEITGEIST_EXPORT_END() Added: branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor.cpp =================================================================== --- branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor.cpp (rev 0) +++ branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor.cpp 2011-03-04 00:46:44 UTC (rev 251) @@ -0,0 +1,476 @@ + +/* -*- 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: RCCMonitor.cpp 246 2011-02-18 18:44:14Z sgvandijk $ + + 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 "rccmonitor.h" +#include <zeitgeist/logserver/logserver.h> +#include <kerosin/sceneserver/singlematnode.h> +#include <kerosin/materialserver/material.h> +#include <oxygen/monitorserver/monitorcmdparser.h> +#include <oxygen/sceneserver/sceneserver.h> +#include <sstream> + +using namespace kerosin; +using namespace oxygen; +using namespace zeitgeist; +using namespace boost; +using namespace salt; +using namespace std; + +RCCMonitor::RCCMonitor() : oxygen::MonitorSystem() +{ + mFullState = true; +} + +RCCMonitor::~RCCMonitor() +{ +} + +void RCCMonitor::ClearNodeCache() +{ + mNodeCache.clear(); +} + +void RCCMonitor::UpdateCached() +{ + MonitorSystem::UpdateCached(); + ClearNodeCache(); +} + +void RCCMonitor::OnLink() +{ + // setup SceneServer reference + mSceneServer = shared_dynamic_cast<SceneServer> + (GetCore()->Get("/sys/server/scene")); + + if (mSceneServer.get() == 0) + { + GetLog()->Error() + << "(RCCMonitor) ERROR: SceneServer not found\n"; + } + +} + +void RCCMonitor::OnUnlink() +{ + mSceneServer.reset(); + mActiveScene.reset(); + ClearNodeCache(); +} + +void RCCMonitor::ParseMonitorMessage(const std::string& data) +{ + // pass the received string on to all installed CommandParsers + TLeafList items; + ListChildrenSupportingClass<MonitorCmdParser>(items); + + for ( + TLeafList::iterator iter = items.begin(); + iter != items.end(); + ++iter + ) + { + shared_static_cast<MonitorCmdParser>(*iter) + ->ParseMonitorMessage(data); + } +} + +string RCCMonitor::GetMonitorInfo(const PredicateList& pList) +{ + stringstream ss; + mFullState = false; + DescribeCustomPredicates(ss,pList); + DescribeActiveScene(ss); + + return ss.str(); +} + +string RCCMonitor::GetMonitorHeaderInfo(const PredicateList& pList) +{ + stringstream ss; + mFullState = true; + ClearNodeCache(); + DescribeCustomPredicates(ss,pList); + DescribeActiveScene(ss); + + return ss.str(); +} + +void RCCMonitor::DescribeCustomPredicates(stringstream& ss,const PredicateList& pList) +{ + ss << "("; + + for ( + PredicateList::TList::const_iterator iter = pList.begin(); + iter != pList.end(); + ++iter + ) + { + const Predicate& pred = (*iter); + + ss << "("; + ss << pred.name; + + const ParameterList& paramList = pred.parameter; + ParameterList::TVector::const_iterator pIter = paramList.begin(); + + std::string param; + while ( + (pIter != paramList.end()) && + (paramList.AdvanceValue(pIter, param)) + ) + { + ss << " "; + ss << param; + } + + ss << ")"; + } + + ss << ")"; +} + +void RCCMonitor::DescribeBaseNode(stringstream& ss) +{ + if (mFullState) + { + ss << "(nd BN"; + } else + { + ss << "(nd"; + } +} + +void RCCMonitor::DescribeLight(stringstream& ss, boost::shared_ptr<Light> light) +{ + if (! mFullState) + { + return DescribeBaseNode(ss); + } + + ss << "(nd Light "; + + const RGBA& diff = light->GetDiffuse(); + ss << "(setDiffuse " << diff.r() << " " << diff.g() << " " + << diff.b() << " " << diff.a() << ") "; + + const RGBA& amb = light->GetAmbient(); + ss << "(setAmbient " << amb.r() << " " << amb.g() << " " + << amb.b() << " " << amb.a() << ") "; + + const RGBA& spec = light->GetSpecular(); + ss << "(setSpecular " << spec.r() << " " << spec.g() << " " + << spec.b() << " " << spec.a() << ")"; +} + +void RCCMonitor::DescribeTransform(stringstream& ss, NodeCache& entry, boost::shared_ptr<Transform> transform) +{ + if (mFullState) + { + ss << "(nd TRF"; + } else + { + ss << "(nd"; + } + + // include transform data only for fullstate or a modified + // transform node + const float precision = 0.005f; + const Matrix& mat = transform->GetLocalTransform(); + + bool update = false; + + if (mFullState) + { + update = true; + } else + { + const salt::Matrix& old = entry.transform; + + for (int i=0;i<16;++i) + { + const float d = fabs(old.m[i] - mat.m[i]); + + if (d > precision) + { + update = true; + break; + } + } + } + + if (update) + { + ss << " (SLT"; + + for (int i=0;i<16;++i) + { + ss << " " << mat.m[i]; + } + + ss << ")"; + + // update cache + entry.transform = mat; + } +} + +void RCCMonitor::DescribeMesh(stringstream& ss, boost::shared_ptr<StaticMesh> mesh) +{ + boost::shared_ptr<SingleMatNode> singleMat = + shared_dynamic_cast<SingleMatNode>(mesh); + + if (singleMat.get() != 0) + { + ss << "(nd SMN"; + } else + { + ss << "(nd StaticMesh"; + } + + if (mFullState || mesh->VisibleToggled()) + if (mesh->IsVisible()) + ss << " (setVisible 1)"; + else + ss << " (setVisible 0)"; + + if (! mFullState) + return; + + if (mesh->IsTransparent()) + { + ss << " (setTransparent)"; + } + + ss << " (load " << mesh->GetMeshName(); + + const ParameterList& params = mesh->GetMeshParameter(); + for ( + ParameterList::TVector::const_iterator iter = params.begin(); + iter != params.end(); + ++iter + ) + { + string str; + params.GetValue(iter,str); + ss << " " << str; + } + + ss << ")"; + + const Vector3f& scale = mesh->GetScale(); + + ss << " (sSc " + << scale[0] << " " + << scale[1] << " " + << scale[2] << ")"; + + if (singleMat.get() != 0) + { + boost::shared_ptr<Material> mat = singleMat->GetMaterial(); + if (mat.get() != 0) + { + ss << " (sMat " << mat->GetName() << ")"; + } + } + else{ + std::vector<std::string> mats = mesh->GetMaterialNames(); + if ( !mats.empty() ){ + ss<<"(resetMaterials"; + for(std::vector<std::string>::const_iterator iter = mats.begin(); + mats.end() != iter; ++iter){ + ss<<' '<<*iter; + } + ss<<')'; + } + } +} + +void RCCMonitor::DescribeAgentState(stringstream& ss, NodeCache& entry, boost::shared_ptr<AgentState> agentstate) +{ + if (mFullState) + { + ss << "(nd AS "; + } + else + { + ss << "(nd "; + } + + int t = agentstate->GetTeamIndex(); + int u = agentstate->GetUniformNumber(); + + if (mFullState || entry.ints["team"] != t || entry.ints["unum"] != u) + { + ss << "(team " << (t == TI_LEFT ? "Left" : t == TI_RIGHT ? "Right" : "None") << ")" + << "(unum " << u << ")"; + entry.ints["team"] = t; + entry.ints["unum"] = u; + } + + string msg; + agentstate->GetSelfMessage(msg, false); + + if (msg != "" && agentstate->GetSelfMessageTimeStamp() != entry.floats["say"]) + { + ss << "(say " << msg << ")"; + entry.floats["say"] = agentstate->GetSelfMessageTimeStamp(); + } +} + +RCCMonitor::NodeCache* RCCMonitor::LookupNode(boost::shared_ptr<BaseNode> node) +{ + if (node.get() == 0) + { + assert(false); + return 0; + } + + TNodeCacheMap::iterator iter = mNodeCache.find(node); + if (iter != mNodeCache.end()) + { + return &((*iter).second); + } + + boost::shared_ptr<Transform> transform + = shared_dynamic_cast<Transform>(node); + + if (transform.get() != 0) + { + mNodeCache[node] + = NodeCache(NT_TRANSFORM, transform->GetLocalTransform()); + + return &(mNodeCache[node]); + } + + boost::shared_ptr<StaticMesh> mesh + = shared_dynamic_cast<StaticMesh>(node); + if (mesh.get() != 0) + { + mNodeCache[node] = NodeCache(NT_STATICMESH); + return &(mNodeCache[node]); + } + + boost::shared_ptr<Light> light + = shared_dynamic_cast<Light>(node); + if (light.get() != 0) + { + mNodeCache[node] = NodeCache(NT_LIGHT); + return &(mNodeCache[node]); + } + + boost::shared_ptr<AgentState> agentstate + = shared_dynamic_cast<AgentState>(node); + if (agentstate.get() != 0) + { + mNodeCache[node] = NodeCache(NT_AGENTSTATE); + return &(mNodeCache[node]); + } + + // treat every other node type as a BaseNode + mNodeCache[node] = NodeCache(NT_BASE); + + return &(mNodeCache[node]); +} + +bool RCCMonitor::DescribeNode(stringstream& ss, boost::shared_ptr<BaseNode> node) +{ + NodeCache* entry = LookupNode(node); + if (entry == 0) + { + // skip node + assert(false); + return false; + } + + switch (entry->type) + { + default: + assert(false); + // fall through + + case NT_BASE: + // skip node + return false; + + case NT_TRANSFORM: + DescribeTransform + (ss, (*entry), shared_static_cast<Transform>(node)); + return true; + + case NT_STATICMESH: + DescribeMesh + (ss, shared_static_cast<StaticMesh>(node)); + return true; + + case NT_LIGHT: + DescribeLight + (ss, shared_static_cast<Light>(node)); + return true; + + case NT_AGENTSTATE: + DescribeAgentState + (ss, (*entry), shared_static_cast<AgentState>(node)); + return true; + } +} + +void RCCMonitor::DescribeActiveScene(stringstream& ss) +{ + if (mSceneServer.get() == 0) + { + return; + } + + mActiveScene = mSceneServer->GetActiveScene(); + + if (mActiveScene.get() != 0) + { + if (mFullState) + { + ss << "(RSG 0 1)"; + } else + { + ss << "(RDS 0 1)"; + } + + ss << "("; + DescribeScene(ss,mActiveScene); + ss << ")"; + } +} + +void RCCMonitor::DescribeScene(stringstream& ss, boost::shared_ptr<BaseNode> node) +{ + bool closeParen = DescribeNode(ss, node); + + TLeafList baseNodes = node->GetBaseNodeChildren(); + for (TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i) + { + boost::shared_ptr<BaseNode> baseNode = shared_dynamic_cast<BaseNode>(*i); + DescribeScene(ss,baseNode); + } + + if (closeParen) + { + ss << ")"; + } +} Added: branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor.h =================================================================== --- branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor.h (rev 0) +++ branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor.h 2011-03-04 00:46:44 UTC (rev 251) @@ -0,0 +1,159 @@ +/* -*- 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: sparkmonitor.h 3 2008-11-21 02:38:08Z 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. +*/ +#ifndef RCCMONITOR_H__ +#define RCCMONITOR_H__ + +#include <oxygen/monitorserver/monitorsystem.h> +#include <oxygen/sceneserver/sceneserver.h> +#include <oxygen/sceneserver/scene.h> +#include <oxygen/sceneserver/transform.h> +#include <kerosin/sceneserver/staticmesh.h> +#include <kerosin/sceneserver/light.h> +#include <oxygen/physicsserver/body.h> +#include <agentstate/agentstate.h> + +class RCCMonitor : public oxygen::MonitorSystem +{ +public: + enum ENodeType + { + NT_BASE = 0, + NT_TRANSFORM, + NT_STATICMESH, + NT_LIGHT, + NT_AGENTSTATE + }; + + struct NodeCache + { + public: + ENodeType type; + + /** the last local transform matrix sent to the client */ + salt::Matrix transform; + + /** the last values of int types sent to the client */ + std::map<std::string, int> ints; + + /** the last values of int types sent to the client */ + std::map<std::string, float> floats; + + /** the last values of string types sent to the client */ + std::map<std::string, std::string> strings; + + public: + NodeCache(ENodeType nt = NT_BASE) + : type(nt) + { + } + + NodeCache(ENodeType nt, const salt::Matrix& t) + : type(nt), transform(t) + { + } + }; + + typedef std::map<boost::shared_ptr<oxygen::BaseNode>, NodeCache> TNodeCacheMap; + +public: + RCCMonitor(); + virtual ~RCCMonitor(); + + /** If a monitor sends information to the world model, this + * function is called to process it. + * @param data data sent from monitor to monitorsystem via SPADES. + */ + void ParseMonitorMessage(const std::string& data); + + /** This function will be called periodically to get information + * about the current state of the world. + * \param items holds a list of additional name value pairs. These + * predicates are collected from MonitorItem objects registered to + * the MonitorServer. The monitor should transfer them to the + * client if possible. + */ + virtual std::string GetMonitorInfo(const oxygen::PredicateList& pList); + + /** This function is called once for every MonitorSystem each time + * a new client connects. It should return any header/setup + * information that is needed. + * \param items holds a list of additional name value + * pairs. These predicates are collected from MonitorItem objects + * registered to the MonitorServer. The monitor should transfer + * them to the client if possible. + */ + virtual std::string GetMonitorHeaderInfo(const oxygen::PredicateList& pList); + + /** update variables from a script */ + virtual void UpdateCached(); + +protected: + virtual void OnLink(); + virtual void OnUnlink(); + + void ClearNodeCache(); + + /** This function looks the cached node entry in the node + cache. The entry is added to the cache if it does not exist + */ + NodeCache* LookupNode(boost::shared_ptr<oxygen::BaseNode> node); + + void DescribeCustomPredicates(std::stringstream& ss,const oxygen::PredicateList& pList); + void DescribeActiveScene(std::stringstream& ss); + void DescribeScene(std::stringstream& ss, + boost::shared_ptr<oxygen::BaseNode> node); + + /** This function writes the s-expression for the given node to + the given strinstream, omitting the closing parentheses. It + returns false if the node is skipped and no description is + created. Skipped nodes are invisible scene graph nodes. + */ + bool DescribeNode(std::stringstream& ss, + boost::shared_ptr<oxygen::BaseNode> node); + void DescribeBaseNode(std::stringstream& ss); + void DescribeTransform(std::stringstream& ss, NodeCache& entry, + boost::shared_ptr<oxygen::Transform> transform); + void DescribeMesh(std::stringstream& ss, + boost::shared_ptr<kerosin::StaticMesh> mesh); + void DescribeLight(std::stringstream& ss, + boost::shared_ptr<kerosin::Light> light); + void DescribeAgentState(std::stringstream& ss, NodeCache& entry, + boost::shared_ptr<AgentState>); + +protected: + /** cached reference to the SceneServer */ + boost::shared_ptr<oxygen::SceneServer> mSceneServer; + + /** cached reference to the current active scene */ + boost::shared_ptr<oxygen::Scene> mActiveScene; + + /** true, if the full state is generated */ + bool mFullState; + + /** cached node type and state */ + TNodeCacheMap mNodeCache; +}; + +DECLARE_CLASS(RCCMonitor); + +#endif // RCCMONITOR_H__ + Added: branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor_c.cpp =================================================================== --- branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor_c.cpp (rev 0) +++ branches/rcctrainer/rcssserver3d/plugin/soccer/rccmonitor/rccmonitor_c.cpp 2011-03-04 00:46:44 UTC (rev 251) @@ -0,0 +1,29 @@ +/* -*- 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: sparkmonitor_c.cpp 3 2008-11-21 02:38:08Z 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 "rccmonitor.h" + +void +CLASS(RCCMonitor)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/BaseParser); +} + Modified: branches/rcctrainer/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- branches/rcctrainer/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2011-03-02 19:40:24 UTC (rev 250) +++ branches/rcctrainer/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2011-03-04 00:46:44 UTC (rev 251) @@ -1300,7 +1300,7 @@ { if ( (*it)->GetUniformNumber() == number) { - (*it)->AddSelfMessage(message); + (*it)->AddSelfMessage(message, mGameState->GetTime()); continue; } SoccerBase::GetTransformParent(*(*it), transform_parent); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-03-02 19:40:30
|
Revision: 250 http://simspark.svn.sourceforge.net/simspark/?rev=250&view=rev Author: sgvandijk Date: 2011-03-02 19:40:24 +0000 (Wed, 02 Mar 2011) Log Message: ----------- - rcctrainer branch Added Paths: ----------- branches/rcctrainer/ Property changes on: branches/rcctrainer ___________________________________________________________________ Added: svn:ignore + .project Added: svn:mergeinfo + /branches/agentselection:195-206 /branches/treehole:175 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-03-02 18:04:58
|
Revision: 249 http://simspark.svn.sourceforge.net/simspark/?rev=249&view=rev Author: sgvandijk Date: 2011-03-02 18:04:51 +0000 (Wed, 02 Mar 2011) Log Message: ----------- - killsim command to kill the server through trainer protocol Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h Modified: trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2011-03-02 17:22:58 UTC (rev 248) +++ trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2011-03-02 18:04:51 UTC (rev 249) @@ -50,7 +50,7 @@ mCommandMap["select"] = CT_SELECT; mCommandMap["kill"] = CT_KILL; mCommandMap["repos"] = CT_REPOS; - + mCommandMap["killsim"] = CT_KILLSIM; // setup team index map // Originally team sides were "L","R" and "N" // But this seems to be unused @@ -120,6 +120,15 @@ GetLog()->Error() << "ERROR: (TrainerCommandParser) Unable to get GameControlServer\n"; } + mSimServer = shared_dynamic_cast<SimulationServer> + (GetCore()->Get("/sys/server/simulation")); + + if (mGameControl.get() == 0) + { + GetLog()->Error() << "ERROR: (TrainerCommandParser) Unable to get SimulationServer\n"; + } + + } void TrainerCommandParser::OnUnlink() @@ -212,6 +221,9 @@ case CT_REPOS: ParseReposCommand(predicate); break; + case CT_KILLSIM: + ParseKillSimCommand(predicate); + break; default: return false; } @@ -699,3 +711,7 @@ } } +void TrainerCommandParser::ParseKillSimCommand(const oxygen::Predicate & predicate) +{ + mSimServer->Quit(); +} Modified: trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2011-03-02 17:22:58 UTC (rev 248) +++ trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2011-03-02 18:04:51 UTC (rev 249) @@ -32,6 +32,7 @@ #include <salt/vector.h> #include <soccertypes.h> #include <soccerruleaspect/soccerruleaspect.h> +#include <oxygen/simulationserver/simulationserver.h> namespace oxygen { @@ -52,7 +53,8 @@ CT_ACK, CT_SELECT, CT_KILL, - CT_REPOS + CT_REPOS, + CT_KILLSIM }; typedef std::map<std::string, ECommandType> TCommandMap; @@ -123,6 +125,12 @@ predicate */ void ParseReposCommand(const oxygen::Predicate & predicate); + + /** parses and executes the killsim command contained in the given + predicate + */ + void ParseKillSimCommand(const oxygen::Predicate & predicate); + protected: TCommandMap mCommandMap; @@ -138,7 +146,9 @@ boost::shared_ptr<oxygen::BaseParser> mSexpParser; //! cached reference to the game control server boost::shared_ptr<oxygen::GameControlServer> mGameControl; - + //! cached reference to the simulation server + boost::shared_ptr<oxygen::SimulationServer> mSimServer; + bool mGetAck; std::string mAckString; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-03-02 17:23:06
|
Revision: 248 http://simspark.svn.sourceforge.net/simspark/?rev=248&view=rev Author: sgvandijk Date: 2011-03-02 17:22:58 +0000 (Wed, 02 Mar 2011) Log Message: ----------- - Take out accidental joint feedback request - Some initialisation - Readd inputControl loop (at correct place) Modified Paths: -------------- trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp trunk/spark/lib/oxygen/sceneserver/scene.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/plugin/odeimps/odehingejoint.cpp Modified: trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp =================================================================== --- trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -30,7 +30,7 @@ using namespace boost; using namespace std; -MonitorServer::MonitorServer() : Node() +MonitorServer::MonitorServer() : Node(), mDataCycle(0) { } Modified: trunk/spark/lib/oxygen/sceneserver/scene.cpp =================================================================== --- trunk/spark/lib/oxygen/sceneserver/scene.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/sceneserver/scene.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -26,7 +26,7 @@ using namespace salt; using namespace zeitgeist; -Scene::Scene() : BaseNode(), mModified(false), mModifiedNum(0) +Scene::Scene() : BaseNode(), mModified(false), mModifiedNum(0), mLastCacheUpdate(0) { } Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -312,15 +312,16 @@ Init(argc, argv); GetLog()->Normal() << "(SimulationServer) entering runloop\n"; + boost::shared_ptr<SimControlNode> inputCtr = GetControlNode("InputControl"); + if ( mMultiThreads ) { GetLog()->Normal()<< "(SimulationServer) running in multi-threads\n"; - RunMultiThreaded(); + RunMultiThreaded(inputCtr); } else { GetLog()->Normal()<< "(SimulationServer) running in single thread\n"; - boost::shared_ptr<SimControlNode> inputCtr = GetControlNode("InputControl"); if ( !mAutoTime && inputCtr.get() == 0 ) { GetLog()->Error()<< "(SimulationServer) ERROR: can not get InputControl\n"; @@ -391,7 +392,7 @@ return mSceneServer.get(); } -void SimulationServer::RunMultiThreaded() +void SimulationServer::RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr) { if (mSimStep == 0) { @@ -428,19 +429,34 @@ { ++mCycle; + // Signal start of cycle mThreadBarrier->wait(); if (mExit) mExitThreads = true; + // Wait for SimControlNodes' acts at the begining of a cycle - mThreadBarrier->wait(); finalDelta = initDelta = mSumDeltaTime; mSceneServer->PrePhysicsUpdate(mSimStep); mSceneServer->PhysicsUpdate(mSimStep); + if (mAutoTime) - AdvanceTime(mSimStep); + { + AdvanceTime(mSimStep); + } + + else + { + if (inputCtr.get() != 0) + { + while (int(mSumDeltaTime*100) < int(mSimStep*100)) + { + inputCtr->StartCycle();// advance the time + } + } + } UpdateDeltaTimeAfterStep(finalDelta); @@ -454,11 +470,13 @@ mSceneServer->PostPhysicsUpdate(); mGameControlServer->Update(finalStep); mSimTime += finalStep; + if (renderControl && renderControl->GetTime() - mSimTime < 0.005f ) renderControl->EndCycle(); - mThreadBarrier->wait(); + // End Cycle + mThreadBarrier->wait(); mSumDeltaTime -= initDelta - finalDelta; } @@ -484,7 +502,7 @@ mThreadBarrier->wait(); newCycle = false; - if ( controlNode->GetTime() - mSimTime <= 0.005f ) + if ( controlNode->GetTime() - mSimTime <= 0.005f && !isInputControl) { newCycle = true; controlNode->StartCycle(); Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-02 17:22:58 UTC (rev 248) @@ -167,7 +167,7 @@ static void CatchSignal(int sig_num); /** the multi-threaded runloop of the simulation */ - void RunMultiThreaded(); + void RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr); /** the thread function which controls a single SimControlNode in * multi-threaded mode. */ Modified: trunk/spark/plugin/odeimps/odehingejoint.cpp =================================================================== --- trunk/spark/plugin/odeimps/odehingejoint.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/plugin/odeimps/odehingejoint.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -32,7 +32,7 @@ { dWorldID ODEWorld = (dWorldID) worldID; dJointID ODEJoint = dJointCreateHinge(ODEWorld, 0); - dJointSetFeedback( ODEJoint, &mFeedback ); + //dJointSetFeedback( ODEJoint, &mFeedback ); return (long) ODEJoint; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-02-26 00:09:59
|
Revision: 247 http://simspark.svn.sourceforge.net/simspark/?rev=247&view=rev Author: sgvandijk Date: 2011-02-26 00:09:51 +0000 (Sat, 26 Feb 2011) Log Message: ----------- - Use ode-config --libs flags Modified Paths: -------------- trunk/rcssserver3d/cmake/FindODE.cmake trunk/spark/cmake/FindODE.cmake Modified: trunk/rcssserver3d/cmake/FindODE.cmake =================================================================== --- trunk/rcssserver3d/cmake/FindODE.cmake 2011-02-18 18:44:14 UTC (rev 246) +++ trunk/rcssserver3d/cmake/FindODE.cmake 2011-02-26 00:09:51 UTC (rev 247) @@ -24,6 +24,12 @@ OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE ODE_CONFIG_RESULT ) + EXECUTE_PROCESS( + COMMAND ${ODE_CONFIG} --libs + OUTPUT_VARIABLE ODE_CONFIG_LIBS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE ODE_CONFIG_RESULT + ) ELSE(COMMAND EXECUTE_PROCESS) EXEC_PROGRAM(${ODE_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE ODE_CONFIG_CFLAGS @@ -33,6 +39,10 @@ OUTPUT_VARIABLE ODE_CONFIG_PREFIX RETURN_VALUE ODE_CONFIG_RESULT ) + EXEC_PROGRAM(${ODE_CONFIG} ARGS "--libs" + OUTPUT_VARIABLE ODE_CONFIG_LIBS + RETURN_VALUE ODE_CONFIG_RESULT + ) ENDIF(COMMAND EXECUTE_PROCESS) # Parse the include flags. @@ -48,9 +58,12 @@ SET(ODE_EXTRA_CFLAGS ${ODE_EXTRA_CFLAGS} "${flag}") ENDIF("${flag}" MATCHES "^-D") ENDFOREACH(flag) + + SET(ODE_EXTRA_LDFLAGS ${ODE_CONFIG_LIBS}) ELSE("${ODE_CONFIG_RESULT}" MATCHES "^0$") MESSAGE("Error running ${ODE_CONFIG}: [${ODE_CONFIG_RESULT}]") ENDIF("${ODE_CONFIG_RESULT}" MATCHES "^0$") + ENDIF(ODE_CONFIG) FIND_PATH(ODE_INCLUDE_DIR ode/ode.h @@ -99,6 +112,13 @@ SET(ODE_CFLAGS CACHE STRING "Additional ODE flags") ENDIF (ODE_EXTRA_CFLAGS) + IF (ODE_EXTRA_LDFLAGS) + SET(ODE_LDFLAGS ${ODE_EXTRA_LDFLAGS} CACHE STRING "Additional ODE linker flags") + MESSAGE(STATUS "Found additional linker flags for ODE: ${ODE_LDFLAGS}") + ELSE (ODE_EXTRA_LDFLAGS) + SET(ODE_CFLAGS CACHE STRING "Additional ODE linker flags") + ENDIF (ODE_EXTRA_LDFLAGS) + IF(ODE_INCLUDE_DIR) MESSAGE(STATUS "Found ODE include dir: ${ODE_INCLUDE_DIR}") ELSE(ODE_INCLUDE_DIR) Modified: trunk/spark/cmake/FindODE.cmake =================================================================== --- trunk/spark/cmake/FindODE.cmake 2011-02-18 18:44:14 UTC (rev 246) +++ trunk/spark/cmake/FindODE.cmake 2011-02-26 00:09:51 UTC (rev 247) @@ -24,6 +24,12 @@ OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE ODE_CONFIG_RESULT ) + EXECUTE_PROCESS( + COMMAND ${ODE_CONFIG} --libs + OUTPUT_VARIABLE ODE_CONFIG_LIBS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE ODE_CONFIG_RESULT + ) ELSE(COMMAND EXECUTE_PROCESS) EXEC_PROGRAM(${ODE_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE ODE_CONFIG_CFLAGS @@ -33,6 +39,10 @@ OUTPUT_VARIABLE ODE_CONFIG_PREFIX RETURN_VALUE ODE_CONFIG_RESULT ) + EXEC_PROGRAM(${ODE_CONFIG} ARGS "--libs" + OUTPUT_VARIABLE ODE_CONFIG_LIBS + RETURN_VALUE ODE_CONFIG_RESULT + ) ENDIF(COMMAND EXECUTE_PROCESS) # Parse the include flags. @@ -48,9 +58,12 @@ SET(ODE_EXTRA_CFLAGS ${ODE_EXTRA_CFLAGS} "${flag}") ENDIF("${flag}" MATCHES "^-D") ENDFOREACH(flag) + + SET(ODE_EXTRA_LDFLAGS ${ODE_CONFIG_LIBS}) ELSE("${ODE_CONFIG_RESULT}" MATCHES "^0$") MESSAGE("Error running ${ODE_CONFIG}: [${ODE_CONFIG_RESULT}]") ENDIF("${ODE_CONFIG_RESULT}" MATCHES "^0$") + ENDIF(ODE_CONFIG) FIND_PATH(ODE_INCLUDE_DIR ode/ode.h @@ -99,6 +112,13 @@ SET(ODE_CFLAGS CACHE STRING "Additional ODE flags") ENDIF (ODE_EXTRA_CFLAGS) + IF (ODE_EXTRA_LDFLAGS) + SET(ODE_LDFLAGS ${ODE_EXTRA_LDFLAGS} CACHE STRING "Additional ODE linker flags") + MESSAGE(STATUS "Found additional linker flags for ODE: ${ODE_LDFLAGS}") + ELSE (ODE_EXTRA_LDFLAGS) + SET(ODE_CFLAGS CACHE STRING "Additional ODE linker flags") + ENDIF (ODE_EXTRA_LDFLAGS) + IF(ODE_INCLUDE_DIR) MESSAGE(STATUS "Found ODE include dir: ${ODE_INCLUDE_DIR}") ELSE(ODE_INCLUDE_DIR) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-02-18 18:44:21
|
Revision: 246 http://simspark.svn.sourceforge.net/simspark/?rev=246&view=rev Author: sgvandijk Date: 2011-02-18 18:44:14 +0000 (Fri, 18 Feb 2011) Log Message: ----------- - spark.rb possible to be loaded locally - Taken out confusing output, output errors that are warnings with Warning - BaseNode keeps cache of BoseNode children (takes out loads of fynamic casting) - HingePerceptor can report torque - Fix multithreaded mode Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp trunk/spark/lib/oxygen/agentaspect/agentaspect.h trunk/spark/lib/oxygen/gamecontrolserver/gamecontrolserver.cpp trunk/spark/lib/oxygen/geometryserver/geometryserver.cpp trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp trunk/spark/lib/oxygen/physicsserver/hingejoint.cpp trunk/spark/lib/oxygen/physicsserver/hingejoint.h trunk/spark/lib/oxygen/physicsserver/int/hingejointint.h trunk/spark/lib/oxygen/sceneserver/basenode.cpp trunk/spark/lib/oxygen/sceneserver/basenode.h trunk/spark/lib/oxygen/sceneserver/scene.cpp trunk/spark/lib/oxygen/sceneserver/scene.h trunk/spark/lib/oxygen/sceneserver/sceneserver.cpp trunk/spark/lib/oxygen/simulationserver/monitorcontrol.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp trunk/spark/plugin/odeimps/odehingejoint.cpp trunk/spark/plugin/odeimps/odehingejoint.h trunk/spark/plugin/sparkagent/hingeperceptor.cpp trunk/spark/plugin/sparkagent/hingeperceptor.h trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp trunk/spark/spark/spark.cpp trunk/spark/spark/spark.rb Modified: trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -861,4 +861,4 @@ void RestrictedVisionPerceptor::SetSenseLine(bool sense) { mSenseLine = sense; -} \ No newline at end of file +} Modified: trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp =================================================================== --- trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -21,6 +21,7 @@ */ #include "agentaspect.h" #include <zeitgeist/logserver/logserver.h> +#include <oxygen/sceneserver/scene.h> using namespace boost; using namespace oxygen; @@ -38,11 +39,20 @@ { } +void +AgentAspect::UpdateCacheInternal() +{ + GetLog()->Debug() << "(AgentAspect) Updating cache\n"; + + UpdateEffectorMap(); + + mPerceptors.clear(); + ListChildrenSupportingClass<Perceptor>(mPerceptors,true); +} + bool AgentAspect::RealizeActions(boost::shared_ptr<ActionObject::TList> actions) { - UpdateEffectorMap(); - for ( ActionObject::TList::iterator iter = actions->begin(); iter != actions->end(); @@ -79,15 +89,13 @@ { mPerceptorCycle++; // build list of perceptors, searching recursively - TLeafList perceptors; - ListChildrenSupportingClass<Perceptor>(perceptors,true); boost::shared_ptr<PredicateList> predList(new PredicateList()); // query the perceptors for new data for ( - TLeafList::iterator iter = perceptors.begin(); - iter != perceptors.end(); + TLeafList::iterator iter = mPerceptors.begin(); + iter != mPerceptors.end(); ++iter ) { @@ -167,6 +175,7 @@ } return added; + } bool AgentAspect::IsSynced() const Modified: trunk/spark/lib/oxygen/agentaspect/agentaspect.h =================================================================== --- trunk/spark/lib/oxygen/agentaspect/agentaspect.h 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/agentaspect/agentaspect.h 2011-02-18 18:44:14 UTC (rev 246) @@ -65,6 +65,8 @@ /** looks up the effector corresponding to a predicate */ virtual boost::shared_ptr<Effector> GetEffector(const std::string predicate) const; + void UpdateCacheInternal(); + //! @return the unique ID for the agent aspect inline int ID() const { return mID; } @@ -83,6 +85,9 @@ private: int mID; + /** cache of the agent's effectors */ + TLeafList mPerceptors; + /** indicates how many times the QueryPerceptors be called */ unsigned int mPerceptorCycle; Modified: trunk/spark/lib/oxygen/gamecontrolserver/gamecontrolserver.cpp =================================================================== --- trunk/spark/lib/oxygen/gamecontrolserver/gamecontrolserver.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/gamecontrolserver/gamecontrolserver.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -155,12 +155,20 @@ aspect->SetName(name.str()); scene->AddChildReference(aspect); + mAgentMap[id] = aspect; + bool ok = aspect->Init(mCreateEffector,id); + if (ok) + { + aspect->UpdateCache(); + scene->UpdateCache(false); + } + // mark the scene as modified scene->SetModified(true); - return aspect->Init(mCreateEffector,id); + return ok; } bool GameControlServer::AgentDisappear(int id) @@ -178,13 +186,12 @@ // remove the AgentAspect from the Scene and our map. The // AgentAspect does all the necessary cleanup boost::shared_ptr<Scene> scene = GetActiveScene(); + if (scene.get() != 0) { (*iter).second->UnlinkChildren(); (*iter).second->Unlink(); - // mark the scene as modified - scene->SetModified(true); } else { GetLog()->Error() @@ -194,6 +201,9 @@ mAgentMap.erase(id); + // mark the scene as modified + scene->SetModified(true); + GetLog()->Debug() << "(GameControlServer) An agent disconnected (id: " << id << ")\n"; @@ -257,9 +267,7 @@ // construct an ActionList using the registered effectors boost::shared_ptr<ActionObject::TList> actionList(new ActionObject::TList()); - // update the map of effectors below the agentaspect boost::shared_ptr<AgentAspect> aspect = (*iter).second; - aspect->UpdateEffectorMap(); for ( Modified: trunk/spark/lib/oxygen/geometryserver/geometryserver.cpp =================================================================== --- trunk/spark/lib/oxygen/geometryserver/geometryserver.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/geometryserver/geometryserver.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -63,7 +63,7 @@ importer->SetName(importerName); AddChildReference(importer); - GetLog()->Normal() + GetLog()->Debug() << "(GeometryServer) MeshImporter '" << importerName << "' registered\n"; return true; @@ -139,7 +139,7 @@ mesh->SetName(name); } - GetLog()->Normal() << "(GeometryServer) imported mesh '" << meshName + GetLog()->Debug() << "(GeometryServer) imported mesh '" << meshName << " with '" << importer->GetName() << "'\n"; if (mesh.get() == 0 || mesh->GetVertexCount() == 0) @@ -183,14 +183,14 @@ } mMeshMap[name] = mesh; - GetLog()->Normal() << "(GeometryServer) mesh " << name << " registered\n"; + GetLog()->Debug() << "(GeometryServer) mesh " << name << " registered\n"; TLeafList exporters; ListChildrenSupportingClass<MeshExporter>(exporters); for (TLeafList::const_iterator bi = exporters.begin(); bi != exporters.end(); ++bi) { - GetLog()->Normal() << "(GeometryServer) additionally registered mesh " + GetLog()->Debug() << "(GeometryServer) additionally registered mesh " << name << " via MeshExporter '" << (*bi)->GetName() << "'\n"; boost::shared_ptr<MeshExporter> mb = shared_static_cast<MeshExporter>(*bi); mb->RegisterMesh(mesh); @@ -213,7 +213,7 @@ exporter->SetName(name); AddChildReference(exporter); - GetLog()->Normal() << "(GeometryServer) MeshExporter '" << name << "' registered\n"; + GetLog()->Debug() << "(GeometryServer) MeshExporter '" << name << "' registered\n"; return true; } Modified: trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp =================================================================== --- trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -44,8 +44,8 @@ if (mSimulationServer.expired()) { - GetLog()->Error() - << "(MonitorServer) ERROR: SimulationServer not found.\n"; + GetLog()->Warning() + << "(MonitorServer) WARNING: SimulationServer not found.\n"; } } Modified: trunk/spark/lib/oxygen/physicsserver/hingejoint.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/hingejoint.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/physicsserver/hingejoint.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -134,6 +134,11 @@ return mHingeJointImp->GetAngleRate(mJointID); } +float HingeJoint::GetTorque() const +{ + return mHingeJointImp->GetTorque(mJointID); +} + void HingeJoint::SetParameter(int parameter, float value){ mJointImp->SetParameter(parameter, value, mJointID); } Modified: trunk/spark/lib/oxygen/physicsserver/hingejoint.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/hingejoint.h 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/physicsserver/hingejoint.h 2011-02-18 18:44:14 UTC (rev 246) @@ -69,6 +69,9 @@ /** returns the time derivate of the hinge angle */ float GetAngleRate() const; + /** returns the torque on the joint */ + float GetTorque() const; + /** Sets a parameter value of this joint*/ void SetParameter(int parameter, float value); Modified: trunk/spark/lib/oxygen/physicsserver/int/hingejointint.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/int/hingejointint.h 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/physicsserver/int/hingejointint.h 2011-02-18 18:44:14 UTC (rev 246) @@ -67,6 +67,9 @@ /** returns the time derivate of the hinge angle */ virtual float GetAngleRate(long jointID) const = 0; + + /** returns the torque on the joint */ + virtual float GetTorque(long jointID) const = 0; }; } //namespace oxygen Modified: trunk/spark/lib/oxygen/sceneserver/basenode.cpp =================================================================== --- trunk/spark/lib/oxygen/sceneserver/basenode.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/sceneserver/basenode.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -84,12 +84,30 @@ { } +Leaf::TLeafList BaseNode::GetBaseNodeChildren() +{ + return mBaseNodeChildren; +} + +void BaseNode::UpdateCache(bool recursive) +{ + UpdateBaseNodeChildren(); + UpdateCacheInternal(); + + if (recursive) + { + // perform update on hierarchy + for (TLeafList::iterator i = mBaseNodeChildren.begin(); i!= mBaseNodeChildren.end(); ++i) + { + shared_static_cast<BaseNode>(*i)->UpdateCache(); + } + } +} + void BaseNode::PrePhysicsUpdate(float deltaTime) { // perform update on hierarchy - TLeafList baseNodes; - ListChildrenSupportingClass<BaseNode>(baseNodes); - for (TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i) + for (TLeafList::iterator i = mBaseNodeChildren.begin(); i!= mBaseNodeChildren.end(); ++i) { shared_static_cast<BaseNode>(*i)->PrePhysicsUpdate(deltaTime); } @@ -104,9 +122,7 @@ void BaseNode::PostPhysicsUpdate() { // perform update on hierarchy - TLeafList baseNodes; - ListChildrenSupportingClass<BaseNode>(baseNodes); - for (TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i) + for (TLeafList::iterator i = mBaseNodeChildren.begin(); i!= mBaseNodeChildren.end(); ++i) { shared_static_cast<BaseNode>(*i)->PostPhysicsUpdate(); } @@ -128,9 +144,7 @@ mWorldBoundingBox.TransformBy(worldTransform); // perform update on hierarchy - TLeafList baseNodes; - ListChildrenSupportingClass<BaseNode>(baseNodes); - for (TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i) + for (TLeafList::iterator i = mBaseNodeChildren.begin(); i!= mBaseNodeChildren.end(); ++i) { boost::shared_ptr<BaseNode> node = shared_static_cast<BaseNode>(*i); node->UpdateHierarchy(); @@ -178,6 +192,12 @@ { } +void BaseNode::UpdateBaseNodeChildren() +{ + mBaseNodeChildren.clear(); + ListChildrenSupportingClass<BaseNode>(mBaseNodeChildren); +} + const salt::AABB3& BaseNode::GetWorldBoundingBox() const { return mWorldBoundingBox; Modified: trunk/spark/lib/oxygen/sceneserver/basenode.h =================================================================== --- trunk/spark/lib/oxygen/sceneserver/basenode.h 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/sceneserver/basenode.h 2011-02-18 18:44:14 UTC (rev 246) @@ -83,8 +83,14 @@ /** returns the world bounding box of this node */ const salt::AABB3& GetWorldBoundingBox() const; + /** get the cached BaseNode children of this node */ + TLeafList GetBaseNodeChildren(); + // scene graph update passes + /** updates internal cache */ + virtual void UpdateCache(bool recursive = true); + /** updates internal state before physics calculation */ void PrePhysicsUpdate(float deltaTime); @@ -123,6 +129,9 @@ etc..) */ virtual void UpdateHierarchyInternal(); + virtual void UpdateCacheInternal() {} + + void UpdateBaseNodeChildren(); // // Members // @@ -138,6 +147,8 @@ /** world bounding box */ salt::AABB3 mWorldBoundingBox; + + TLeafList mBaseNodeChildren; }; DECLARE_CLASS(BaseNode); Modified: trunk/spark/lib/oxygen/sceneserver/scene.cpp =================================================================== --- trunk/spark/lib/oxygen/sceneserver/scene.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/sceneserver/scene.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -34,6 +34,16 @@ { } +void Scene::UpdateCacheInternal() +{ + mLastCacheUpdate = mModifiedNum; +} + +int Scene::GetLastCacheUpdate() +{ + return mLastCacheUpdate; +} + const salt::Matrix& Scene::GetWorldTransform() const { return mIdentityMatrix; @@ -58,4 +68,3 @@ { return mModifiedNum; } - Modified: trunk/spark/lib/oxygen/sceneserver/scene.h =================================================================== --- trunk/spark/lib/oxygen/sceneserver/scene.h 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/sceneserver/scene.h 2011-02-18 18:44:14 UTC (rev 246) @@ -69,12 +69,19 @@ /** return how many times the scene was modified */ int GetModifiedNum(); + /** return he modification count at the last update */ + int GetLastCacheUpdate(); protected: + void UpdateCacheInternal(); + /** true, if the scene is modified */ bool mModified; /** how many times the scene was modified */ int mModifiedNum; + + /** the modification count at the last update */ + int mLastCacheUpdate; }; DECLARE_CLASS(Scene); Modified: trunk/spark/lib/oxygen/sceneserver/sceneserver.cpp =================================================================== --- trunk/spark/lib/oxygen/sceneserver/sceneserver.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/sceneserver/sceneserver.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -41,7 +41,7 @@ int SceneServer::mTransformMark = 0; SceneServer::SceneServer() : Node() -{ +{ } SceneServer::~SceneServer() @@ -95,6 +95,9 @@ } mPhysicsServer->UpdateCache(mActiveScene.get()); + + if (mActiveScene->GetLastCacheUpdate() != mActiveScene->GetModifiedNum()) + mActiveScene->UpdateCache(); } void SceneServer::OnUnlink() @@ -181,6 +184,7 @@ } UpdateCache(); + ++mTransformMark; mActiveScene->PrePhysicsUpdate(deltaTime); @@ -257,7 +261,7 @@ if (importer->ImportScene(file,root,parameter)) { - GetLog()->Normal() + GetLog()->Debug() << "(SceneServer) imported scene file '" << file << " with '" << importer->GetName() @@ -378,7 +382,7 @@ importer->SetName(importerName); AddChildReference(importer); - GetLog()->Normal() + GetLog()->Debug() << "(SceneServer) SceneImporter '" << importerName << "' registered\n"; return true; Modified: trunk/spark/lib/oxygen/simulationserver/monitorcontrol.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/monitorcontrol.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/simulationserver/monitorcontrol.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -62,6 +62,7 @@ } string header = mMonitorServer->GetMonitorHeaderInfo(); + mNetMessage->PrepareToSend(header); SendClientMessage(client->addr,header); @@ -90,10 +91,19 @@ string info; boost::shared_ptr<Scene> scene = GetActiveScene(); if (scene.get() != 0 - && scene->GetModifiedNum() > mFullStateLogged ) + && scene->GetModifiedNum() > mFullStateLogged) { - mFullStateLogged = scene->GetModifiedNum(); - info = mMonitorServer->GetMonitorHeaderInfo(); + if (scene->GetLastCacheUpdate() == scene->GetModifiedNum()) + { + mFullStateLogged = scene->GetModifiedNum(); + info = mMonitorServer->GetMonitorHeaderInfo(); + } + else + { + GetLog()->Debug() + << "(MonitorControl) Scene is modified, but hasn't updated cache yet. Doing nothing.\n"; + return; + } } else { Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -427,10 +427,12 @@ while (!mExitThreads) { ++mCycle; + mThreadBarrier->wait(); if (mExit) mExitThreads = true; // Wait for SimControlNodes' acts at the begining of a cycle + mThreadBarrier->wait(); finalDelta = initDelta = mSumDeltaTime; @@ -480,6 +482,7 @@ while (!mExitThreads) { mThreadBarrier->wait(); + newCycle = false; if ( controlNode->GetTime() - mSimTime <= 0.005f ) { @@ -489,14 +492,9 @@ controlNode->ActAgent(); controlNode->SetSimTime(mSimTime); } + mThreadBarrier->wait(); - if (isInputControl) - { - while (int(mSumDeltaTime*100) < int(mSimStep*100)) - controlNode->StartCycle(); // advance the time - } - // wait for physics update mThreadBarrier->wait(); if (!isRenderControl && newCycle) Modified: trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp =================================================================== --- trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -258,7 +258,7 @@ void ScriptServer::UpdateCachedAllNodes() { - GetLog()->Normal() << "(ScriptServer) updating cached script variables\n"; + GetLog()->Debug() << "(ScriptServer) updating cached script variables\n"; GetCore()->GetRoot()->UpdateCached(); } @@ -480,7 +480,7 @@ { // run the init script in the sourceDir string sourcePath = sourceDir + salt::RFile::Sep() + name; - GetLog()->Normal() << "(ScriptServer) Running " << sourcePath << "... " << endl; + GetLog()->Debug() << "(ScriptServer) Running " << sourcePath << "... " << endl; boost::shared_ptr<salt::StdFile> file(new(salt::StdFile)); if (! file->Open(sourcePath.c_str())) @@ -493,7 +493,7 @@ return eError; } else { - GetLog()->Normal() << "(ScriptServer) Script ended OK " << sourcePath << endl; + GetLog()->Debug() << "(ScriptServer) Script ended OK " << sourcePath << endl; } // copy it to the destDir @@ -504,7 +504,7 @@ string destPath = destDir + salt::RFile::Sep() + name; - GetLog()->Normal() << "Copying " << sourcePath + GetLog()->Debug() << "Copying " << sourcePath << " to " << destPath << endl; stringstream s; @@ -579,7 +579,7 @@ return false; } - GetLog()->Normal() << "(ScriptServer) Created Directory '" + GetLog()->Debug() << "(ScriptServer) Created Directory '" << dotDir << "'\n"; return true; @@ -589,6 +589,9 @@ ScriptServer::RunInitScript(const string &fileName, const string &relPath, EInitScriptType type) { + GetLog()->Debug() << "(ScriptServer) Attempting to run init script '" + << fileName << "'\n"; + string dotDir; bool validDotDir = (type == IS_USERLOCAL) && @@ -607,56 +610,52 @@ if (validDotDir) { + // Trying dot-dir in home directory result = RunInitScriptInternal(dotDir, fileName, false); - } + if (result == eOK) + { + GetLog()->Debug() << "(ScriptServer) : Ran init script '" + << dotDir << salt::RFile::Sep() << fileName << "'\n"; + return true; + } + else if (result == eError) + { + GetLog()->Error() << "(ScriptServer) ERROR: Found error in init script '" + << dotDir << salt::RFile::Sep() << fileName << "'\n"; + return false; + } - if (result == eOK) - { - GetLog()->Debug() << "(ScriptServer) : Ran init script '" - << dotDir << salt::RFile::Sep() << fileName << "'\n"; - return true; - } - - if (result == eNotFound) - { GetLog()->Debug() << "(ScriptServer) : Did not find init script '" - << dotDir << salt::RFile::Sep() << fileName << "'\n"; + << dotDir << salt::RFile::Sep() << fileName << "'\n"; } - else if (result == eError) - { - GetLog()->Error() << "(ScriptServer) ERROR: Found error in init script '" - << dotDir << salt::RFile::Sep() << fileName << "'\n"; - return false; - } - // + + // Trying package data directory result = RunInitScriptInternal(pkgdatadir, fileName, validDotDir, dotDir); - if (result == eOK) { GetLog()->Debug() << "(ScriptServer) : Ran init script '" << pkgdatadir << salt::RFile::Sep() << fileName << "'\n"; return true; } - - if (result == eNotFound) - { - GetLog()->Debug() << "(ScriptServer) : Did not find init script '" - << pkgdatadir << salt::RFile::Sep() << fileName << "'\n"; - } else if (result == eError) { GetLog()->Error() << "(ScriptServer) ERROR: Found error in init script '" << pkgdatadir << salt::RFile::Sep() << fileName << "'\n"; + return false; } + GetLog()->Debug() << "(ScriptServer) : Did not find init script '" + << pkgdatadir << salt::RFile::Sep() << fileName << "'\n"; + // Trying relative path to cwd result = RunInitScriptInternal(mRelPathPrefix+relPath, fileName, validDotDir, dotDir); - if (result == eNotFound) + if (result == eOK) { - GetLog()->Error() << "(ScriptServer) ERROR: Cannot locate init script '" - << fileName << "'\n"; + GetLog()->Debug() << "(ScriptServer) : Ran init script '" + << mRelPathPrefix+relPath << salt::RFile::Sep() << fileName << "'\n"; + return true; } else if (result == eError) { @@ -664,5 +663,7 @@ << mRelPathPrefix+relPath << salt::RFile::Sep() << fileName << "'\n"; } + GetLog()->Error() << "(ScriptServer) ERROR: Cannot locate init script '" + << fileName << "'\n"; return (result == eOK); } Modified: trunk/spark/plugin/odeimps/odehingejoint.cpp =================================================================== --- trunk/spark/plugin/odeimps/odehingejoint.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/plugin/odeimps/odehingejoint.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -32,6 +32,7 @@ { dWorldID ODEWorld = (dWorldID) worldID; dJointID ODEJoint = dJointCreateHinge(ODEWorld, 0); + dJointSetFeedback( ODEJoint, &mFeedback ); return (long) ODEJoint; } @@ -86,3 +87,10 @@ dJointID ODEJoint = (dJointID) jointID; return gRadToDeg(dJointGetHingeAngleRate(ODEJoint)); } + +float HingeJointImp::GetTorque(long jointID) const +{ + dJointID ODEJoint = (dJointID) jointID; + dJointFeedback* fb = dJointGetFeedback(ODEJoint); + return dLENGTH(fb->t1) + dLENGTH(fb->t2); +} Modified: trunk/spark/plugin/odeimps/odehingejoint.h =================================================================== --- trunk/spark/plugin/odeimps/odehingejoint.h 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/plugin/odeimps/odehingejoint.h 2011-02-18 18:44:14 UTC (rev 246) @@ -38,6 +38,10 @@ salt::Vector3f GetAxis(long jointID); float GetAngle(long jointID) const; float GetAngleRate(long jointID) const; + float GetTorque(long jointID) const; +private: + dJointFeedback mFeedback; + }; DECLARE_CLASS(HingeJointImp); Modified: trunk/spark/plugin/sparkagent/hingeperceptor.cpp =================================================================== --- trunk/spark/plugin/sparkagent/hingeperceptor.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/plugin/sparkagent/hingeperceptor.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -48,6 +48,13 @@ axisElement.AddValue(mJoint->GetAngleRate()); } +void HingePerceptor::InsertAxisTorque(Predicate& predicate) +{ + ParameterList& axisElement = predicate.parameter.AddList(); + axisElement.AddValue(string("tq")); + axisElement.AddValue(mJoint->GetTorque()); +} + bool HingePerceptor::Percept(boost::shared_ptr<oxygen::PredicateList> predList) { if (mJoint.get() == 0) @@ -65,6 +72,7 @@ InsertAxisAngle(predicate); //InsertAxisRate(predicate); - + //InsertAxisTorque(predicate); + return true; } Modified: trunk/spark/plugin/sparkagent/hingeperceptor.h =================================================================== --- trunk/spark/plugin/sparkagent/hingeperceptor.h 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/plugin/sparkagent/hingeperceptor.h 2011-02-18 18:44:14 UTC (rev 246) @@ -35,6 +35,7 @@ protected: void InsertAxisAngle(oxygen::Predicate& predicate); void InsertAxisRate(oxygen::Predicate& predicate); + void InsertAxisTorque(oxygen::Predicate& predicate); }; DECLARE_CLASS(HingePerceptor); Modified: trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -415,17 +415,13 @@ { bool closeParen = DescribeNode(ss, node); - for (TLeafList::iterator i = node->begin(); i!= node->end(); ++i) + TLeafList baseNodes = node->GetBaseNodeChildren(); + for (TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i) { boost::shared_ptr<BaseNode> baseNode = shared_dynamic_cast<BaseNode>(*i); - if (baseNode.get() == 0) - { - continue; - } - DescribeScene(ss,baseNode); } - + if (closeParen) { ss << ")"; Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -191,7 +191,8 @@ } mActiveScene = mSceneServer->GetActiveScene(); - + mActiveScene->UpdateCache(); + if (mActiveScene.get() == 0) { return; @@ -233,6 +234,8 @@ mSceneImporter->ParseScene(string(pcont->lastPos), mManagedScene, boost::shared_ptr<ParameterList>()); + + mActiveScene->SetModified(true); destroy_sexp(sexp_custom); destroy_continuation(pcont); Modified: trunk/spark/spark/spark.cpp =================================================================== --- trunk/spark/spark/spark.cpp 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/spark/spark.cpp 2011-02-18 18:44:14 UTC (rev 246) @@ -109,7 +109,7 @@ ( "spark.rb", "lib/spark", - ScriptServer::IS_COMMON + ScriptServer::IS_USERLOCAL ); UpdateCached(); Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2011-02-11 22:53:50 UTC (rev 245) +++ trunk/spark/spark/spark.rb 2011-02-18 18:44:14 UTC (rev 246) @@ -188,8 +188,6 @@ end def sparkSetupMonitor - print "(spark.rb) sparkSetupMonitor\n" - # add the agent control node simulationServer = sparkGetSimulationServer() if (simulationServer != nil) @@ -205,7 +203,8 @@ else if ($monitorType == 'tcp') monitorClient.setClientTypeTCP() else - print "(spark.rb) unknown monitor socket type " + print "(spark.rb) sparkSetupMonitor\n" + print "(spark.rb) ERROR: unknown monitor socket type " print $monitorType print "\n" end @@ -218,7 +217,7 @@ end def sparkSetupMonitorLogPlayer - print "(spark.rb) sparkSetupMonitorLogPlayer\n" + #print "(spark.rb) sparkSetupMonitorLogPlayer\n" simulationServer = sparkGetSimulationServer() if (simulationServer != nil) @@ -241,7 +240,7 @@ # simulation specific monitor processing # def sparkRegisterCustomMonitor(className) - print "(spark.rb) sparkRegisterCustomMonitor " + className + "\n" + #print "(spark.rb) sparkRegisterCustomMonitor " + className + "\n" sparkGetSimulationServer() sparkCreate(className, $serverPath+'simulation/SparkMonitorClient/'+className) end @@ -251,7 +250,7 @@ # application specific render logic # def sparkRegisterCustomRender(className) - print "(spark.rb) sparkRegisterCustomRender " + className + "\n" + #print "(spark.rb) sparkRegisterCustomRender " + className + "\n" sparkGetSimulationServer() sparkCreate(className, $serverPath+'simulation/RenderControl/'+className) end @@ -261,7 +260,7 @@ # application specific input processing # def sparkRegisterCustomInput(className) - print "(spark.rb) sparkRegisterCustomInput " + className + "\n" + #print "(spark.rb) sparkRegisterCustomInput " + className + "\n" sparkGetSimulationServer() sparkCreate(className, $serverPath+'simulation/InputControl/'+className) end @@ -271,13 +270,12 @@ # commands received from a monitor client # def sparkRegisterMonitorCmdParser(className) - print "(spark.rb) sparkRegisterMonitorCmdParser " + className + "\n" + #print "(spark.rb) sparkRegisterMonitorCmdParser " + className + "\n" sparkGetMonitorServer() sparkCreate(className, $serverPath+'monitor/SparkMonitor/'+className) end def sparkSetupServer - print "(spark.rb) sparkSetupServer\n" # add the agent control node simulationServer = sparkGetSimulationServer() @@ -306,7 +304,8 @@ else if ($agentType == 'tcp') agentControl.setServerTypeTCP() else - print "(spark.rb) unknown agent socket type " + print "(spark.rb) sparkSetupServer\n" + print "(spark.rb) ERROR: unknown agent socket type " print $agentType print "\n" end @@ -321,7 +320,8 @@ else if ($serverType == 'tcp') monitorControl.setServerTypeTCP() else - print "(spark.rb) unknown monitor socket type " + print "(spark.rb) sparkSetupServer\n" + print "(spark.rb) ERROR: unknown monitor socket type " print $serverType print "\n" end @@ -416,7 +416,7 @@ end def sparkSetupTrain() - print "(spark.rb) sparkSetupTrain\n" + #print "(spark.rb) sparkSetupTrain\n" # # register train control node to the simulation server @@ -504,7 +504,7 @@ # deregisters all output stream def sparkResetLogging() - print "(spark.rb) sparkResetLogging removing all log targets\n"; + #print "(spark.rb) sparkResetLogging removing all log targets\n"; logServer = get($serverPath+'log') if (logServer != nil) @@ -513,11 +513,21 @@ end +# logs all normal output to cout +def sparkLogNormalToCout() + sparkEnableLog(':cout', 'eNormal') +end + # logs all error output to cerr def sparkLogErrorToCerr() sparkEnableLog(':cerr', 'eError') end +# logs all warning output to cerr +def sparkLogWarningToCerr() + sparkEnableLog(':cerr', 'eWarning') +end + # logs all debug output to cerr def sparkLogDebugToCerr() sparkEnableLog(':cerr', 'eDebug') @@ -552,12 +562,12 @@ # setup spark # -print "(spark.rb) setup\n" +#print "(spark.rb) setup\n" #import the implementations of the desired physics engine #currently supported: odeimps (uses Open Dynamics Engine) importBundle 'odeimps' -print "(spark.rb) using ODE, to change the physics engine go to line 559 in spark.rb\n" +#print "(spark.rb) using ODE, to change the physics engine go to line 559 in spark.rb\n" # # set up logging This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-02-11 22:53:56
|
Revision: 245 http://simspark.svn.sourceforge.net/simspark/?rev=245&view=rev Author: sgvandijk Date: 2011-02-11 22:53:50 +0000 (Fri, 11 Feb 2011) Log Message: ----------- - Use ode-config to find ODE. Helps find locally installed ODE - Use HINTS instead of PATHS for finding simspark, so SPARK_DIR has preference over default paths Modified Paths: -------------- trunk/rcssserver3d/cmake/FindODE.cmake trunk/rcssserver3d/cmake/FindSpark.cmake trunk/spark/cmake/FindODE.cmake Modified: trunk/rcssserver3d/cmake/FindODE.cmake =================================================================== --- trunk/rcssserver3d/cmake/FindODE.cmake 2011-02-10 18:40:37 UTC (rev 244) +++ trunk/rcssserver3d/cmake/FindODE.cmake 2011-02-11 22:53:50 UTC (rev 245) @@ -18,11 +18,21 @@ OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE ODE_CONFIG_RESULT ) + EXECUTE_PROCESS( + COMMAND ${ODE_CONFIG} --prefix + OUTPUT_VARIABLE ODE_CONFIG_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE ODE_CONFIG_RESULT + ) ELSE(COMMAND EXECUTE_PROCESS) EXEC_PROGRAM(${ODE_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE ODE_CONFIG_CFLAGS RETURN_VALUE ODE_CONFIG_RESULT ) + EXEC_PROGRAM(${ODE_CONFIG} ARGS "--prefix" + OUTPUT_VARIABLE ODE_CONFIG_PREFIX + RETURN_VALUE ODE_CONFIG_RESULT + ) ENDIF(COMMAND EXECUTE_PROCESS) # Parse the include flags. @@ -44,22 +54,25 @@ ENDIF(ODE_CONFIG) FIND_PATH(ODE_INCLUDE_DIR ode/ode.h + ${ODE_CONFIG_PREFIX}/include /usr/include /usr/local/include - $ENV{OGRE_HOME}/include # OGRE SDK on WIN32 + $ENV{ODE_HOME}/include $ENV{INCLUDE} C:/library/ode/include "C:/Program Files/ode/include" "C:/Program Files (x86)/ode/include" C:/ode/include + NO_DEFAULT_PATH ) FIND_LIBRARY(ODE_LIBRARY NAMES ode ode_double ode_single PATHS + ${ODE_CONFIG_PREFIX}/lib /usr/lib /usr/lib64 /usr/local/lib - $ENV{OGRE_HOME}/lib # OGRE SDK on WIN32 + $ENV{ODE_HOME}/lib C:/library/ode/lib/ "C:/Program Files/ode/lib/" "C:/Program Files (x86)/ode/lib/" @@ -68,6 +81,7 @@ releaselib ReleaseDoubleDLL ReleaseDoubleLib ReleaseSingleDLL ReleaseSingleLib + NO_DEFAULT_PATH ) IF (WIN32) Modified: trunk/rcssserver3d/cmake/FindSpark.cmake =================================================================== --- trunk/rcssserver3d/cmake/FindSpark.cmake 2011-02-10 18:40:37 UTC (rev 244) +++ trunk/rcssserver3d/cmake/FindSpark.cmake 2011-02-11 22:53:50 UTC (rev 245) @@ -30,12 +30,12 @@ SET(SPARK_DIR $ENV{SPARK_DIR} "C:/Program Files/simspark" "C:/Program Files (x86)/simspark" "C:/library/simspark") FIND_PATH(SPARK_INCLUDE_DIR spark/spark.h - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark include/simspark) SET(SPARK_NAMES spark spark_debug) FIND_LIBRARY(SPARK_LIBRARY NAMES ${SPARK_NAMES} - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark lib/simspark) GET_FILENAME_COMPONENT(SPARK_LIB_DIR ${SPARK_LIBRARY} PATH) @@ -60,12 +60,12 @@ ENDIF (SALT_INCLUDE_DIR) FIND_PATH(SALT_INCLUDE_DIR salt/salt.h - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark include/simspark) SET(SALT_NAMES salt salt_debug) FIND_LIBRARY(SALT_LIBRARY NAMES ${SALT_NAMES} - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark lib/simspark) # handle the QUIETLY and REQUIRED arguments and set SALT_FOUND to TRUE if @@ -89,12 +89,12 @@ ENDIF (ZEITGEIST_INCLUDE_DIR) FIND_PATH(ZEITGEIST_INCLUDE_DIR zeitgeist/zeitgeist.h - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark include/simspark) SET(ZEITGEIST_NAMES zeitgeist zeitgeist_debug) FIND_LIBRARY(ZEITGEIST_LIBRARY NAMES ${ZEITGEIST_NAMES} - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark lib/simspark) # handle the QUIETLY and REQUIRED arguments and set ZEITGEIST_FOUND to TRUE if @@ -118,12 +118,12 @@ ENDIF (OXYGEN_INCLUDE_DIR) FIND_PATH(OXYGEN_INCLUDE_DIR oxygen/oxygen.h - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark include/simspark) SET(OXYGEN_NAMES oxygen oxygen_debug) FIND_LIBRARY(OXYGEN_LIBRARY NAMES ${OXYGEN_NAMES} - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark lib/simspark) # handle the QUIETLY and REQUIRED arguments and set OXYGEN_FOUND to TRUE if @@ -147,12 +147,12 @@ ENDIF (KEROSIN_INCLUDE_DIR) FIND_PATH(KEROSIN_INCLUDE_DIR kerosin/kerosin.h - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark include/simspark) SET(KEROSIN_NAMES kerosin kerosin_debug) FIND_LIBRARY(KEROSIN_LIBRARY NAMES ${KEROSIN_NAMES} - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark lib/simspark) # handle the QUIETLY and REQUIRED arguments and set KEROSIN_FOUND to TRUE if @@ -176,12 +176,12 @@ ENDIF (RCSSNET3D_INCLUDE_DIR) FIND_PATH(RCSSNET3D_INCLUDE_DIR rcssnet/addr.hpp - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark include/simspark) SET(RCSSNET3D_NAMES rcssnet3D rcssnet3D_debug) FIND_LIBRARY(RCSSNET3D_LIBRARY NAMES ${RCSSNET3D_NAMES} - PATHS ${SPARK_DIR} + HINTS ${SPARK_DIR} PATH_SUFFIXES simspark lib/simspark) # handle the QUIETLY and REQUIRED arguments and set RCSSNET3D_FOUND to TRUE if Modified: trunk/spark/cmake/FindODE.cmake =================================================================== --- trunk/spark/cmake/FindODE.cmake 2011-02-10 18:40:37 UTC (rev 244) +++ trunk/spark/cmake/FindODE.cmake 2011-02-11 22:53:50 UTC (rev 245) @@ -18,11 +18,21 @@ OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE ODE_CONFIG_RESULT ) + EXECUTE_PROCESS( + COMMAND ${ODE_CONFIG} --prefix + OUTPUT_VARIABLE ODE_CONFIG_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE ODE_CONFIG_RESULT + ) ELSE(COMMAND EXECUTE_PROCESS) EXEC_PROGRAM(${ODE_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE ODE_CONFIG_CFLAGS RETURN_VALUE ODE_CONFIG_RESULT ) + EXEC_PROGRAM(${ODE_CONFIG} ARGS "--prefix" + OUTPUT_VARIABLE ODE_CONFIG_PREFIX + RETURN_VALUE ODE_CONFIG_RESULT + ) ENDIF(COMMAND EXECUTE_PROCESS) # Parse the include flags. @@ -44,6 +54,7 @@ ENDIF(ODE_CONFIG) FIND_PATH(ODE_INCLUDE_DIR ode/ode.h + ${ODE_CONFIG_PREFIX}/include /usr/include /usr/local/include $ENV{ODE_HOME}/include @@ -52,10 +63,12 @@ "C:/Program Files/ode/include" "C:/Program Files (x86)/ode/include" C:/ode/include + NO_DEFAULT_PATH ) FIND_LIBRARY(ODE_LIBRARY NAMES ode ode_double ode_single PATHS + ${ODE_CONFIG_PREFIX}/lib /usr/lib /usr/lib64 /usr/local/lib @@ -68,6 +81,7 @@ releaselib ReleaseDoubleDLL ReleaseDoubleLib ReleaseSingleDLL ReleaseSingleLib + NO_DEFAULT_PATH ) IF (WIN32) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-02-10 18:40:43
|
Revision: 244 http://simspark.svn.sourceforge.net/simspark/?rev=244&view=rev Author: sgvandijk Date: 2011-02-10 18:40:37 +0000 (Thu, 10 Feb 2011) Log Message: ----------- - ChangeLog Modified Paths: -------------- trunk/rcssserver3d/ChangeLog Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2011-02-10 18:37:19 UTC (rev 243) +++ trunk/rcssserver3d/ChangeLog 2011-02-10 18:40:37 UTC (rev 244) @@ -1,3 +1,11 @@ +2011-02-10 Sander van Dijk <sgv...@gm...> + + * rcssserver3d/rcssserver3d/main.cpp + - Set different agent and monitor ports with --agent-posrt and --server-port + + * /trunk/rcssserver3d/data/textures/rcs-naofield.png + - New field texture + 2011-01-13 Hedayat Vatankhah <hed...@gm...> * cmake/UseLATEX.cmake: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-02-10 18:37:25
|
Revision: 243 http://simspark.svn.sourceforge.net/simspark/?rev=243&view=rev Author: sgvandijk Date: 2011-02-10 18:37:19 +0000 (Thu, 10 Feb 2011) Log Message: ----------- - Set different agent and monitor ports with --agent-posrt and --server-port - New field texture Modified Paths: -------------- trunk/rcssserver3d/data/textures/rcs-naofield.png trunk/rcssserver3d/rcssserver3d/main.cpp Modified: trunk/rcssserver3d/data/textures/rcs-naofield.png =================================================================== (Binary files differ) Modified: trunk/rcssserver3d/rcssserver3d/main.cpp =================================================================== --- trunk/rcssserver3d/rcssserver3d/main.cpp 2011-01-13 16:49:48 UTC (rev 242) +++ trunk/rcssserver3d/rcssserver3d/main.cpp 2011-02-10 18:37:19 UTC (rev 243) @@ -84,6 +84,8 @@ << "\noptions:\n" << " --help\t\t\t print this message.\n" << " --script-path PATH\t set the script path (simspark.rb path).\n" + << "--agent-port PORTNUM\t port for agents to connect to.\n" + << "--server-port PORTNUM\t port for monitors to connect to.\n" << "\n"; } @@ -91,7 +93,7 @@ { for( int i = 1; i < argc; i++) { - if(strcmp( argv[1], "--help" ) == 0) + if(strcmp( argv[i], "--help" ) == 0) { PrintHelp(); return false; @@ -107,6 +109,29 @@ return false; } } + else if (strcmp(argv[i], "--agent-port") == 0) + { + i++; + if (i < argc) + GetScriptServer()->Eval(string("$agentPort = ") + argv[i]); + else + { + PrintHelp(); + return false; + } + } + else if (strcmp(argv[i], "--server-port") == 0) + { + i++; + if (i < argc) + GetScriptServer()->Eval(string("$serverPort = ") + argv[i]); + else + { + PrintHelp(); + return false; + } + } + } return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-01-13 16:49:55
|
Revision: 242 http://simspark.svn.sourceforge.net/simspark/?rev=242&view=rev Author: hedayat Date: 2011-01-13 16:49:48 +0000 (Thu, 13 Jan 2011) Log Message: ----------- Updated UseLATEX Fixed a compile issue on Mac (Thanks to Luca Giuliani) Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/cmake/UseLATEX.cmake trunk/rcssserver3d/plugin/soccermonitor/CMakeLists.txt Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2010-12-19 19:18:59 UTC (rev 241) +++ trunk/rcssserver3d/ChangeLog 2011-01-13 16:49:48 UTC (rev 242) @@ -1,3 +1,11 @@ +2011-01-13 Hedayat Vatankhah <hed...@gm...> + + * cmake/UseLATEX.cmake: + - Updated to version 1.7.2 + + * plugin/soccermonitor/CMakeLists.txt: + - Link OpenGL libraries to fix MacOSX compile issue(Thanks to Giuliani) + 2010-12-14 Yuan Xu <xu...@in...> * rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp * rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp Modified: trunk/rcssserver3d/cmake/UseLATEX.cmake =================================================================== --- trunk/rcssserver3d/cmake/UseLATEX.cmake 2010-12-19 19:18:59 UTC (rev 241) +++ trunk/rcssserver3d/cmake/UseLATEX.cmake 2011-01-13 16:49:48 UTC (rev 242) @@ -1,6 +1,6 @@ # File: UseLATEX.cmake # CMAKE commands to actually use the LaTeX compiler -# Version: 1.7.0 +# Version: 1.7.2 # Author: Kenneth Moreland (kmorel at sandia dot gov) # # Copyright 2004 Sandia Corporation. @@ -49,6 +49,10 @@ # auxclean: Deletes <name>.aux. This is sometimes necessary # if a LaTeX error occurs and writes a bad aux file. # +# The dvi target is added to the ALL. That is, it will be the target +# built by default. If the DEFAULT_PDF argument is given, then the +# pdf target will be the default instead of dvi. +# # If the argument MANGLE_TARGET_NAMES is given, then each of the # target names above will be mangled with the <tex_file> name. This # is to make the targets unique if ADD_LATEX_DOCUMENT is called for @@ -58,8 +62,15 @@ # # History: # -# 1.7.0 Added DEPENDS options (thanks to Theodore Papadopoulp). +# 1.7.2.1 (By Hedayat) Do not add anything to default ALL target # +# 1.7.2 Use ps2pdf to convert eps to pdf to get around the problem with +# ImageMagick dropping the bounding box (thanks to Lukasz Lis). +# +# 1.7.1 Fixed some dependency issues. +# +# 1.7.0 Added DEPENDS options (thanks to Theodore Papadopoulo). +# # 1.6.1 Ported the makeglossaries command to CMake and embedded the port # into UseLATEX.cmake. # @@ -71,16 +82,16 @@ # specify tex files without the .tex extension is removed. The removed # function is of dubious value anyway. # -# When copying input files, skip over any file that exists in the -# binary directory but does not exist in the source directory with the -# assumption that these files were added by some other mechanism. I -# find this useful when creating large documents with multiple -# chapters that I want to build separately (for speed) as I work on -# them. I use the same boilerplate as the starting point for all -# and just copy it with different configurations. This was what the -# separate ADD_LATEX_DOCUMENT method was supposed to originally be for. -# Since its external use is pretty much deprecated, I removed that -# documentation. +# When copying input files, skip over any file that exists in the +# binary directory but does not exist in the source directory with the +# assumption that these files were added by some other mechanism. I +# find this useful when creating large documents with multiple +# chapters that I want to build separately (for speed) as I work on +# them. I use the same boilerplate as the starting point for all +# and just copy it with different configurations. This was what the +# separate ADD_LATEX_DOCUMENT method was supposed to originally be for. +# Since its external use is pretty much deprecated, I removed that +# documentation. # # 1.4.1 Copy .sty files along with the other class and package files. # @@ -375,6 +386,30 @@ ENDIF (LATEX_OUTPUT_PATH) ENDMACRO(LATEX_GET_OUTPUT_PATH) +MACRO(LATEX_ADD_CONVERT_COMMAND output_path input_path output_extension + input_extension flags) + SET (converter ${IMAGEMAGICK_CONVERT}) + SET (convert_flags "") + # ImageMagick has broken eps to pdf conversion + # use ps2pdf instead + IF (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf") + IF (PS2PDF_CONVERTER) + SET (converter ${PS2PDF_CONVERTER}) + SET (convert_flags "-dEPSCrop ${flags}") + ELSE (PS2PDF_CONVERTER) + MESSAGE(SEND_ERROR "Using postscript files with pdflatex requires ps2pdf for conversion.") + ENDIF (PS2PDF_CONVERTER) + ELSE (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf") + SET (convert_flags ${flags}) + ENDIF (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf") + + ADD_CUSTOM_COMMAND(OUTPUT ${output_path} + COMMAND ${converter} + ARGS ${convert_flags} ${input_path} ${output_path} + DEPENDS ${input_path} + ) +ENDMACRO(LATEX_ADD_CONVERT_COMMAND) + # Makes custom commands to convert a file to a particular type. MACRO(LATEX_CONVERT_IMAGE output_files input_file output_extension convert_flags output_extensions other_files) @@ -389,12 +424,9 @@ LATEX_LIST_CONTAINS(is_type ${extension} ${output_extensions}) IF (is_type) IF (convert_flags) - ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${output_file} - COMMAND ${IMAGEMAGICK_CONVERT} - ARGS ${input_dir}/${input_file} ${convert_flags} - ${output_dir}/${output_file} - DEPENDS ${input_dir}/${input_file} - ) + LATEX_ADD_CONVERT_COMMAND(${output_dir}/${output_file} + ${input_dir}/${input_file} ${output_extension} ${extension} + "${convert_flags}") SET(${output_files} ${${output_files}} ${output_dir}/${output_file}) ELSE (convert_flags) # As a shortcut, we can just copy the file. @@ -419,12 +451,9 @@ # If we still need to convert, do it. IF (do_convert) - ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${output_file} - COMMAND ${IMAGEMAGICK_CONVERT} - ARGS ${input_dir}/${input_file} ${convert_flags} - ${output_dir}/${output_file} - DEPENDS ${input_dir}/${input_file} - ) + LATEX_ADD_CONVERT_COMMAND(${output_dir}/${output_file} + ${input_dir}/${input_file} ${output_extension} ${extension} + "${convert_flags}") SET(${output_files} ${${output_files}} ${output_dir}/${output_file}) ENDIF (do_convert) ENDIF (is_type) @@ -493,20 +522,20 @@ LATEX_LIST_CONTAINS(use_config ${file} ${LATEX_CONFIGURE}) IF (use_config) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file} - ${output_dir}/${file} - @ONLY - ) + ${output_dir}/${file} + @ONLY + ) ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${file} - COMMAND ${CMAKE_COMMAND} - ARGS ${CMAKE_BINARY_DIR} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} - ) + COMMAND ${CMAKE_COMMAND} + ARGS ${CMAKE_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} + ) ELSE (use_config) ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${file} - COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${output_dir}/${file} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} - ) + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${output_dir}/${file} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} + ) ENDIF (use_config) ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}) IF (EXISTS ${output_dir}/${file}) @@ -671,31 +700,45 @@ COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}) + # Add commands and targets for building dvi outputs. + ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.dvi + COMMAND ${make_dvi_command} + DEPENDS ${make_dvi_depends} + ) IF (LATEX_DEFAULT_PDF) - ADD_CUSTOM_TARGET(${dvi_target} ${make_dvi_command} - DEPENDS ${make_dvi_depends}) + ADD_CUSTOM_TARGET(${dvi_target} + DEPENDS ${output_dir}/${LATEX_TARGET}.dvi) ELSE (LATEX_DEFAULT_PDF) - ADD_CUSTOM_TARGET(${dvi_target} ALL ${make_dvi_command} - DEPENDS ${make_dvi_depends}) + ADD_CUSTOM_TARGET(${dvi_target} + DEPENDS ${output_dir}/${LATEX_TARGET}.dvi) ENDIF (LATEX_DEFAULT_PDF) + # Add commands and targets for building pdf outputs (with pdflatex). IF (PDFLATEX_COMPILER) + ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.pdf + COMMAND ${make_pdf_command} + DEPENDS ${make_pdf_depends} + ) IF (LATEX_DEFAULT_PDF) - ADD_CUSTOM_TARGET(${pdf_target} ${make_pdf_command} - DEPENDS ${make_pdf_depends}) + ADD_CUSTOM_TARGET(${pdf_target} + DEPENDS ${output_dir}/${LATEX_TARGET}.pdf) ELSE (LATEX_DEFAULT_PDF) - ADD_CUSTOM_TARGET(${pdf_target} ${make_pdf_command} - DEPENDS ${make_pdf_depends}) + ADD_CUSTOM_TARGET(${pdf_target} + DEPENDS ${output_dir}/${LATEX_TARGET}.pdf) ENDIF (LATEX_DEFAULT_PDF) ENDIF (PDFLATEX_COMPILER) IF (DVIPS_CONVERTER) + ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.ps + COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} + ${DVIPS_CONVERTER} ${DVIPS_CONVERTER_FLAGS} -o ${LATEX_TARGET}.ps ${LATEX_TARGET}.dvi + DEPENDS ${output_dir}/${LATEX_TARGET}.dvi) ADD_CUSTOM_TARGET(${ps_target} - ${CMAKE_COMMAND} -E chdir ${output_dir} - ${DVIPS_CONVERTER} ${DVIPS_CONVERTER_FLAGS} -o ${LATEX_TARGET}.ps ${LATEX_TARGET}.dvi - ) - ADD_DEPENDENCIES(${ps_target} ${dvi_target}) + DEPENDS ${output_dir}/${LATEX_TARGET}.ps) IF (PS2PDF_CONVERTER) + # Since both the pdf and safepdf targets have the same output, we + # cannot properly do the dependencies for both. When selecting safepdf, + # simply force a recompile every time. ADD_CUSTOM_TARGET(${safepdf_target} ${CMAKE_COMMAND} -E chdir ${output_dir} ${PS2PDF_CONVERTER} ${PS2PDF_CONVERTER_FLAGS} ${LATEX_TARGET}.ps ${LATEX_TARGET}.pdf Modified: trunk/rcssserver3d/plugin/soccermonitor/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/CMakeLists.txt 2010-12-19 19:18:59 UTC (rev 241) +++ trunk/rcssserver3d/plugin/soccermonitor/CMakeLists.txt 2011-01-13 16:49:48 UTC (rev 242) @@ -24,7 +24,7 @@ add_library(soccermonitor MODULE ${soccermonitor_LIB_SRCS} ${soccermonitor_LIB_HDRS}) -target_link_libraries(soccermonitor ${spark_libs}) +target_link_libraries(soccermonitor ${spark_libs} ${OPENGL_LIBRARIES}) if (NOT APPLE) set_target_properties(soccermonitor PROPERTIES VERSION 1.0.0 SOVERSION 1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |