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: <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-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-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-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. |