From: <he...@us...> - 2013-04-24 20:11:48
|
Revision: 349 http://simspark.svn.sourceforge.net/simspark/?rev=349&view=rev Author: hedayat Date: 2013-04-24 20:11:40 +0000 (Wed, 24 Apr 2013) Log Message: ----------- Add heterogeneous robot type to AgentState, so that it can be checked by rules. Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h trunk/rcssserver3d/plugin/soccer/agentstate/agentstate_c.cpp Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2013-04-12 09:04:57 UTC (rev 348) +++ trunk/rcssserver3d/ChangeLog 2013-04-24 20:11:40 UTC (rev 349) @@ -1,3 +1,11 @@ +2013-04-25 Hedayat Vatankhah <hed...@gm...> + + * data/rsg/agent/nao/nao_hetero.rsg: + * plugin/soccer/agentstate/agentstate.h: + * plugin/soccer/agentstate/agentstate.cpp: + * plugin/soccer/agentstate/agentstate_c.cpp: + - added robot type to agent state + 2012-11-25 Hedayat Vatankhah <hed...@gm...> * data/rsg/agent/nao/nao_hetero.rsg: Modified: trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg 2013-04-12 09:04:57 UTC (rev 348) +++ trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg 2013-04-24 20:11:40 UTC (rev 349) @@ -70,6 +70,7 @@ (nd AgentState (setName AgentState) + (setRobotType $type) (nd GameStatePerceptor) (nd HearPerceptor) (nd Transform Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2013-04-12 09:04:57 UTC (rev 348) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2013-04-24 20:11:40 UTC (rev 349) @@ -76,6 +76,18 @@ } void +AgentState::SetRobotType(int type) +{ + mRobotType = type; +} + +int +AgentState::GetRobotType() const +{ + return mRobotType; +} + +void AgentState::SetID(const std::string& id, TPerceptType pt) { std::istringstream iss(id); @@ -238,7 +250,7 @@ GetLog()->Error() << "ERROR: (AgentState::OnUnlink) could not get game state\n"; return; } - + game_state->ReturnUniform(GetTeamIndex(), GetUniformNumber()); } Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2013-04-12 09:04:57 UTC (rev 348) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2013-04-24 20:11:40 UTC (rev 349) @@ -59,6 +59,12 @@ /** returns the uniform number as integer */ int GetUniformNumber() const; + /** Set the robot type. */ + void SetRobotType(int type); + + /** returns the robot type */ + int GetRobotType() const; + /** Set the object id for perceptors. * * This method is the same as SetUniformNumber for AgentState. @@ -97,25 +103,25 @@ /** Whether agent is selected */ bool IsSelected() const; - + /** Select agent */ void Select(bool s = true); - + /** Unselect agent */ void UnSelect(); - + /** Backup old touch group and create new empty one */ void NewTouchGroup(); - + /** Get the touch group of the previous step */ boost::shared_ptr<TouchGroup> GetOldTouchGroup(); - + /** Get the current touch group */ boost::shared_ptr<TouchGroup> GetTouchGroup(); - + /** Set the current touch group */ void SetTouchGroup(boost::shared_ptr<TouchGroup> group); - + protected: /** team index */ TTeamIndex mTeamIndex; @@ -123,6 +129,9 @@ /** uniform number */ int mUniformNumber; + /** robot type */ + int mRobotType; + /** motor temperature */ float mTemperature; @@ -161,7 +170,7 @@ /** is this agent selected */ bool mSelected; - + boost::shared_ptr<TouchGroup> mOldTouchGroup; boost::shared_ptr<TouchGroup> mTouchGroup; Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate_c.cpp 2013-04-12 09:04:57 UTC (rev 348) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate_c.cpp 2013-04-24 20:11:40 UTC (rev 349) @@ -25,8 +25,25 @@ using namespace boost; using namespace oxygen; +FUNCTION(AgentState,setRobotType) +{ + int inType; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in.begin(), inType)) + ) + { + return false; + } + + obj->SetRobotType(inType); + return true; +} + void CLASS(AgentState)::DefineClass() { DEFINE_BASECLASS(ObjectState); + DEFINE_FUNCTION(setRobotType); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |