From: <sgv...@us...> - 2009-06-16 09:54:57
|
Revision: 69 http://simspark.svn.sourceforge.net/simspark/?rev=69&view=rev Author: sgvandijk Date: 2009-06-16 09:53:55 +0000 (Tue, 16 Jun 2009) Log Message: ----------- - simspark can take command line argument specifying the rb script to run (Simon Raffeiner) - new soccer input command to give kick-off to the team on the right (bound to 'j') (Simon Raffeiner) Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb trunk/rcssserver3d/simspark/main.cpp Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2009-06-15 15:08:14 UTC (rev 68) +++ trunk/rcssserver3d/ChangeLog 2009-06-16 09:53:55 UTC (rev 69) @@ -1,3 +1,15 @@ +2009-06-16 Sander van Dijk <sgv...@gm...> + + * simspark/main.cpp + - simspark can take command line argument specifying the rb script to run + (Simon Raffeiner) + + * plugin/soccermonitor/soccerinput.cpp + * plugin/soccermonitor/soccerinput.h + * rcssmonitor3d/soccerbindings.rb + - new soccer input command to give kick-off to the team on the right (bound + to 'j') (Simon Raffeiner) + 2009-06-15 Sander van Dijk <sgv...@gm...> * plugin/soccer/ballstateaspect/ballstateaspect.h Modified: trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2009-06-15 15:08:14 UTC (rev 68) +++ trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2009-06-16 09:53:55 UTC (rev 69) @@ -42,6 +42,7 @@ { shared_ptr<ScriptServer> scriptServer = GetCore()->GetScriptServer(); scriptServer->CreateVariable("Command.KickOff", CmdKickOff); + scriptServer->CreateVariable("Command.KickOffRight", CmdKickOffRight); scriptServer->CreateVariable("Command.MoveAgent", CmdMoveAgent); scriptServer->CreateVariable("Command.DropBall", CmdDropBall); scriptServer->CreateVariable("Command.ShootBall", CmdShootBall); @@ -131,6 +132,13 @@ SendCommand("(kickOff Left)"); } break; + case CmdKickOffRight: + if (input.GetKeyPress()) + { + SendCommand("(kickOff Right)"); + } + break; + case CmdMoveAgent: if (input.GetKeyPress()) { Modified: trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h 2009-06-15 15:08:14 UTC (rev 68) +++ trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h 2009-06-16 09:53:55 UTC (rev 69) @@ -37,7 +37,8 @@ { CmdUser = kerosin::InputControl::CmdUser, CmdKickOff = CmdUser + 1, - CmdMoveAgent = CmdKickOff + 1, + CmdKickOffRight = CmdKickOff + 1, + CmdMoveAgent = CmdKickOffRight + 1, CmdDropBall = CmdMoveAgent + 1, CmdShootBall = CmdDropBall + 1, CmdMoveBall = CmdShootBall + 1, Modified: trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2009-06-15 15:08:14 UTC (rev 68) +++ trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2009-06-16 09:53:55 UTC (rev 69) @@ -25,6 +25,7 @@ else print "setting bindings for online monitor\n\n"; inputServer.bindCommand('k', Command.KickOff); + inputServer.bindCommand('j', Command.KickOffRight); inputServer.bindCommand('b', Command.DropBall); inputServer.bindCommand('m', Command.MoveAgent); inputServer.bindCommand('n', Command.ShootBall); Modified: trunk/rcssserver3d/simspark/main.cpp =================================================================== --- trunk/rcssserver3d/simspark/main.cpp 2009-06-15 15:08:14 UTC (rev 68) +++ trunk/rcssserver3d/simspark/main.cpp 2009-06-16 09:53:55 UTC (rev 69) @@ -46,7 +46,8 @@ { public: SimSpark(const std::string& relPathPrefix) : - Spark(relPathPrefix) + Spark(relPathPrefix), + mScriptPath("simspark.rb") {}; /** called once after Spark finished it's init */ @@ -60,15 +61,18 @@ /** process command line options */ bool ProcessCmdLine(int argc, char* argv[]); + +private: + std::string mScriptPath; }; void SimSpark::PrintGreeting() { GetLog()->Normal() - << "simspark, a monolithic simulator 0.1\n" + << "simspark, a monolithic simulator 0.6.1\n" << "Copyright (C) 2004 Markus Rollmann, \n" - << "Universit�t Koblenz.\n" - << "Copyright (C) 2004, " + << "Universität Koblenz.\n" + << "Copyright (C) 2004-2009, " << "The RoboCup Soccer Server Maintenance Group.\n" << "\nType '--help' for further information\n\n"; } @@ -76,24 +80,26 @@ void SimSpark::PrintHelp() { GetLog()->Normal() - << "\nusage: simspark [options]\n" - << "\noptions:\n" - << " --help\t print this message.\n" - << "\n"; + << "\nusage: simspark [options] [script]\n" + << "\noptions:\n" + << " --help\t print this message.\n" + << "\n"; } bool SimSpark::ProcessCmdLine(int argc, char* argv[]) { - for( int i = 0; i < argc; i++) + if(argc == 1) + return true; + + if(argc > 2 || strcmp( argv[0], "--help" ) == 0) { - if( strcmp( argv[i], "--help" ) == 0 ) - { - PrintHelp(); - return false; - } + PrintHelp(); + return false; } - return true; + mScriptPath = argv[1]; + + return true; } bool SimSpark::InitApp(int argc, char** argv) @@ -104,19 +110,19 @@ // process command line if (! ProcessCmdLine(argc, argv)) - { - return false; - } + { + return false; + } // run initialization scripts - GetScriptServer()->Run("simspark.rb"); + GetScriptServer()->Run(mScriptPath); // tell the inputControl node the loaction of our camera shared_ptr<InputControl> inputCtr = GetInputControl(); if (inputCtr.get() != 0) - { - inputCtr->SetFPSController("/usr/scene/camera/physics/controller"); - } + { + inputCtr->SetFPSController("/usr/scene/camera/physics/controller"); + } return true; } @@ -127,21 +133,21 @@ SimSpark spark("../../"); if (! spark.Init(argc, argv)) - { - return 1; - } + { + return 1; + } spark.GetSimulationServer()->Run(argc,argv); shared_ptr<RenderControl> renderCtr = spark.GetRenderControl(); if (renderCtr.get() != 0) - { - spark.GetLog()->Normal() - << "Average FPS: " - << renderCtr->GetFramesRendered() / - spark.GetSimulationServer()->GetTime() - << "\n"; - } + { + spark.GetLog()->Normal() + << "Average FPS: " + << renderCtr->GetFramesRendered() / + spark.GetSimulationServer()->GetTime() + << "\n"; + } return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |