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...> - 2010-06-08 07:56:59
|
Revision: 216 http://simspark.svn.sourceforge.net/simspark/?rev=216&view=rev Author: hedayat Date: 2010-06-08 07:56:52 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Tagged 0.6.4 release Added Paths: ----------- tags/RCSSSERVER3D_0.6.4_RELEASE/ Property changes on: tags/RCSSSERVER3D_0.6.4_RELEASE ___________________________________________________________________ Added: svn:ignore + .project .cproject Makefile.in rcssserver3d_config.h rcssserver3d_config.h.in configure stamp-h1 aclocal.m4 autom4te.cache config.status .cdtconfigure.Build (GNU) libtool Makefile .settings Added: svn:mergeinfo + /branches/agentselection/rcssserver3d:195-206 /branches/treehole/rcssserver3d:175 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-08 07:50:56
|
Revision: 215 http://simspark.svn.sourceforge.net/simspark/?rev=215&view=rev Author: hedayat Date: 2010-06-08 07:50:50 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Tagged simspark 0.2.1 release Added Paths: ----------- tags/SIMSPARK_0.2.1_RELEASE/ Property changes on: tags/SIMSPARK_0.2.1_RELEASE ___________________________________________________________________ Added: svn:ignore + .project .cproject autom4te.cache configure sparkconfig.h.in Makefile.in aclocal.m4 .cdtconfigure.Build (GNU) Makefile config.status stamp-h1 libtool sparkconfig.h .settings Added: svn:mergeinfo + /branches/agentselection/spark:195-206 /branches/treehole/spark:175 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-07 20:40:04
|
Revision: 214 http://simspark.svn.sourceforge.net/simspark/?rev=214&view=rev Author: hedayat Date: 2010-06-07 20:39:58 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Create relative symlink for simspark to (hopefully) avoid installation errors. Fixed the executable name in linux .desktop file Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/linux/rcssserver3d.desktop trunk/rcssserver3d/rcssserver3d/CMakeLists.txt Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2010-06-07 13:13:28 UTC (rev 213) +++ trunk/rcssserver3d/ChangeLog 2010-06-07 20:39:58 UTC (rev 214) @@ -1,3 +1,12 @@ +2010-06-08 Hedayat Vatankhah <he...@gr...> + + * linux/rcssserver3d.desktop: + - changed the binary name to rcsoccersim3d + + * rcssserver3d/CMakeLists.txt: + - simspark is now a relative symlink, hopefully fixing some problems on + 'make install' + 2010-06-07 Hedayat Vatankhah <he...@gr...> * NEWS: Modified: trunk/rcssserver3d/linux/rcssserver3d.desktop =================================================================== --- trunk/rcssserver3d/linux/rcssserver3d.desktop 2010-06-07 13:13:28 UTC (rev 213) +++ trunk/rcssserver3d/linux/rcssserver3d.desktop 2010-06-07 20:39:58 UTC (rev 214) @@ -2,7 +2,7 @@ Encoding=UTF-8 Name=RoboCup Soccer Server 3D Comment=RoboCup Soccer Simulation Server 3D -Exec=simspark +Exec=rcsoccersim3d Icon=simspark Terminal=false Type=Application Modified: trunk/rcssserver3d/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/rcssserver3d/CMakeLists.txt 2010-06-07 13:13:28 UTC (rev 213) +++ trunk/rcssserver3d/rcssserver3d/CMakeLists.txt 2010-06-07 20:39:58 UTC (rev 214) @@ -23,8 +23,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/rcsoccersim3d) execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - ${CMAKE_INSTALL_PREFIX}/${BINDIR}/rcssserver3d - ${CMAKE_CURRENT_BINARY_DIR}/simspark) + rcssserver3d ${CMAKE_CURRENT_BINARY_DIR}/simspark) ########### install files ############### This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-07 13:13:36
|
Revision: 213 http://simspark.svn.sourceforge.net/simspark/?rev=213&view=rev Author: hedayat Date: 2010-06-07 13:13:28 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Fixed accelerometer installation on MacOSX Look into ENV{ODE_HOME} instead of ENV{OGRE_HOME} to find ODE library Reapply the accelerometer filter to remain compatible with simspark-0.2 Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/cmake/FindODE.cmake trunk/spark/plugin/accelerometer/CMakeLists.txt trunk/spark/plugin/accelerometer/accelerometer.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-06-06 22:44:51 UTC (rev 212) +++ trunk/spark/ChangeLog 2010-06-07 13:13:28 UTC (rev 213) @@ -4,6 +4,16 @@ * RELEASE: - prepared for 0.2.1 release + * plugin/accelerometer/accelerometer.cpp: + - reapply the filter to remain compatible with simspark-0.2 for RoboCup 2010 + + * cmake/FindODE.cmake: + - lookup in the directory specified in ODE_HOME env. variable instead of + OGRE_HOME + + * plugin/accelerometer/CMakeLists.txt: + - fixed accelerometer installation on MacOSX + * lib/oxygen/simulationserver/monitorlogger.h: * lib/oxygen/simulationserver/monitorlogger.cpp: - request complete game information every 10 seconds so that it'll receive Modified: trunk/spark/cmake/FindODE.cmake =================================================================== --- trunk/spark/cmake/FindODE.cmake 2010-06-06 22:44:51 UTC (rev 212) +++ trunk/spark/cmake/FindODE.cmake 2010-06-07 13:13:28 UTC (rev 213) @@ -46,7 +46,7 @@ FIND_PATH(ODE_INCLUDE_DIR ode/ode.h /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" @@ -59,7 +59,7 @@ /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/" Modified: trunk/spark/plugin/accelerometer/CMakeLists.txt =================================================================== --- trunk/spark/plugin/accelerometer/CMakeLists.txt 2010-06-06 22:44:51 UTC (rev 212) +++ trunk/spark/plugin/accelerometer/CMakeLists.txt 2010-06-07 13:13:28 UTC (rev 213) @@ -10,7 +10,8 @@ target_link_libraries(accelerometer ${spark_libs} ${Boost_LIBRARIES}) -set_target_properties(accelerometer PROPERTIES VERSION 0.0.0 SOVERSION 0) if (NOT APPLE) - install(TARGETS accelerometer DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) + set_target_properties(accelerometer PROPERTIES VERSION 0.0.0 SOVERSION 0) endif (NOT APPLE) + +install(TARGETS accelerometer DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) Modified: trunk/spark/plugin/accelerometer/accelerometer.cpp =================================================================== --- trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-06-06 22:44:51 UTC (rev 212) +++ trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-06-07 13:13:28 UTC (rev 213) @@ -84,5 +84,10 @@ Matrix invRot = mBody->GetRotation(); invRot.InvertRotationMatrix(); - mAcc = invRot * acc; +// mAcc = invRot * acc; + acc = invRot * acc; + + float k = 0.9; + mAcc = k*mAcc + (1-k)*acc; + mLastVel = vel; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-06 22:44:57
|
Revision: 212 http://simspark.svn.sourceforge.net/simspark/?rev=212&view=rev Author: hedayat Date: 2010-06-06 22:44:51 +0000 (Sun, 06 Jun 2010) Log Message: ----------- Monitor Logger now logs game state data in fixed intervals, so that such data will not be missed Some more release notes Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/NEWS trunk/spark/RELEASE trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp trunk/spark/lib/oxygen/simulationserver/monitorlogger.h Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/ChangeLog 2010-06-06 22:44:51 UTC (rev 212) @@ -1,3 +1,14 @@ +2010-06-07 Hedayat Vatankhah <he...@gr...> + + * NEWS: + * RELEASE: + - prepared for 0.2.1 release + + * lib/oxygen/simulationserver/monitorlogger.h: + * lib/oxygen/simulationserver/monitorlogger.cpp: + - request complete game information every 10 seconds so that it'll receive + new game state information + 2010-06-06 Hedayat Vatankhah <he...@gr...> * lib/oxygen/monitorserver/monitorserver.h: Modified: trunk/spark/NEWS =================================================================== --- trunk/spark/NEWS 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/NEWS 2010-06-06 22:44:51 UTC (rev 212) @@ -1,3 +1,18 @@ +[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 +support and some new features such as the potential of using different +physical simulation engines. + +* 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 + [0.2] In this release you can find some bug and compilation fixes, improved Windows support and some new features including a new sensor and features to facilitate Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/RELEASE 2010-06-06 22:44:51 UTC (rev 212) @@ -1,5 +1,6 @@ RELEASE News of simspark-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 support and some new features such as the potential of using different physical simulation engines. @@ -10,7 +11,8 @@ * Fixes: - Compilation fixes on newer compilers (VS 2010) - - Fixed some bugs on 64 bit systems and in multi-threaded mode + - 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 You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp 2010-06-06 22:44:51 UTC (rev 212) @@ -29,7 +29,8 @@ using namespace boost; using namespace std; -MonitorLogger::MonitorLogger() : SimControlNode(), mFullStateLogged(0) +MonitorLogger::MonitorLogger() : SimControlNode(), mFullStateLogged(0), + mFullStateLoggedTime(0) { } @@ -70,9 +71,12 @@ string info; boost::shared_ptr<Scene> scene = GetActiveScene(); - if (scene.get() != 0 - && scene->GetModifiedNum() > mFullStateLogged ) + // The logger might miss some information as it runs at a lower rate + if (mTime - mFullStateLoggedTime > 3.0 || + (scene.get() != 0 && scene->GetModifiedNum() > mFullStateLogged) + ) { + mFullStateLoggedTime = mTime; mFullStateLogged = scene->GetModifiedNum(); info = mMonitorServer->GetMonitorHeaderInfo(); } Modified: trunk/spark/lib/oxygen/simulationserver/monitorlogger.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/monitorlogger.h 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/lib/oxygen/simulationserver/monitorlogger.h 2010-06-06 22:44:51 UTC (rev 212) @@ -61,6 +61,9 @@ /** number of full state logged */ int mFullStateLogged; + + /** the time of the last full state logging */ + float mFullStateLoggedTime; }; DECLARE_CLASS(MonitorLogger); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-06 22:39:35
|
Revision: 211 http://simspark.svn.sourceforge.net/simspark/?rev=211&view=rev Author: hedayat Date: 2010-06-06 22:39:29 +0000 (Sun, 06 Jun 2010) Log Message: ----------- Code style cleanup Some more release notes Add NEWS section for the new release Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/NEWS trunk/rcssserver3d/RELEASE trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h trunk/rcssserver3d/rcssserver3d/rcsoccersim3d.in Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2010-06-06 08:55:20 UTC (rev 210) +++ trunk/rcssserver3d/ChangeLog 2010-06-06 22:39:29 UTC (rev 211) @@ -1,3 +1,22 @@ +2010-06-07 Hedayat Vatankhah <he...@gr...> + + * NEWS: + - prepared for 0.6.4 release + + * RELEASE: + - add some documentation about new monitor controls + + * plugin/soccer/gamestateaspect/gamestateitem.cpp: + - send game state with initial predicates, so that the logger will not + miss them in the next cycle + + * rcssserver3d/rcsoccersim3d.in: + - removed some extra lines checking for rcssagent3d + + * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp: + * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h: + - make the first letter of CheckVisuable() capital + 2010-06-05 Hedayat Vatankhah <he...@gr...> * RELEASE: Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2010-06-06 08:55:20 UTC (rev 210) +++ trunk/rcssserver3d/NEWS 2010-06-06 22:39:29 UTC (rev 211) @@ -1,3 +1,26 @@ +[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 +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. + +* 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 + +* Other changes: +- Improved referee to enforce more fair games +- Visual Studio 2010 compilation fixes +- Agents can sense field lines if enabled (currently disabled) + [0.6.3] In this release, we are preparing for a simulation with more robots than before. The current target is to have 6 vs 6 games, so we have made some changes to Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2010-06-06 08:55:20 UTC (rev 210) +++ trunk/rcssserver3d/RELEASE 2010-06-06 22:39:29 UTC (rev 211) @@ -7,10 +7,20 @@ release comes with some more facilities for a human referee to control the game and individual players in the field. -* Summary: +* 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 + +* Other changes: - Improved referee to enforce more fair games -- Improved monitor which provides more power to the human referee - Visual Studio 2010 compilation fixes +- Agents can sense field lines if enabled (currently disabled) You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp 2010-06-06 08:55:20 UTC (rev 210) +++ trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp 2010-06-06 22:39:29 UTC (rev 211) @@ -634,7 +634,7 @@ mSenseMyPos = sense; } -bool RestrictedVisionPerceptor::checkVisuable(RestrictedVisionPerceptor::ObjectData& od) const +bool RestrictedVisionPerceptor::CheckVisuable(RestrictedVisionPerceptor::ObjectData& od) const { // theta is the angle in horizontal plane, with fwAngle as 0 degree od.mTheta = gNormalizeDeg(gRadToDeg(gNormalizeRad( @@ -694,8 +694,8 @@ { LineData& ld = (*i); - bool seeBeginPoint = checkVisuable(ld.mBeginPoint); - bool seeEndPoint = checkVisuable(ld.mEndPoint); + bool seeBeginPoint = CheckVisuable(ld.mBeginPoint); + bool seeEndPoint = CheckVisuable(ld.mEndPoint); if (!(seeBeginPoint && seeEndPoint)) { @@ -747,11 +747,11 @@ if ( inum == 2 ) { ld.mBeginPoint.mRelPos = X[0]; - checkVisuable(ld.mBeginPoint); + CheckVisuable(ld.mBeginPoint); seeBeginPoint = true; ld.mEndPoint.mRelPos = X[1]; - checkVisuable(ld.mEndPoint); + CheckVisuable(ld.mEndPoint); seeEndPoint = true; } else if ( inum == 1 ) @@ -759,13 +759,13 @@ if ( !seeBeginPoint ) { ld.mBeginPoint.mRelPos = X[0]; - checkVisuable(ld.mBeginPoint); + CheckVisuable(ld.mBeginPoint); seeBeginPoint = true; } else { ld.mEndPoint.mRelPos = X[0]; - checkVisuable(ld.mEndPoint); + CheckVisuable(ld.mEndPoint); seeEndPoint = true; } } Modified: trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h 2010-06-06 08:55:20 UTC (rev 210) +++ trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h 2010-06-06 22:39:29 UTC (rev 211) @@ -180,7 +180,7 @@ void SetupLines(TLineList& visibleLines); - bool checkVisuable(ObjectData& od) const; + bool CheckVisuable(ObjectData& od) const; /** Checks if the given object is occluded, seen from from my_pos */ bool CheckOcclusion(const salt::Vector3f& my_pos, const ObjectData& od) const; Modified: trunk/rcssserver3d/rcssserver3d/rcsoccersim3d.in =================================================================== --- trunk/rcssserver3d/rcssserver3d/rcsoccersim3d.in 2010-06-06 08:55:20 UTC (rev 210) +++ trunk/rcssserver3d/rcssserver3d/rcsoccersim3d.in 2010-06-06 22:39:29 UTC (rev 211) @@ -31,13 +31,6 @@ exit 1 fi -AGT="$bindir/rcssagent3d" -if [ ! -f $AGT ]; then - echo "Error: $AGT does not exist!" - echo "" - exit 1 -fi - #-------------------------------------------------- # set handler # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-06 08:55:26
|
Revision: 210 http://simspark.svn.sourceforge.net/simspark/?rev=210&view=rev Author: hedayat Date: 2010-06-06 08:55:20 +0000 (Sun, 06 Jun 2010) Log Message: ----------- Make sure that game data (scores/team names) Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateitem.cpp Modified: trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateitem.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateitem.cpp 2010-06-05 22:24:55 UTC (rev 209) +++ trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateitem.cpp 2010-06-06 08:55:20 UTC (rev 210) @@ -97,6 +97,8 @@ pred.parameter.AddValue (SoccerBase::PlayMode2Str(static_cast<TPlayMode>(i))); } + + GetPredicates(pList); } void GameStateItem::GetPredicates(PredicateList& pList) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-05 22:25:01
|
Revision: 209 http://simspark.svn.sourceforge.net/simspark/?rev=209&view=rev Author: hedayat Date: 2010-06-05 22:24:55 +0000 (Sat, 05 Jun 2010) Log Message: ----------- (Hopefully) fixed the race condition when logging is enabled Removed an extra output line Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp trunk/spark/ChangeLog trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp trunk/spark/lib/oxygen/monitorserver/monitorserver.h Modified: trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-06-04 21:19:08 UTC (rev 208) +++ trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-06-05 22:24:55 UTC (rev 209) @@ -159,8 +159,6 @@ bool TrainerCommandParser::ParsePredicate(const oxygen::Predicate & predicate) { - cerr << "repos 1" << endl; - SoccerBase::GetGameState(*this,mGameState); SoccerBase::GetSoccerRuleAspect(*this,mSoccerRule); Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-06-04 21:19:08 UTC (rev 208) +++ trunk/spark/ChangeLog 2010-06-05 22:24:55 UTC (rev 209) @@ -1,3 +1,9 @@ +2010-06-06 Hedayat Vatankhah <he...@gr...> + + * lib/oxygen/monitorserver/monitorserver.h: + * lib/oxygen/monitorserver/monitorserver.cpp (MonitorServer::GetMonitorData): + - more protection against simultaneous access (by monitor(s) and the logger) + 2010-06-05 Hedayat Vatankhah <he...@gr...> * lib/oxygen/simulationserver/simulationserver.cpp (SimulationServer::Step): Modified: trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp =================================================================== --- trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2010-06-04 21:19:08 UTC (rev 208) +++ trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2010-06-05 22:24:55 UTC (rev 209) @@ -170,6 +170,7 @@ } PredicateList pList; + boost::mutex::scoped_lock dataLock(mMonitorMutex); CollectItemPredicates(true,pList); return monitorSystem->GetMonitorHeaderInfo(pList); } @@ -177,7 +178,7 @@ string MonitorServer::GetMonitorData() { int cycle = mSimulationServer->GetCycle(); - boost::mutex::scoped_lock dataLock(mDataMutex); + boost::mutex::scoped_lock dataLock(mMonitorMutex); if ( cycle == mDataCycle ){ return mData; @@ -203,7 +204,7 @@ if (monitorSystem.get() != 0) { + boost::mutex::scoped_lock dataLock(mMonitorMutex); monitorSystem->ParseMonitorMessage(data); } } - Modified: trunk/spark/lib/oxygen/monitorserver/monitorserver.h =================================================================== --- trunk/spark/lib/oxygen/monitorserver/monitorserver.h 2010-06-04 21:19:08 UTC (rev 208) +++ trunk/spark/lib/oxygen/monitorserver/monitorserver.h 2010-06-05 22:24:55 UTC (rev 209) @@ -92,8 +92,8 @@ /** the cycle of cacahed data */ int mDataCycle; - /** a mutex to protect mData and mDataCycle variables */ - boost::mutex mDataMutex; + /** a mutex to protect monitor related internal data */ + boost::mutex mMonitorMutex; }; DECLARE_CLASS(MonitorServer); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-04 21:19:14
|
Revision: 208 http://simspark.svn.sourceforge.net/simspark/?rev=208&view=rev Author: hedayat Date: 2010-06-04 21:19:08 +0000 (Fri, 04 Jun 2010) Log Message: ----------- Preparing for a new release Removing a delay in the simulation loop Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/RELEASE trunk/spark/CMakeLists.txt trunk/spark/ChangeLog trunk/spark/RELEASE trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2010-06-01 13:04:58 UTC (rev 207) +++ trunk/rcssserver3d/CMakeLists.txt 2010-06-04 21:19:08 UTC (rev 208) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.3") +set(PACKAGE_VERSION "0.6.4") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2010-06-01 13:04:58 UTC (rev 207) +++ trunk/rcssserver3d/ChangeLog 2010-06-04 21:19:08 UTC (rev 208) @@ -1,3 +1,9 @@ +2010-06-05 Hedayat Vatankhah <he...@gr...> + + * RELEASE: + * CMakeLists.txt: + - preparing for 0.6.4 release + 2010-05-23 Hedayat Vatankhah <he...@gr...> * rcssserver3d/naosoccersim.rb: Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2010-06-01 13:04:58 UTC (rev 207) +++ trunk/rcssserver3d/RELEASE 2010-06-04 21:19:08 UTC (rev 208) @@ -1,33 +1,16 @@ -RELEASE News of rcssserver3d-0.6.3 +RELEASE News of rcssserver3d-0.6.4 -In this release, we are preparing for a simulation with more robots than before. -The current target is to have 6 vs 6 games, so we have made some changes to -make the simulator more suitable for it. The most notable changes made in -rcssserver3d package in this direction are: -1. Disabling the internal monitor by default: starting from this version, the -simulation server (simspark binary, now called rcssserver3d) no longer brings -up a monitor when run. To actually view the simulation, a monitor (e.g. -rcsmonitor3d which is included in this package) should be run separately. This -separation noticeably improves the performance of the server. A new executable -called "rcsoccersim3d" is provided which runs both the simulation server and a -monitor on the local machine. -2. Bigger field: in this version, field dimensions and goal width are 1.5 times -larger than before to provide enough area for 6 vs 6 games. +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. -* New names: - - rcssserver3d: the old simspark binary has been renamed to rcssserver3d, as - it more clearly shows the functionality of the simulator. A symbolic link - called simspark is provided for compatibility. - - rcsoccersim3d: as stated above, running rcssserver3d (formerly simspark) - no longer starts a monitor to view the simulation, and a monitor should be - run separately. For users' convenience a new executable called rcsoccersim3d - is provided which runs both rcssserver3d and rcssmonitor3 to connect to - the running simulator. - -* Other notable changes: - - Added HMDP effector/perceptor - - Some compilation fixes - - Improved Windows support +* Summary: +- Improved referee to enforce more fair games +- Improved monitor which provides more power to the human referee +- Visual Studio 2010 compilation fixes You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/CMakeLists.txt =================================================================== --- trunk/spark/CMakeLists.txt 2010-06-01 13:04:58 UTC (rev 207) +++ trunk/spark/CMakeLists.txt 2010-06-04 21:19:08 UTC (rev 208) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(simspark CXX C) -set(PACKAGE_VERSION "0.2") +set(PACKAGE_VERSION "0.2.1") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) @@ -143,13 +143,13 @@ 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.0) -set(OXYGEN_SO_VERSION 3) -set(OXYGEN_VERSION ${OXYGEN_SO_VERSION}.3.0) +set(ZEITGEIST_VERSION ${ZEITGEIST_SO_VERSION}.1.1) +set(OXYGEN_SO_VERSION 4) +set(OXYGEN_VERSION ${OXYGEN_SO_VERSION}.0.0) set(KEROSIN_SO_VERSION 1) -set(KEROSIN_VERSION ${KEROSIN_SO_VERSION}.1.0) +set(KEROSIN_VERSION ${KEROSIN_SO_VERSION}.1.1) set(SPARK_SO_VERSION 0) -set(SPARK_VERSION ${SPARK_SO_VERSION}.0.0) +set(SPARK_VERSION ${SPARK_SO_VERSION}.0.1) set(RCSSNET_SO_VERSION 0) set(RCSSNET_VERSION ${RCSSNET_SO_VERSION}.1.0) Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-06-01 13:04:58 UTC (rev 207) +++ trunk/spark/ChangeLog 2010-06-04 21:19:08 UTC (rev 208) @@ -1,3 +1,15 @@ +2010-06-05 Hedayat Vatankhah <he...@gr...> + + * lib/oxygen/simulationserver/simulationserver.cpp (SimulationServer::Step): + - disabling the usleep call to retain full compatibility with the previous + versions + + * RELEASE: + - release notes for the next version (0.2.1) + + * CMakeLists.txt: + - bumped library versions and package version for the next release + 2010-05-09 Hedayat Vatankhah <he...@gr...> * lib/zeitgeist/scriptserver/scriptserver.cpp (thisCall): Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2010-06-01 13:04:58 UTC (rev 207) +++ trunk/spark/RELEASE 2010-06-04 21:19:08 UTC (rev 208) @@ -1,49 +1,16 @@ -RELEASE News of simspark-0.2 +RELEASE News of simspark-0.2.1 In this release you can find some bug and compilation fixes, improved Windows -support and some new features including a new sensor and features to facilitate -agent debugging and development. It also provides a more deterministic behavior -for agents which should make them more reliable. +support and some new features such as the potential of using different +physical simulation engines. * New features: - - An Accelerometer sensor which reports the linear acceleration - - A "Sync Mode" operation is introduced. In this mode, the server will not - advance to the next cycle until all connected agents send a "(syn)" command - to the server. You can use this mode by setting "agentSyncMode" to true in - simspark.rb (or spark.rb) - - Simulator will run in simulation time mode instead of real time - if "useRealTime" variable is set to false in simspark.rb (or spark.rb) + - The core physics system does no longer depend on ODE (Thanks to Andreas). + ODE implementation is now provided as a plugin. -* More deterministic agent-server communication - - Simspark will now collect received commands right before sending - sense data of the last cycle. So, any commands which is sent by agents - after receiving new sense data will be executed in the next cycle, not the - current one. This results in a more deterministic behavior, and agents' - efficiency should not change between remote and local runs considerably. - - An Accelerometer sensor - - Fixed some rendering bugs (agents not visible through goals) - - A "Sync Mode" operation is introduced. In this mode, the server will not - advance to the next cycle untill all connected agents send a "(syn)" command - to the server. You can use this mode by setting "agentSyncMode" to true in - simspark.rb (or spark.rb) - - Simulator will run in simulation time mode instead of real time - if "useRealTime" variable is set to false in simspark.rb (or spark.rb) - - To make changes to most of the resource files (e.g. simspark.rb), you can - create a copy in ~/.simspark directory and make desired changes there. The - directory structure of the original files should be preserved (e.g. - rsg/agent/nao/nao.rgs) - -* More convenience: - - Simspark should always accept connections. No more "Connection refused" - messages and the need to wait for simspark's network port to be freed! - - To make changes to most of the resource files (e.g. simspark.rb), you can - create a copy in ~/.simspark directory and make desired changes there. The - directory structure of the original files should be preserved (e.g. - rsg/agent/nao/nao.rgs) - * Fixes: - - Compilation fixes - - Fixed some rendering bugs (agents not visible through goals) + - Compilation fixes on newer compilers (VS 2010) + - Fixed some bugs on 64 bit systems and in multi-threaded mode You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2010-06-01 13:04:58 UTC (rev 207) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2010-06-04 21:19:08 UTC (rev 208) @@ -237,7 +237,7 @@ mSimTime += mSumDeltaTime; mSumDeltaTime = 0; } - usleep(10000); +// usleep(10000); } void SimulationServer::ControlEvent(EControlEvent event) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-06-01 13:05:11
|
Revision: 207 http://simspark.svn.sourceforge.net/simspark/?rev=207&view=rev Author: sgvandijk Date: 2010-06-01 13:04:58 +0000 (Tue, 01 Jun 2010) Log Message: ----------- - Merge agentselection branch -r206 into trunk Modified Paths: -------------- trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg trunk/rcssserver3d/data/scripts/rcs-materials-textures.rb trunk/rcssserver3d/data/scripts/rcs-materials.rb trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h trunk/rcssserver3d/plugin/soccermonitor/soccerrender.cpp trunk/rcssserver3d/plugin/soccermonitor/soccerrender.h trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb trunk/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb trunk/spark/data/scripts/materials.rb trunk/spark/lib/kerosin/inputserver/input.h trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp trunk/spark/lib/kerosin/inputserver/inputserver.cpp trunk/spark/lib/kerosin/renderserver/rendernode.cpp trunk/spark/lib/kerosin/renderserver/rendernode.h trunk/spark/lib/kerosin/renderserver/rendernode_c.cpp trunk/spark/lib/kerosin/renderserver/renderserver.cpp trunk/spark/lib/kerosin/sceneserver/singlematnode_c.cpp trunk/spark/lib/kerosin/sceneserver/staticmesh_c.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp trunk/spark/plugin/inputsdl/keyboardsdl.cpp trunk/spark/plugin/inputsdl/mousesdl.cpp trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/treehole:175 + /branches/agentselection:195-206 /branches/treehole:175 Modified: trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-06-01 13:04:58 UTC (rev 207) @@ -68,6 +68,15 @@ (setName AgentState) (nd GameStatePerceptor) (nd HearPerceptor) + (nd Transform + (nd Cylinder + (setName SelectionMarker) + (setParams 1.0 1.0) + (setScale 0.2 0.2 0.02) + (setMaterial matSelect) + (setTransparent) + ) + ) ) (nd GyroRatePerceptor (setName torso)) Modified: trunk/rcssserver3d/data/scripts/rcs-materials-textures.rb =================================================================== --- trunk/rcssserver3d/data/scripts/rcs-materials-textures.rb 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/data/scripts/rcs-materials-textures.rb 2010-06-01 13:04:58 UTC (rev 207) @@ -19,7 +19,6 @@ material.setDiffuse(1.0,0.64,0.4,1.0) material.setAmbient(0.2,0.01,0.0,1.0) - # grass # without lines Modified: trunk/rcssserver3d/data/scripts/rcs-materials.rb =================================================================== --- trunk/rcssserver3d/data/scripts/rcs-materials.rb 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/data/scripts/rcs-materials.rb 2010-06-01 13:04:58 UTC (rev 207) @@ -22,7 +22,6 @@ material.setDiffuse(0.1,0.6,0.1,1.0) material.setAmbient(0.1,0.3,0.1,1.0) - #---------------------------------------------------------------- # left team #---------------------------------------------------------------- Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -23,9 +23,11 @@ #include <soccertypes.h> #include <soccerbase/soccerbase.h> #include <gamestateaspect/gamestateaspect.h> +#include <kerosin/renderserver/rendernode.h> #include <sstream> using namespace oxygen; +using namespace kerosin; using namespace std; AgentState::AgentState() : ObjectState(), mTeamIndex(TI_NONE), @@ -33,7 +35,8 @@ mHearMax(2), mHearInc(1), mHearDecay(2), mHearMateCap(2), mHearOppCap(2), mIfSelfMsg(false), - mIfMateMsg(false), mIfOppMsg(false) + mIfMateMsg(false), mIfOppMsg(false), + mSelected(false) { // set mID and mUniformNumber into a joint state SetUniformNumber(0); @@ -211,6 +214,18 @@ } void +AgentState::UpdateHierarchyInternal() +{ + boost::shared_ptr<RenderNode> node = boost::shared_dynamic_cast<RenderNode>(GetChild("SelectionMarker", true)); + if (!node) + { + GetLog()->Error() << "ERROR: (AgentState::UpdateHierarchyInternal) could not find selection marker\n"; + return; + } + node->SetVisible(mSelected); +} + +void AgentState::OnUnlink() { ObjectState::OnUnlink(); @@ -226,3 +241,20 @@ game_state->ReturnUniform(GetTeamIndex(), GetUniformNumber()); } +bool +AgentState::IsSelected() const +{ + return mSelected; +} + +void +AgentState::Select(bool s) +{ + mSelected = s; +} + +void +AgentState::UnSelect() +{ + mSelected = false; +} Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2010-06-01 13:04:58 UTC (rev 207) @@ -91,6 +91,10 @@ bool GetMessage(std::string& msg, float& direction, bool teamMate); bool GetSelfMessage(std::string& msg); + bool IsSelected() const; + void Select(bool s = true); + void UnSelect(); + protected: /** team index */ TTeamIndex mTeamIndex; @@ -134,7 +138,9 @@ /** is there any message from oponnent */ bool mIfOppMsg; + bool mSelected; protected: + virtual void UpdateHierarchyInternal(); virtual void OnUnlink(); }; Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -486,6 +486,48 @@ } void +SoccerRuleAspect::ClearSelectedPlayers() +{ + float min_dist = mFreeKickMoveDist; + std::list<boost::shared_ptr<AgentState> > 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; + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { + SoccerBase::GetTransformParent(**i, agent_aspect); + + // if agent is selected, move it away + Vector3f new_pos = agent_aspect->GetWorldTransform().Pos(); + + if ((*i)->IsSelected()) + { + float dist = salt::UniformRNG<>(min_dist, min_dist + 2.0)(); + + if ((*i)->GetTeamIndex() == TI_LEFT) + { + if (new_pos[0] - dist < -mFieldLength/2.0) + { + new_pos[1] = new_pos[1] < 0 ? new_pos[1] + dist : new_pos[1] - dist; + } else { + new_pos[0] = new_pos[0] - dist; + } + } else { + if (new_pos[0] + dist > mFieldLength/2.0) + { + new_pos[1] = new_pos[1] < 0 ? new_pos[1] + dist : new_pos[1] - dist; + } else { + new_pos[0] = new_pos[0] + dist; + } + } + SoccerBase::MoveAgent(agent_aspect, new_pos); + } + } +} + +void SoccerRuleAspect::DropBall() { DropBall(mBallBody->GetPosition()); @@ -1638,7 +1680,51 @@ } } -Vector2f SoccerRuleAspect::GetFieldSize() const +Vector2f +SoccerRuleAspect::GetFieldSize() const { return Vector2f(mFieldLength,mFieldWidth); } + +void +SoccerRuleAspect::ResetAgentSelection() +{ + std::list<boost::shared_ptr<AgentState> > agent_states; + if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE)) + { + + std::list<boost::shared_ptr<AgentState> >::const_iterator i; + for (i = agent_states.begin(); i != agent_states.end(); ++i) + (*i)->UnSelect(); + } +} + +void +SoccerRuleAspect::SelectNextAgent() +{ + std::list<boost::shared_ptr<AgentState> > 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; + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { + if ((*i)->IsSelected()) + { + (*i)->UnSelect(); + selectNext = true; + continue; + } + else if (selectNext) + { + (*i)->Select(); + return; + } + } + + // No agent selected, select first + first->Select(); + } +} Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-06-01 13:04:58 UTC (rev 207) @@ -45,7 +45,7 @@ { public: typedef std::list<boost::shared_ptr<AgentState> > TAgentStateList; - + public: SoccerRuleAspect(); virtual ~SoccerRuleAspect(); @@ -139,6 +139,12 @@ salt::Vector2f GetFieldSize() const; + void ResetAgentSelection(); + + void SelectNextAgent(); + + void ClearSelectedPlayers(); + protected: /** rereads the current soccer script values */ virtual void UpdateCachedInternal(); @@ -233,7 +239,7 @@ * @param idx the team which kick off */ void ClearPlayersBeforeKickOff(TTeamIndex idx); - + protected: /** reference to the body node of the Ball */ boost::shared_ptr<oxygen::RigidBody> mBallBody; Modified: trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -29,10 +29,12 @@ #include <agentstate/agentstate.h> #include <soccertypes.h> #include <gamestateaspect/gamestateaspect.h> +#include <oxygen/agentaspect/agentaspect.h> #include "trainercommandparser.h" using namespace std; using namespace boost; +using namespace salt; using namespace zeitgeist; using namespace oxygen; @@ -45,7 +47,10 @@ mCommandMap["dropBall"] = CT_DROP_BALL; mCommandMap["kickOff"] = CT_KICK_OFF; mCommandMap["getAck"] = CT_ACK; - + mCommandMap["select"] = CT_SELECT; + mCommandMap["kill"] = CT_KILL; + mCommandMap["repos"] = CT_REPOS; + // setup team index map // Originally team sides were "L","R" and "N" // But this seems to be unused @@ -106,6 +111,15 @@ GetLog()->Error() << "ERROR: (TrainerCommnadParser) failed to create SexpParser\n"; return; } + + mGameControl = shared_dynamic_cast<GameControlServer> + (GetCore()->Get("/sys/server/gamecontrol")); + + if (mGameControl.get() == 0) + { + GetLog()->Error() << "ERROR: (TrainerCommandParser) Unable to get GameControlServer\n"; + } + } void TrainerCommandParser::OnUnlink() @@ -145,6 +159,8 @@ bool TrainerCommandParser::ParsePredicate(const oxygen::Predicate & predicate) { + cerr << "repos 1" << endl; + SoccerBase::GetGameState(*this,mGameState); SoccerBase::GetSoccerRuleAspect(*this,mSoccerRule); @@ -189,6 +205,15 @@ break; } + case CT_SELECT: + ParseSelectCommand(predicate); + break; + case CT_KILL: + ParseKillCommand(predicate); + break; + case CT_REPOS: + ParseReposCommand(predicate); + break; default: return false; } @@ -200,17 +225,17 @@ { Predicate::Iterator unumParam(predicate); int unum; + bool specified = true; // extract unum if (predicate.FindParameter(unumParam, "unum")) { if (! predicate.GetValue(unumParam, unum)) - { - GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get unum\n"; - return; - } + specified = false; } - + else + specified = false; + string team; TTeamIndex idx; Predicate::Iterator teamParam(predicate); @@ -219,26 +244,29 @@ if (predicate.FindParameter(teamParam, "team")) { if (! predicate.GetValue(teamParam, team)) - { - GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get team name\n"; - return; - } - - idx = mTeamIndexMap[team]; + specified = false; + else + idx = mTeamIndexMap[team]; } + else + specified = false; + if (!specified) + { + mSoccerRule->ClearSelectedPlayers(); + return; + } SoccerBase::TAgentStateList agentStates; - SoccerBase::GetAgentStates(*this, agentStates, idx); + SoccerBase::GetAgentStates(*this, agentStates, (specified ? idx : TI_NONE)); SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); bool found = false; while (iter != agentStates.end() && !found) { - if ((*iter)->GetUniformNumber() == unum) - { - found = true; - } + if ((specified && (*iter)->GetUniformNumber() == unum && (*iter)->GetTeamIndex() == idx) || + (!specified && (*iter)->IsSelected())) + found = true; else ++iter; } @@ -250,7 +278,6 @@ } Predicate::Iterator posParam(predicate); - if (predicate.FindParameter(posParam, "pos")) { salt::Vector3f pos; @@ -477,3 +504,200 @@ } } +void TrainerCommandParser::ParseSelectCommand(const oxygen::Predicate & predicate) +{ + Predicate::Iterator unumParam(predicate); + int unum; + bool specified = true; + + shared_ptr<SoccerRuleAspect> soccerRuleAspect; + if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) + { + GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n"; + return; + } + + // extract unum + if (predicate.FindParameter(unumParam, "unum")) + { + if (! predicate.GetValue(unumParam, unum)) + specified = false; + } + else + specified = false; + + if (specified && unum == -1) + { + soccerRuleAspect->ResetAgentSelection(); + return; + } + + string team; + TTeamIndex idx; + Predicate::Iterator teamParam(predicate); + + // extract side + if (predicate.FindParameter(teamParam, "team")) + { + if (! predicate.GetValue(teamParam, team)) + specified = false; + else + idx = mTeamIndexMap[team]; + } + else + specified = false; + + if (!specified) + { + soccerRuleAspect->SelectNextAgent(); + return; + } + + SoccerBase::TAgentStateList agentStates; + SoccerBase::GetAgentStates(*this, agentStates, idx); + SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); + bool found = false; + + while (iter != agentStates.end() && !found) + { + if ((*iter)->GetUniformNumber() == unum) + { + found = true; + } + else + ++iter; + } + + if (!found) + { + GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get correct AgentState\n"; + return; + } + + soccerRuleAspect->ResetAgentSelection(); + (*iter)->Select(); +} + +void TrainerCommandParser::ParseKillCommand(const oxygen::Predicate & predicate) +{ + Predicate::Iterator unumParam(predicate); + int unum; + bool specified = true; + + shared_ptr<SoccerRuleAspect> soccerRuleAspect; + if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) + { + GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n"; + return; + } + + // extract unum + if (predicate.FindParameter(unumParam, "unum")) + { + if (! predicate.GetValue(unumParam, unum)) + specified = false; + } + else + specified = false; + + string team; + TTeamIndex idx; + Predicate::Iterator teamParam(predicate); + + // extract side + if (predicate.FindParameter(teamParam, "team")) + { + if (! predicate.GetValue(teamParam, team)) + specified = false; + else + idx = mTeamIndexMap[team]; + } + else + specified = false; + + GameControlServer::TAgentAspectList agentAspects; + mGameControl->GetAgentAspectList(agentAspects); + GameControlServer::TAgentAspectList::iterator aaiter; + for ( + aaiter = agentAspects.begin(); + aaiter != agentAspects.end(); + ++aaiter + ) + { + // search for the first agent of the left/right side + boost::shared_ptr<AgentState> agentState = + shared_dynamic_cast<AgentState>((*aaiter)->GetChild("AgentState", true)); + + if ((specified && agentState->GetUniformNumber() == unum && agentState->GetTeamIndex() == idx) || + (!specified && agentState->IsSelected())) + { + mGameControl->pushDisappearedAgent((*aaiter)->ID()); + break; + } + } +} + +void TrainerCommandParser::ParseReposCommand(const oxygen::Predicate & predicate) +{ + cerr << "repos 2" << endl; + + Predicate::Iterator unumParam(predicate); + int unum; + bool specified = true; + + shared_ptr<SoccerRuleAspect> soccerRuleAspect; + if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) + { + GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n"; + return; + } + + // extract unum + if (predicate.FindParameter(unumParam, "unum")) + { + if (! predicate.GetValue(unumParam, unum)) + specified = false; + } + else + specified = false; + + string team; + TTeamIndex idx; + Predicate::Iterator teamParam(predicate); + + // extract side + if (predicate.FindParameter(teamParam, "team")) + { + if (! predicate.GetValue(teamParam, team)) + specified = false; + else + idx = mTeamIndexMap[team]; + } + else + specified = false; + + SoccerBase::TAgentStateList agentStates; + SoccerBase::GetAgentStates(*this, agentStates, TI_NONE); + SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); + boost::shared_ptr<oxygen::Transform> agent_aspect; + for (;iter != agentStates.end(); ++iter) + { + if ((specified && (*iter)->GetUniformNumber() == unum && (*iter)->GetTeamIndex() == idx) || + (!specified && (*iter)->IsSelected())) + { + Vector3f ballPos(0,0,0); + boost::shared_ptr<RigidBody> ballBody; + + if (SoccerBase::GetBallBody(*this, ballBody)) + ballPos = ballBody->GetPosition(); + + SoccerBase::GetTransformParent(**iter, agent_aspect); + cerr << "repos 3" << endl; + Vector3f new_pos = mSoccerRule->RepositionOutsidePos(ballPos, (*iter)->GetUniformNumber(), (*iter)->GetTeamIndex()); + SoccerBase::MoveAgent(agent_aspect, new_pos); + + break; + } + } +} + Modified: trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-06-01 13:04:58 UTC (rev 207) @@ -33,6 +33,11 @@ #include <soccertypes.h> #include <soccerruleaspect/soccerruleaspect.h> +namespace oxygen +{ + class GameControlServer; +} + class TrainerCommandParser : public oxygen::MonitorCmdParser { public: @@ -44,7 +49,10 @@ CT_PLAYMODE, CT_DROP_BALL, CT_KICK_OFF, - CT_ACK + CT_ACK, + CT_SELECT, + CT_KILL, + CT_REPOS }; typedef std::map<std::string, ECommandType> TCommandMap; @@ -100,7 +108,21 @@ predicate */ void ParseKickOffCommand(const oxygen::Predicate & predicate); + + /** parses and executes the select command contained in the given + predicate + */ + void ParseSelectCommand(const oxygen::Predicate & predicate); + /** parses and executes the kill command contained in the given + predicate + */ + void ParseKillCommand(const oxygen::Predicate & predicate); + + /** parses and executes the reposition command contained in the given + predicate + */ + void ParseReposCommand(const oxygen::Predicate & predicate); protected: TCommandMap mCommandMap; @@ -114,6 +136,8 @@ boost::shared_ptr<SoccerRuleAspect> mSoccerRule; //! the parser used to create the PredicateList boost::shared_ptr<oxygen::BaseParser> mSexpParser; + //! cached reference to the game control server + boost::shared_ptr<oxygen::GameControlServer> mGameControl; bool mGetAck; std::string mAckString; Modified: trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -28,9 +28,11 @@ using namespace zeitgeist; using namespace oxygen; using namespace kerosin; +using namespace std; SoccerInput::SoccerInput() - : InputItem() + : InputItem(), + mCmdMode(CmdModeDefault) { } @@ -55,9 +57,25 @@ scriptServer->CreateVariable("Command.CameraRightCorner", CmdCameraRightCorner); scriptServer->CreateVariable("Command.CameraRightGoal", CmdCameraRightGoal); //JAN - scriptServer->CreateVariable("Command.FreeKickLeft", CmdFreeKickLeft); - scriptServer->CreateVariable("Command.FreeKickRight", CmdFreeKickRight); - + scriptServer->CreateVariable("Command.One", CmdOne); + scriptServer->CreateVariable("Command.Two", CmdTwo); + scriptServer->CreateVariable("Command.Three", CmdThree); + scriptServer->CreateVariable("Command.Four", CmdFour); + scriptServer->CreateVariable("Command.Five", CmdFive); + scriptServer->CreateVariable("Command.Six", CmdSix); + scriptServer->CreateVariable("Command.Seven", CmdSeven); + scriptServer->CreateVariable("Command.Eight", CmdEight); + scriptServer->CreateVariable("Command.Nine", CmdNine); + scriptServer->CreateVariable("Command.Zero", CmdZero); + scriptServer->CreateVariable("Command.Left", CmdLeft); + scriptServer->CreateVariable("Command.Right", CmdRight); + + scriptServer->CreateVariable("Command.PlayerSelectMode", CmdPlayerSelectMode); + scriptServer->CreateVariable("Command.SelectNextAgent", CmdSelectNextAgent); + scriptServer->CreateVariable("Command.ResetSelection", CmdResetSelection); + scriptServer->CreateVariable("Command.KillSelection", CmdKillSelection); + scriptServer->CreateVariable("Command.ReposSelection", CmdReposSelection); + mMonitorClient = shared_dynamic_cast<NetClient> (GetCore()->Get("/sys/server/simulation/SparkMonitorClient")); @@ -107,143 +125,213 @@ void SoccerInput::ProcessInput(const Input& input) { - // get list of registered SoccerMonitor objects - TLeafList soccerMonitorList; - mMonitorClient->ListChildrenSupportingClass<SoccerMonitor>(soccerMonitorList); - - if (soccerMonitorList.empty()) - { - GetLog()->Error() - << "ERROR: (SoccerInput) Unable to get SoccerMonitor\n"; - return; - } - - boost::shared_ptr<SoccerMonitor> soccerMonitor = - shared_static_cast<SoccerMonitor>(soccerMonitorList.front()); - switch (input.mId) { default: return; - case CmdKickOff: + case CmdPlayerSelectMode: if (input.GetKeyPress()) - { - SendCommand("(kickOff Left)"); - } + { + mCmdMode = CmdModePlayerSelect; + } break; - case CmdKickOffRight: + + case CmdSelectNextAgent: if (input.GetKeyPress()) { - SendCommand("(kickOff Right)"); + SendCommand("(select)"); } break; - - case CmdMoveAgent: + + case CmdResetSelection: if (input.GetKeyPress()) { - //SendCommand("(agent (team Left)(unum 1)(pos -2.0 1.0 3.5))"); + SendCommand("(select (unum -1))"); } break; - case CmdDropBall: + + case CmdKillSelection: if (input.GetKeyPress()) { - SendCommand("(dropBall)"); + SendCommand("(kill)"); } break; - case CmdShootBall: + + case CmdReposSelection: if (input.GetKeyPress()) { - //SendCommand("(ball (vel -4.0 0.0 2.0))"); + SendCommand("(repos)"); } break; - case CmdMoveBall: + + case CmdKickOff: if (input.GetKeyPress()) { - //SendCommand("(ball (pos -42.0 0.0 0.3))"); + SendCommand("(kickOff Left)"); } break; - case CmdCameraLeftGoal: + case CmdKickOffRight: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(-fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(90); - mFPS->SetVAngleDeg(35); + SendCommand("(kickOff Right)"); } break; - case CmdCameraLeftCorner: + + case CmdMoveAgent: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(-fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(50); - mFPS->SetVAngleDeg(30); + SendCommand("(agent)"); } break; - case CmdCameraMiddleLeft: + case CmdDropBall: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(salt::gRadToDeg(-0.625)); - mFPS->SetVAngleDeg(40); + SendCommand("(dropBall)"); } break; - case CmdCameraMiddleRight: + case CmdShootBall: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(salt::gRadToDeg(0.625)); - mFPS->SetVAngleDeg(40); + //SendCommand("(ball (vel -4.0 0.0 2.0))"); } break; - case CmdCameraMiddle: + case CmdMoveBall: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(0, -fieldSize.y()*1.1, fieldSize.x()*0.6); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(0); - mFPS->SetVAngleDeg(45); + //SendCommand("(ball (pos -42.0 0.0 0.3))"); } break; - case CmdCameraRightCorner: + + case CmdOne: + case CmdTwo: + case CmdThree: + case CmdFour: + case CmdFive: + case CmdSix: + case CmdSeven: + case CmdEight: + case CmdNine: + case CmdZero: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(-50); - mFPS->SetVAngleDeg(30); + if (mCmdMode == CmdModeDefault) + SelectCamera(input.mId - CmdOne); + else + { + ostringstream u_ss; + u_ss << "(select (unum " << (input.mId - CmdOne + 1) << ") "; + if (mCmdMode == CmdModeLeftPlayerSelect) + { + u_ss << "(team Left))"; + SendCommand(u_ss.str()); + mCmdMode = CmdModeDefault; + } + else if (mCmdMode == CmdModeRightPlayerSelect) + { + u_ss << "(team Right))"; + SendCommand(u_ss.str()); + mCmdMode = CmdModeDefault; + } + } } break; - case CmdCameraRightGoal: + case CmdLeft: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(-90); - mFPS->SetVAngleDeg(35); + if (mCmdMode == CmdModeDefault) + SendCommand("(playMode free_kick_left)"); + else if (mCmdMode == CmdModePlayerSelect || mCmdMode == CmdModeRightPlayerSelect) + mCmdMode = CmdModeLeftPlayerSelect; } break; - case CmdFreeKickLeft: + case CmdRight: if (input.GetKeyPress()) { - SendCommand("(playMode free_kick_left)"); + if (mCmdMode == CmdModeDefault) + SendCommand("(playMode free_kick_right)"); + else if (mCmdMode == CmdModePlayerSelect || mCmdMode == CmdModeLeftPlayerSelect) + mCmdMode = CmdModeRightPlayerSelect; } break; - case CmdFreeKickRight: - if (input.GetKeyPress()) - { - SendCommand("(playMode free_kick_right)"); - } - break; }; } + +void SoccerInput::SelectCamera(int idx) +{ + // get list of registered SoccerMonitor objects + TLeafList soccerMonitorList; + mMonitorClient->ListChildrenSupportingClass<SoccerMonitor>(soccerMonitorList); + + if (soccerMonitorList.empty()) + { + GetLog()->Error() + << "ERROR: (SoccerInput) Unable to get SoccerMonitor\n"; + return; + } + + boost::shared_ptr<SoccerMonitor> soccerMonitor = + shared_static_cast<SoccerMonitor>(soccerMonitorList.front()); + + salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); + + switch (idx) + { + case 0: + { + salt::Vector3f pos(-fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(90); + mFPS->SetVAngleDeg(35); + } + break; + case 1: + { + salt::Vector3f pos(-fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(50); + mFPS->SetVAngleDeg(30); + } + break; + case 2: + { + salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(salt::gRadToDeg(-0.625)); + mFPS->SetVAngleDeg(40); + } + break; + case 3: + { + salt::Vector3f pos(0, -fieldSize.y()*1.1, fieldSize.x()*0.6); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(0); + mFPS->SetVAngleDeg(45); + } + break; + case 4: + { + salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(salt::gRadToDeg(0.625)); + mFPS->SetVAngleDeg(40); + } + break; + case 5: + { + salt::Vector3f pos(fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(-50); + mFPS->SetVAngleDeg(30); + } + break; + case 6: + { + salt::Vector3f pos(fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(-90); + mFPS->SetVAngleDeg(35); + } + break; + } +} Modified: trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-06-01 13:04:58 UTC (rev 207) @@ -49,10 +49,37 @@ CmdCameraMiddle = CmdCameraMiddleRight + 1, CmdCameraRightCorner = CmdCameraMiddle + 1, CmdCameraRightGoal = CmdCameraRightCorner + 1, + + CmdOne = CmdCameraRightGoal + 1, + CmdTwo = CmdOne + 1, + CmdThree = CmdTwo + 1, + CmdFour = CmdThree + 1, + CmdFive = CmdFour + 1, + CmdSix = CmdFive + 1, + CmdSeven = CmdSix + 1, + CmdEight = CmdSeven + 1, + CmdNine = CmdEight + 1, + CmdZero = CmdNine + 1, + //JAN - CmdFreeKickLeft = CmdCameraRightGoal + 1, - CmdFreeKickRight = CmdFreeKickLeft + 1 + CmdLeft = CmdZero + 1, + CmdRight = CmdLeft + 1, + + CmdPlayerSelectMode = CmdRight + 1, + CmdSelectNextAgent = CmdPlayerSelectMode + 1, + CmdResetSelection = CmdSelectNextAgent + 1, + CmdKillSelection = CmdResetSelection + 1, + CmdReposSelection = CmdKillSelection + 1 }; + + enum ECmdMode + { + CmdModeDefault = 1, + CmdModePlayerSelect, + CmdModeLeftPlayerSelect, + CmdModeRightPlayerSelect, + CmdModeNone + }; public: SoccerInput(); @@ -71,9 +98,12 @@ /** reset SparkMonitorClient reference */ virtual void OnUnlink(); + ECmdMode GetCmdMode() const { return mCmdMode; } + protected: void SendCommand(const std::string& cmd); + void SelectCamera(int idx); protected: /** cached reference to the monitor client */ boost::shared_ptr<oxygen::NetClient> mMonitorClient; @@ -82,6 +112,8 @@ boost::shared_ptr<oxygen::RigidBody> mCameraBody; boost::shared_ptr<oxygen::FPSController> mFPS; + + ECmdMode mCmdMode; }; DECLARE_CLASS(SoccerInput); Modified: trunk/rcssserver3d/plugin/soccermonitor/soccerrender.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/soccerrender.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccermonitor/soccerrender.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -23,6 +23,7 @@ #include <sstream> #include "soccerrender.h" #include "soccermonitor.h" +#include "soccerinput.h" #include <zeitgeist/logserver/logserver.h> #include <kerosin/openglserver/openglserver.h> #include <kerosin/fontserver/fontserver.h> @@ -69,6 +70,13 @@ { GetLog()->Error() << "ERROR: (SoccerRender) Unable to get SoccerMonitor\n"; } + mInput = shared_static_cast<SoccerInput> + (GetCore()->Get("/sys/server/simulation/InputControl/SoccerInput")); + + if (mInput.get() == 0) + { + GetLog()->Error() << "ERROR: (SoccerRender) Unable to get SoccerInput\n"; + } } void SoccerRender::OnUnlink() @@ -90,7 +98,7 @@ return; } - stringstream ss_l, ss_c, ss_r; + stringstream ss_l, ss_c, ss_r, ss_m; ss_c.setf(ios_base::fixed,ios_base::floatfield); ss_c.precision(2); @@ -141,5 +149,8 @@ xPos = int((1024-(mFont->GetStringWidth(ss_c.str().c_str())))/2); mFont->DrawString(xPos, 0, ss_c.str().c_str()); + //ss_m << mInput->GetCmdMode(); + //mFont->DrawString(10, 30, ss_m.str().c_str()); + mFontServer->End(); } Modified: trunk/rcssserver3d/plugin/soccermonitor/soccerrender.h =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/soccerrender.h 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/plugin/soccermonitor/soccerrender.h 2010-06-01 13:04:58 UTC (rev 207) @@ -32,6 +32,7 @@ } class SoccerMonitor; +class SoccerInput; class SoccerRender : public kerosin::CustomRender { @@ -51,6 +52,7 @@ boost::shared_ptr<SoccerMonitor> mMonitor; boost::shared_ptr<kerosin::FontServer> mFontServer; boost::shared_ptr<kerosin::Font> mFont; + boost::shared_ptr<SoccerInput> mInput; }; DECLARE_CLASS(SoccerRender); Modified: trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-06-01 13:04:58 UTC (rev 207) @@ -28,16 +28,33 @@ inputServer.bindCommand('j', Command.KickOffRight); inputServer.bindCommand('b', Command.DropBall); inputServer.bindCommand('m', Command.MoveAgent); - inputServer.bindCommand('n', Command.ShootBall); - inputServer.bindCommand('x', Command.MoveBall); - inputServer.bindCommand('1', Command.CameraLeftGoal); - inputServer.bindCommand('2', Command.CameraLeftCorner); - inputServer.bindCommand('3', Command.CameraMiddleLeft); - inputServer.bindCommand('4', Command.CameraMiddle); - inputServer.bindCommand('5', Command.CameraMiddleRight); - inputServer.bindCommand('6', Command.CameraRightCorner); - inputServer.bindCommand('7', Command.CameraRightGoal); - inputServer.bindCommand('l', Command.FreeKickLeft); - inputServer.bindCommand('r', Command.FreeKickRight); + #inputServer.bindCommand('n', Command.ShootBall); + #inputServer.bindCommand('x', Command.MoveBall); + + #inputServer.bindCommand('1', Command.CameraLeftGoal); + #inputServer.bindCommand('2', Command.CameraLeftCorner); + #inputServer.bindCommand('3', Command.CameraMiddleLeft); + #inputServer.bindCommand('4', Command.CameraMiddle); + #inputServer.bindCommand('5', Command.CameraMiddleRight); + #inputServer.bindCommand('6', Command.CameraRightCorner); + #inputServer.bindCommand('7', Command.CameraRightGoal); + inputServer.bindCommand('1', Command.One); + inputServer.bindCommand('2', Command.Two); + inputServer.bindCommand('3', Command.Three); + inputServer.bindCommand('4', Command.Four); + inputServer.bindCommand('5', Command.Five); + inputServer.bindCommand('6', Command.Six); + inputServer.bindCommand('7', Command.Seven); + inputServer.bindCommand('8', Command.Eight); + inputServer.bindCommand('9', Command.Nine); + inputServer.bindCommand('0', Command.Zero); + + inputServer.bindCommand('l', Command.Left); + inputServer.bindCommand('r', Command.Right); + inputServer.bindCommand('lctrl s', Command.PlayerSelectMode); + inputServer.bindCommand('n', Command.SelectNextAgent); + inputServer.bindCommand('e', Command.ResetSelection); + inputServer.bindCommand('x', Command.KillSelection); + inputServer.bindCommand('p', Command.ReposSelection); end end Modified: trunk/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb =================================================================== --- trunk/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb 2010-06-01 13:04:58 UTC (rev 207) @@ -13,10 +13,6 @@ # state sparkRegisterCustomMonitor 'SoccerMonitor' -# register the soccer render plugin to draw the game state on the -# screen -sparkRegisterCustomRender 'SoccerRender' - if ($logPlayerMode == true) # register the soccer input logplayer plugin for playback # specific keys @@ -29,3 +25,7 @@ # bind keys to soccer commands run "soccerbindings.rb" +# register the soccer render plugin to draw the game state on the +# screen +sparkRegisterCustomRender 'SoccerRender' + Modified: trunk/spark/data/scripts/materials.rb =================================================================== --- trunk/spark/data/scripts/materials.rb 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/data/scripts/materials.rb 2010-06-01 13:04:58 UTC (rev 207) @@ -14,6 +14,7 @@ material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matRed'); material.setDiffuse(1.0,0.0,0.0,1.0) +material.setAmbient(1.0,0.0,0.0,1.0) material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matRedGlow'); material.setDiffuse(1.0,0.0,0.0,1.0) @@ -33,6 +34,12 @@ material.setDiffuse(0.1,0.6,0.1,1.0) material.setAmbient(0.1,0.3,0.1,1.0) +# selection marker +material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matSelect'); +material.setDiffuse(1.0,0.0,0.0,0.5) +material.setAmbient(1.0,0.0,0.0,0.5) +material.setSpecular(1.0,0.2,0.2,0.5); + # shades of grey material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matWhite'); material.setDiffuse(1.0,1.0,1.0,1.0) Modified: trunk/spark/lib/kerosin/inputserver/input.h =================================================================== --- trunk/spark/lib/kerosin/inputserver/input.h 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/inputserver/input.h 2010-06-01 13:04:58 UTC (rev 207) @@ -101,6 +101,7 @@ float f; } mData; + unsigned int mModState; public: // numbers Modified: trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp =================================================================== --- trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -217,10 +217,10 @@ ListChildrenSupportingClass<InputItem>(items); for ( - TLeafList::iterator iter = items.begin(); - iter != items.end(); - ++iter - ) + TLeafList::iterator iter = items.begin(); + iter != items.end(); + ++iter + ) { shared_static_cast<InputItem>(*iter) ->ProcessInput(input); Modified: trunk/spark/lib/kerosin/inputserver/inputserver.cpp =================================================================== --- trunk/spark/lib/kerosin/inputserver/inputserver.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/inputserver/inputserver.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -288,6 +288,7 @@ // return Input::eUser input return true; } + // translate raw input to binding TBindMap::iterator bindListIter = mBindings.find(input.mCode); if (bindListIter == mBindings.end()) @@ -305,11 +306,13 @@ ++bindIter ) { + /* const Bind& bind = (*bindIter); //printf("Looking at: %d %d %d", (*bind).mCode, (*bind).cmd, (*bind).modifier); - if (bind.modifier == mModifierState) + if (bind.modifier == input.mModState) { + */ #if 0 if (input.mType == Input::eButton) { @@ -320,13 +323,13 @@ #else const Bind& bind = (*bindIter); - //printf("Looking at: %d %d %d", (*bind).mCode, (*bind).cmd, (*bind).modifier); if ( - (bind.modifier == 0 && mModifierState == 0) || - (bind.modifier & mModifierState) + (bind.modifier == 0 && input.mModState == 0) || + (bind.modifier & input.mModState) ) #endif { + input.mId = bind.cmd; return true; } @@ -335,7 +338,7 @@ input.mId = bind.cmd; return true; } - } + //} } input.mId = -1; @@ -404,6 +407,7 @@ { current = tokens.front(); tokens.pop_front(); + bind.modifier |= ParseModifier(current); } Modified: trunk/spark/lib/kerosin/renderserver/rendernode.cpp =================================================================== --- trunk/spark/lib/kerosin/renderserver/rendernode.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/renderserver/rendernode.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -24,10 +24,13 @@ #include "rendernode.h" using namespace kerosin; +using namespace std; RenderNode::RenderNode() : BaseNode(), - mTransparent(false) + mTransparent(false), + mVisible(true), + mVisibleToggled(true) { } @@ -37,5 +40,19 @@ void RenderNode::SetTransparent() { - mTransparent = true; + mTransparent = true; } + +void RenderNode::SetVisible(bool visible) +{ + if (!mVisibleToggled && mVisible != visible) + mVisibleToggled = true; + mVisible = visible; +} + +bool RenderNode::VisibleToggled() +{ + bool tmp = mVisibleToggled; + mVisibleToggled = false; + return tmp; +} Modified: trunk/spark/lib/kerosin/renderserver/rendernode.h =================================================================== --- trunk/spark/lib/kerosin/renderserver/rendernode.h 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/renderserver/rendernode.h 2010-06-01 13:04:58 UTC (rev 207) @@ -45,8 +45,15 @@ bool IsTransparent() { return mTransparent; } void SetTransparent(); + + void SetVisible(bool visible); + bool IsVisible() const { return mVisible; } + bool VisibleToggled(); + private: bool mTransparent; + bool mVisible; + bool mVisibleToggled; }; DECLARE_ABSTRACTCLASS(RenderNode); Modified: trunk/spark/lib/kerosin/renderserver/rendernode_c.cpp =================================================================== --- trunk/spark/lib/kerosin/renderserver/rendernode_c.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/renderserver/rendernode_c.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -29,8 +29,26 @@ return true; } +FUNCTION(RenderNode,setVisible) +{ + int visible; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in.begin(), visible)) + ) + { + return false; + } + + + obj->SetVisible(visible); + return true; +} + void CLASS(RenderNode)::DefineClass() { DEFINE_BASECLASS(oxygen/BaseNode); DEFINE_FUNCTION(setTransparent); + DEFINE_FUNCTION(setVisible); } Modified: trunk/spark/lib/kerosin/renderserver/renderserver.cpp =================================================================== --- trunk/spark/lib/kerosin/renderserver/renderserver.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/renderserver/renderserver.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -251,6 +251,10 @@ { boost::shared_ptr<RenderNode> renderNode = shared_dynamic_cast<RenderNode>(node); if (renderNode.get() != 0 && + !renderNode->IsVisible()) + return; + + if (renderNode.get() != 0 && ((pass == 0 && !renderNode->IsTransparent()) || (pass == 1 && renderNode->IsTransparent())) ) { Modified: trunk/spark/lib/kerosin/sceneserver/singlematnode_c.cpp =================================================================== --- trunk/spark/lib/kerosin/sceneserver/singlematnode_c.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/sceneserver/singlematnode_c.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -40,10 +40,28 @@ return obj->SetMaterial(inName); } +FUNCTION(SingleMatNode,setVisible) +{ + int visible; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in.begin(), visible)) + ) + { + return false; + } + + + obj->SetVisible(visible); + return true; +} + void CLASS(SingleMatNode)::DefineClass() { DEFINE_BASECLASS(kerosin/StaticMesh); DEFINE_FUNCTION(setMaterial); + DEFINE_FUNCTION(setVisible); } Modified: trunk/spark/lib/kerosin/sceneserver/staticmesh_c.cpp =================================================================== --- trunk/spark/lib/kerosin/sceneserver/staticmesh_c.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/kerosin/sceneserver/staticmesh_c.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -144,15 +144,9 @@ return true; } -FUNCTION(RenderNode,setTransparent) -{ - obj->SetTransparent(); - return true; -} - void CLASS(StaticMesh)::DefineClass() { - DEFINE_BASECLASS(oxygen/BaseNode); + DEFINE_BASECLASS(kerosin/RenderNode); DEFINE_FUNCTION(load); DEFINE_FUNCTION(setScale); DEFINE_FUNCTION(setCastShadows) @@ -160,5 +154,4 @@ DEFINE_FUNCTION(setExternalMeshName) DEFINE_FUNCTION(setExternalMeshScale) DEFINE_FUNCTION(resetMaterials) - DEFINE_FUNCTION(setTransparent); } Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -237,6 +237,7 @@ mSimTime += mSumDeltaTime; mSumDeltaTime = 0; } + usleep(10000); } void SimulationServer::ControlEvent(EControlEvent event) Modified: trunk/spark/plugin/inputsdl/keyboardsdl.cpp =================================================================== --- trunk/spark/plugin/inputsdl/keyboardsdl.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/plugin/inputsdl/keyboardsdl.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -24,6 +24,7 @@ #include <zeitgeist/logserver/logserver.h> using namespace kerosin; +using namespace std; KeyboardSDL::KeyboardSDL() : InputDeviceSDL() @@ -213,8 +214,7 @@ return 1; } - unsigned int& modState = - mInputSystem->GetInputServer()->GetModifierState(); + unsigned int modState; modState = Input::eNone; @@ -238,6 +238,16 @@ modState |= Input::eRAlt; } + if (event->key.keysym.mod & KMOD_LCTRL) + { + modState |= Input::eLCtrl; + } + + if (event->key.keysym.mod & KMOD_RCTRL) + { + modState |= Input::eRCtrl; + } + if (event->key.keysym.sym == 0) { return 1; @@ -254,6 +264,7 @@ Input input(Input::eButton, sym); input.mData.l = (event->type == SDL_KEYDOWN); + input.mModState = modState; mInputSystem->AddInputInternal(input); return 0; Modified: trunk/spark/plugin/inputsdl/mousesdl.cpp =================================================================== --- trunk/spark/plugin/inputsdl/mousesdl.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/plugin/inputsdl/mousesdl.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -69,6 +69,7 @@ } input.mData.l = (event->type == SDL_MOUSEBUTTONDOWN); + input.mModState = 0; mInputSystem->AddInputInternal(input); return 0; } Modified: trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp 2010-06-01 11:03:37 UTC (rev 206) +++ trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp 2010-06-01 13:04:58 UTC (rev 207) @@ -233,11 +233,6 @@ void SparkMonitor::DescribeMesh(stringstream& ss, boost::shared_ptr<StaticMesh> mesh) { - if (! mFullState) - { - return DescribeBaseNode(ss); - } - boost::shared_ptr<SingleMatNode> singleMat = shared_dynamic_cast<SingleMatNode>(mesh); @@ -249,6 +244,15 @@ 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)"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-06-01 11:03:43
|
Revision: 206 http://simspark.svn.sourceforge.net/simspark/?rev=206&view=rev Author: sgvandijk Date: 2010-06-01 11:03:37 +0000 (Tue, 01 Jun 2010) Log Message: ----------- - Monitor command to position agent out of field Modified Paths: -------------- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-06-01 10:07:38 UTC (rev 205) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-06-01 11:03:37 UTC (rev 206) @@ -34,6 +34,7 @@ using namespace std; using namespace boost; +using namespace salt; using namespace zeitgeist; using namespace oxygen; @@ -48,6 +49,7 @@ mCommandMap["getAck"] = CT_ACK; mCommandMap["select"] = CT_SELECT; mCommandMap["kill"] = CT_KILL; + mCommandMap["repos"] = CT_REPOS; // setup team index map // Originally team sides were "L","R" and "N" @@ -157,6 +159,8 @@ bool TrainerCommandParser::ParsePredicate(const oxygen::Predicate & predicate) { + cerr << "repos 1" << endl; + SoccerBase::GetGameState(*this,mGameState); SoccerBase::GetSoccerRuleAspect(*this,mSoccerRule); @@ -207,6 +211,9 @@ case CT_KILL: ParseKillCommand(predicate); break; + case CT_REPOS: + ParseReposCommand(predicate); + break; default: return false; } @@ -630,4 +637,67 @@ } } +void TrainerCommandParser::ParseReposCommand(const oxygen::Predicate & predicate) +{ + cerr << "repos 2" << endl; + + Predicate::Iterator unumParam(predicate); + int unum; + bool specified = true; + shared_ptr<SoccerRuleAspect> soccerRuleAspect; + if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) + { + GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n"; + return; + } + + // extract unum + if (predicate.FindParameter(unumParam, "unum")) + { + if (! predicate.GetValue(unumParam, unum)) + specified = false; + } + else + specified = false; + + string team; + TTeamIndex idx; + Predicate::Iterator teamParam(predicate); + + // extract side + if (predicate.FindParameter(teamParam, "team")) + { + if (! predicate.GetValue(teamParam, team)) + specified = false; + else + idx = mTeamIndexMap[team]; + } + else + specified = false; + + SoccerBase::TAgentStateList agentStates; + SoccerBase::GetAgentStates(*this, agentStates, TI_NONE); + SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); + boost::shared_ptr<oxygen::Transform> agent_aspect; + for (;iter != agentStates.end(); ++iter) + { + if ((specified && (*iter)->GetUniformNumber() == unum && (*iter)->GetTeamIndex() == idx) || + (!specified && (*iter)->IsSelected())) + { + Vector3f ballPos(0,0,0); + boost::shared_ptr<RigidBody> ballBody; + + if (SoccerBase::GetBallBody(*this, ballBody)) + ballPos = ballBody->GetPosition(); + + SoccerBase::GetTransformParent(**iter, agent_aspect); + cerr << "repos 3" << endl; + Vector3f new_pos = mSoccerRule->RepositionOutsidePos(ballPos, (*iter)->GetUniformNumber(), (*iter)->GetTeamIndex()); + SoccerBase::MoveAgent(agent_aspect, new_pos); + + break; + } + } +} + Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-06-01 10:07:38 UTC (rev 205) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-06-01 11:03:37 UTC (rev 206) @@ -51,7 +51,8 @@ CT_KICK_OFF, CT_ACK, CT_SELECT, - CT_KILL + CT_KILL, + CT_REPOS }; typedef std::map<std::string, ECommandType> TCommandMap; @@ -117,6 +118,11 @@ predicate */ void ParseKillCommand(const oxygen::Predicate & predicate); + + /** parses and executes the reposition command contained in the given + predicate + */ + void ParseReposCommand(const oxygen::Predicate & predicate); protected: TCommandMap mCommandMap; Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-06-01 10:07:38 UTC (rev 205) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-06-01 11:03:37 UTC (rev 206) @@ -74,6 +74,7 @@ scriptServer->CreateVariable("Command.SelectNextAgent", CmdSelectNextAgent); scriptServer->CreateVariable("Command.ResetSelection", CmdResetSelection); scriptServer->CreateVariable("Command.KillSelection", CmdKillSelection); + scriptServer->CreateVariable("Command.ReposSelection", CmdReposSelection); mMonitorClient = shared_dynamic_cast<NetClient> (GetCore()->Get("/sys/server/simulation/SparkMonitorClient")); @@ -157,6 +158,13 @@ } break; + case CmdReposSelection: + if (input.GetKeyPress()) + { + SendCommand("(repos)"); + } + break; + case CmdKickOff: if (input.GetKeyPress()) { Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-06-01 10:07:38 UTC (rev 205) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-06-01 11:03:37 UTC (rev 206) @@ -68,7 +68,8 @@ CmdPlayerSelectMode = CmdRight + 1, CmdSelectNextAgent = CmdPlayerSelectMode + 1, CmdResetSelection = CmdSelectNextAgent + 1, - CmdKillSelection = CmdResetSelection + 1 + CmdKillSelection = CmdResetSelection + 1, + CmdReposSelection = CmdKillSelection + 1 }; enum ECmdMode Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp 2010-06-01 10:07:38 UTC (rev 205) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp 2010-06-01 11:03:37 UTC (rev 206) @@ -149,8 +149,8 @@ xPos = int((1024-(mFont->GetStringWidth(ss_c.str().c_str())))/2); mFont->DrawString(xPos, 0, ss_c.str().c_str()); - ss_m << mInput->GetCmdMode(); - mFont->DrawString(10, 30, ss_m.str().c_str()); + //ss_m << mInput->GetCmdMode(); + //mFont->DrawString(10, 30, ss_m.str().c_str()); mFontServer->End(); } Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-06-01 10:07:38 UTC (rev 205) +++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-06-01 11:03:37 UTC (rev 206) @@ -55,5 +55,6 @@ inputServer.bindCommand('n', Command.SelectNextAgent); inputServer.bindCommand('e', Command.ResetSelection); inputServer.bindCommand('x', Command.KillSelection); + inputServer.bindCommand('p', Command.ReposSelection); end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-06-01 10:07:45
|
Revision: 205 http://simspark.svn.sourceforge.net/simspark/?rev=205&view=rev Author: sgvandijk Date: 2010-06-01 10:07:38 +0000 (Tue, 01 Jun 2010) Log Message: ----------- - Merge from trunk r204 Modified Paths: -------------- branches/agentselection/rcssserver3d/ChangeLog branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h branches/agentselection/rcssserver3d/rcssserver3d/naosoccersim.rb branches/agentselection/spark/ChangeLog branches/agentselection/spark/lib/oxygen/simulationserver/simulationserver.cpp branches/agentselection/spark/lib/zeitgeist/scriptserver/scriptserver.cpp branches/agentselection/spark/plugin/accelerometer/accelerometer.cpp branches/agentselection/spark/plugin/agentsynceffector/agentsynceffector.cpp branches/agentselection/spark/plugin/inputwx/CMakeLists.txt branches/agentselection/spark/plugin/openglsyswx/CMakeLists.txt Property Changed: ---------------- branches/agentselection/ Property changes on: branches/agentselection ___________________________________________________________________ Modified: svn:mergeinfo - /branches/treehole:175 + /branches/treehole:175 /trunk:195-204 Modified: branches/agentselection/rcssserver3d/ChangeLog =================================================================== --- branches/agentselection/rcssserver3d/ChangeLog 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/rcssserver3d/ChangeLog 2010-06-01 10:07:38 UTC (rev 205) @@ -1,3 +1,11 @@ +2010-05-23 Hedayat Vatankhah <he...@gr...> + + * rcssserver3d/naosoccersim.rb: + * plugin/soccer/soccerruleaspect/soccerruleaspect.h: + * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp: + - Added the simple referee patch from FCPortugal team (thanks to + Luis Paulo Reis) + 2010-02-28 Marian Buchta <mar...@gm...> * cmake/FindBoost.cmake: Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-06-01 10:07:38 UTC (rev 205) @@ -53,10 +53,19 @@ mFirstCollidingAgent(true), mNotOffside(false), mLastModeWasPlayOn(false), - mUseOffside(true) + mUseOffside(true), + mDropBallTime(15), + mNotStandingMaxTime(1000), // max time player may be sitted or laying down before being repositioned + mGoalieNotStandingMaxTime(1000), // max time goalie may be sitted or laying down before being repositioned + mGroundMaxTime(1000), // max time player may be on the ground before being repositioned + mGoalieGroundMaxTime(1000), // max time goalie (pl number 1) may be on the ground before being repositioned + mMaxPlayersInsideOwnArea(1000), // maximum number of players of the defending team that may be inside own penalty area + 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 + mMaxFaultTime(0.0) // maximum time allowed for a player to commit a positional fault before being repositioned { mFreeKickPos = Vector3f(0.0,0.0,mBallRadius); - } SoccerRuleAspect::~SoccerRuleAspect() @@ -72,7 +81,272 @@ mBallBody->Enable(); } +/* Uses only Ball and Players positions and detects overcrowind near ball and areas and +players innappropriate behavior (laying on the ground or not walking for too much time) */ +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 + } +} + + +void +SoccerRuleAspect::ResetFaultCounterPlayer(int unum, TTeamIndex idx) +{ + playerGround[unum][idx] = 0; + playerNotStanding[unum][idx] = 0; + playerStanding[unum][idx] = 5/0.02; // Considers player has been standing for some time in playoff + prevPlayerInsideOwnArea[unum][idx] = 0; + playerInsideOwnArea[unum][idx] = 0; + playerFaultTime[unum][idx] = 0; +} + +void +SoccerRuleAspect::ResetFaultCounter(TTeamIndex idx) +{ + for(int t=1; t<=11; t++) { + ResetFaultCounterPlayer(t,idx); + } +} + +// Process agent state: standing, sitted, laying down, ... +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...) + + //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 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 +} + +// 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]++; + +// DEBUG +// if (dArr[1][idx]<1000.0) { +// cout << "Team: " << idx << " --> "; +// for(int t1=1; t1<=6; t1++) +// if (dArr[t1][idx]<5.0) cout << t1 << " o:" << oArr[t1][idx] << " d: " << dArr[t1][idx] << " | "; +// cout << endl; +// } +} + +// Calculate Distance arrays and ordering to the ball and own goal +void SoccerRuleAspect::CalculateDistanceArrays(TTeamIndex idx) +{ + 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; + + 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 + 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; + } + + 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())); + + // determine closest player + 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]; + + // 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; + + //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); + } + + // compute rank of distance to ball + SimpleOrder(distArr, ordArr, idx); + // compute rank of distance to own goal + SimpleOrder(distGArr, ordGArr, idx); +} + +// 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"; + } + + 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 + } + + } +} + + +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; +} + + +// Clear Players that are violating the rules void +SoccerRuleAspect::ClearPlayersAutomatic(TTeamIndex idx) +{ + 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; + + 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) { + 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... + salt::Vector3f new_pos = RepositionOutsidePos(ballPos, unum, idx); + //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; + } + } +} + +void SoccerRuleAspect::ClearPlayers(const salt::Vector3f& pos, float radius, float min_dist, TTeamIndex idx) { @@ -897,6 +1171,9 @@ << playMode << "\n"; break; } + + // Simple Referee + AutomaticSimpleReferee(playMode); } void @@ -954,7 +1231,20 @@ float penaltyLength, penaltyWidth; SoccerBase::GetSoccerVar(*this,"PenaltyLength",penaltyLength); SoccerBase::GetSoccerVar(*this,"PenaltyWidth",penaltyWidth); + + // auto ref parameters + SoccerBase::GetSoccerVar(*this,"NotStandingMaxTime",mNotStandingMaxTime); + SoccerBase::GetSoccerVar(*this,"GoalieNotStandingMaxTime",mGoalieNotStandingMaxTime); + SoccerBase::GetSoccerVar(*this,"GroundMaxTime",mGroundMaxTime); + SoccerBase::GetSoccerVar(*this,"GoalieGroundMaxTime",mGoalieGroundMaxTime); + SoccerBase::GetSoccerVar(*this,"MaxPlayersInsideOwnArea",mMaxPlayersInsideOwnArea); + SoccerBase::GetSoccerVar(*this,"MinOppDistance",mMinOppDistance); + SoccerBase::GetSoccerVar(*this,"Min2PlDistance",mMin2PlDistance); + SoccerBase::GetSoccerVar(*this,"Min3PlDistance",mMin3PlDistance); + //SoccerBase::GetSoccerVar(*this,"MaxFaultTime",mMaxFaultTime); + + // cout << "MaxInside " << mMaxPlayersInsideOwnArea << endl << endl; // set up bounding boxes for halfs and goal areas // the right and the left half are intentionally oversized towards the sides and Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-06-01 10:07:38 UTC (rev 205) @@ -64,7 +64,49 @@ \param pos position where the ball should be dropped- */ void DropBall(salt::Vector3f pos); + + /** Calculates the out of the field reposition pos for a given agent with unum and team idx + Agents are repositioned outside of the field near the mid field line on the opposite yy side + regarding the ball position + */ + salt::Vector3f RepositionOutsidePos(salt::Vector3f initPos, int unum, TTeamIndex idx); + + /** Calculates the inside field reposition pos for a given agent with unum and team idx + Agents are repositioned at distance from the ball, that is, at: plpos + (plpos-ballpos).normalize()*dist + */ + //salt::Vector3f RepositionInsidePos(salt::Vector3f initPos, int unum, TTeamIndex idx, float distance); + /** New rules for repositioning players that commit faults + */ + void ClearPlayersAutomatic(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); + + /** 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 a given player + */ + void ResetFaultCounterPlayer(int unum, 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); + /** broadcast a said message to all players \param message said message- \param pos positon of the player- @@ -95,6 +137,7 @@ * @return the length and width */ salt::Vector2f GetFieldSize() const; + void ResetAgentSelection(); @@ -209,21 +252,15 @@ /** the radius of the Ball */ float mBallRadius; - /** the length of the pause after a goal */ float mGoalPauseTime; - /** the length of the pause after the ball left the field */ float mKickInPauseTime; - /** the length of one game half */ float mHalfTime; - /** the time we wait before dropping the ball in play modes where only - one team can touch the ball - */ + one team can touch the ball */ float mDropBallTime; - /** the point above the ground, where the ball left the field */ salt::Vector3f mLastValidBallPos; /** the field length (in meters) */ @@ -247,6 +284,43 @@ float mWaitBeforeKickOff; /** flag if we want to play only one half of the match */ bool mSingleHalfTime; + + //FCP 2010 - New Parameters (added by FCPortugal for Singapure 2010) + /** max time player may be sitted or laying down before being repositioned */ + int mNotStandingMaxTime; + /** max time player may be on the ground before being repositioned */ + int mGroundMaxTime; + /** max time goalie may be sitted or laying down before being repositioned */ + int mGoalieNotStandingMaxTime; + /** max time goalie (player number 1) may be on the ground before being repositioned */ + int mGoalieGroundMaxTime; + /** min dist for second closest of team before being repositioned */ + float mMin2PlDistance; + /** min dist for third closest of team before being repositioned */ + float mMin3PlDistance; + /** min dist for closest Opponent to ball in order to use repositions for the second and third player*/ + float mMinOppDistance; + /** maximum number of players of the defending team that may be inside own penalty area */ + int mMaxPlayersInsideOwnArea; + /** 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 */ + salt::Vector3f playerPos[12][3]; //Players Positions - not used + int playerGround[12][3]; //Time Players are on the ground + int playerNotStanding[12][3]; //Time Players are not standing (head up for more than 0.5s) + int playerInsideOwnArea[12][3]; //Player is inside own area + int prevPlayerInsideOwnArea[12][3]; //Player was inside own area last cycle + int playerStanding[12][3]; //Time Players are standing + float distArr[12][3]; //Distance array to ball (left/right team) + int ordArr[12][3]; //Distance order of players (left/right team) + float distGArr[12][3]; //Distance array to own goal (left/right team) + int ordGArr[12][3]; //Distance order of players to own goal (left/right team) + int playerFaultTime[12][3]; //Time player is commiting a positional fault + int numPlInsideOwnArea[3]; //Number of players inside own area + int closestPlayer[3]; //Closest Player from each team + float closestPlayerDist[3]; //Closest Player distance to ball from each team + /* FCP 2010 - New Parameters */ + // areas where opponents are not allowed in certain play modes /** bounding box for the right half of the field */ salt::AABB2 mRightHalf; Modified: branches/agentselection/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssserver3d/naosoccersim.rb 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/rcssserver3d/rcssserver3d/naosoccersim.rb 2010-06-01 10:07:38 UTC (rev 205) @@ -62,10 +62,30 @@ addSoccerVar('RuleGoalPauseTime',3.0) addSoccerVar('RuleKickInPauseTime',1.0) addSoccerVar('RuleHalfTime',5.0 * 60) -addSoccerVar('RuleDropBallTime',30) +addSoccerVar('RuleDropBallTime',15) addSoccerVar('SingleHalfTime', false) addSoccerVar('UseOffside',false) +# auto ref parameters FCP 2010 +addSoccerVar('NotStandingMaxTime',30) +addSoccerVar('GoalieNotStandingMaxTime',60) +addSoccerVar('GroundMaxTime',15) +addSoccerVar('GoalieGroundMaxTime', 30) +addSoccerVar('MaxPlayersInsideOwnArea',3) +addSoccerVar('MinOppDistance',0.8) +addSoccerVar('Min2PlDistance',0.4) +addSoccerVar('Min3PlDistance',1.0) + +# auto ref parameters for testing (not for use in competition...) +#addSoccerVar('NotStandingMaxTime',10) +#addSoccerVar('GoalieNotStandingMaxTime',30) +#addSoccerVar('GroundMaxTime', 5) +#addSoccerVar('GoalieGroundMaxTime', 5) +#addSoccerVar('MaxPlayersInsideOwnArea',2) +#addSoccerVar('MinOppDistance',1.0) +#addSoccerVar('Min2PlDistance',0.6) +#addSoccerVar('Min3PlDistance',1.5) + # recorders addSoccerVar('BallRecorder',"Ball/geometry/recorder") addSoccerVar('LeftGoalRecorder',"leftgoal/GoalBox/BoxCollider/recorder") Modified: branches/agentselection/spark/ChangeLog =================================================================== --- branches/agentselection/spark/ChangeLog 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/spark/ChangeLog 2010-06-01 10:07:38 UTC (rev 205) @@ -1,3 +1,8 @@ +2010-05-09 Hedayat Vatankhah <he...@gr...> + + * lib/zeitgeist/scriptserver/scriptserver.cpp (thisCall): + - Fixed a bug in number to pointer conversion in 64bit systems + 2010-03-28 Hedayat Vatankhah <he...@gr...> * lib/oxygen/monitorserver/monitorserver.h (MonitorServer): Modified: branches/agentselection/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- branches/agentselection/spark/lib/oxygen/simulationserver/simulationserver.cpp 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/spark/lib/oxygen/simulationserver/simulationserver.cpp 2010-06-01 10:07:38 UTC (rev 205) @@ -237,6 +237,7 @@ mSimTime += mSumDeltaTime; mSumDeltaTime = 0; } + usleep(10000); } void SimulationServer::ControlEvent(EControlEvent event) Modified: branches/agentselection/spark/lib/zeitgeist/scriptserver/scriptserver.cpp =================================================================== --- branches/agentselection/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2010-06-01 10:07:38 UTC (rev 205) @@ -147,7 +147,7 @@ ParameterList in; getParameterList(args, in); - Object *obj = (Object*)NUM2INT(objPointer); + Object *obj = (Object*)NUM2ULONG(objPointer); Class::TCmdProc cmd = obj->GetClass()->GetCmdProc(STR2CSTR(functionName)); Modified: branches/agentselection/spark/plugin/accelerometer/accelerometer.cpp =================================================================== --- branches/agentselection/spark/plugin/accelerometer/accelerometer.cpp 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/spark/plugin/accelerometer/accelerometer.cpp 2010-06-01 10:07:38 UTC (rev 205) @@ -79,6 +79,7 @@ // calculate the acceleration according to velocity, it is a bit noise Vector3f vel = mBody->GetVelocity(); Vector3f acc = (vel - mLastVel) / deltaTime; + mLastVel = vel; acc -= mGravity; Matrix invRot = mBody->GetRotation(); Modified: branches/agentselection/spark/plugin/agentsynceffector/agentsynceffector.cpp =================================================================== --- branches/agentselection/spark/plugin/agentsynceffector/agentsynceffector.cpp 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/spark/plugin/agentsynceffector/agentsynceffector.cpp 2010-06-01 10:07:38 UTC (rev 205) @@ -27,6 +27,7 @@ using namespace boost; using namespace oxygen; +using namespace std; AgentSyncEffector::AgentSyncEffector() : oxygen::Effector() { Modified: branches/agentselection/spark/plugin/inputwx/CMakeLists.txt =================================================================== --- branches/agentselection/spark/plugin/inputwx/CMakeLists.txt 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/spark/plugin/inputwx/CMakeLists.txt 2010-06-01 10:07:38 UTC (rev 205) @@ -12,7 +12,13 @@ ) include_directories(${wxWidgets_INCLUDE_DIRS}) - add_definitions(${wxWidgets_DEFINITIONS}) + if (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + add_definitions(${wxWidgets_DEFINITIONS}) + else (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + set_property(DIRECTORY APPEND + PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS}) + endif (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + add_library(inputwx MODULE ${inputwx_LIB_SRCS}) target_link_libraries(inputwx ${wxWidgets_LIBRARIES} ${spark_libs}) Modified: branches/agentselection/spark/plugin/openglsyswx/CMakeLists.txt =================================================================== --- branches/agentselection/spark/plugin/openglsyswx/CMakeLists.txt 2010-05-23 07:34:24 UTC (rev 204) +++ branches/agentselection/spark/plugin/openglsyswx/CMakeLists.txt 2010-06-01 10:07:38 UTC (rev 205) @@ -10,7 +10,12 @@ ) include_directories(${wxWidgets_INCLUDE_DIRS}) - add_definitions(${wxWidgets_DEFINITIONS}) + if (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + add_definitions(${wxWidgets_DEFINITIONS}) + else (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + set_property(DIRECTORY APPEND + PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS}) + endif (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) add_library(openglsyswx MODULE ${openglsyswx_LIB_SRCS}) target_link_libraries(openglsyswx ${wxWidgets_LIBRARIES} ${spark_libs}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-05-23 07:34:31
|
Revision: 204 http://simspark.svn.sourceforge.net/simspark/?rev=204&view=rev Author: hedayat Date: 2010-05-23 07:34:24 +0000 (Sun, 23 May 2010) Log Message: ----------- Applied the simple referee patch Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2010-05-19 17:15:37 UTC (rev 203) +++ trunk/rcssserver3d/ChangeLog 2010-05-23 07:34:24 UTC (rev 204) @@ -1,3 +1,11 @@ +2010-05-23 Hedayat Vatankhah <he...@gr...> + + * rcssserver3d/naosoccersim.rb: + * plugin/soccer/soccerruleaspect/soccerruleaspect.h: + * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp: + - Added the simple referee patch from FCPortugal team (thanks to + Luis Paulo Reis) + 2010-02-28 Marian Buchta <mar...@gm...> * cmake/FindBoost.cmake: Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-19 17:15:37 UTC (rev 203) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-23 07:34:24 UTC (rev 204) @@ -53,10 +53,19 @@ mFirstCollidingAgent(true), mNotOffside(false), mLastModeWasPlayOn(false), - mUseOffside(true) + mUseOffside(true), + mDropBallTime(15), + mNotStandingMaxTime(1000), // max time player may be sitted or laying down before being repositioned + mGoalieNotStandingMaxTime(1000), // max time goalie may be sitted or laying down before being repositioned + mGroundMaxTime(1000), // max time player may be on the ground before being repositioned + mGoalieGroundMaxTime(1000), // max time goalie (pl number 1) may be on the ground before being repositioned + mMaxPlayersInsideOwnArea(1000), // maximum number of players of the defending team that may be inside own penalty area + 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 + mMaxFaultTime(0.0) // maximum time allowed for a player to commit a positional fault before being repositioned { mFreeKickPos = Vector3f(0.0,0.0,mBallRadius); - } SoccerRuleAspect::~SoccerRuleAspect() @@ -72,7 +81,272 @@ mBallBody->Enable(); } +/* Uses only Ball and Players positions and detects overcrowind near ball and areas and +players innappropriate behavior (laying on the ground or not walking for too much time) */ +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 + } +} + + +void +SoccerRuleAspect::ResetFaultCounterPlayer(int unum, TTeamIndex idx) +{ + playerGround[unum][idx] = 0; + playerNotStanding[unum][idx] = 0; + playerStanding[unum][idx] = 5/0.02; // Considers player has been standing for some time in playoff + prevPlayerInsideOwnArea[unum][idx] = 0; + playerInsideOwnArea[unum][idx] = 0; + playerFaultTime[unum][idx] = 0; +} + +void +SoccerRuleAspect::ResetFaultCounter(TTeamIndex idx) +{ + for(int t=1; t<=11; t++) { + ResetFaultCounterPlayer(t,idx); + } +} + +// Process agent state: standing, sitted, laying down, ... +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...) + + //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 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 +} + +// 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]++; + +// DEBUG +// if (dArr[1][idx]<1000.0) { +// cout << "Team: " << idx << " --> "; +// for(int t1=1; t1<=6; t1++) +// if (dArr[t1][idx]<5.0) cout << t1 << " o:" << oArr[t1][idx] << " d: " << dArr[t1][idx] << " | "; +// cout << endl; +// } +} + +// Calculate Distance arrays and ordering to the ball and own goal +void SoccerRuleAspect::CalculateDistanceArrays(TTeamIndex idx) +{ + 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; + + 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 + 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; + } + + 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())); + + // determine closest player + 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]; + + // 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; + + //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); + } + + // compute rank of distance to ball + SimpleOrder(distArr, ordArr, idx); + // compute rank of distance to own goal + SimpleOrder(distGArr, ordGArr, idx); +} + +// 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"; + } + + 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 + } + + } +} + + +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; +} + + +// Clear Players that are violating the rules void +SoccerRuleAspect::ClearPlayersAutomatic(TTeamIndex idx) +{ + 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; + + 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) { + 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... + salt::Vector3f new_pos = RepositionOutsidePos(ballPos, unum, idx); + //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; + } + } +} + +void SoccerRuleAspect::ClearPlayers(const salt::Vector3f& pos, float radius, float min_dist, TTeamIndex idx) { @@ -855,6 +1129,9 @@ << playMode << "\n"; break; } + + // Simple Referee + AutomaticSimpleReferee(playMode); } void @@ -912,7 +1189,20 @@ float penaltyLength, penaltyWidth; SoccerBase::GetSoccerVar(*this,"PenaltyLength",penaltyLength); SoccerBase::GetSoccerVar(*this,"PenaltyWidth",penaltyWidth); + + // auto ref parameters + SoccerBase::GetSoccerVar(*this,"NotStandingMaxTime",mNotStandingMaxTime); + SoccerBase::GetSoccerVar(*this,"GoalieNotStandingMaxTime",mGoalieNotStandingMaxTime); + SoccerBase::GetSoccerVar(*this,"GroundMaxTime",mGroundMaxTime); + SoccerBase::GetSoccerVar(*this,"GoalieGroundMaxTime",mGoalieGroundMaxTime); + SoccerBase::GetSoccerVar(*this,"MaxPlayersInsideOwnArea",mMaxPlayersInsideOwnArea); + SoccerBase::GetSoccerVar(*this,"MinOppDistance",mMinOppDistance); + SoccerBase::GetSoccerVar(*this,"Min2PlDistance",mMin2PlDistance); + SoccerBase::GetSoccerVar(*this,"Min3PlDistance",mMin3PlDistance); + //SoccerBase::GetSoccerVar(*this,"MaxFaultTime",mMaxFaultTime); + + // cout << "MaxInside " << mMaxPlayersInsideOwnArea << endl << endl; // set up bounding boxes for halfs and goal areas // the right and the left half are intentionally oversized towards the sides and Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-19 17:15:37 UTC (rev 203) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-23 07:34:24 UTC (rev 204) @@ -64,7 +64,49 @@ \param pos position where the ball should be dropped- */ void DropBall(salt::Vector3f pos); + + /** Calculates the out of the field reposition pos for a given agent with unum and team idx + Agents are repositioned outside of the field near the mid field line on the opposite yy side + regarding the ball position + */ + salt::Vector3f RepositionOutsidePos(salt::Vector3f initPos, int unum, TTeamIndex idx); + + /** Calculates the inside field reposition pos for a given agent with unum and team idx + Agents are repositioned at distance from the ball, that is, at: plpos + (plpos-ballpos).normalize()*dist + */ + //salt::Vector3f RepositionInsidePos(salt::Vector3f initPos, int unum, TTeamIndex idx, float distance); + /** New rules for repositioning players that commit faults + */ + void ClearPlayersAutomatic(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); + + /** 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 a given player + */ + void ResetFaultCounterPlayer(int unum, 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); + /** broadcast a said message to all players \param message said message- \param pos positon of the player- @@ -95,6 +137,7 @@ * @return the length and width */ salt::Vector2f GetFieldSize() const; + protected: /** rereads the current soccer script values */ @@ -203,21 +246,15 @@ /** the radius of the Ball */ float mBallRadius; - /** the length of the pause after a goal */ float mGoalPauseTime; - /** the length of the pause after the ball left the field */ float mKickInPauseTime; - /** the length of one game half */ float mHalfTime; - /** the time we wait before dropping the ball in play modes where only - one team can touch the ball - */ + one team can touch the ball */ float mDropBallTime; - /** the point above the ground, where the ball left the field */ salt::Vector3f mLastValidBallPos; /** the field length (in meters) */ @@ -241,6 +278,43 @@ float mWaitBeforeKickOff; /** flag if we want to play only one half of the match */ bool mSingleHalfTime; + + //FCP 2010 - New Parameters (added by FCPortugal for Singapure 2010) + /** max time player may be sitted or laying down before being repositioned */ + int mNotStandingMaxTime; + /** max time player may be on the ground before being repositioned */ + int mGroundMaxTime; + /** max time goalie may be sitted or laying down before being repositioned */ + int mGoalieNotStandingMaxTime; + /** max time goalie (player number 1) may be on the ground before being repositioned */ + int mGoalieGroundMaxTime; + /** min dist for second closest of team before being repositioned */ + float mMin2PlDistance; + /** min dist for third closest of team before being repositioned */ + float mMin3PlDistance; + /** min dist for closest Opponent to ball in order to use repositions for the second and third player*/ + float mMinOppDistance; + /** maximum number of players of the defending team that may be inside own penalty area */ + int mMaxPlayersInsideOwnArea; + /** 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 */ + salt::Vector3f playerPos[12][3]; //Players Positions - not used + int playerGround[12][3]; //Time Players are on the ground + int playerNotStanding[12][3]; //Time Players are not standing (head up for more than 0.5s) + int playerInsideOwnArea[12][3]; //Player is inside own area + int prevPlayerInsideOwnArea[12][3]; //Player was inside own area last cycle + int playerStanding[12][3]; //Time Players are standing + float distArr[12][3]; //Distance array to ball (left/right team) + int ordArr[12][3]; //Distance order of players (left/right team) + float distGArr[12][3]; //Distance array to own goal (left/right team) + int ordGArr[12][3]; //Distance order of players to own goal (left/right team) + int playerFaultTime[12][3]; //Time player is commiting a positional fault + int numPlInsideOwnArea[3]; //Number of players inside own area + int closestPlayer[3]; //Closest Player from each team + float closestPlayerDist[3]; //Closest Player distance to ball from each team + /* FCP 2010 - New Parameters */ + // areas where opponents are not allowed in certain play modes /** bounding box for the right half of the field */ salt::AABB2 mRightHalf; Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2010-05-19 17:15:37 UTC (rev 203) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2010-05-23 07:34:24 UTC (rev 204) @@ -62,10 +62,30 @@ addSoccerVar('RuleGoalPauseTime',3.0) addSoccerVar('RuleKickInPauseTime',1.0) addSoccerVar('RuleHalfTime',5.0 * 60) -addSoccerVar('RuleDropBallTime',30) +addSoccerVar('RuleDropBallTime',15) addSoccerVar('SingleHalfTime', false) addSoccerVar('UseOffside',false) +# auto ref parameters FCP 2010 +addSoccerVar('NotStandingMaxTime',30) +addSoccerVar('GoalieNotStandingMaxTime',60) +addSoccerVar('GroundMaxTime',15) +addSoccerVar('GoalieGroundMaxTime', 30) +addSoccerVar('MaxPlayersInsideOwnArea',3) +addSoccerVar('MinOppDistance',0.8) +addSoccerVar('Min2PlDistance',0.4) +addSoccerVar('Min3PlDistance',1.0) + +# auto ref parameters for testing (not for use in competition...) +#addSoccerVar('NotStandingMaxTime',10) +#addSoccerVar('GoalieNotStandingMaxTime',30) +#addSoccerVar('GroundMaxTime', 5) +#addSoccerVar('GoalieGroundMaxTime', 5) +#addSoccerVar('MaxPlayersInsideOwnArea',2) +#addSoccerVar('MinOppDistance',1.0) +#addSoccerVar('Min2PlDistance',0.6) +#addSoccerVar('Min3PlDistance',1.5) + # recorders addSoccerVar('BallRecorder',"Ball/geometry/recorder") addSoccerVar('LeftGoalRecorder',"leftgoal/GoalBox/BoxCollider/recorder") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yx...@us...> - 2010-05-19 17:15:43
|
Revision: 203 http://simspark.svn.sourceforge.net/simspark/?rev=203&view=rev Author: yxu Date: 2010-05-19 17:15:37 +0000 (Wed, 19 May 2010) Log Message: ----------- bugfix, thanks Armin Ildermi from Nexus3D Modified Paths: -------------- trunk/spark/plugin/accelerometer/accelerometer.cpp Modified: trunk/spark/plugin/accelerometer/accelerometer.cpp =================================================================== --- trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-05-19 16:21:28 UTC (rev 202) +++ trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-05-19 17:15:37 UTC (rev 203) @@ -79,6 +79,7 @@ // calculate the acceleration according to velocity, it is a bit noise Vector3f vel = mBody->GetVelocity(); Vector3f acc = (vel - mLastVel) / deltaTime; + mLastVel = vel; acc -= mGravity; Matrix invRot = mBody->GetRotation(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-05-19 16:21:34
|
Revision: 202 http://simspark.svn.sourceforge.net/simspark/?rev=202&view=rev Author: sgvandijk Date: 2010-05-19 16:21:28 +0000 (Wed, 19 May 2010) Log Message: ----------- - Select player based on uniform number Modified Paths: -------------- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-05-19 14:58:17 UTC (rev 201) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-05-19 16:21:28 UTC (rev 202) @@ -567,6 +567,7 @@ return; } + soccerRuleAspect->ResetAgentSelection(); (*iter)->Select(); } Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-19 14:58:17 UTC (rev 201) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-19 16:21:28 UTC (rev 202) @@ -57,10 +57,20 @@ scriptServer->CreateVariable("Command.CameraRightCorner", CmdCameraRightCorner); scriptServer->CreateVariable("Command.CameraRightGoal", CmdCameraRightGoal); //JAN - scriptServer->CreateVariable("Command.FreeKickLeft", CmdFreeKickLeft); - scriptServer->CreateVariable("Command.FreeKickRight", CmdFreeKickRight); + scriptServer->CreateVariable("Command.One", CmdOne); + scriptServer->CreateVariable("Command.Two", CmdTwo); + scriptServer->CreateVariable("Command.Three", CmdThree); + scriptServer->CreateVariable("Command.Four", CmdFour); + scriptServer->CreateVariable("Command.Five", CmdFive); + scriptServer->CreateVariable("Command.Six", CmdSix); + scriptServer->CreateVariable("Command.Seven", CmdSeven); + scriptServer->CreateVariable("Command.Eight", CmdEight); + scriptServer->CreateVariable("Command.Nine", CmdNine); + scriptServer->CreateVariable("Command.Zero", CmdZero); + scriptServer->CreateVariable("Command.Left", CmdLeft); + scriptServer->CreateVariable("Command.Right", CmdRight); - scriptServer->CreateVariable("Command.NextMode", CmdNextMode); + scriptServer->CreateVariable("Command.PlayerSelectMode", CmdPlayerSelectMode); scriptServer->CreateVariable("Command.SelectNextAgent", CmdSelectNextAgent); scriptServer->CreateVariable("Command.ResetSelection", CmdResetSelection); scriptServer->CreateVariable("Command.KillSelection", CmdKillSelection); @@ -114,31 +124,15 @@ void SoccerInput::ProcessInput(const Input& input) { - // get list of registered SoccerMonitor objects - TLeafList soccerMonitorList; - mMonitorClient->ListChildrenSupportingClass<SoccerMonitor>(soccerMonitorList); - - if (soccerMonitorList.empty()) - { - GetLog()->Error() - << "ERROR: (SoccerInput) Unable to get SoccerMonitor\n"; - return; - } - - boost::shared_ptr<SoccerMonitor> soccerMonitor = - shared_static_cast<SoccerMonitor>(soccerMonitorList.front()); - switch (input.mId) { default: return; - case CmdNextMode: + case CmdPlayerSelectMode: if (input.GetKeyPress()) { - mCmdMode = (ECmdMode)(mCmdMode + 1); - if (mCmdMode == CmdModeNone) - mCmdMode = CmdModeDefault; + mCmdMode = CmdModePlayerSelect; } break; @@ -200,87 +194,136 @@ //SendCommand("(ball (pos -42.0 0.0 0.3))"); } break; - case CmdCameraLeftGoal: + + case CmdOne: + case CmdTwo: + case CmdThree: + case CmdFour: + case CmdFive: + case CmdSix: + case CmdSeven: + case CmdEight: + case CmdNine: + case CmdZero: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(-fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(90); - mFPS->SetVAngleDeg(35); + if (mCmdMode == CmdModeDefault) + SelectCamera(input.mId - CmdOne); + else + { + ostringstream u_ss; + u_ss << "(select (unum " << (input.mId - CmdOne + 1) << ") "; + if (mCmdMode == CmdModeLeftPlayerSelect) + { + u_ss << "(team Left))"; + SendCommand(u_ss.str()); + mCmdMode = CmdModeDefault; + } + else if (mCmdMode == CmdModeRightPlayerSelect) + { + u_ss << "(team Right))"; + SendCommand(u_ss.str()); + mCmdMode = CmdModeDefault; + } + } } break; - case CmdCameraLeftCorner: + case CmdLeft: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(-fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(50); - mFPS->SetVAngleDeg(30); + if (mCmdMode == CmdModeDefault) + SendCommand("(playMode free_kick_left)"); + else if (mCmdMode == CmdModePlayerSelect || mCmdMode == CmdModeRightPlayerSelect) + mCmdMode = CmdModeLeftPlayerSelect; } break; - case CmdCameraMiddleLeft: + case CmdRight: if (input.GetKeyPress()) { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(salt::gRadToDeg(-0.625)); - mFPS->SetVAngleDeg(40); + if (mCmdMode == CmdModeDefault) + SendCommand("(playMode free_kick_right)"); + else if (mCmdMode == CmdModePlayerSelect || mCmdMode == CmdModeLeftPlayerSelect) + mCmdMode = CmdModeRightPlayerSelect; } break; - case CmdCameraMiddleRight: - if (input.GetKeyPress()) - { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(salt::gRadToDeg(0.625)); - mFPS->SetVAngleDeg(40); - } + }; +} + +void SoccerInput::SelectCamera(int idx) +{ + // get list of registered SoccerMonitor objects + TLeafList soccerMonitorList; + mMonitorClient->ListChildrenSupportingClass<SoccerMonitor>(soccerMonitorList); + + if (soccerMonitorList.empty()) + { + GetLog()->Error() + << "ERROR: (SoccerInput) Unable to get SoccerMonitor\n"; + return; + } + + boost::shared_ptr<SoccerMonitor> soccerMonitor = + shared_static_cast<SoccerMonitor>(soccerMonitorList.front()); + + salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); + + switch (idx) + { + case 0: + { + salt::Vector3f pos(-fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(90); + mFPS->SetVAngleDeg(35); + } break; - case CmdCameraMiddle: - if (input.GetKeyPress()) - { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(0, -fieldSize.y()*1.1, fieldSize.x()*0.6); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(0); - mFPS->SetVAngleDeg(45); - } + case 1: + { + salt::Vector3f pos(-fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(50); + mFPS->SetVAngleDeg(30); + } break; - case CmdCameraRightCorner: - if (input.GetKeyPress()) - { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(-50); - mFPS->SetVAngleDeg(30); - } + case 2: + { + salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(salt::gRadToDeg(-0.625)); + mFPS->SetVAngleDeg(40); + } break; - case CmdCameraRightGoal: - if (input.GetKeyPress()) - { - salt::Vector2f fieldSize = soccerMonitor->GetFieldSize(); - salt::Vector3f pos(fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4); - mCameraBody->SetPosition(pos); - mFPS->SetHAngleDeg(-90); - mFPS->SetVAngleDeg(35); - } + case 3: + { + salt::Vector3f pos(0, -fieldSize.y()*1.1, fieldSize.x()*0.6); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(0); + mFPS->SetVAngleDeg(45); + } break; - case CmdFreeKickLeft: - if (input.GetKeyPress()) - { - SendCommand("(playMode free_kick_left)"); - } + case 4: + { + salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(salt::gRadToDeg(0.625)); + mFPS->SetVAngleDeg(40); + } break; - case CmdFreeKickRight: - if (input.GetKeyPress()) - { - SendCommand("(playMode free_kick_right)"); - } + case 5: + { + salt::Vector3f pos(fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(-50); + mFPS->SetVAngleDeg(30); + } break; - }; + case 6: + { + salt::Vector3f pos(fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(-90); + mFPS->SetVAngleDeg(35); + } + break; + } } Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-19 14:58:17 UTC (rev 201) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-19 16:21:28 UTC (rev 202) @@ -49,12 +49,24 @@ CmdCameraMiddle = CmdCameraMiddleRight + 1, CmdCameraRightCorner = CmdCameraMiddle + 1, CmdCameraRightGoal = CmdCameraRightCorner + 1, + + CmdOne = CmdCameraRightGoal + 1, + CmdTwo = CmdOne + 1, + CmdThree = CmdTwo + 1, + CmdFour = CmdThree + 1, + CmdFive = CmdFour + 1, + CmdSix = CmdFive + 1, + CmdSeven = CmdSix + 1, + CmdEight = CmdSeven + 1, + CmdNine = CmdEight + 1, + CmdZero = CmdNine + 1, + //JAN - CmdFreeKickLeft = CmdCameraRightGoal + 1, - CmdFreeKickRight = CmdFreeKickLeft + 1, + CmdLeft = CmdZero + 1, + CmdRight = CmdLeft + 1, - CmdNextMode = CmdFreeKickRight + 1, - CmdSelectNextAgent = CmdNextMode + 1, + CmdPlayerSelectMode = CmdRight + 1, + CmdSelectNextAgent = CmdPlayerSelectMode + 1, CmdResetSelection = CmdSelectNextAgent + 1, CmdKillSelection = CmdResetSelection + 1 }; @@ -63,6 +75,8 @@ { CmdModeDefault = 1, CmdModePlayerSelect, + CmdModeLeftPlayerSelect, + CmdModeRightPlayerSelect, CmdModeNone }; @@ -88,6 +102,7 @@ protected: void SendCommand(const std::string& cmd); + void SelectCamera(int idx); protected: /** cached reference to the monitor client */ boost::shared_ptr<oxygen::NetClient> mMonitorClient; Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-19 14:58:17 UTC (rev 201) +++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-19 16:21:28 UTC (rev 202) @@ -30,16 +30,28 @@ inputServer.bindCommand('m', Command.MoveAgent); #inputServer.bindCommand('n', Command.ShootBall); #inputServer.bindCommand('x', Command.MoveBall); - inputServer.bindCommand('1', Command.CameraLeftGoal); - inputServer.bindCommand('2', Command.CameraLeftCorner); - inputServer.bindCommand('3', Command.CameraMiddleLeft); - inputServer.bindCommand('4', Command.CameraMiddle); - inputServer.bindCommand('5', Command.CameraMiddleRight); - inputServer.bindCommand('6', Command.CameraRightCorner); - inputServer.bindCommand('7', Command.CameraRightGoal); - inputServer.bindCommand('l', Command.FreeKickLeft); - inputServer.bindCommand('r', Command.FreeKickRight); - inputServer.bindCommand('lctrl y', Command.NextMode); + + #inputServer.bindCommand('1', Command.CameraLeftGoal); + #inputServer.bindCommand('2', Command.CameraLeftCorner); + #inputServer.bindCommand('3', Command.CameraMiddleLeft); + #inputServer.bindCommand('4', Command.CameraMiddle); + #inputServer.bindCommand('5', Command.CameraMiddleRight); + #inputServer.bindCommand('6', Command.CameraRightCorner); + #inputServer.bindCommand('7', Command.CameraRightGoal); + inputServer.bindCommand('1', Command.One); + inputServer.bindCommand('2', Command.Two); + inputServer.bindCommand('3', Command.Three); + inputServer.bindCommand('4', Command.Four); + inputServer.bindCommand('5', Command.Five); + inputServer.bindCommand('6', Command.Six); + inputServer.bindCommand('7', Command.Seven); + inputServer.bindCommand('8', Command.Eight); + inputServer.bindCommand('9', Command.Nine); + inputServer.bindCommand('0', Command.Zero); + + inputServer.bindCommand('l', Command.Left); + inputServer.bindCommand('r', Command.Right); + inputServer.bindCommand('lctrl s', Command.PlayerSelectMode); inputServer.bindCommand('n', Command.SelectNextAgent); inputServer.bindCommand('e', Command.ResetSelection); inputServer.bindCommand('x', Command.KillSelection); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-05-19 14:58:23
|
Revision: 201 http://simspark.svn.sourceforge.net/simspark/?rev=201&view=rev Author: sgvandijk Date: 2010-05-19 14:58:17 +0000 (Wed, 19 May 2010) Log Message: ----------- - clear selection, clear selected agent, monitorinput controls Modified Paths: -------------- branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb branches/agentselection/spark/data/scripts/materials.rb Modified: branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg =================================================================== --- branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-05-19 14:58:17 UTC (rev 201) @@ -69,9 +69,10 @@ (nd GameStatePerceptor) (nd HearPerceptor) (nd Transform - (nd Sphere + (nd Cylinder (setName SelectionMarker) - (setRadius 0.4) + (setParams 1.0 1.0) + (setScale 0.2 0.2 0.02) (setMaterial matSelect) (setTransparent) ) Modified: branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-05-19 14:58:17 UTC (rev 201) @@ -250,7 +250,6 @@ void AgentState::Select(bool s) { - cerr << "Selecting " << mUniformNumber << endl; mSelected = s; } Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-19 14:58:17 UTC (rev 201) @@ -212,8 +212,9 @@ } void -SoccerRuleAspect::ClearSelectedPlayers(float min_dist) +SoccerRuleAspect::ClearSelectedPlayers() { + float min_dist = mFreeKickMoveDist; std::list<boost::shared_ptr<AgentState> > agent_states; if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE)) return; Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-19 14:58:17 UTC (rev 201) @@ -100,6 +100,8 @@ void SelectNextAgent(); + void ClearSelectedPlayers(); + protected: /** rereads the current soccer script values */ virtual void UpdateCachedInternal(); @@ -194,8 +196,6 @@ * @param idx the team which kick off */ void ClearPlayersBeforeKickOff(TTeamIndex idx); - - void ClearSelectedPlayers(float min_dist); protected: /** reference to the body node of the Ball */ Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-05-19 14:58:17 UTC (rev 201) @@ -47,6 +47,7 @@ mCommandMap["kickOff"] = CT_KICK_OFF; mCommandMap["getAck"] = CT_ACK; mCommandMap["select"] = CT_SELECT; + mCommandMap["kill"] = CT_KILL; // setup team index map // Originally team sides were "L","R" and "N" @@ -203,6 +204,9 @@ case CT_SELECT: ParseSelectCommand(predicate); break; + case CT_KILL: + ParseKillCommand(predicate); + break; default: return false; } @@ -240,6 +244,12 @@ else specified = false; + if (!specified) + { + mSoccerRule->ClearSelectedPlayers(); + return; + } + SoccerBase::TAgentStateList agentStates; SoccerBase::GetAgentStates(*this, agentStates, (specified ? idx : TI_NONE)); SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); @@ -247,7 +257,7 @@ while (iter != agentStates.end() && !found) { - if ((specified && (*iter)->GetUniformNumber() == unum) || + if ((specified && (*iter)->GetUniformNumber() == unum && (*iter)->GetTeamIndex() == idx) || (!specified && (*iter)->IsSelected())) found = true; else @@ -319,31 +329,6 @@ } } - Predicate::Iterator killParam(predicate); - if (predicate.FindParameter(killParam, "kill")) - { - GameControlServer::TAgentAspectList agentAspects; - mGameControl->GetAgentAspectList(agentAspects); - - GameControlServer::TAgentAspectList::iterator aaiter; - for ( - aaiter = agentAspects.begin(); - aaiter != agentAspects.end(); - ++aaiter - ) - { - // search for the first agent of the left/right side - boost::shared_ptr<AgentState> agentState = - shared_dynamic_cast<AgentState>((*aaiter)->GetChild("AgentState", true)); - - if (agentState == *iter) - { - mGameControl->pushDisappearedAgent((*aaiter)->ID()); - break; - } - } - } - // Joschka: I removed the part to set a velocity because it doesn't really // seem to have a meaning for agents that have more than just a single body @@ -534,6 +519,12 @@ else specified = false; + if (specified && unum == -1) + { + soccerRuleAspect->ResetAgentSelection(); + return; + } + string team; TTeamIndex idx; Predicate::Iterator teamParam(predicate); @@ -578,3 +569,64 @@ (*iter)->Select(); } + +void TrainerCommandParser::ParseKillCommand(const oxygen::Predicate & predicate) +{ + Predicate::Iterator unumParam(predicate); + int unum; + bool specified = true; + + shared_ptr<SoccerRuleAspect> soccerRuleAspect; + if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) + { + GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n"; + return; + } + + // extract unum + if (predicate.FindParameter(unumParam, "unum")) + { + if (! predicate.GetValue(unumParam, unum)) + specified = false; + } + else + specified = false; + + string team; + TTeamIndex idx; + Predicate::Iterator teamParam(predicate); + + // extract side + if (predicate.FindParameter(teamParam, "team")) + { + if (! predicate.GetValue(teamParam, team)) + specified = false; + else + idx = mTeamIndexMap[team]; + } + else + specified = false; + + GameControlServer::TAgentAspectList agentAspects; + mGameControl->GetAgentAspectList(agentAspects); + GameControlServer::TAgentAspectList::iterator aaiter; + for ( + aaiter = agentAspects.begin(); + aaiter != agentAspects.end(); + ++aaiter + ) + { + // search for the first agent of the left/right side + boost::shared_ptr<AgentState> agentState = + shared_dynamic_cast<AgentState>((*aaiter)->GetChild("AgentState", true)); + + if ((specified && agentState->GetUniformNumber() == unum && agentState->GetTeamIndex() == idx) || + (!specified && agentState->IsSelected())) + { + mGameControl->pushDisappearedAgent((*aaiter)->ID()); + break; + } + } +} + + Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-05-19 14:58:17 UTC (rev 201) @@ -50,7 +50,8 @@ CT_DROP_BALL, CT_KICK_OFF, CT_ACK, - CT_SELECT + CT_SELECT, + CT_KILL }; typedef std::map<std::string, ECommandType> TCommandMap; @@ -112,6 +113,10 @@ */ void ParseSelectCommand(const oxygen::Predicate & predicate); + /** parses and executes the kill command contained in the given + predicate + */ + void ParseKillCommand(const oxygen::Predicate & predicate); protected: TCommandMap mCommandMap; Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-19 14:58:17 UTC (rev 201) @@ -62,6 +62,7 @@ scriptServer->CreateVariable("Command.NextMode", CmdNextMode); scriptServer->CreateVariable("Command.SelectNextAgent", CmdSelectNextAgent); + scriptServer->CreateVariable("Command.ResetSelection", CmdResetSelection); scriptServer->CreateVariable("Command.KillSelection", CmdKillSelection); mMonitorClient = shared_dynamic_cast<NetClient> @@ -148,10 +149,17 @@ } break; + case CmdResetSelection: + if (input.GetKeyPress()) + { + SendCommand("(select (unum -1))"); + } + break; + case CmdKillSelection: if (input.GetKeyPress()) { - SendCommand("(agent (kill 1))"); + SendCommand("(kill)"); } break; @@ -171,7 +179,7 @@ case CmdMoveAgent: if (input.GetKeyPress()) { - //SendCommand("(agent (team Left)(unum 1)(pos -2.0 1.0 3.5))"); + SendCommand("(agent)"); } break; case CmdDropBall: Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-19 14:58:17 UTC (rev 201) @@ -55,7 +55,8 @@ CmdNextMode = CmdFreeKickRight + 1, CmdSelectNextAgent = CmdNextMode + 1, - CmdKillSelection = CmdSelectNextAgent + 1 + CmdResetSelection = CmdSelectNextAgent + 1, + CmdKillSelection = CmdResetSelection + 1 }; enum ECmdMode Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-19 14:58:17 UTC (rev 201) @@ -27,7 +27,7 @@ inputServer.bindCommand('k', Command.KickOff); inputServer.bindCommand('j', Command.KickOffRight); inputServer.bindCommand('b', Command.DropBall); - #inputServer.bindCommand('m', Command.MoveAgent); + inputServer.bindCommand('m', Command.MoveAgent); #inputServer.bindCommand('n', Command.ShootBall); #inputServer.bindCommand('x', Command.MoveBall); inputServer.bindCommand('1', Command.CameraLeftGoal); @@ -41,6 +41,7 @@ inputServer.bindCommand('r', Command.FreeKickRight); inputServer.bindCommand('lctrl y', Command.NextMode); inputServer.bindCommand('n', Command.SelectNextAgent); + inputServer.bindCommand('e', Command.ResetSelection); inputServer.bindCommand('x', Command.KillSelection); end end Modified: branches/agentselection/spark/data/scripts/materials.rb =================================================================== --- branches/agentselection/spark/data/scripts/materials.rb 2010-05-18 16:16:23 UTC (rev 200) +++ branches/agentselection/spark/data/scripts/materials.rb 2010-05-19 14:58:17 UTC (rev 201) @@ -36,9 +36,9 @@ # selection marker material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matSelect'); -material.setDiffuse(1.0,0.0,0.0,0.4) -material.setAmbient(1.0,0.0,0.0,1.0) -material.setSpecular(1.0,0.5,0.5,1.0); +material.setDiffuse(1.0,0.0,0.0,0.5) +material.setAmbient(1.0,0.0,0.0,0.5) +material.setSpecular(1.0,0.2,0.2,0.5); # shades of grey material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matWhite'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-05-18 16:16:29
|
Revision: 200 http://simspark.svn.sourceforge.net/simspark/?rev=200&view=rev Author: sgvandijk Date: 2010-05-18 16:16:23 +0000 (Tue, 18 May 2010) Log Message: ----------- - kill command kills selected agent Modified Paths: -------------- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb branches/agentselection/rcssserver3d/rcssserver3d/simspark.rb branches/agentselection/spark/data/scripts/materials.rb branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp branches/agentselection/spark/plugin/inputsdl/mousesdl.cpp Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-18 16:16:23 UTC (rev 200) @@ -1411,8 +1411,6 @@ void SoccerRuleAspect::SelectNextAgent() { - cerr << "Selecting Next Agent..." << endl; - std::list<boost::shared_ptr<AgentState> > agent_states; bool selectNext = false; if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE) && agent_states.size() > 0) Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-18 16:16:23 UTC (rev 200) @@ -45,7 +45,6 @@ { public: typedef std::list<boost::shared_ptr<AgentState> > TAgentStateList; - typedef std::pair<TTeamIndex, int> TAgentSelection; public: SoccerRuleAspect(); Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-05-18 16:16:23 UTC (rev 200) @@ -29,6 +29,7 @@ #include <agentstate/agentstate.h> #include <soccertypes.h> #include <gamestateaspect/gamestateaspect.h> +#include <oxygen/agentaspect/agentaspect.h> #include "trainercommandparser.h" using namespace std; @@ -107,6 +108,15 @@ GetLog()->Error() << "ERROR: (TrainerCommnadParser) failed to create SexpParser\n"; return; } + + mGameControl = shared_dynamic_cast<GameControlServer> + (GetCore()->Get("/sys/server/gamecontrol")); + + if (mGameControl.get() == 0) + { + GetLog()->Error() << "ERROR: (TrainerCommandParser) Unable to get GameControlServer\n"; + } + } void TrainerCommandParser::OnUnlink() @@ -152,8 +162,6 @@ // lookup the command type corresponding to the predicate name TCommandMap::iterator iter = mCommandMap.find(predicate.name); - cerr << "Trainer command: " << predicate.name << endl; - if (iter == mCommandMap.end()) { return false; @@ -206,17 +214,17 @@ { Predicate::Iterator unumParam(predicate); int unum; + bool specified = true; // extract unum if (predicate.FindParameter(unumParam, "unum")) { if (! predicate.GetValue(unumParam, unum)) - { - GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get unum\n"; - return; - } + specified = false; } - + else + specified = false; + string team; TTeamIndex idx; Predicate::Iterator teamParam(predicate); @@ -225,26 +233,23 @@ if (predicate.FindParameter(teamParam, "team")) { if (! predicate.GetValue(teamParam, team)) - { - GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get team name\n"; - return; - } - - idx = mTeamIndexMap[team]; + specified = false; + else + idx = mTeamIndexMap[team]; } + else + specified = false; - SoccerBase::TAgentStateList agentStates; - SoccerBase::GetAgentStates(*this, agentStates, idx); + SoccerBase::GetAgentStates(*this, agentStates, (specified ? idx : TI_NONE)); SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); bool found = false; while (iter != agentStates.end() && !found) { - if ((*iter)->GetUniformNumber() == unum) - { - found = true; - } + if ((specified && (*iter)->GetUniformNumber() == unum) || + (!specified && (*iter)->IsSelected())) + found = true; else ++iter; } @@ -256,7 +261,6 @@ } Predicate::Iterator posParam(predicate); - if (predicate.FindParameter(posParam, "pos")) { salt::Vector3f pos; @@ -315,6 +319,31 @@ } } + Predicate::Iterator killParam(predicate); + if (predicate.FindParameter(killParam, "kill")) + { + GameControlServer::TAgentAspectList agentAspects; + mGameControl->GetAgentAspectList(agentAspects); + + GameControlServer::TAgentAspectList::iterator aaiter; + for ( + aaiter = agentAspects.begin(); + aaiter != agentAspects.end(); + ++aaiter + ) + { + // search for the first agent of the left/right side + boost::shared_ptr<AgentState> agentState = + shared_dynamic_cast<AgentState>((*aaiter)->GetChild("AgentState", true)); + + if (agentState == *iter) + { + mGameControl->pushDisappearedAgent((*aaiter)->ID()); + break; + } + } + } + // Joschka: I removed the part to set a velocity because it doesn't really // seem to have a meaning for agents that have more than just a single body @@ -489,12 +518,9 @@ int unum; bool specified = true; - cerr << "Parsing Select Command..." << endl; - shared_ptr<SoccerRuleAspect> soccerRuleAspect; if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) { - cerr << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n" << endl; GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n"; return; } Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-05-18 16:16:23 UTC (rev 200) @@ -33,6 +33,11 @@ #include <soccertypes.h> #include <soccerruleaspect/soccerruleaspect.h> +namespace oxygen +{ + class GameControlServer; +} + class TrainerCommandParser : public oxygen::MonitorCmdParser { public: @@ -120,6 +125,8 @@ boost::shared_ptr<SoccerRuleAspect> mSoccerRule; //! the parser used to create the PredicateList boost::shared_ptr<oxygen::BaseParser> mSexpParser; + //! cached reference to the game control server + boost::shared_ptr<oxygen::GameControlServer> mGameControl; bool mGetAck; std::string mAckString; Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-18 16:16:23 UTC (rev 200) @@ -62,7 +62,7 @@ scriptServer->CreateVariable("Command.NextMode", CmdNextMode); scriptServer->CreateVariable("Command.SelectNextAgent", CmdSelectNextAgent); - + scriptServer->CreateVariable("Command.KillSelection", CmdKillSelection); mMonitorClient = shared_dynamic_cast<NetClient> (GetCore()->Get("/sys/server/simulation/SparkMonitorClient")); @@ -147,6 +147,13 @@ SendCommand("(select)"); } break; + + case CmdKillSelection: + if (input.GetKeyPress()) + { + SendCommand("(agent (kill 1))"); + } + break; case CmdKickOff: if (input.GetKeyPress()) Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-18 16:16:23 UTC (rev 200) @@ -54,7 +54,8 @@ CmdFreeKickRight = CmdFreeKickLeft + 1, CmdNextMode = CmdFreeKickRight + 1, - CmdSelectNextAgent = CmdNextMode + 1 + CmdSelectNextAgent = CmdNextMode + 1, + CmdKillSelection = CmdSelectNextAgent + 1 }; enum ECmdMode Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-18 16:16:23 UTC (rev 200) @@ -41,5 +41,6 @@ inputServer.bindCommand('r', Command.FreeKickRight); inputServer.bindCommand('lctrl y', Command.NextMode); inputServer.bindCommand('n', Command.SelectNextAgent); + inputServer.bindCommand('x', Command.KillSelection); end end Modified: branches/agentselection/rcssserver3d/rcssserver3d/simspark.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssserver3d/simspark.rb 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/rcssserver3d/rcssserver3d/simspark.rb 2010-05-18 16:16:23 UTC (rev 200) @@ -48,7 +48,7 @@ sparkLogErrorToCerr() #sparkLogAllToCerr() #sparkLogAllToFile('spark.txt') -sparkLogDebugToCerr() +#sparkLogDebugToCerr() # # uncomment any of the following to run a simulation Modified: branches/agentselection/spark/data/scripts/materials.rb =================================================================== --- branches/agentselection/spark/data/scripts/materials.rb 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/spark/data/scripts/materials.rb 2010-05-18 16:16:23 UTC (rev 200) @@ -36,8 +36,9 @@ # selection marker material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matSelect'); -material.setDiffuse(1.0,0.0,0.0,0.2) -material.setAmbient(1.0,0.0,0.0,0.2) +material.setDiffuse(1.0,0.0,0.0,0.4) +material.setAmbient(1.0,0.0,0.0,1.0) +material.setSpecular(1.0,0.5,0.5,1.0); # shades of grey material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matWhite'); Modified: branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp 2010-05-18 16:16:23 UTC (rev 200) @@ -212,21 +212,21 @@ break; default: + // pass unknown events on to the registered InputItems + TLeafList items; + ListChildrenSupportingClass<InputItem>(items); + + for ( + TLeafList::iterator iter = items.begin(); + iter != items.end(); + ++iter + ) + { + shared_static_cast<InputItem>(*iter) + ->ProcessInput(input); + } break; } - // pass unknown events on to the registered InputItems - TLeafList items; - ListChildrenSupportingClass<InputItem>(items); - - for ( - TLeafList::iterator iter = items.begin(); - iter != items.end(); - ++iter - ) - { - shared_static_cast<InputItem>(*iter) - ->ProcessInput(input); - } } if (mAdvanceTime) Modified: branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp 2010-05-18 16:16:23 UTC (rev 200) @@ -288,6 +288,7 @@ // return Input::eUser input return true; } + // translate raw input to binding TBindMap::iterator bindListIter = mBindings.find(input.mCode); if (bindListIter == mBindings.end()) @@ -322,13 +323,13 @@ #else const Bind& bind = (*bindIter); - //printf("Looking at: %d %d %d", (*bind).mCode, (*bind).cmd, (*bind).modifier); if ( (bind.modifier == 0 && input.mModState == 0) || (bind.modifier & input.mModState) ) #endif { + input.mId = bind.cmd; return true; } Modified: branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp =================================================================== --- branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp 2010-05-18 16:16:23 UTC (rev 200) @@ -265,7 +265,7 @@ Input input(Input::eButton, sym); input.mData.l = (event->type == SDL_KEYDOWN); input.mModState = modState; - mInputSystem->AddInput(input); + mInputSystem->AddInputInternal(input); return 0; } Modified: branches/agentselection/spark/plugin/inputsdl/mousesdl.cpp =================================================================== --- branches/agentselection/spark/plugin/inputsdl/mousesdl.cpp 2010-05-17 18:50:22 UTC (rev 199) +++ branches/agentselection/spark/plugin/inputsdl/mousesdl.cpp 2010-05-18 16:16:23 UTC (rev 200) @@ -69,6 +69,7 @@ } input.mData.l = (event->type == SDL_MOUSEBUTTONDOWN); + input.mModState = 0; mInputSystem->AddInputInternal(input); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-05-17 18:50:28
|
Revision: 199 http://simspark.svn.sourceforge.net/simspark/?rev=199&view=rev Author: sgvandijk Date: 2010-05-17 18:50:22 +0000 (Mon, 17 May 2010) Log Message: ----------- - Agent selection works (just cycling through agents, todo: specific agent multiple selection clear selection mouse selection do something with selection ) Modified Paths: -------------- branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg branches/agentselection/rcssserver3d/data/scripts/rcs-materials-textures.rb branches/agentselection/rcssserver3d/data/scripts/rcs-materials.rb branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb branches/agentselection/rcssserver3d/rcssserver3d/simspark.rb branches/agentselection/spark/data/scripts/materials.rb branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp Modified: branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg =================================================================== --- branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-05-17 18:50:22 UTC (rev 199) @@ -71,8 +71,8 @@ (nd Transform (nd Sphere (setName SelectionMarker) - (setRadius 0.2) - (setMaterial matRed) + (setRadius 0.4) + (setMaterial matSelect) (setTransparent) ) ) Modified: branches/agentselection/rcssserver3d/data/scripts/rcs-materials-textures.rb =================================================================== --- branches/agentselection/rcssserver3d/data/scripts/rcs-materials-textures.rb 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/data/scripts/rcs-materials-textures.rb 2010-05-17 18:50:22 UTC (rev 199) @@ -19,7 +19,6 @@ material.setDiffuse(1.0,0.64,0.4,1.0) material.setAmbient(0.2,0.01,0.0,1.0) - # grass # without lines Modified: branches/agentselection/rcssserver3d/data/scripts/rcs-materials.rb =================================================================== --- branches/agentselection/rcssserver3d/data/scripts/rcs-materials.rb 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/data/scripts/rcs-materials.rb 2010-05-17 18:50:22 UTC (rev 199) @@ -22,7 +22,6 @@ material.setDiffuse(0.1,0.6,0.1,1.0) material.setAmbient(0.1,0.3,0.1,1.0) - #---------------------------------------------------------------- # left team #---------------------------------------------------------------- Modified: branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-05-17 18:50:22 UTC (rev 199) @@ -241,3 +241,21 @@ game_state->ReturnUniform(GetTeamIndex(), GetUniformNumber()); } +bool +AgentState::IsSelected() const +{ + return mSelected; +} + +void +AgentState::Select(bool s) +{ + cerr << "Selecting " << mUniformNumber << endl; + mSelected = s; +} + +void +AgentState::UnSelect() +{ + mSelected = false; +} Modified: branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2010-05-17 18:50:22 UTC (rev 199) @@ -91,9 +91,9 @@ bool GetMessage(std::string& msg, float& direction, bool teamMate); bool GetSelfMessage(std::string& msg); - bool IsSelected() const { return mSelected; } - void Select(bool s = true) { mSelected = s; } - void UnSelect() { mSelected = false; } + bool IsSelected() const; + void Select(bool s = true); + void UnSelect(); protected: /** team index */ Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-17 18:50:22 UTC (rev 199) @@ -1411,11 +1411,13 @@ void SoccerRuleAspect::SelectNextAgent() { + cerr << "Selecting Next Agent..." << endl; + std::list<boost::shared_ptr<AgentState> > agent_states; - boost::shared_ptr<AgentState> first = agent_states.front(); - bool found = false; - if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE)) + 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; for (i = agent_states.begin(); i != agent_states.end(); ++i) @@ -1423,17 +1425,17 @@ if ((*i)->IsSelected()) { (*i)->UnSelect(); - found = true; + selectNext = true; continue; } - if (found) + else if (selectNext) { (*i)->Select(); - found = false; - break; + return; } } - if (found) - first->Select(); + + // No agent selected, select first + first->Select(); } -} \ No newline at end of file +} Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2010-05-17 18:50:22 UTC (rev 199) @@ -45,7 +45,8 @@ mCommandMap["dropBall"] = CT_DROP_BALL; mCommandMap["kickOff"] = CT_KICK_OFF; mCommandMap["getAck"] = CT_ACK; - + mCommandMap["select"] = CT_SELECT; + // setup team index map // Originally team sides were "L","R" and "N" // But this seems to be unused @@ -151,6 +152,8 @@ // lookup the command type corresponding to the predicate name TCommandMap::iterator iter = mCommandMap.find(predicate.name); + cerr << "Trainer command: " << predicate.name << endl; + if (iter == mCommandMap.end()) { return false; @@ -189,6 +192,9 @@ break; } + case CT_SELECT: + ParseSelectCommand(predicate); + break; default: return false; } @@ -477,3 +483,72 @@ } } +void TrainerCommandParser::ParseSelectCommand(const oxygen::Predicate & predicate) +{ + Predicate::Iterator unumParam(predicate); + int unum; + bool specified = true; + + cerr << "Parsing Select Command..." << endl; + + shared_ptr<SoccerRuleAspect> soccerRuleAspect; + if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) + { + cerr << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n" << endl; + GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get soccer rule aspect\n"; + return; + } + + // extract unum + if (predicate.FindParameter(unumParam, "unum")) + { + if (! predicate.GetValue(unumParam, unum)) + specified = false; + } + else + specified = false; + + string team; + TTeamIndex idx; + Predicate::Iterator teamParam(predicate); + + // extract side + if (predicate.FindParameter(teamParam, "team")) + { + if (! predicate.GetValue(teamParam, team)) + specified = false; + else + idx = mTeamIndexMap[team]; + } + else + specified = false; + + if (!specified) + { + soccerRuleAspect->SelectNextAgent(); + return; + } + + SoccerBase::TAgentStateList agentStates; + SoccerBase::GetAgentStates(*this, agentStates, idx); + SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); + bool found = false; + + while (iter != agentStates.end() && !found) + { + if ((*iter)->GetUniformNumber() == unum) + { + found = true; + } + else + ++iter; + } + + if (!found) + { + GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get correct AgentState\n"; + return; + } + + (*iter)->Select(); +} Modified: branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2010-05-17 18:50:22 UTC (rev 199) @@ -44,7 +44,8 @@ CT_PLAYMODE, CT_DROP_BALL, CT_KICK_OFF, - CT_ACK + CT_ACK, + CT_SELECT }; typedef std::map<std::string, ECommandType> TCommandMap; @@ -100,6 +101,11 @@ predicate */ void ParseKickOffCommand(const oxygen::Predicate & predicate); + + /** parses and executes the select command contained in the given + predicate + */ + void ParseSelectCommand(const oxygen::Predicate & predicate); protected: TCommandMap mCommandMap; Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-17 18:50:22 UTC (rev 199) @@ -61,6 +61,7 @@ scriptServer->CreateVariable("Command.FreeKickRight", CmdFreeKickRight); scriptServer->CreateVariable("Command.NextMode", CmdNextMode); + scriptServer->CreateVariable("Command.SelectNextAgent", CmdSelectNextAgent); mMonitorClient = shared_dynamic_cast<NetClient> @@ -139,6 +140,13 @@ mCmdMode = CmdModeDefault; } break; + + case CmdSelectNextAgent: + if (input.GetKeyPress()) + { + SendCommand("(select)"); + } + break; case CmdKickOff: if (input.GetKeyPress()) Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-17 18:50:22 UTC (rev 199) @@ -53,7 +53,8 @@ CmdFreeKickLeft = CmdCameraRightGoal + 1, CmdFreeKickRight = CmdFreeKickLeft + 1, - CmdNextMode = CmdFreeKickRight + 1 + CmdNextMode = CmdFreeKickRight + 1, + CmdSelectNextAgent = CmdNextMode + 1 }; enum ECmdMode Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-17 18:50:22 UTC (rev 199) @@ -28,8 +28,8 @@ inputServer.bindCommand('j', Command.KickOffRight); inputServer.bindCommand('b', Command.DropBall); #inputServer.bindCommand('m', Command.MoveAgent); - inputServer.bindCommand('n', Command.ShootBall); - inputServer.bindCommand('x', Command.MoveBall); + #inputServer.bindCommand('n', Command.ShootBall); + #inputServer.bindCommand('x', Command.MoveBall); inputServer.bindCommand('1', Command.CameraLeftGoal); inputServer.bindCommand('2', Command.CameraLeftCorner); inputServer.bindCommand('3', Command.CameraMiddleLeft); @@ -40,5 +40,6 @@ inputServer.bindCommand('l', Command.FreeKickLeft); inputServer.bindCommand('r', Command.FreeKickRight); inputServer.bindCommand('lctrl y', Command.NextMode); + inputServer.bindCommand('n', Command.SelectNextAgent); end end Modified: branches/agentselection/rcssserver3d/rcssserver3d/simspark.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssserver3d/simspark.rb 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/rcssserver3d/rcssserver3d/simspark.rb 2010-05-17 18:50:22 UTC (rev 199) @@ -48,7 +48,7 @@ sparkLogErrorToCerr() #sparkLogAllToCerr() #sparkLogAllToFile('spark.txt') -#sparkLogDebugToCerr() +sparkLogDebugToCerr() # # uncomment any of the following to run a simulation Modified: branches/agentselection/spark/data/scripts/materials.rb =================================================================== --- branches/agentselection/spark/data/scripts/materials.rb 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/spark/data/scripts/materials.rb 2010-05-17 18:50:22 UTC (rev 199) @@ -13,8 +13,8 @@ material.setDiffuse(1.0,0.3,0.0,1.0) material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matRed'); -material.setDiffuse(1.0,0.0,0.0,0.5) -material.setAmbient(1.0,0.0,0.0,0.5) +material.setDiffuse(1.0,0.0,0.0,1.0) +material.setAmbient(1.0,0.0,0.0,1.0) material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matRedGlow'); material.setDiffuse(1.0,0.0,0.0,1.0) @@ -34,6 +34,11 @@ material.setDiffuse(0.1,0.6,0.1,1.0) material.setAmbient(0.1,0.3,0.1,1.0) +# selection marker +material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matSelect'); +material.setDiffuse(1.0,0.0,0.0,0.2) +material.setAmbient(1.0,0.0,0.0,0.2) + # shades of grey material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matWhite'); material.setDiffuse(1.0,1.0,1.0,1.0) Modified: branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp 2010-05-17 18:50:22 UTC (rev 199) @@ -29,7 +29,8 @@ RenderNode::RenderNode() : BaseNode(), mTransparent(false), - mVisible(true) + mVisible(true), + mVisibleToggled(true) { } @@ -44,5 +45,14 @@ void RenderNode::SetVisible(bool visible) { - mVisible = visible; -} \ No newline at end of file + if (!mVisibleToggled && mVisible != visible) + mVisibleToggled = true; + mVisible = visible; +} + +bool RenderNode::VisibleToggled() +{ + bool tmp = mVisibleToggled; + mVisibleToggled = false; + return tmp; +} Modified: branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h =================================================================== --- branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h 2010-05-17 18:50:22 UTC (rev 199) @@ -47,11 +47,13 @@ void SetTransparent(); void SetVisible(bool visible); - bool IsVisible() { return mVisible; } + bool IsVisible() const { return mVisible; } + bool VisibleToggled(); private: bool mTransparent; bool mVisible; + bool mVisibleToggled; }; DECLARE_ABSTRACTCLASS(RenderNode); Modified: branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp =================================================================== --- branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp 2010-05-16 14:46:27 UTC (rev 198) +++ branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp 2010-05-17 18:50:22 UTC (rev 199) @@ -244,14 +244,11 @@ ss << "(nd StaticMesh"; } - if (mesh->IsVisible()) - { + if (mFullState || mesh->VisibleToggled()) + if (mesh->IsVisible()) ss << " (setVisible 1)"; - } - else - { + else ss << " (setVisible 0)"; - } if (! mFullState) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-05-16 14:46:34
|
Revision: 198 http://simspark.svn.sourceforge.net/simspark/?rev=198&view=rev Author: sgvandijk Date: 2010-05-16 14:46:27 +0000 (Sun, 16 May 2010) Log Message: ----------- - Initial player selection stuff Modified Paths: -------------- branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.h branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb branches/agentselection/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb branches/agentselection/spark/data/scripts/materials.rb branches/agentselection/spark/lib/kerosin/inputserver/input.h branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h branches/agentselection/spark/lib/kerosin/renderserver/rendernode_c.cpp branches/agentselection/spark/lib/kerosin/renderserver/renderserver.cpp branches/agentselection/spark/lib/kerosin/sceneserver/singlematnode_c.cpp branches/agentselection/spark/lib/kerosin/sceneserver/staticmesh_c.cpp branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp Modified: branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg =================================================================== --- branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-05-16 14:46:27 UTC (rev 198) @@ -68,6 +68,14 @@ (setName AgentState) (nd GameStatePerceptor) (nd HearPerceptor) + (nd Transform + (nd Sphere + (setName SelectionMarker) + (setRadius 0.2) + (setMaterial matRed) + (setTransparent) + ) + ) ) (nd GyroRatePerceptor (setName torso)) Modified: branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -23,9 +23,11 @@ #include <soccertypes.h> #include <soccerbase/soccerbase.h> #include <gamestateaspect/gamestateaspect.h> +#include <kerosin/renderserver/rendernode.h> #include <sstream> using namespace oxygen; +using namespace kerosin; using namespace std; AgentState::AgentState() : ObjectState(), mTeamIndex(TI_NONE), @@ -33,7 +35,8 @@ mHearMax(2), mHearInc(1), mHearDecay(2), mHearMateCap(2), mHearOppCap(2), mIfSelfMsg(false), - mIfMateMsg(false), mIfOppMsg(false) + mIfMateMsg(false), mIfOppMsg(false), + mSelected(false) { // set mID and mUniformNumber into a joint state SetUniformNumber(0); @@ -211,6 +214,18 @@ } void +AgentState::UpdateHierarchyInternal() +{ + boost::shared_ptr<RenderNode> node = boost::shared_dynamic_cast<RenderNode>(GetChild("SelectionMarker", true)); + if (!node) + { + GetLog()->Error() << "ERROR: (AgentState::UpdateHierarchyInternal) could not find selection marker\n"; + return; + } + node->SetVisible(mSelected); +} + +void AgentState::OnUnlink() { ObjectState::OnUnlink(); Modified: branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2010-05-16 14:46:27 UTC (rev 198) @@ -91,6 +91,10 @@ bool GetMessage(std::string& msg, float& direction, bool teamMate); bool GetSelfMessage(std::string& msg); + bool IsSelected() const { return mSelected; } + void Select(bool s = true) { mSelected = s; } + void UnSelect() { mSelected = false; } + protected: /** team index */ TTeamIndex mTeamIndex; @@ -134,7 +138,9 @@ /** is there any message from oponnent */ bool mIfOppMsg; + bool mSelected; protected: + virtual void UpdateHierarchyInternal(); virtual void OnUnlink(); }; Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -212,6 +212,47 @@ } void +SoccerRuleAspect::ClearSelectedPlayers(float min_dist) +{ + std::list<boost::shared_ptr<AgentState> > 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; + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { + SoccerBase::GetTransformParent(**i, agent_aspect); + + // if agent is selected, move it away + Vector3f new_pos = agent_aspect->GetWorldTransform().Pos(); + + if ((*i)->IsSelected()) + { + float dist = salt::UniformRNG<>(min_dist, min_dist + 2.0)(); + + if ((*i)->GetTeamIndex() == TI_LEFT) + { + if (new_pos[0] - dist < -mFieldLength/2.0) + { + new_pos[1] = new_pos[1] < 0 ? new_pos[1] + dist : new_pos[1] - dist; + } else { + new_pos[0] = new_pos[0] - dist; + } + } else { + if (new_pos[0] + dist > mFieldLength/2.0) + { + new_pos[1] = new_pos[1] < 0 ? new_pos[1] + dist : new_pos[1] - dist; + } else { + new_pos[0] = new_pos[0] + dist; + } + } + SoccerBase::MoveAgent(agent_aspect, new_pos); + } + } +} + +void SoccerRuleAspect::DropBall() { DropBall(mBallBody->GetPosition()); @@ -1348,7 +1389,51 @@ } } -Vector2f SoccerRuleAspect::GetFieldSize() const +Vector2f +SoccerRuleAspect::GetFieldSize() const { return Vector2f(mFieldLength,mFieldWidth); } + +void +SoccerRuleAspect::ResetAgentSelection() +{ + std::list<boost::shared_ptr<AgentState> > agent_states; + if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE)) + { + + std::list<boost::shared_ptr<AgentState> >::const_iterator i; + for (i = agent_states.begin(); i != agent_states.end(); ++i) + (*i)->UnSelect(); + } +} + +void +SoccerRuleAspect::SelectNextAgent() +{ + std::list<boost::shared_ptr<AgentState> > agent_states; + boost::shared_ptr<AgentState> first = agent_states.front(); + bool found = false; + if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE)) + { + + std::list<boost::shared_ptr<AgentState> >::const_iterator i; + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { + if ((*i)->IsSelected()) + { + (*i)->UnSelect(); + found = true; + continue; + } + if (found) + { + (*i)->Select(); + found = false; + break; + } + } + if (found) + first->Select(); + } +} \ No newline at end of file Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-16 14:46:27 UTC (rev 198) @@ -45,7 +45,8 @@ { public: typedef std::list<boost::shared_ptr<AgentState> > TAgentStateList; - + typedef std::pair<TTeamIndex, int> TAgentSelection; + public: SoccerRuleAspect(); virtual ~SoccerRuleAspect(); @@ -96,6 +97,10 @@ */ salt::Vector2f GetFieldSize() const; + void ResetAgentSelection(); + + void SelectNextAgent(); + protected: /** rereads the current soccer script values */ virtual void UpdateCachedInternal(); @@ -191,6 +196,8 @@ */ void ClearPlayersBeforeKickOff(TTeamIndex idx); + void ClearSelectedPlayers(float min_dist); + protected: /** reference to the body node of the Ball */ boost::shared_ptr<oxygen::RigidBody> mBallBody; Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -28,9 +28,11 @@ using namespace zeitgeist; using namespace oxygen; using namespace kerosin; +using namespace std; SoccerInput::SoccerInput() - : InputItem() + : InputItem(), + mCmdMode(CmdModeDefault) { } @@ -57,7 +59,10 @@ //JAN scriptServer->CreateVariable("Command.FreeKickLeft", CmdFreeKickLeft); scriptServer->CreateVariable("Command.FreeKickRight", CmdFreeKickRight); + + scriptServer->CreateVariable("Command.NextMode", CmdNextMode); + mMonitorClient = shared_dynamic_cast<NetClient> (GetCore()->Get("/sys/server/simulation/SparkMonitorClient")); @@ -126,6 +131,15 @@ default: return; + case CmdNextMode: + if (input.GetKeyPress()) + { + mCmdMode = (ECmdMode)(mCmdMode + 1); + if (mCmdMode == CmdModeNone) + mCmdMode = CmdModeDefault; + } + break; + case CmdKickOff: if (input.GetKeyPress()) { Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-16 14:46:27 UTC (rev 198) @@ -51,8 +51,17 @@ CmdCameraRightGoal = CmdCameraRightCorner + 1, //JAN CmdFreeKickLeft = CmdCameraRightGoal + 1, - CmdFreeKickRight = CmdFreeKickLeft + 1 + CmdFreeKickRight = CmdFreeKickLeft + 1, + + CmdNextMode = CmdFreeKickRight + 1 }; + + enum ECmdMode + { + CmdModeDefault = 1, + CmdModePlayerSelect, + CmdModeNone + }; public: SoccerInput(); @@ -71,6 +80,8 @@ /** reset SparkMonitorClient reference */ virtual void OnUnlink(); + ECmdMode GetCmdMode() const { return mCmdMode; } + protected: void SendCommand(const std::string& cmd); @@ -82,6 +93,8 @@ boost::shared_ptr<oxygen::RigidBody> mCameraBody; boost::shared_ptr<oxygen::FPSController> mFPS; + + ECmdMode mCmdMode; }; DECLARE_CLASS(SoccerInput); Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -23,6 +23,7 @@ #include <sstream> #include "soccerrender.h" #include "soccermonitor.h" +#include "soccerinput.h" #include <zeitgeist/logserver/logserver.h> #include <kerosin/openglserver/openglserver.h> #include <kerosin/fontserver/fontserver.h> @@ -69,6 +70,13 @@ { GetLog()->Error() << "ERROR: (SoccerRender) Unable to get SoccerMonitor\n"; } + mInput = shared_static_cast<SoccerInput> + (GetCore()->Get("/sys/server/simulation/InputControl/SoccerInput")); + + if (mInput.get() == 0) + { + GetLog()->Error() << "ERROR: (SoccerRender) Unable to get SoccerInput\n"; + } } void SoccerRender::OnUnlink() @@ -90,7 +98,7 @@ return; } - stringstream ss_l, ss_c, ss_r; + stringstream ss_l, ss_c, ss_r, ss_m; ss_c.setf(ios_base::fixed,ios_base::floatfield); ss_c.precision(2); @@ -141,5 +149,8 @@ xPos = int((1024-(mFont->GetStringWidth(ss_c.str().c_str())))/2); mFont->DrawString(xPos, 0, ss_c.str().c_str()); + ss_m << mInput->GetCmdMode(); + mFont->DrawString(10, 30, ss_m.str().c_str()); + mFontServer->End(); } Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.h =================================================================== --- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.h 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.h 2010-05-16 14:46:27 UTC (rev 198) @@ -32,6 +32,7 @@ } class SoccerMonitor; +class SoccerInput; class SoccerRender : public kerosin::CustomRender { @@ -51,6 +52,7 @@ boost::shared_ptr<SoccerMonitor> mMonitor; boost::shared_ptr<kerosin::FontServer> mFontServer; boost::shared_ptr<kerosin::Font> mFont; + boost::shared_ptr<SoccerInput> mInput; }; DECLARE_CLASS(SoccerRender); Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-16 14:46:27 UTC (rev 198) @@ -27,7 +27,7 @@ inputServer.bindCommand('k', Command.KickOff); inputServer.bindCommand('j', Command.KickOffRight); inputServer.bindCommand('b', Command.DropBall); - inputServer.bindCommand('m', Command.MoveAgent); + #inputServer.bindCommand('m', Command.MoveAgent); inputServer.bindCommand('n', Command.ShootBall); inputServer.bindCommand('x', Command.MoveBall); inputServer.bindCommand('1', Command.CameraLeftGoal); @@ -39,5 +39,6 @@ inputServer.bindCommand('7', Command.CameraRightGoal); inputServer.bindCommand('l', Command.FreeKickLeft); inputServer.bindCommand('r', Command.FreeKickRight); + inputServer.bindCommand('lctrl y', Command.NextMode); end end Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb =================================================================== --- branches/agentselection/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb 2010-05-16 14:46:27 UTC (rev 198) @@ -13,10 +13,6 @@ # state sparkRegisterCustomMonitor 'SoccerMonitor' -# register the soccer render plugin to draw the game state on the -# screen -sparkRegisterCustomRender 'SoccerRender' - if ($logPlayerMode == true) # register the soccer input logplayer plugin for playback # specific keys @@ -29,3 +25,7 @@ # bind keys to soccer commands run "soccerbindings.rb" +# register the soccer render plugin to draw the game state on the +# screen +sparkRegisterCustomRender 'SoccerRender' + Modified: branches/agentselection/spark/data/scripts/materials.rb =================================================================== --- branches/agentselection/spark/data/scripts/materials.rb 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/data/scripts/materials.rb 2010-05-16 14:46:27 UTC (rev 198) @@ -13,7 +13,8 @@ material.setDiffuse(1.0,0.3,0.0,1.0) material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matRed'); -material.setDiffuse(1.0,0.0,0.0,1.0) +material.setDiffuse(1.0,0.0,0.0,0.5) +material.setAmbient(1.0,0.0,0.0,0.5) material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matRedGlow'); material.setDiffuse(1.0,0.0,0.0,1.0) Modified: branches/agentselection/spark/lib/kerosin/inputserver/input.h =================================================================== --- branches/agentselection/spark/lib/kerosin/inputserver/input.h 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/inputserver/input.h 2010-05-16 14:46:27 UTC (rev 198) @@ -101,6 +101,7 @@ float f; } mData; + unsigned int mModState; public: // numbers Modified: branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -212,21 +212,21 @@ break; default: - // pass unknown events on to the registered InputItems - TLeafList items; - ListChildrenSupportingClass<InputItem>(items); - - for ( - TLeafList::iterator iter = items.begin(); - iter != items.end(); - ++iter - ) - { - shared_static_cast<InputItem>(*iter) - ->ProcessInput(input); - } break; } + // pass unknown events on to the registered InputItems + TLeafList items; + ListChildrenSupportingClass<InputItem>(items); + + for ( + TLeafList::iterator iter = items.begin(); + iter != items.end(); + ++iter + ) + { + shared_static_cast<InputItem>(*iter) + ->ProcessInput(input); + } } if (mAdvanceTime) Modified: branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -305,11 +305,13 @@ ++bindIter ) { + /* const Bind& bind = (*bindIter); //printf("Looking at: %d %d %d", (*bind).mCode, (*bind).cmd, (*bind).modifier); - if (bind.modifier == mModifierState) + if (bind.modifier == input.mModState) { + */ #if 0 if (input.mType == Input::eButton) { @@ -322,8 +324,8 @@ //printf("Looking at: %d %d %d", (*bind).mCode, (*bind).cmd, (*bind).modifier); if ( - (bind.modifier == 0 && mModifierState == 0) || - (bind.modifier & mModifierState) + (bind.modifier == 0 && input.mModState == 0) || + (bind.modifier & input.mModState) ) #endif { @@ -335,7 +337,7 @@ input.mId = bind.cmd; return true; } - } + //} } input.mId = -1; @@ -404,6 +406,7 @@ { current = tokens.front(); tokens.pop_front(); + bind.modifier |= ParseModifier(current); } Modified: branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -24,10 +24,12 @@ #include "rendernode.h" using namespace kerosin; +using namespace std; RenderNode::RenderNode() : BaseNode(), - mTransparent(false) + mTransparent(false), + mVisible(true) { } @@ -37,5 +39,10 @@ void RenderNode::SetTransparent() { - mTransparent = true; + mTransparent = true; } + +void RenderNode::SetVisible(bool visible) +{ + mVisible = visible; +} \ No newline at end of file Modified: branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h =================================================================== --- branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h 2010-05-16 14:46:27 UTC (rev 198) @@ -45,8 +45,13 @@ bool IsTransparent() { return mTransparent; } void SetTransparent(); + + void SetVisible(bool visible); + bool IsVisible() { return mVisible; } + private: bool mTransparent; + bool mVisible; }; DECLARE_ABSTRACTCLASS(RenderNode); Modified: branches/agentselection/spark/lib/kerosin/renderserver/rendernode_c.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/renderserver/rendernode_c.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/renderserver/rendernode_c.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -29,8 +29,26 @@ return true; } +FUNCTION(RenderNode,setVisible) +{ + int visible; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in.begin(), visible)) + ) + { + return false; + } + + + obj->SetVisible(visible); + return true; +} + void CLASS(RenderNode)::DefineClass() { DEFINE_BASECLASS(oxygen/BaseNode); DEFINE_FUNCTION(setTransparent); + DEFINE_FUNCTION(setVisible); } Modified: branches/agentselection/spark/lib/kerosin/renderserver/renderserver.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/renderserver/renderserver.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/renderserver/renderserver.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -251,6 +251,10 @@ { boost::shared_ptr<RenderNode> renderNode = shared_dynamic_cast<RenderNode>(node); if (renderNode.get() != 0 && + !renderNode->IsVisible()) + return; + + if (renderNode.get() != 0 && ((pass == 0 && !renderNode->IsTransparent()) || (pass == 1 && renderNode->IsTransparent())) ) { Modified: branches/agentselection/spark/lib/kerosin/sceneserver/singlematnode_c.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/sceneserver/singlematnode_c.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/sceneserver/singlematnode_c.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -40,10 +40,28 @@ return obj->SetMaterial(inName); } +FUNCTION(SingleMatNode,setVisible) +{ + int visible; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in.begin(), visible)) + ) + { + return false; + } + + + obj->SetVisible(visible); + return true; +} + void CLASS(SingleMatNode)::DefineClass() { DEFINE_BASECLASS(kerosin/StaticMesh); DEFINE_FUNCTION(setMaterial); + DEFINE_FUNCTION(setVisible); } Modified: branches/agentselection/spark/lib/kerosin/sceneserver/staticmesh_c.cpp =================================================================== --- branches/agentselection/spark/lib/kerosin/sceneserver/staticmesh_c.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/lib/kerosin/sceneserver/staticmesh_c.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -144,15 +144,9 @@ return true; } -FUNCTION(RenderNode,setTransparent) -{ - obj->SetTransparent(); - return true; -} - void CLASS(StaticMesh)::DefineClass() { - DEFINE_BASECLASS(oxygen/BaseNode); + DEFINE_BASECLASS(kerosin/RenderNode); DEFINE_FUNCTION(load); DEFINE_FUNCTION(setScale); DEFINE_FUNCTION(setCastShadows) @@ -160,5 +154,4 @@ DEFINE_FUNCTION(setExternalMeshName) DEFINE_FUNCTION(setExternalMeshScale) DEFINE_FUNCTION(resetMaterials) - DEFINE_FUNCTION(setTransparent); } Modified: branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp =================================================================== --- branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -24,6 +24,7 @@ #include <zeitgeist/logserver/logserver.h> using namespace kerosin; +using namespace std; KeyboardSDL::KeyboardSDL() : InputDeviceSDL() @@ -213,8 +214,7 @@ return 1; } - unsigned int& modState = - mInputSystem->GetInputServer()->GetModifierState(); + unsigned int modState; modState = Input::eNone; @@ -238,6 +238,16 @@ modState |= Input::eRAlt; } + if (event->key.keysym.mod & KMOD_LCTRL) + { + modState |= Input::eLCtrl; + } + + if (event->key.keysym.mod & KMOD_RCTRL) + { + modState |= Input::eRCtrl; + } + if (event->key.keysym.sym == 0) { return 1; @@ -254,7 +264,8 @@ Input input(Input::eButton, sym); input.mData.l = (event->type == SDL_KEYDOWN); - mInputSystem->AddInputInternal(input); + input.mModState = modState; + mInputSystem->AddInput(input); return 0; } Modified: branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp =================================================================== --- branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp 2010-05-12 20:39:17 UTC (rev 197) +++ branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp 2010-05-16 14:46:27 UTC (rev 198) @@ -233,11 +233,6 @@ void SparkMonitor::DescribeMesh(stringstream& ss, boost::shared_ptr<StaticMesh> mesh) { - if (! mFullState) - { - return DescribeBaseNode(ss); - } - boost::shared_ptr<SingleMatNode> singleMat = shared_dynamic_cast<SingleMatNode>(mesh); @@ -249,6 +244,18 @@ ss << "(nd StaticMesh"; } + if (mesh->IsVisible()) + { + ss << " (setVisible 1)"; + } + else + { + ss << " (setVisible 0)"; + } + + if (! mFullState) + return; + if (mesh->IsTransparent()) { ss << " (setTransparent)"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-05-12 20:39:23
|
Revision: 197 http://simspark.svn.sourceforge.net/simspark/?rev=197&view=rev Author: hedayat Date: 2010-05-12 20:39:17 +0000 (Wed, 12 May 2010) Log Message: ----------- CMake 2.8 compatibility fix Modified Paths: -------------- trunk/spark/plugin/inputwx/CMakeLists.txt trunk/spark/plugin/openglsyswx/CMakeLists.txt Modified: trunk/spark/plugin/inputwx/CMakeLists.txt =================================================================== --- trunk/spark/plugin/inputwx/CMakeLists.txt 2010-05-09 17:45:33 UTC (rev 196) +++ trunk/spark/plugin/inputwx/CMakeLists.txt 2010-05-12 20:39:17 UTC (rev 197) @@ -12,7 +12,13 @@ ) include_directories(${wxWidgets_INCLUDE_DIRS}) - add_definitions(${wxWidgets_DEFINITIONS}) + if (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + add_definitions(${wxWidgets_DEFINITIONS}) + else (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + set_property(DIRECTORY APPEND + PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS}) + endif (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + add_library(inputwx MODULE ${inputwx_LIB_SRCS}) target_link_libraries(inputwx ${wxWidgets_LIBRARIES} ${spark_libs}) Modified: trunk/spark/plugin/openglsyswx/CMakeLists.txt =================================================================== --- trunk/spark/plugin/openglsyswx/CMakeLists.txt 2010-05-09 17:45:33 UTC (rev 196) +++ trunk/spark/plugin/openglsyswx/CMakeLists.txt 2010-05-12 20:39:17 UTC (rev 197) @@ -10,7 +10,12 @@ ) include_directories(${wxWidgets_INCLUDE_DIRS}) - add_definitions(${wxWidgets_DEFINITIONS}) + if (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + add_definitions(${wxWidgets_DEFINITIONS}) + else (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) + set_property(DIRECTORY APPEND + PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS}) + endif (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8) add_library(openglsyswx MODULE ${openglsyswx_LIB_SRCS}) target_link_libraries(openglsyswx ${wxWidgets_LIBRARIES} ${spark_libs}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-05-09 17:45:39
|
Revision: 196 http://simspark.svn.sourceforge.net/simspark/?rev=196&view=rev Author: hedayat Date: 2010-05-09 17:45:33 +0000 (Sun, 09 May 2010) Log Message: ----------- Fixed a bug in num to pointer conversion in 64bit systems Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-05-07 18:57:03 UTC (rev 195) +++ trunk/spark/ChangeLog 2010-05-09 17:45:33 UTC (rev 196) @@ -1,3 +1,8 @@ +2010-05-09 Hedayat Vatankhah <he...@gr...> + + * lib/zeitgeist/scriptserver/scriptserver.cpp (thisCall): + - Fixed a bug in number to pointer conversion in 64bit systems + 2010-03-28 Hedayat Vatankhah <he...@gr...> * lib/oxygen/monitorserver/monitorserver.h (MonitorServer): Modified: trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp =================================================================== --- trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2010-05-07 18:57:03 UTC (rev 195) +++ trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2010-05-09 17:45:33 UTC (rev 196) @@ -147,7 +147,7 @@ ParameterList in; getParameterList(args, in); - Object *obj = (Object*)NUM2INT(objPointer); + Object *obj = (Object*)NUM2ULONG(objPointer); Class::TCmdProc cmd = obj->GetClass()->GetCmdProc(STR2CSTR(functionName)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-05-07 18:57:10
|
Revision: 195 http://simspark.svn.sourceforge.net/simspark/?rev=195&view=rev Author: sgvandijk Date: 2010-05-07 18:57:03 +0000 (Fri, 07 May 2010) Log Message: ----------- - Branch rev 194 Revision Links: -------------- http://simspark.svn.sourceforge.net/simspark/?rev=194&view=rev Added Paths: ----------- branches/agentselection/ Property changes on: branches/agentselection ___________________________________________________________________ Added: svn:ignore + .project Added: svn:mergeinfo + /branches/treehole:175 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-04-10 11:08:37
|
Revision: 194 http://simspark.svn.sourceforge.net/simspark/?rev=194&view=rev Author: hedayat Date: 2010-04-10 11:08:31 +0000 (Sat, 10 Apr 2010) Log Message: ----------- Make the speed of log playback equal to the speed of log saving. Modified Paths: -------------- trunk/spark/spark/spark.rb Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2010-04-04 09:49:22 UTC (rev 193) +++ trunk/spark/spark/spark.rb 2010-04-10 11:08:31 UTC (rev 194) @@ -227,7 +227,7 @@ monitorClient = sparkCreate('SparkMonitorLogFileServer', $serverPath+'simulation/SparkMonitorLogFileServer') monitorClient.setFileName($logPlayerFile) - monitorClient.setStepDelay(33000) + monitorClient.setStep($monitorLoggerStep) end rubySceneImporter = get($serverPath+'scene/RubySceneImporter') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yx...@us...> - 2010-04-04 09:49:28
|
Revision: 193 http://simspark.svn.sourceforge.net/simspark/?rev=193&view=rev Author: yxu Date: 2010-04-04 09:49:22 +0000 (Sun, 04 Apr 2010) Log Message: ----------- * initialize accelerometer * remove the filter in accelerometer ( team can filter it by themselves) Modified Paths: -------------- trunk/spark/plugin/accelerometer/accelerometer.cpp Modified: trunk/spark/plugin/accelerometer/accelerometer.cpp =================================================================== --- trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-03-31 23:10:34 UTC (rev 192) +++ trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-04-04 09:49:22 UTC (rev 193) @@ -48,6 +48,7 @@ mGravity = mBody->GetWorld()->GetGravity(); mLastVel = mBody->GetVelocity(); + mAcc.Zero(); } bool Accelerometer::Percept(boost::shared_ptr<PredicateList> predList) @@ -75,15 +76,12 @@ // float mass = mBody->GetMass(); // mAcc = F / mass - mGravity; + // calculate the acceleration according to velocity, it is a bit noise Vector3f vel = mBody->GetVelocity(); Vector3f acc = (vel - mLastVel) / deltaTime; acc -= mGravity; Matrix invRot = mBody->GetRotation(); invRot.InvertRotationMatrix(); - acc = invRot * acc; - - float k = 0.9; - mAcc = k*mAcc + (1-k)*acc; - mLastVel = vel; + mAcc = invRot * acc; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yx...@us...> - 2010-03-31 23:10:41
|
Revision: 192 http://simspark.svn.sourceforge.net/simspark/?rev=192&view=rev Author: yxu Date: 2010-03-31 23:10:34 +0000 (Wed, 31 Mar 2010) Log Message: ----------- fix radius of field ring Modified Paths: -------------- trunk/rcssserver3d/data/rsg/agent/fieldline.rsg trunk/rcssserver3d/data/rsg/agent/fieldring.rsg Modified: trunk/rcssserver3d/data/rsg/agent/fieldline.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/fieldline.rsg 2010-03-30 13:50:44 UTC (rev 191) +++ trunk/rcssserver3d/data/rsg/agent/fieldline.rsg 2010-03-31 23:10:34 UTC (rev 192) @@ -16,12 +16,13 @@ ;; (def $centerX (eval (eval $BegX + $EndX) / 2.0)) ;; (def $centerY (eval (eval $BegY + $EndY) / 2.0)) - ;; (def $lengthY (eval (eval $EndY - $BegY) / 2.0)) + ;; (def $lengthX (eval $EndX - $BegX)) + ;; (def $lengthY (eval $EndY - $BegY)) ;; (nd Transform ;; (setLocalPos $centerX $centerY 0) ;; (nd Box - ;; (setExtents 0.1 $lengthY 0.1) + ;; (setExtents $lengthX $lengthY 0.1) ;; ) ;; ) ) \ No newline at end of file Modified: trunk/rcssserver3d/data/rsg/agent/fieldring.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/fieldring.rsg 2010-03-30 13:50:44 UTC (rev 191) +++ trunk/rcssserver3d/data/rsg/agent/fieldring.rsg 2010-03-31 23:10:34 UTC (rev 192) @@ -7,23 +7,23 @@ ( (templ $Radius) - (def $px0 1.0) + (def $px0 (eval 1.0 * $Radius)) (def $py0 0.0) - (def $px36 0.80901699437494745) - (def $py36 0.58778525229247314) + (def $px36 (eval 0.80901699437494745 * $Radius)) + (def $py36 (eval 0.58778525229247314 * $Radius)) - (def $px72 0.30901699437494745) - (def $py72 0.95105651629515353) + (def $px72 (eval 0.30901699437494745 * $Radius)) + (def $py72 (eval 0.95105651629515353 * $Radius)) - (def $px108 -0.30901699437494734) - (def $py108 0.95105651629515364) + (def $px108 (eval -0.30901699437494734 * $Radius)) + (def $py108 (eval 0.95105651629515364 * $Radius)) - (def $px144 -0.80901699437494734) - (def $py144 0.58778525229247325) + (def $px144 (eval -0.80901699437494734 * $Radius)) + (def $py144 (eval 0.58778525229247325 * $Radius)) - (def $px180 -1.0) - (def $py180 0.0) + (def $px180 (eval -1.0 * $Radius)) + (def $py180 (eval 0.0)) (def $px216 $px144) (def $py216 (eval -1 * $py144)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |