From: <he...@us...> - 2012-04-16 09:41:48
|
Revision: 305 http://simspark.svn.sourceforge.net/simspark/?rev=305&view=rev Author: hedayat Date: 2012-04-16 09:41:37 +0000 (Mon, 16 Apr 2012) Log Message: ----------- Fixed a small bug in TrainerCommandParser Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2012-04-09 21:00:07 UTC (rev 304) +++ trunk/rcssserver3d/ChangeLog 2012-04-16 09:41:37 UTC (rev 305) @@ -1,3 +1,9 @@ +2012-04-15 Hedayat Vatankhah <hed...@gm...> + + * plugin/soccer/trainercommandparser/trainercommandparser.cpp + (TrainerCommandParser::ParsePlayerCommand): + - fixed a small bug in parsing move paramter (Thanks to Andreas Seekircher) + 2012-04-10 Hedayat Vatankhah <hed...@gm...> * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp Modified: trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2012-04-09 21:00:07 UTC (rev 304) +++ trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2012-04-16 09:41:37 UTC (rev 305) @@ -52,7 +52,7 @@ mCommandMap["repos"] = CT_REPOS; mCommandMap["killsim"] = CT_KILLSIM; mCommandMap["reqfullstate"] = CT_REQFULLSTATE; - + // setup team index map // Originally team sides were "L","R" and "N" // But this seems to be unused @@ -124,7 +124,7 @@ mSimServer = shared_dynamic_cast<SimulationServer> (GetCore()->Get("/sys/server/simulation")); - + if (mGameControl.get() == 0) { GetLog()->Error() << "ERROR: (TrainerCommandParser) Unable to get SimulationServer\n"; @@ -132,7 +132,7 @@ mMonitorControl = shared_dynamic_cast<MonitorControl> (mSimServer->GetControlNode("MonitorControl")); - + if (mMonitorControl.get() == 0) { GetLog()->Error() << "ERROR: (TrainerCommandParser) Unable to get MonitorControl\n"; @@ -235,7 +235,7 @@ case CT_REQFULLSTATE: mMonitorControl->RequestFullState(); break; - + default: return false; } @@ -244,7 +244,7 @@ } void TrainerCommandParser::ParsePlayerCommand(const oxygen::Predicate & predicate) -{ +{ Predicate::Iterator unumParam(predicate); int unum; bool specified = true; @@ -257,7 +257,7 @@ } else specified = false; - + string team; TTeamIndex idx; Predicate::Iterator teamParam(predicate); @@ -269,7 +269,7 @@ specified = false; else idx = mTeamIndexMap[team]; - } + } else specified = false; @@ -278,17 +278,17 @@ mSoccerRule->ClearSelectedPlayers(); return; } - + SoccerBase::TAgentStateList agentStates; - SoccerBase::GetAgentStates(*this, agentStates, (specified ? idx : TI_NONE)); + SoccerBase::GetAgentStates(*this, agentStates, (specified ? idx : TI_NONE)); SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); bool found = false; while (iter != agentStates.end() && !found) - { + { if ((specified && (*iter)->GetUniformNumber() == unum && (*iter)->GetTeamIndex() == idx) || (!specified && (*iter)->IsSelected())) - found = true; + found = true; else ++iter; } @@ -296,7 +296,7 @@ if (!found) { GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get correct AgentState\n"; - return; + return; } Predicate::Iterator posParam(predicate); @@ -332,7 +332,7 @@ float ang; // extract position vector - if (! predicate.GetValue(moveParam, pos)) + if (! predicate.AdvanceValue(moveParam, pos)) { GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get agent rot\n"; return; @@ -358,7 +358,7 @@ } } - // Joschka: I removed the part to set a velocity because it doesn't really + // 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 Predicate::Iterator batParam(predicate); @@ -372,11 +372,11 @@ { GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get battery value\n"; return; - } + } // set new battery (*iter)->SetBattery(battery); - + } Predicate::Iterator tempParam(predicate); @@ -391,17 +391,17 @@ GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get temperatur value\n"; return; } - + // set new temperature (*iter)->SetBattery(temperature); - + } } void TrainerCommandParser::ParseBallCommand(const oxygen::Predicate& predicate) { - Predicate::Iterator posParam(predicate); + Predicate::Iterator posParam(predicate); if (predicate.FindParameter(posParam, "pos")) { @@ -412,7 +412,7 @@ { GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get ball pos\n"; return; - } + } boost::shared_ptr<RigidBody> body; @@ -515,7 +515,7 @@ { GetLog()->Error() << "(TrainerCommandParser) ERROR: unknown team" << team << "\n"; - + } } else @@ -527,11 +527,11 @@ } void TrainerCommandParser::ParseSelectCommand(const oxygen::Predicate & predicate) -{ +{ Predicate::Iterator unumParam(predicate); int unum; bool specified = true; - + boost::shared_ptr<SoccerRuleAspect> soccerRuleAspect; if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) { @@ -547,13 +547,13 @@ } else specified = false; - + if (specified && unum == -1) { soccerRuleAspect->ResetAgentSelection(); return; } - + string team; TTeamIndex idx; Predicate::Iterator teamParam(predicate); @@ -565,26 +565,26 @@ specified = false; else idx = mTeamIndexMap[team]; - } + } else specified = false; - + if (!specified) { soccerRuleAspect->SelectNextAgent(); return; } - + SoccerBase::TAgentStateList agentStates; - SoccerBase::GetAgentStates(*this, agentStates, idx); + SoccerBase::GetAgentStates(*this, agentStates, idx); SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); bool found = false; while (iter != agentStates.end() && !found) - { - if ((*iter)->GetUniformNumber() == unum) + { + if ((*iter)->GetUniformNumber() == unum) { - found = true; + found = true; } else ++iter; @@ -593,7 +593,7 @@ if (!found) { GetLog()->Error() << "(TrainerCommandParser) ERROR: can't get correct AgentState\n"; - return; + return; } soccerRuleAspect->ResetAgentSelection(); @@ -601,11 +601,11 @@ } void TrainerCommandParser::ParseKillCommand(const oxygen::Predicate & predicate) -{ +{ Predicate::Iterator unumParam(predicate); int unum; bool specified = true; - + boost::shared_ptr<SoccerRuleAspect> soccerRuleAspect; if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) { @@ -621,7 +621,7 @@ } else specified = false; - + string team; TTeamIndex idx; Predicate::Iterator teamParam(predicate); @@ -633,10 +633,10 @@ specified = false; else idx = mTeamIndexMap[team]; - } + } else specified = false; - + GameControlServer::TAgentAspectList agentAspects; mGameControl->GetAgentAspectList(agentAspects); GameControlServer::TAgentAspectList::iterator aaiter; @@ -660,13 +660,13 @@ } void TrainerCommandParser::ParseReposCommand(const oxygen::Predicate & predicate) -{ +{ cerr << "repos 2" << endl; Predicate::Iterator unumParam(predicate); int unum; bool specified = true; - + boost::shared_ptr<SoccerRuleAspect> soccerRuleAspect; if (!SoccerBase::GetSoccerRuleAspect(*this, soccerRuleAspect)) { @@ -682,7 +682,7 @@ } else specified = false; - + string team; TTeamIndex idx; Predicate::Iterator teamParam(predicate); @@ -694,12 +694,12 @@ specified = false; else idx = mTeamIndexMap[team]; - } + } else specified = false; SoccerBase::TAgentStateList agentStates; - SoccerBase::GetAgentStates(*this, agentStates, TI_NONE); + SoccerBase::GetAgentStates(*this, agentStates, TI_NONE); SoccerBase::TAgentStateList::iterator iter = agentStates.begin(); boost::shared_ptr<oxygen::Transform> agent_aspect; for (;iter != agentStates.end(); ++iter) @@ -715,14 +715,14 @@ SoccerBase::GetTransformParent(**iter, agent_aspect); cerr << "repos 3" << endl; - Vector3f new_pos = mSoccerRule->RepositionOutsidePos(ballPos, (*iter)->GetUniformNumber(), (*iter)->GetTeamIndex()); - SoccerBase::MoveAgent(agent_aspect, new_pos); + Vector3f new_pos = mSoccerRule->RepositionOutsidePos(ballPos, (*iter)->GetUniformNumber(), (*iter)->GetTeamIndex()); + SoccerBase::MoveAgent(agent_aspect, new_pos); break; } } } - + void TrainerCommandParser::ParseKillSimCommand(const oxygen::Predicate & predicate) { mSimServer->Quit(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |