From: <he...@us...> - 2012-06-21 09:06:07
|
Revision: 320 http://simspark.svn.sourceforge.net/simspark/?rev=320&view=rev Author: hedayat Date: 2012-06-21 09:05:56 +0000 (Thu, 21 Jun 2012) Log Message: ----------- Don't enforce single-kick-in-kickoff rule when there are 2 players or less in the game (e.g. Penalty shoots!) A small cleanup: use SoccerBase::GetGameControlServer() Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2012-05-27 18:52:22 UTC (rev 319) +++ trunk/rcssserver3d/ChangeLog 2012-06-21 09:05:56 UTC (rev 320) @@ -1,3 +1,12 @@ +2012-06-21 Hedayat Vatankhah <hed...@gm...> + + * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp: + - let a player kick the ball more than once in kickoff if there are not + more than 2 players inside the game. Should be removed when a proper + "Penalty mode" is added to the simulator + - small cleanup: call SoccerBase::GetGameControlServer() to access + game control server + 2012-05-23 Hedayat Vatankhah <hed...@gm...> * NEWS: Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2012-05-27 18:52:22 UTC (rev 319) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2012-06-21 09:05:56 UTC (rev 320) @@ -713,18 +713,11 @@ SoccerRuleAspect::UpdateBeforeKickOff() { // get game control server to check agent count - static boost::shared_ptr<GameControlServer> game_control; + boost::shared_ptr<GameControlServer> game_control; - if (game_control.get() == 0) + if (!SoccerBase::GetGameControlServer(*this, game_control)) { - game_control = shared_dynamic_cast<GameControlServer> - (GetCore()->Get("/sys/server/gamecontrol")); - - if (game_control.get() == 0) - { - GetLog()->Error() << "(SoccerRuleAspect) Error: can't get GameControlServer.\n"; - return; - } + return; } // if no players are connected, just return @@ -786,8 +779,13 @@ } if (time > mGameState->GetLastModeChange()) { + boost::shared_ptr<GameControlServer> game_control; + if (SoccerBase::GetGameControlServer(*this, game_control) + && game_control->GetAgentCount() > 2) // todo: remove this when there is a "penalty" playmode + { + mCheckKickOffKickerFault = true; + } mLastKickOffKickTime = time; - mCheckKickOffKickerFault = true; mLastKickOffTaker = agent; mGameState->SetPlayMode(PM_PlayOn); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2012-11-26 20:25:56
|
Revision: 329 http://simspark.svn.sourceforge.net/simspark/?rev=329&view=rev Author: hedayat Date: 2012-11-26 20:25:49 +0000 (Mon, 26 Nov 2012) Log Message: ----------- Added changed to enable heterogeneous Nao robots Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Added Paths: ----------- trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg trunk/rcssserver3d/rcssserver3d/naorobottypes.rb Removed Paths: ------------- trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2012-11-24 15:19:21 UTC (rev 328) +++ trunk/rcssserver3d/ChangeLog 2012-11-26 20:25:49 UTC (rev 329) @@ -1,3 +1,14 @@ +2012-11-25 Hedayat Vatankhah <hed...@gm...> + + * data/rsg/agent/nao/nao_hetero.rsg: + - nao_hetero.rsg can be used to create different variants of Nao robot + - nao.rsg a compatbility scene to create default Nao type (type 0) + + * rcssserver3d/naorobottypes.rb: + * rcssserver3d/naosoccersim.rb: + * rcssserver3d/CMakeLists.txt: + - added naorobottypes.rb to initialize Nao heterogeneous robot parameters + 2012-06-21 Hedayat Vatankhah <hed...@gm...> * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp: Deleted: trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg 2012-11-24 15:19:21 UTC (rev 328) +++ trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg 2012-11-26 20:25:49 UTC (rev 329) @@ -1,138 +0,0 @@ -; -*- mode: lisp; -*- - -; -; nao robot description file. -; - -(RSG 0 1) -( - -; -; The torso parameters -; - -(def $TorsoLength 0.1) -(def $TorsoWidth 0.1) -(def $TorsoHeight 0.18) -(def $TorsoMass 1.2171) - -(def $TorsoInitX 0) -(def $TorsoInitY -1) -(def $TorsoInitZ 1.5) - -(def $loadObj (eval Nao.UseTexture)) -; -;Begin Construct of Nao -; -(nd Space - (setName spacenao) - (disableInnerCollision true) - - ; - ;The torso part - ; - (nd AgentAspect - (setName body) - (setLocalPos $TorsoInitX $TorsoInitY $TorsoInitZ) - - (switch $loadObj - (true - (nd Transform - (setLocalRotation -90 0 180) - (nd StaticMesh - (load 'models/naobody.obj') - (setScale $TorsoLength $TorsoLength $TorsoLength) - ) - ) - ) - - (false - (importScene rsg/agent/nao/box_appearance.rsg $TorsoLength $TorsoWidth $TorsoHeight matGrey) - ) - ) - - ;(importScene rsg/agent/nao/box_physics.rsg $TorsoLength $TorsoWidth $TorsoHeight $TorsoMass) - (importScene rsg/agent/nao/box_physics_nocollider.rsg $TorsoLength $TorsoWidth $TorsoHeight $TorsoMass) - (nd BoxCollider - (setName TorsoCollider) - (setBoxLengths $TorsoLength $TorsoWidth $TorsoHeight) - (importScene rsg/agent/nao/contactjointhandler.rsg) - ) - - ;Install effectors and perceptors - (nd StaticMeshInitEffector) - - (nd TimePerceptor) - - (nd AgentState - (setName AgentState) - (nd GameStatePerceptor) - (nd HearPerceptor) - (nd Transform - (nd Cylinder - (setName SelectionMarker) - (setParams 1.0 1.0) - (setScale 0.2 0.2 0.02) - (setMaterial matSelect) - (setTransparent) - ) - ) - ) - - (nd GyroRatePerceptor (setName torso)) - (nd Accelerometer (setName torso)) - - ;(nd HMDPPerceptor) - ;(nd HMDPEffector) - - (nd BeamEffector) - - (nd SayEffector) - - ;(nd VisionPerceptor - ; (setSenseMyPos false) - ; (setStaticSenseAxis false) - ; (addNoise false)) - - (nd AgentSyncEffector) - - );end of AgentAspect - - - ; - ;The neck and head part - ; - (importScene rsg/agent/nao/naoneckhead.rsg $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) - - - ; - ;The Right Arm - ; - (importScene rsg/agent/nao/naoarm.rsg - 1 r - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) - - ; - ;The Left Arm - ; - (importScene rsg/agent/nao/naoarm.rsg - -1 l - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) - - ; - ;The Right Leg - ; - (importScene rsg/agent/nao/naoleg.rsg - 1 r - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) - - ; - ;The Left Leg - ; - (importScene rsg/agent/nao/naoleg.rsg - -1 l - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) - -);end of nd Space - -);end of RSG 0 1 Copied: trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg (from rev 317, trunk/rcssserver3d/data/rsg/agent/nao/nao.rsg) =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg (rev 0) +++ trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg 2012-11-26 20:25:49 UTC (rev 329) @@ -0,0 +1,142 @@ +; -*- mode: lisp; -*- + +; +; nao robot description file. +; + +(RSG 0 1) +( + +(templ $type) + +; +; The torso parameters +; + +;(def $TorsoLength (eval "NaoType["$type"]['tl']")) + +(def $TorsoLength 0.1) +(def $TorsoWidth 0.1) +(def $TorsoHeight 0.18) +(def $TorsoMass 1.2171) + +(def $TorsoInitX 0) +(def $TorsoInitY -1) +(def $TorsoInitZ 1.5) + +(def $loadObj (eval Nao.UseTexture)) +; +;Begin Construct of Nao +; +(nd Space + (setName spacenao) + (disableInnerCollision true) + + ; + ;The torso part + ; + (nd AgentAspect + (setName body) + (setLocalPos $TorsoInitX $TorsoInitY $TorsoInitZ) + + (switch $loadObj + (true + (nd Transform + (setLocalRotation -90 0 180) + (nd StaticMesh + (load 'models/naobody.obj') + (setScale $TorsoLength $TorsoLength $TorsoLength) + ) + ) + ) + + (false + (importScene rsg/agent/nao/box_appearance.rsg $TorsoLength $TorsoWidth $TorsoHeight matGrey) + ) + ) + + ;(importScene rsg/agent/nao/box_physics.rsg $TorsoLength $TorsoWidth $TorsoHeight $TorsoMass) + (importScene rsg/agent/nao/box_physics_nocollider.rsg $TorsoLength $TorsoWidth $TorsoHeight $TorsoMass) + (nd BoxCollider + (setName TorsoCollider) + (setBoxLengths $TorsoLength $TorsoWidth $TorsoHeight) + (importScene rsg/agent/nao/contactjointhandler.rsg) + ) + + ;Install effectors and perceptors + (nd StaticMeshInitEffector) + + (nd TimePerceptor) + + (nd AgentState + (setName AgentState) + (nd GameStatePerceptor) + (nd HearPerceptor) + (nd Transform + (nd Cylinder + (setName SelectionMarker) + (setParams 1.0 1.0) + (setScale 0.2 0.2 0.02) + (setMaterial matSelect) + (setTransparent) + ) + ) + ) + + (nd GyroRatePerceptor (setName torso)) + (nd Accelerometer (setName torso)) + + ;(nd HMDPPerceptor) + ;(nd HMDPEffector) + + (nd BeamEffector) + + (nd SayEffector) + + ;(nd VisionPerceptor + ; (setSenseMyPos false) + ; (setStaticSenseAxis false) + ; (addNoise false)) + + (nd AgentSyncEffector) + + );end of AgentAspect + + + ; + ;The neck and head part + ; + (importScene rsg/agent/nao/naoneckhead.rsg $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + + + ; + ;The Right Arm + ; + (importScene rsg/agent/nao/naoarm.rsg + 1 r + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + + ; + ;The Left Arm + ; + (importScene rsg/agent/nao/naoarm.rsg + -1 l + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + + ; + ;The Right Leg + ; + (importScene rsg/agent/nao/naoleg.rsg + 1 r + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + + ; + ;The Left Leg + ; + (importScene rsg/agent/nao/naoleg.rsg + -1 l + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + +);end of nd Space + +);end of RSG 0 1 Modified: trunk/rcssserver3d/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/rcssserver3d/CMakeLists.txt 2012-11-24 15:19:21 UTC (rev 328) +++ trunk/rcssserver3d/rcssserver3d/CMakeLists.txt 2012-11-26 20:25:49 UTC (rev 329) @@ -27,7 +27,7 @@ ########### install files ############### -install(FILES rcssserver3d.rb soccersim.rb naosoccersim.rb +install(FILES rcssserver3d.rb soccersim.rb naosoccersim.rb naorobottypes.rb internalsoccermonitor.rb internalsoccerbindings.rb DESTINATION ${DATADIR}/${CMAKE_PROJECT_NAME}) Added: trunk/rcssserver3d/rcssserver3d/naorobottypes.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naorobottypes.rb (rev 0) +++ trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2012-11-26 20:25:49 UTC (rev 329) @@ -0,0 +1,6 @@ +NaoType = [ +# Type 0 (Standard Nao) +{'tl' => 0.1}, +# Type 1 +{'tl' => 0.12} +] Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2012-11-24 15:19:21 UTC (rev 328) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2012-11-26 20:25:49 UTC (rev 329) @@ -129,3 +129,6 @@ # install the TrainerCommandParser to parse commands received from a # monitor client sparkRegisterMonitorCmdParser 'TrainerCommandParser' + +# Load parameters for heterogeneous Nao robots +run "naorobottypes.rb" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kla...@us...> - 2013-04-12 09:05:05
|
Revision: 348 http://simspark.svn.sourceforge.net/simspark/?rev=348&view=rev Author: klausdorer Date: 2013-04-12 09:04:57 +0000 (Fri, 12 Apr 2013) Log Message: ----------- adjusted rsg files to be able to pass heterogeneous type information introduced the possibility to specify different joint max speeds added two heterogeneous types: longer leg and faster foot pitch Modified Paths: -------------- trunk/rcssserver3d/data/rsg/agent/nao/hingejoint.rsg trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg trunk/rcssserver3d/data/rsg/agent/nao/naoarm.rsg trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg trunk/rcssserver3d/data/rsg/agent/nao/universaljoint.rsg trunk/rcssserver3d/rcssserver3d/naorobottypes.rb Modified: trunk/rcssserver3d/data/rsg/agent/nao/hingejoint.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/hingejoint.rsg 2013-03-30 00:43:18 UTC (rev 347) +++ trunk/rcssserver3d/data/rsg/agent/nao/hingejoint.rsg 2013-04-12 09:04:57 UTC (rev 348) @@ -6,14 +6,9 @@ $Path_Body1 $Path_Body2 $Anchor_X $Anchor_Y $Anchor_Z $Axis_X $Axis_Y $Axis_Z - $Min $Max + $MinDeg $MaxDeg + $MaxAbsSpeed ) - - (def $PI 3.14159265) - ;(def $MinDeg (eval $Min * (eval 180.0 / $PI))) - ;(def $MaxDeg (eval $Max * (eval 180.0 / $PI))) - (def $MinDeg $Min) - (def $MaxDeg $Max) ; There are 2 types of motor installed on the real Nao, each type has ; 2 types of "Reduction ratio". @@ -23,7 +18,7 @@ ; We don't need to follow them totally that different hingeeffector is using ; different types of motor. ; All the hingeeffector uses the 351.77 - (def $MaxAbsSpeed (eval $PI * (eval 351.77 / 180.0))) + ; (def $MaxAbsSpeed (eval $PI * (eval 351.77 / 180.0))) ; ;Hinge Joint Parameters Modified: trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg 2013-03-30 00:43:18 UTC (rev 347) +++ trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg 2013-04-12 09:04:57 UTC (rev 348) @@ -106,7 +106,9 @@ ; ;The neck and head part ; - (importScene rsg/agent/nao/naoneckhead.rsg $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + (importScene rsg/agent/nao/naoneckhead.rsg + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) ; @@ -114,28 +116,32 @@ ; (importScene rsg/agent/nao/naoarm.rsg 1 r - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) ; ;The Left Arm ; (importScene rsg/agent/nao/naoarm.rsg -1 l - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) ; ;The Right Leg ; (importScene rsg/agent/nao/naoleg.rsg 1 r - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) ; ;The Left Leg ; (importScene rsg/agent/nao/naoleg.rsg -1 l - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj) + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) );end of nd Space Modified: trunk/rcssserver3d/data/rsg/agent/nao/naoarm.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/naoarm.rsg 2013-03-30 00:43:18 UTC (rev 347) +++ trunk/rcssserver3d/data/rsg/agent/nao/naoarm.rsg 2013-04-12 09:04:57 UTC (rev 348) @@ -8,6 +8,7 @@ ; (templ $LRFactor $LeftOrRight $Torso_X $Torso_Y $Torso_Z $loadObj + $type ) ; @@ -91,8 +92,12 @@ ; ;Joint Parameters ; + (def $PI 3.14159265) + (def $MaxAbsJointSpeed (eval $PI * (eval 351.77 / 180.0))) + (def $aj1_min -120) (def $aj1_max 120) + (def $aj1_max_abs_speed $MaxAbsJointSpeed) (def $right_aj2_min -95) (def $left_aj2_min -1) @@ -105,9 +110,11 @@ (def $aj2_max_c1 (eval (eval $right_aj2_max + $left_aj2_max) * 0.5)) (def $aj2_max_c2 (eval (eval $right_aj2_max - $left_aj2_max) * 0.5)) (def $aj2_max (eval $aj2_max_c1 + (eval $LRFactor * $aj2_max_c2))) + (def $aj2_max_abs_speed $MaxAbsJointSpeed) (def $aj3_min -120) (def $aj3_max 120) + (def $aj3_max_abs_speed $MaxAbsJointSpeed) (def $right_aj4_min -1) (def $left_aj4_min -90) @@ -120,6 +127,7 @@ (def $aj4_max_c1 (eval (eval $right_aj4_max + $left_aj4_max) * 0.5)) (def $aj4_max_c2 (eval (eval $right_aj4_max - $left_aj4_max) * 0.5)) (def $aj4_max (eval $aj4_max_c1 + (eval $LRFactor * $aj4_max_c2))) + (def $aj4_max_abs_speed $MaxAbsJointSpeed) (def $aj2_Anchor_X (eval -1 * $UpperarmRelShoulderX)) @@ -152,7 +160,8 @@ ../sphereBody ../../body/boxBody 0 0 0 1 0 0 ;1 -1 -1 - $aj1_min $aj1_max) + $aj1_min $aj1_max + $aj1_max_abs_speed) ) ; @@ -175,11 +184,12 @@ (importScene rsg/agent/nao/box_physics.rsg $UpperArmSizeX $UpperArmSizeY $UpperArmSizeZ $UpperArmMass) (importScene rsg/agent/nao/hingejoint.rsg - $Joint2PerName $Joint2EffName - ../boxBody $ShoulderBodyPath - $aj2_Anchor_X $aj2_Anchor_Y $aj2_Anchor_Z - 0 0 1 ;2 -1 -1 - $aj2_min $aj2_max) + $Joint2PerName $Joint2EffName + ../boxBody $ShoulderBodyPath + $aj2_Anchor_X $aj2_Anchor_Y $aj2_Anchor_Z + 0 0 1 ;2 -1 -1 + $aj2_min $aj2_max + $aj2_max_abs_speed) ) ; @@ -195,11 +205,12 @@ (importScene rsg/agent/nao/sphere_physics_nocollider.rsg $ElbowRadius $ElbowMass) (importScene rsg/agent/nao/hingejoint.rsg - $Joint3PerName $Joint3EffName - ../sphereBody $UpperarmBodyPath - 0 0 0 - 0 1 0 ;1 -1 -1 - $aj3_min $aj3_max) + $Joint3PerName $Joint3EffName + ../sphereBody $UpperarmBodyPath + 0 0 0 + 0 1 0 ;1 -1 -1 + $aj3_min $aj3_max + $aj3_max_abs_speed) ) ; @@ -221,11 +232,12 @@ (importScene rsg/agent/nao/box_physics.rsg $LowerArmSizeX $LowerArmSizeY $LowerArmSizeZ $LowerArmMass) (importScene rsg/agent/nao/hingejoint.rsg - $Joint4PerName $Joint4EffName - ../boxBody $ElbowBodyPath - $aj4_Anchor_X $aj4_Anchor_Y $aj4_Anchor_Z - 0 0 1 ;2 -1 -1 - $aj4_min $aj4_max) + $Joint4PerName $Joint4EffName + ../boxBody $ElbowBodyPath + $aj4_Anchor_X $aj4_Anchor_Y $aj4_Anchor_Z + 0 0 1 ;2 -1 -1 + $aj4_min $aj4_max + $aj4_max_abs_speed) (nd ObjectState (setID $LowerarmName) Modified: trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg 2013-03-30 00:43:18 UTC (rev 347) +++ trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg 2013-04-12 09:04:57 UTC (rev 348) @@ -8,6 +8,7 @@ ; (templ $LRFactor $LeftOrRight $Torso_X $Torso_Y $Torso_Z $loadObj + $type ) ; @@ -56,7 +57,8 @@ (def $ThighRelHip2_X 0) (def $ThighRelHip2_Y 0.01) - (def $ThighRelHip2_Z -0.04) + ;(def $ThighRelHip2_Z -0.04) + (def $ThighRelHip2_Z (eval "NaoType["$type"]['ThighRelHip2_Z']")) (def $ShankRelThigh_X 0) (def $ShankRelThigh_Y 0.005) @@ -125,8 +127,12 @@ ; ;Joint Parameters ; + (def $PI 3.14159265) + (def $MaxAbsJointSpeed (eval $PI * (eval 351.77 / 180.0))) + (def $lj1_min -90) (def $lj1_max 1) + (def $lj1_max_abs_speed $MaxAbsJointSpeed) (def $right_lj2_min -45) (def $left_lj2_min -25) @@ -139,15 +145,19 @@ (def $lj2_max_c1 (eval (eval $right_lj2_max + $left_lj2_max) * 0.5)) (def $lj2_max_c2 (eval (eval $right_lj2_max - $left_lj2_max) * 0.5)) (def $lj2_max (eval $lj2_max_c1 + (eval $LRFactor * $lj2_max_c2))) + (def $lj2_max_abs_speed $MaxAbsJointSpeed) (def $lj3_min -25) (def $lj3_max 100) + (def $lj3_max_abs_speed $MaxAbsJointSpeed) (def $lj4_min -130) (def $lj4_max 1) + (def $lj4_max_abs_speed $MaxAbsJointSpeed) (def $lj5_min -45) (def $lj5_max 75) + (def $lj5_max_abs_speed (eval "NaoType["$type"]['lj5_max_abs_speed']")) (def $right_lj6_min -25) (def $left_lj6_min -45) @@ -160,6 +170,7 @@ (def $lj6_max_c1 (eval (eval $right_lj6_max + $left_lj6_max) * 0.5)) (def $lj6_max_c2 (eval (eval $right_lj6_max - $left_lj6_max) * 0.5)) (def $lj6_max (eval $lj6_max_c1 + (eval $LRFactor * $lj6_max_c2))) + (def $lj6_max_abs_speed (eval "NaoType["$type"]['lj6_max_abs_speed']")) (def $lj1_axis_x -0.7071) (def $lj1_axis_y 0) @@ -193,7 +204,8 @@ ../sphereBody ../../body/boxBody 0 0 0 $lj1_axis_x $lj1_axis_y $lj1_axis_z - $lj1_min $lj1_max) + $lj1_min $lj1_max + $lj1_max_abs_speed) ) ; @@ -212,7 +224,8 @@ ../sphereBody $Hip1BodyPath 0 0 0 ;anchor 0 1 0 ;axis - $lj2_min $lj2_max) + $lj2_min $lj2_max + $lj2_max_abs_speed) ) ; @@ -243,11 +256,12 @@ (importScene rsg/agent/nao/hingejoint.rsg - $Joint3PerName $Joint3EffName - ../boxBody $Hip2BodyPath - $lj3_Anchor_X $lj3_Anchor_Y $lj3_Anchor_Z - 1 0 0 ;1 -1 -1 - $lj3_min $lj3_max) + $Joint3PerName $Joint3EffName + ../boxBody $Hip2BodyPath + $lj3_Anchor_X $lj3_Anchor_Y $lj3_Anchor_Z + 1 0 0 ;1 -1 -1 + $lj3_min $lj3_max + $lj3_max_abs_speed) ) @@ -277,11 +291,12 @@ ) (importScene rsg/agent/nao/hingejoint.rsg - $Joint4PerName $Joint4EffName - ../boxBody $ThighBodyPath - 0 -0.01 0.045 - 1 0 0 ;0 -1 -1 - $lj4_min $lj4_max) + $Joint4PerName $Joint4EffName + ../boxBody $ThighBodyPath + 0 -0.01 0.045 + 1 0 0 ;0 -1 -1 + $lj4_min $lj4_max + $lj4_max_abs_speed) ) @@ -301,7 +316,8 @@ ../sphereBody $ShankBodyPath 0 0 0 1 0 0 ;0 -1 -1 - $lj5_min $lj5_max) + $lj5_min $lj5_max + $lj5_max_abs_speed) ) @@ -336,11 +352,12 @@ ) (importScene rsg/agent/nao/hingejoint.rsg - $Joint6PerName $Joint6EffName - ../boxBody $AnkleBodyPath - 0 -0.03 0.035 - 0 1 0 ;1 -1 -1 - $lj6_min $lj6_max) + $Joint6PerName $Joint6EffName + ../boxBody $AnkleBodyPath + 0 -0.03 0.035 + 0 1 0 ;1 -1 -1 + $lj6_min $lj6_max + $lj6_max_abs_speed) (nd ObjectState (setID $FootName) Modified: trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg 2013-03-30 00:43:18 UTC (rev 347) +++ trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg 2013-04-12 09:04:57 UTC (rev 348) @@ -2,7 +2,9 @@ (RSG 0 1) ( - (templ $Torso_X $Torso_Y $Torso_Z $loadObj) + (templ $Torso_X $Torso_Y $Torso_Z $loadObj + $type + ) ; ;neck parameter @@ -27,14 +29,19 @@ ; ;Head effector 1 parameter ; + (def $PI 3.14159265) + (def $MaxAbsJointSpeed (eval $PI * (eval 351.77 / 180.0))) + (def $he1_min -120) (def $he1_max 120) + (def $he1_max_abs_speed $MaxAbsJointSpeed) ; ;Head effector 2 parameter ; (def $he2_min -45) (def $he2_max 45) + (def $he2_max_abs_speed $MaxAbsJointSpeed) ; ;Begin construct neck @@ -51,7 +58,8 @@ ../capsuleBody ../../body/boxBody 0 0 0 0 0 1 - $he1_min $he1_max) + $he1_min $he1_max + $he1_max_abs_speed) ) ; @@ -84,7 +92,8 @@ ;../boxBody ../../body/boxBody 0 0 -0.005 1 0 0 - $he2_min $he2_max) + $he2_min $he2_max + $he2_max_abs_speed) (nd RestrictedVisionPerceptor (setViewCones 120 120) Modified: trunk/rcssserver3d/data/rsg/agent/nao/universaljoint.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/universaljoint.rsg 2013-03-30 00:43:18 UTC (rev 347) +++ trunk/rcssserver3d/data/rsg/agent/nao/universaljoint.rsg 2013-04-12 09:04:57 UTC (rev 348) @@ -9,6 +9,7 @@ $Axis2_X $Axis2_Y $Axis2_Z $Min0 $Max0 $Min1 $Max1 + $MaxAbsSpeed ) (def $PI 3.14159265) @@ -26,7 +27,6 @@ (def $Stop_ERP 0.8) (def $FudgeFactor 1e-5) (def $Bounce 1) - (def $MaxAbsSpeed (eval $PI * (eval 351.77 / 180.0))) (nd UniversalJoint (attach $Path_Body1 $Path_Body2) Modified: trunk/rcssserver3d/rcssserver3d/naorobottypes.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2013-03-30 00:43:18 UTC (rev 347) +++ trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2013-04-12 09:04:57 UTC (rev 348) @@ -1,6 +1,8 @@ NaoType = [ # Type 0 (Standard Nao) -{'tl' => 0.1}, +{'ThighRelHip2_Z' => -0.04, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395}, # Type 1 -{'tl' => 0.12} +{'ThighRelHip2_Z' => -0.08, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395}, +# Type 2 +{'ThighRelHip2_Z' => -0.04, 'lj5_max_abs_speed' => 9.21, 'lj6_max_abs_speed' => 4.605} ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <sgv...@us...> - 2013-05-22 14:59:04
|
Revision: 351 http://sourceforge.net/p/simspark/svn/351 Author: sgvandijk Date: 2013-05-22 14:59:02 +0000 (Wed, 22 May 2013) Log Message: ----------- - Rename fault to foul - SoccerRuleAspect keeps list of fouls - Created SoccerRuleItem; adds fouls to monitor protocol Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/CMakeLists.txt trunk/rcssserver3d/plugin/soccer/export.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Added Paths: ----------- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp Modified: trunk/rcssserver3d/plugin/soccer/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/plugin/soccer/CMakeLists.txt 2013-05-20 11:28:53 UTC (rev 350) +++ trunk/rcssserver3d/plugin/soccer/CMakeLists.txt 2013-05-22 14:59:02 UTC (rev 351) @@ -37,6 +37,7 @@ soccercontrolaspect/soccercontrolaspect.h soccernode/soccernode.h soccerruleaspect/soccerruleaspect.h + soccerruleaspect/soccerruleitem.h trainercommandparser/trainercommandparser.h gametimeperceptor/gametimeperceptor.h visionperceptor/visionperceptor.h @@ -106,6 +107,8 @@ soccernode/soccernode_c.cpp soccerruleaspect/soccerruleaspect.cpp soccerruleaspect/soccerruleaspect_c.cpp + soccerruleaspect/soccerruleitem.cpp + soccerruleaspect/soccerruleitem_c.cpp trainercommandparser/trainercommandparser.cpp trainercommandparser/trainercommandparser_c.cpp visionperceptor/visionperceptor.cpp Modified: trunk/rcssserver3d/plugin/soccer/export.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/export.cpp 2013-05-20 11:28:53 UTC (rev 350) +++ trunk/rcssserver3d/plugin/soccer/export.cpp 2013-05-22 14:59:02 UTC (rev 351) @@ -36,6 +36,7 @@ #include "gamestateaspect/gamestateitem.h" #include "ballstateaspect/ballstateaspect.h" #include "soccerruleaspect/soccerruleaspect.h" +#include "soccerruleaspect/soccerruleitem.h" #include "agentstate/agentstate.h" #include "sexpmonitor/sexpmonitor.h" #include "internalsoccermonitor/internalsoccerrender.h" @@ -63,6 +64,7 @@ ZEITGEIST_EXPORT(GameStateItem); ZEITGEIST_EXPORT(BallStateAspect); ZEITGEIST_EXPORT(SoccerRuleAspect); + ZEITGEIST_EXPORT(SoccerRuleItem); ZEITGEIST_EXPORT(BeamEffector); ZEITGEIST_EXPORT(CatchEffector); ZEITGEIST_EXPORT(CreateEffector); Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-05-20 11:28:53 UTC (rev 350) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-05-22 14:59:02 UTC (rev 351) @@ -68,9 +68,9 @@ mMin2PlDistance(0), // min dist for second closest of team before being repositioned mMin3PlDistance(0), // min dist for third closest of team before being repositioned mMaxTouchGroupSize(1000), - mMaxFaultTime(0.0), // maximum time allowed for a player to commit a positional fault before being repositioned + mMaxFoulTime(0.0), // maximum time allowed for a player to commit a positional foul before being repositioned mLastKickOffKickTime(0), - mCheckKickOffKickerFault(false) + mCheckKickOffKickerFoul(false) { mFreeKickPos = Vector3f(0.0,0.0,mBallRadius); } @@ -93,21 +93,21 @@ void SoccerRuleAspect::AutomaticSimpleReferee(TPlayMode playMode) { - // Reset counters and do not consider players' faults when game is not + // Reset counters and do not consider players' fouls when game is not // running if (mGameState->IsPaused()) { - ResetFaultCounter(TI_LEFT); - ResetFaultCounter(TI_RIGHT); + ResetFoulCounter(TI_LEFT); + ResetFoulCounter(TI_RIGHT); } else { CalculateDistanceArrays(TI_LEFT); // Calculates distance arrays for left team CalculateDistanceArrays(TI_RIGHT); // Calculates distance arrays for right team - AnalyseFaults(TI_LEFT); // Analyzes simple faults for the left team - AnalyseFaults(TI_RIGHT); // Analyzes simple faults for the right team - AnalyseTouchGroups(TI_LEFT); - AnalyseTouchGroups(TI_RIGHT); + AnalyseFouls(TI_LEFT); // Analyzes simple fouls for the left team + AnalyseFouls(TI_RIGHT); // Analyzes simple fouls for the right team + AnalyseTouchGroups(TI_LEFT); // Analyzes how many players are touching for the left team + AnalyseTouchGroups(TI_RIGHT); // Analyzes whether too many players are touching 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 @@ -120,21 +120,21 @@ void -SoccerRuleAspect::ResetFaultCounterPlayer(int unum, TTeamIndex idx) +SoccerRuleAspect::ResetFoulCounterPlayer(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; + playerFoulTime[unum][idx] = 0; } void -SoccerRuleAspect::ResetFaultCounter(TTeamIndex idx) +SoccerRuleAspect::ResetFoulCounter(TTeamIndex idx) { for(int t=1; t<=11; t++) { - ResetFaultCounterPlayer(t,idx); + ResetFoulCounterPlayer(t,idx); } } @@ -301,7 +301,8 @@ if (pl[idx] >= touchGroup->size() - pl[idx]) { - playerFaultTime[(*i)->GetUniformNumber()][idx]++; + playerFoulTime[(*i)->GetUniformNumber()][idx]++; + playerLastFoul[(*i)->GetUniformNumber()][idx] = FT_Touching; // Remove player from touch group so no more agents are replaced touchGroup->erase(*i); } @@ -309,7 +310,8 @@ { // I am the last one to enter the group, but the number of // opponents in the group are more than us - playerFaultTime[(*oppIt)->GetUniformNumber()][oppIdx]++; + playerFoulTime[(*oppIt)->GetUniformNumber()][oppIdx]++; + playerLastFoul[(*oppIt)->GetUniformNumber()][oppIdx] = FT_Touching; touchGroup->erase(*oppIt); } } @@ -330,8 +332,8 @@ } } -// Analyse Faults and Creates Fault Time Array -void SoccerRuleAspect::AnalyseFaults(TTeamIndex idx) +// Analyse Fouls and Creates Foul Time Array +void SoccerRuleAspect::AnalyseFouls(TTeamIndex idx) { TTeamIndex idx2; if (idx == TI_LEFT) @@ -345,13 +347,15 @@ if (unum != 1 && closestPlayerDist[idx2] < mMinOppDistance && (distArr[unum][idx] <= mMin3PlDistance + 0.01 && ordArr[unum][idx] == 3)) { - playerFaultTime[unum][idx]++; + playerFoulTime[unum][idx]++; + playerLastFoul[unum][idx] = FT_Crowding; } // I am the second closest player but i am too near the ball (and not the goalie) else if(unum != 1 && closestPlayerDist[idx2] < mMinOppDistance && distArr[unum][idx] <= mMin2PlDistance + 0.01 && ordArr[unum][idx] == 2 ) { - playerFaultTime[unum][idx]++; + playerFoulTime[unum][idx]++; + playerLastFoul[unum][idx] = FT_Crowding; } // 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 @@ -359,31 +363,36 @@ (prevPlayerInsideOwnArea[unum][idx] == 0 || (prevPlayerInsideOwnArea[1][idx] == 0 && playerInsideOwnArea[1][idx] == 1 && mMaxPlayersInsideOwnArea + 1 == ordGArr[unum][idx])))) { - playerFaultTime[unum][idx]++; + playerFoulTime[unum][idx]++; + playerLastFoul[unum][idx] = FT_IllegalDefence; } // I am a field player and on the ground for too much time else if (unum != 1 && playerGround[unum][idx] > mGroundMaxTime / 0.02) { - playerFaultTime[unum][idx]++; + playerFoulTime[unum][idx]++; + playerLastFoul[unum][idx] = FT_Incapable; } // I am a field player and I am not standing for too much time else if(unum!=1 && playerNotStanding[unum][idx] > mNotStandingMaxTime / 0.02) { - playerFaultTime[unum][idx]++; + playerFoulTime[unum][idx]++; + playerLastFoul[unum][idx] = FT_Incapable; } // I am the goalie and I am on the ground for too much time else if (unum == 1 && playerGround[unum][idx] > mGoalieGroundMaxTime / 0.02) { - playerFaultTime[unum][idx]++; + playerFoulTime[unum][idx]++; + playerLastFoul[unum][idx] = FT_Incapable; } // I am the goalie and I and not standing for too much time else if (unum == 1 && playerNotStanding[unum][idx] > mGoalieNotStandingMaxTime / 0.02) { - playerFaultTime[unum][idx]++; + playerFoulTime[unum][idx]++; + playerLastFoul[unum][idx] = FT_Incapable; } else { - playerFaultTime[unum][idx]=0; + playerFoulTime[unum][idx]=0; } } } @@ -424,14 +433,16 @@ SoccerBase::GetTransformParent(**i, agent_aspect); Vector3f agentPos = agent_aspect->GetWorldTransform().Pos(); int unum = (*i)->GetUniformNumber(); - if (playerFaultTime[unum][idx] > mMaxFaultTime / 0.02) + if (playerFoulTime[unum][idx] > mMaxFoulTime / 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); + ResetFoulCounterPlayer(unum, idx); + // Record faul + mFouls.push_back(Foul(mFouls.size() + 1, playerLastFoul[unum][idx], *i)); //cout << "*********Player Repos Num: " << unum << " Team: " << team << " Pos: " << new_pos << endl; } } @@ -591,7 +602,7 @@ } void -SoccerRuleAspect::PunishKickOffFault( +SoccerRuleAspect::PunishKickOffFoul( boost::shared_ptr<oxygen::AgentAspect> agent) { boost::shared_ptr<AgentState> agentState; @@ -666,6 +677,20 @@ } } +vector<SoccerRuleAspect::Foul> +SoccerRuleAspect::GetFouls() const +{ + return mFouls; +} + +vector<SoccerRuleAspect::Foul> +SoccerRuleAspect::GetFoulsSince(unsigned index) const +{ + Foul f(index+1, (EFoulType)0, boost::shared_ptr<AgentState>()); + vector<SoccerRuleAspect::Foul>::const_iterator low = lower_bound(mFouls.begin(), mFouls.end(), f); + return vector<Foul>(low, mFouls.end()); +} + void SoccerRuleAspect::DropBall() { @@ -783,7 +808,7 @@ if (SoccerBase::GetGameControlServer(*this, game_control) && game_control->GetAgentCount() > 2) // todo: remove this when there is a "penalty" playmode { - mCheckKickOffKickerFault = true; + mCheckKickOffKickerFoul = true; } mLastKickOffKickTime = time; mLastKickOffTaker = agent; @@ -1177,7 +1202,7 @@ boost::shared_ptr<AgentAspect> agent; if (WasLastKickFromKickOff(agent)) { - PunishKickOffFault(agent); + PunishKickOffFoul(agent); return false; } @@ -1189,18 +1214,18 @@ } bool -SoccerRuleAspect::CheckKickOffTakerFault() +SoccerRuleAspect::CheckKickOffTakerFoul() { - if (!mCheckKickOffKickerFault) + if (!mCheckKickOffKickerFoul) return false; boost::shared_ptr<AgentAspect> agent; if (!WasLastKickFromKickOff(agent)) // second kick { - mCheckKickOffKickerFault = false; + mCheckKickOffKickerFoul = false; if (agent == mLastKickOffTaker) { - PunishKickOffFault(mLastKickOffTaker); + PunishKickOffFoul(mLastKickOffTaker); return true; } } @@ -1232,7 +1257,7 @@ } #endif - if (CheckKickOffTakerFault()) + if (CheckKickOffTakerFoul()) { return; } @@ -1488,7 +1513,7 @@ SoccerBase::GetSoccerVar(*this,"Min2PlDistance",mMin2PlDistance); SoccerBase::GetSoccerVar(*this,"Min3PlDistance",mMin3PlDistance); SoccerBase::GetSoccerVar(*this,"MaxTouchGroupSize",mMaxTouchGroupSize); - //SoccerBase::GetSoccerVar(*this,"MaxFaultTime",mMaxFaultTime); + //SoccerBase::GetSoccerVar(*this,"MaxFoulTime",mMaxFoulTime); // cout << "MaxInside " << mMaxPlayersInsideOwnArea << endl << endl; Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2013-05-20 11:28:53 UTC (rev 350) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2013-05-22 14:59:02 UTC (rev 351) @@ -46,6 +46,29 @@ public: typedef std::list<boost::shared_ptr<AgentState> > TAgentStateList; + enum EFoulType + { + FT_Crowding, + FT_Touching, + FT_IllegalDefence, + FT_IllegalAttack, + FT_Incapable, + FT_KickOff + }; + + struct Foul + { + Foul(unsigned _index, EFoulType _type, boost::shared_ptr<AgentState> _agent) + : index(_index), + type(_type), + agent(_agent) + {} + int index; + EFoulType type; + boost::shared_ptr<AgentState> agent; + bool operator<(Foul const& other) const { return index < other.index; } + }; + public: SoccerRuleAspect(); virtual ~SoccerRuleAspect(); @@ -76,7 +99,7 @@ */ //salt::Vector3f RepositionInsidePos(salt::Vector3f initPos, int unum, TTeamIndex idx, float distance); - /** New rules for repositioning players that commit faults + /** New rules for repositioning players that commit fouls */ void ClearPlayersAutomatic(TTeamIndex idx); @@ -91,17 +114,17 @@ */ void ProcessAgentState(salt::Vector3f pos, int unum, TTeamIndex idx); - /** Reset the fault time counter for all players and also other counters + /** Reset the foul time counter for all players and also other counters */ - void ResetFaultCounter(TTeamIndex idx); + void ResetFoulCounter(TTeamIndex idx); - /** Reset the fault time counter for a given player + /** Reset the foul time counter for a given player */ - void ResetFaultCounterPlayer(int unum, TTeamIndex idx); + void ResetFoulCounterPlayer(int unum, TTeamIndex idx); - /**Analyse Faults from players and increase fault counter of offending players + /**Analyse Fouls from players and increase foul counter of offending players */ - void AnalyseFaults(TTeamIndex idx); + void AnalyseFouls(TTeamIndex idx); /** Check whether too many agents are touching */ @@ -146,7 +169,14 @@ */ salt::Vector2f GetFieldSize() const; + /** Get the foul history + */ + std::vector<Foul> GetFouls() const; + /** Get the foul history, starting from given foul index + */ + std::vector<Foul> GetFoulsSince(unsigned index) const; + void ResetAgentSelection(); void SelectNextAgent(); @@ -212,7 +242,7 @@ bool CheckOffside(); /** checks if kickoff taker has kicked the ball again before other players */ - bool CheckKickOffTakerFault(); + bool CheckKickOffTakerFoul(); /** moves the ball to pos setting its linear and angular velocity to 0 */ void MoveBall(const salt::Vector3f& pos); @@ -257,9 +287,9 @@ void SwapTeamSides(); /** - * Punish agent's fault committed during kickoff + * Punish agent's foul committed during kickoff */ - void PunishKickOffFault(boost::shared_ptr<oxygen::AgentAspect> agent); + void PunishKickOffFoul(boost::shared_ptr<oxygen::AgentAspect> agent); /** returns true if last kick was happenned in kick off */ bool WasLastKickFromKickOff( @@ -342,10 +372,10 @@ int mMaxPlayersInsideOwnArea; /** maximum number of players that may be in a single touch group */ int mMaxTouchGroupSize; - /** maximum time allowed for a player to commit a positional fault before being repositioned */ - int mMaxFaultTime; + /** maximum time allowed for a player to commit a positional foul before being repositioned */ + int mMaxFoulTime; - /* Useful arrays for dealing with agent state an faults */ + /* Useful arrays for dealing with agent state an fouls */ 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) @@ -356,7 +386,8 @@ 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 playerFoulTime[12][3]; //Time player is commiting a positional foul + EFoulType playerLastFoul[12][3]; //Type of last foul committed by player 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 @@ -399,7 +430,10 @@ /** the player which kicked in the last kick off mode */ boost::shared_ptr<oxygen::AgentAspect> mLastKickOffTaker; /** if kickoff taker should be checked for single kick rule */ - bool mCheckKickOffKickerFault; + bool mCheckKickOffKickerFoul; + + /** complete foul history */ + std::vector<Foul> mFouls; }; DECLARE_CLASS(SoccerRuleAspect); Added: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp (rev 0) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp 2013-05-22 14:59:02 UTC (rev 351) @@ -0,0 +1,78 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id: gamestateitem.cpp 259 2011-03-24 20:25:24Z hedayat $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "soccerruleitem.h" +#include <soccerbase/soccerbase.h> +#include <agentstate/agentstate.h> + +using namespace zeitgeist; +using namespace oxygen; +using namespace std; + +SoccerRuleItem::SoccerRuleItem() + : MonitorItem(), + mLastFoul(0) +{ +} + +SoccerRuleItem::~SoccerRuleItem() +{ +} + +void SoccerRuleItem::GetInitialPredicates(PredicateList& pList) +{ + GetPredicates(pList); +} + +void SoccerRuleItem::AddFoul(SoccerRuleAspect::Foul const& foul, PredicateList& pList) +{ + Predicate& predicate = pList.AddPredicate(); + predicate.name = "foul"; + predicate.parameter.AddValue(foul.index); + predicate.parameter.AddValue((int)foul.type); + predicate.parameter.AddValue((int)foul.agent->GetTeamIndex()); + predicate.parameter.AddValue((int)foul.agent->GetUniformNumber()); +} + +void SoccerRuleItem::GetPredicates(PredicateList& pList) +{ + if (mSoccerRule.get() == 0) + { + return; + } + + vector<SoccerRuleAspect::Foul> newFouls = mSoccerRule->GetFoulsSince(mLastFoul); + for (unsigned i = 0; i < newFouls.size(); ++i) + { + AddFoul(newFouls[i], pList); + mLastFoul = newFouls[i].index; + } +} + +void SoccerRuleItem::OnLink() +{ + SoccerBase::GetSoccerRuleAspect(*this, mSoccerRule); +} + +void SoccerRuleItem::OnUnlink() +{ + mSoccerRule.reset(); +} Added: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h (rev 0) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h 2013-05-22 14:59:02 UTC (rev 351) @@ -0,0 +1,64 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id: gamestateitem.h 21 2009-01-14 14:38:57Z yxu $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef SOCCERRULEITEM_H +#define SOCCERRULEITEM_H + +#include <oxygen/monitorserver/monitoritem.h> +#include "soccerruleaspect.h" + +class SoccerRuleItem : public oxygen::MonitorItem +{ +public: + SoccerRuleItem(); + virtual ~SoccerRuleItem(); + + /** This function is called once for every MonitorSystem each time + * a new client connects. It should append predicates to a list + * that is sent using the active monitor + */ + virtual void GetInitialPredicates(oxygen::PredicateList& pList); + + /** This function will be called periodically to append predicates + to a list that is sent using the active monitor + */ + virtual void GetPredicates(oxygen::PredicateList& pList); + + /** sets the reference to the GameStateAspect */ + virtual void OnLink(); + + /** resets the reference to the GameStateAspect */ + virtual void OnUnlink(); + +protected: + boost::shared_ptr<SoccerRuleAspect> mSoccerRule; + + //! Last foul sent out to monitors + unsigned mLastFoul; + + void AddFoul(SoccerRuleAspect::Foul const& foul, oxygen::PredicateList& pList); + +}; + +DECLARE_CLASS(SoccerRuleItem) + +#endif // SOCCERRULEITEM_H + Added: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp (rev 0) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp 2013-05-22 14:59:02 UTC (rev 351) @@ -0,0 +1,30 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id: gamestateitem_c.cpp 9 2008-11-24 02:39:02Z hedayat $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "soccerruleitem.h" + +using namespace oxygen; + +void CLASS(SoccerRuleItem)::DefineClass() +{ + DEFINE_BASECLASS(MonitorItem); +} Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-05-20 11:28:53 UTC (rev 350) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-05-22 14:59:02 UTC (rev 351) @@ -124,6 +124,7 @@ monitorServer = get($serverPath+'monitor') if (monitorServer != nil) monitorServer.registerMonitorItem('GameStateItem') + monitorServer.registerMonitorItem('SoccerRuleItem') end # install the TrainerCommandParser to parse commands received from a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kla...@us...> - 2013-05-29 05:32:18
|
Revision: 353 http://sourceforge.net/p/simspark/svn/353 Author: klausdorer Date: 2013-05-29 05:32:14 +0000 (Wed, 29 May 2013) Log Message: ----------- Adjusted NaoType1 (LongLeg) according to finding during tests at German Open. Arms are now also longer. Enlargement of legs is now split into two parts, half at hip, half at ankle. Inverse Kinematics Walks of Nao should now also work without major changes on this type. Modified Paths: -------------- trunk/rcssserver3d/data/rsg/agent/nao/naoarm.rsg trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg trunk/rcssserver3d/rcssserver3d/naorobottypes.rb Modified: trunk/rcssserver3d/data/rsg/agent/nao/naoarm.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/naoarm.rsg 2013-05-24 15:01:08 UTC (rev 352) +++ trunk/rcssserver3d/data/rsg/agent/nao/naoarm.rsg 2013-05-29 05:32:14 UTC (rev 353) @@ -46,7 +46,8 @@ (def $UpperarmRelShoulderZ 0) (def $ElbowRelUpperArm_X (eval $LRFactor * -0.01)) - (def $ElbowRelUpperArm_Y 0.07) + ;(def $ElbowRelUpperArm_Y 0.07) + (def $ElbowRelUpperArm_Y (eval "NaoType["$type"]['ElbowRelUpperArm_Y']")) (def $ElbowRelUpperArm_Z 0.009) (def $LowerarmRelElbow_X 0) Modified: trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg 2013-05-24 15:01:08 UTC (rev 352) +++ trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg 2013-05-29 05:32:14 UTC (rev 353) @@ -66,7 +66,8 @@ (def $AnkleRelShank_X 0) (def $AnkleRelShank_Y -0.01) - (def $AnkleRelShank_Z -0.055) + ;(def $AnkleRelShank_Z -0.055) + (def $AnkleRelShank_Z (eval "NaoType["$type"]['AnkleRelShank_Z']")) (def $FootRelAnkle_X 0) (def $FootRelAnkle_Y 0.03) Modified: trunk/rcssserver3d/rcssserver3d/naorobottypes.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2013-05-24 15:01:08 UTC (rev 352) +++ trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2013-05-29 05:32:14 UTC (rev 353) @@ -1,8 +1,8 @@ NaoType = [ # Type 0 (Standard Nao) -{'ThighRelHip2_Z' => -0.04, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395}, +{'ThighRelHip2_Z' => -0.04, 'AnkleRelShank_Z' => -0.055, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395, 'ElbowRelUpperArm_Y' => 0.07}, # Type 1 -{'ThighRelHip2_Z' => -0.08, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395}, +{'ThighRelHip2_Z' => -0.06, 'AnkleRelShank_Z' => -0.075, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395, 'ElbowRelUpperArm_Y' => 0.11}, # Type 2 -{'ThighRelHip2_Z' => -0.04, 'lj5_max_abs_speed' => 9.21, 'lj6_max_abs_speed' => 4.605} +{'ThighRelHip2_Z' => -0.04, 'AnkleRelShank_Z' => -0.055, 'lj5_max_abs_speed' => 9.21, 'lj6_max_abs_speed' => 4.605, 'ElbowRelUpperArm_Y' => 0.07} ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-06-05 20:03:22
|
Revision: 354 http://sourceforge.net/p/simspark/svn/354 Author: hedayat Date: 2013-06-05 20:03:19 +0000 (Wed, 05 Jun 2013) Log Message: ----------- Added sensing the orientation of the agent by Patrick MacAlpine Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor_c.cpp Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2013-05-29 05:32:14 UTC (rev 353) +++ trunk/rcssserver3d/ChangeLog 2013-06-05 20:03:19 UTC (rev 354) @@ -1,3 +1,11 @@ +2013-06-06 Hedayat Vatankhah <hed...@gm...> + + * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h: + * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp: + * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor_c.cpp: + * data/rsg/agent/nao/naoneckhead.rsg: + - Add MyOrientation sensing by Patrick (setSenseMyOrien in rsg file) + 2013-04-25 Hedayat Vatankhah <hed...@gm...> * data/rsg/agent/nao/nao_hetero.rsg: Modified: trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg 2013-05-29 05:32:14 UTC (rev 353) +++ trunk/rcssserver3d/data/rsg/agent/nao/naoneckhead.rsg 2013-06-05 20:03:19 UTC (rev 354) @@ -98,6 +98,7 @@ (nd RestrictedVisionPerceptor (setViewCones 120 120) (setSenseMyPos false) + (setSenseMyOrien false) (setSenseBallPos false) (setStaticSenseAxis false) (addNoise true) Modified: trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp 2013-05-29 05:32:14 UTC (rev 353) +++ trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp 2013-06-05 20:03:19 UTC (rev 354) @@ -38,6 +38,7 @@ RestrictedVisionPerceptor::RestrictedVisionPerceptor() : Perceptor(), mSenseMyPos(false), + mSenseMyOrien(false), mSenseBallPos(false), mAddNoise(true), mStaticSenseAxis(true), @@ -160,7 +161,7 @@ SoccerBase::GetTransformParent(*this,mTransformParent); // SoccerBase::GetAgentState(*this, mAgentState); SoccerBase::GetActiveScene(*this,mActiveScene); - + boost::shared_ptr<AgentAspect> agent_aspect = FindParentSupportingClass<AgentAspect>().lock(); if (agent_aspect == 0) @@ -176,7 +177,7 @@ { mAgentAspect = agent_aspect; } - + mAgentState = static_pointer_cast<AgentState> (mAgentAspect->GetChildOfClass("AgentState",true)); if (mAgentState == 0) @@ -272,7 +273,7 @@ } boost::shared_ptr<Transform> j = od.mObj->GetTransformParent(); - + if (j.get() == 0) { continue; // this should never happen @@ -280,7 +281,7 @@ od.mRelPos = j->GetWorldTransform().Pos() - myPos; od.mDist = od.mRelPos.Length(); - + visibleNodes[node].push_back(od); } } @@ -298,14 +299,14 @@ boost::shared_ptr<AgentAspect> agent_aspect = dynamic_pointer_cast<AgentAspect>(node); if (agent_aspect != 0) - { + { boost::shared_ptr<AgentAspect> aspect = agent_aspect->FindParentSupportingClass<AgentAspect>().lock(); if (aspect != 0) { agent_aspect = aspect; } - + boost::shared_ptr<AgentState> agent_state = static_pointer_cast<AgentState> (agent_aspect->GetChildOfClass("AgentState",true)); if (agent_state.get() == 0 || @@ -314,7 +315,7 @@ { return; } - + ParameterList& element = predicate.parameter.AddList(); element.AddValue(std::string("P")); @@ -461,21 +462,32 @@ element.AddValue(sensedMyPos[2]); } + if (mSenseMyOrien) + { + // Orientation + TTeamIndex ti = mAgentState->GetTeamIndex(); + Vector3f sensedMyUp = SoccerBase::FlipView(mTransformParent->GetWorldTransform().Up(), ti); + + ParameterList& element = predicate.parameter.AddList(); + element.AddValue(std::string("myorien")); + element.AddValue(gRadToDeg(gArcTan2(sensedMyUp[1], sensedMyUp[0]))); + } + if (mSenseBallPos) { TTeamIndex ti = mAgentState->GetTeamIndex(); boost::shared_ptr<Ball> ball; SoccerBase::GetBall(*this, ball); Vector3f sensedBallPos = SoccerBase::FlipView(ball->GetWorldTransform().Pos(), ti); - + ParameterList& element = predicate.parameter.AddList(); element.AddValue(std::string("ballpos")); element.AddValue(sensedBallPos[0]); element.AddValue(sensedBallPos[1]); element.AddValue(sensedBallPos[2]); - + } - + if (mSenseLine) { SenseLine(predicate); @@ -578,21 +590,32 @@ element.AddValue(sensedMyPos[2]); } + if (mSenseMyOrien) + { + // Orientation + TTeamIndex ti = mAgentState->GetTeamIndex(); + Vector3f sensedMyUp = SoccerBase::FlipView(mTransformParent->GetWorldTransform().Up(), ti); + + ParameterList& element = predicate.parameter.AddList(); + element.AddValue(std::string("myorien")); + element.AddValue(gRadToDeg(gArcTan2(sensedMyUp[1], sensedMyUp[0]))); + } + if (mSenseBallPos) { TTeamIndex ti = mAgentState->GetTeamIndex(); boost::shared_ptr<Ball> ball; SoccerBase::GetBall(*this, ball); Vector3f sensedBallPos = SoccerBase::FlipView(ball->GetWorldTransform().Pos(), ti); - + ParameterList& element = predicate.parameter.AddList(); element.AddValue(std::string("ballpos")); element.AddValue(sensedBallPos[0]); element.AddValue(sensedBallPos[1]); element.AddValue(sensedBallPos[2]); - + } - + if (mSenseLine) { SenseLine(predicate); @@ -665,6 +688,12 @@ } void +RestrictedVisionPerceptor::SetSenseMyOrien(bool sense) +{ + mSenseMyOrien = sense; +} + +void RestrictedVisionPerceptor::SetSenseBallPos(bool sense) { mSenseBallPos = sense; @@ -691,7 +720,7 @@ // object is too close return false; } - + const int hAngle_2 = mHViewCone >> 1; if (gAbs(od.mTheta) > hAngle_2) { @@ -737,7 +766,7 @@ { Vector3f bp3 = ld.mBeginPoint.mRelPos; Vector3f ep3 = ld.mEndPoint.mRelPos; - + if ( bp3.y() < focalLength && ep3.y() >= focalLength ) { float t = ( focalLength - ep3.y() ) / ( bp3.y() - ep3.y() ); @@ -807,7 +836,7 @@ } } } - + if (seeBeginPoint && seeEndPoint) { // make some noise Modified: trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h 2013-05-29 05:32:14 UTC (rev 353) +++ trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h 2013-06-05 20:03:19 UTC (rev 354) @@ -105,7 +105,10 @@ //! Turn sensing of agent position on/off void SetSenseMyPos(bool sense); - //! Turn sensing of agent position on/off + //! Turn sensing of agent orientation on/off + void SetSenseMyOrien(bool sense); + + //! Turn sensing of ball position on/off void SetSenseBallPos(bool sense); // turn sensing of lines on/off @@ -211,6 +214,9 @@ //! true, if the absolute position of the agent is sensed. bool mSenseMyPos; + + //! true, if the absolute orientation of the agent's camera in the x-y plane is sensed. + bool mSenseMyOrien; //! true, if the absolute position of the ball is sensed. bool mSenseBallPos; Modified: trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor_c.cpp 2013-05-29 05:32:14 UTC (rev 353) +++ trunk/rcssserver3d/plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor_c.cpp 2013-06-05 20:03:19 UTC (rev 354) @@ -80,6 +80,22 @@ return true; } +FUNCTION(RestrictedVisionPerceptor,setSenseMyOrien) +{ + bool inSenseMyOrien; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in.begin(),inSenseMyOrien)) + ) + { + return false; + } + + obj->SetSenseMyOrien(inSenseMyOrien); + return true; +} + FUNCTION(RestrictedVisionPerceptor,setSenseBallPos) { bool inSenseBallPos; @@ -188,6 +204,7 @@ DEFINE_FUNCTION(setNoiseParams); DEFINE_FUNCTION(addNoise); DEFINE_FUNCTION(setSenseMyPos); + DEFINE_FUNCTION(setSenseMyOrien); DEFINE_FUNCTION(setSenseBallPos); DEFINE_FUNCTION(setStaticSenseAxis); DEFINE_FUNCTION(setViewCones); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-06-08 21:23:57
|
Revision: 355 http://sourceforge.net/p/simspark/svn/355 Author: hedayat Date: 2013-06-08 21:23:54 +0000 (Sat, 08 Jun 2013) Log Message: ----------- Check the number of hetero players each team can use. Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2013-06-05 20:03:19 UTC (rev 354) +++ trunk/rcssserver3d/ChangeLog 2013-06-08 21:23:54 UTC (rev 355) @@ -1,3 +1,14 @@ +2013-06-09 Hedayat Vatankhah <hed...@gm...> + + * plugin/soccer/gamestateaspect/gamestateaspect.h: + * plugin/soccer/gamestateaspect/gamestateaspect.cpp: + * plugin/soccer/agentstate/agentstate.cpp (AgentState::OnUnlink): + * rcssserver3d/naosoccersim.rb: + - control the number of heterogeneous players each team can use. It limits + both the total number of heterogeneous players of each team + (MaxTotalHeteroCount variable in naosoccersim.rb), and the number of + heterogeneous players of each type (MaxHeteroTypeCount variable) + 2013-06-06 Hedayat Vatankhah <hed...@gm...> * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h: @@ -4,7 +15,7 @@ * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp: * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor_c.cpp: * data/rsg/agent/nao/naoneckhead.rsg: - - Add MyOrientation sensing by Patrick (setSenseMyOrien in rsg file) + - added MyOrientation sensing by Patrick (setSenseMyOrien in rsg file) 2013-04-25 Hedayat Vatankhah <hed...@gm...> Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2013-06-05 20:03:19 UTC (rev 354) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2013-06-08 21:23:54 UTC (rev 355) @@ -251,7 +251,8 @@ return; } - game_state->ReturnUniform(GetTeamIndex(), GetUniformNumber()); + game_state->ReturnUniform(GetTeamIndex(), GetUniformNumber(), + GetRobotType()); } bool Modified: trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp 2013-06-05 20:03:19 UTC (rev 354) +++ trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp 2013-06-08 21:23:54 UTC (rev 355) @@ -38,14 +38,21 @@ mFupTime = 0; mLastModeChange = 0; mGameHalf = GH_FIRST; + mRobotTypeCount[0].push_back(0); // add count for type 0 (default type) + mRobotTypeCount[1].push_back(0); + mHeteroCount[0] = 0; + mHeteroCount[1] = 0; mScore[0] = 0; mScore[1] = 0; mLastKickOffGameHalf = GH_NONE; mNextHalfKickOff = TI_NONE; mLeftInit = Vector3f(0,0,0); mRightInit = Vector3f(0,0,0); + mAgentRadius = 3.5; mFinished = false; mGamePaused = true; + mMaxHeteroTypeCount = 3; + mMaxTotalHeteroCount = 9; } GameStateAspect::~GameStateAspect() @@ -266,6 +273,82 @@ } bool +GameStateAspect::InsertRobotType(TTeamIndex idx, int type) +{ + int i; + + switch (idx) + { + case TI_LEFT: + i = 0; + break; + case TI_RIGHT: + i = 1; + break; + default: + return false; + } + + if (type) // heterogeneous player + { + if (mHeteroCount[i] == mMaxTotalHeteroCount) + { + GetLog()->Error() + << "ERROR: (GameStateAspect::InsertRobotType) Hetero player" + " count limit reached.\n"; + return false; + } + + ++mHeteroCount[i]; + + if (mRobotTypeCount[i].size() <= type) + mRobotTypeCount[i].resize(type+1); + + if (mRobotTypeCount[i][type] == mMaxHeteroTypeCount) + { + GetLog()->Error() + << "ERROR: (GameStateAspect::InsertRobotType) No more robots " + "of type " << type << " are allowed.\n"; + return false; + } + } + + ++mRobotTypeCount[i][type]; + + return true; +} + +bool +GameStateAspect::EraseRobotType(TTeamIndex idx, int type) +{ + int i; + + switch (idx) + { + case TI_LEFT: + i = 0; + break; + case TI_RIGHT: + i = 1; + break; + default: + return false; + } + + if (mRobotTypeCount[i].size() <= type || !mRobotTypeCount[i][type]) + { + return false; + } + + if (type) // heterogeneous player + --mHeteroCount[i]; + + --mRobotTypeCount[i][type]; + + return true; +} + +bool GameStateAspect::RequestUniform(boost::shared_ptr<AgentState> agentState, std::string teamName, unsigned int unum) { @@ -297,6 +380,15 @@ return false; } + if (!InsertRobotType(idx, agentState->GetRobotType())) + { + GetLog()->Error() + << "ERROR: (GameStateAspect::RequestUniform) cannot insert robot" + " of type " << agentState->GetRobotType() << " to team " + << teamName << "\n"; + return false; + } + agentState->SetUniformNumber(unum); agentState->SetTeamIndex(idx); //agentState->SetPerceptName(teamName, ObjectState::PT_Default); @@ -311,7 +403,7 @@ } bool -GameStateAspect::ReturnUniform(TTeamIndex ti, unsigned int unum) +GameStateAspect::ReturnUniform(TTeamIndex ti, unsigned int unum, int type) { if (! EraseUnum(ti,unum)) { @@ -321,6 +413,14 @@ return false; } + if (!EraseRobotType(ti, type)) + { + GetLog()->Error() + << "ERROR: (GameStateAspect::ReturnUniform) cannot erase robot " + " type " << type << " from team " << ti << "\n"; + return false; + } + return true; } @@ -445,6 +545,9 @@ SoccerBase::GetSoccerVar(*this, "CoinTossForKickOff", coinTossKickOff); if (!coinTossKickOff) mNextHalfKickOff = TI_LEFT; + + SoccerBase::GetSoccerVar(*this, "MaxHeteroTypeCount", mMaxHeteroTypeCount); + SoccerBase::GetSoccerVar(*this, "MaxTotalHeteroCount", mMaxTotalHeteroCount); } int Modified: trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h 2013-06-05 20:03:19 UTC (rev 354) +++ trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h 2013-06-08 21:23:54 UTC (rev 355) @@ -24,6 +24,7 @@ #include <soccercontrolaspect/soccercontrolaspect.h> #include <set> +#include <vector> class AgentState; @@ -87,7 +88,7 @@ std::string teamName, unsigned int unum); /** notifies that a uniform number is free again */ - bool ReturnUniform(TTeamIndex ti, unsigned int unum); + bool ReturnUniform(TTeamIndex ti, unsigned int unum, int type); /** returns the next uniform number not taken for the given team */ int RequestUniformNumber(TTeamIndex ti) const; @@ -133,6 +134,18 @@ contain a uniform number unum and erases it. */ bool EraseUnum(TTeamIndex idx, int unum); + /** + * Adds a robot of the given type to the given team if permitted. + * @return true if permitted + */ + bool InsertRobotType(TTeamIndex idx, int type); + + /** + * Removes a robot of the given type from the given team if exists. + * @return true on success + */ + bool EraseRobotType(TTeamIndex idx, int type); + /** returns the team index corresponding to the given teamName. If the teamname does not exist and less than two teams are registered, the given team name is registered. @@ -170,6 +183,12 @@ /** the set of uniform number for each team */ TUnumSet mUnumSet[2]; + /** the array of robot type counts for each team */ + std::vector<int> mRobotTypeCount[2]; + + /** the number of heterogeneous players for each team */ + int mHeteroCount[2]; + /** the scores of two teams */ int mScore[2]; @@ -187,6 +206,12 @@ /** flag if the game is running or paused (e.g. in goal_left/right state) */ bool mGamePaused; + + /** the maximum number of heterogeneous players of a single type per team */ + int mMaxHeteroTypeCount; + + /** the maximum number of total heterogeneous players for a team */ + int mMaxTotalHeteroCount; }; DECLARE_CLASS(GameStateAspect); Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-05 20:03:19 UTC (rev 354) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-08 21:23:54 UTC (rev 355) @@ -60,6 +60,8 @@ # agent parameters addSoccerVar('AgentRadius', 0.4) +addSoccerVar('MaxHeteroTypeCount', 3) +addSoccerVar('MaxTotalHeteroCount', 9) # ball parameters addSoccerVar('BallRadius', 0.042) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2013-06-12 10:28:10
|
Revision: 360 http://sourceforge.net/p/simspark/svn/360 Author: sgvandijk Date: 2013-06-12 10:28:06 +0000 (Wed, 12 Jun 2013) Log Message: ----------- Added Patrick's charging foul rules, plus soccervar parameters to enable and configure them. these fouls are not penalized, only recorded and sent to the monitor Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2013-06-12 09:17:07 UTC (rev 359) +++ trunk/rcssserver3d/ChangeLog 2013-06-12 10:28:06 UTC (rev 360) @@ -1,3 +1,13 @@ +2013-06-12 Sander van Dijk <sgv...@gm...> + + * plugin/soccer/soccerruleaspect/soccerruleaspect.h: + * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp: + * rcssserver3d/naosoccersim.rb: + - added Patrick's charging foul rules, plus soccervar parameters + to enable and configure them. these fouls are not penalized, only + recorded and sent to the monitor + + 2013-06-09 Hedayat Vatankhah <hed...@gm...> * plugin/soccer/gamestateaspect/gamestateaspect.h: Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-06-12 09:17:07 UTC (rev 359) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-06-12 10:28:06 UTC (rev 360) @@ -58,6 +58,11 @@ mNotOffside(false), mLastModeWasPlayOn(false), mUseOffside(true), + mUseCharging(true), + mChargingMinSpeed(0.2), + mChargingMinBallDist(0.2), + mChargingMaxOppSpeedAngle(90), + mChargingIllInterceptMinMutualSpeedAngel(70), 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 @@ -275,6 +280,151 @@ return; random_shuffle(agent_states.begin(), agent_states.end()); + + // BEGIN FOUL DETECTION + if (mUseCharging) + { + + SoccerBase::TAgentStateList::iterator asIt = agent_states.begin(); + for (; asIt != agent_states.end(); ++asIt) + { + boost::shared_ptr<TouchGroup> touchGroup = (*asIt)->GetTouchGroup(); + + if (touchGroup->size() != 2) { + continue; + } + + salt::Vector3f agentVel[2]; + salt::Vector3f agentPos[2]; + float s[2]; //agentSpeed + float d[2]; //agentDistToBall + float a[2]; //agentAngleOfSpeedVectorToBall + float agentAngleOfSpeedVectorToOpponent[2]; + float m; //mutualAngleOfSpeed + int agentUNum[2]; + int agentTeamIndex[2]; + + salt::Vector3f ballPos = mBallBody->GetPosition(); + + int i = 0; + for (TouchGroup::iterator agentIt = touchGroup->begin(); + agentIt != touchGroup->end(); ++agentIt) + { + + boost::shared_ptr<Transform> transform_parent; + boost::shared_ptr<RigidBody> agent_body; + + SoccerBase::GetTransformParent(*(*agentIt), transform_parent); + SoccerBase::GetAgentBody(transform_parent, agent_body); + + // Get agent position + agentPos[i] = agent_body->GetPosition(); + + // Compute agent distance to ball + d[i] = sqrt(pow(agentPos[i].x()-ballPos.x(),2)+pow(agentPos[i].y()-ballPos.y(),2)); + + // Get agent velocity + agentVel[i] = agent_body->GetVelocity(); + + // Compute agent speed + s[i] = sqrt(pow(agentVel[i].x(),2)+pow(agentVel[i].y(),2)); + + // Compute speed vector angle to ball + a[i] = abs(salt::gRadToDeg(salt::gNormalizeRad(salt::gArcTan2(agentVel[i].y(), agentVel[i].x()) - salt::gArcTan2(ballPos.y()-agentPos[i].y(), ballPos.x()-agentPos[i].x())))); + + // Get agent uniform number and team index + agentUNum[i] = (*agentIt)->GetUniformNumber(); + agentTeamIndex[i] = (*agentIt)->GetTeamIndex(); + + std::cout << "Agent " << agentUNum[i] << " team " << agentTeamIndex[i] << ":\tposition = " << agentPos[i] << "\tvelocity = " << agentVel[i] << std::endl; + + i++; + } + + + // Check if these are opponent agents meaning they have different team indexes + bool haveOpponent = agentTeamIndex[0] != agentTeamIndex[1]; + + if (haveOpponent) { + // Compute speed vector angle to opponent + for (i = 0; i <= 1; i++) { + agentAngleOfSpeedVectorToOpponent[i] = abs(salt::gRadToDeg(salt::gNormalizeRad(salt::gArcTan2(agentVel[i].y(), agentVel[i].x()) - salt::gArcTan2(agentPos[1-i].y()-agentPos[i].y(), agentPos[1-i].x()-agentPos[i].x())))); + } + + // Compute mutual angle of speed + m = abs(salt::gRadToDeg(salt::gNormalizeRad(salt::gArcTan2(agentVel[0].y(), agentVel[0].x()) - salt::gArcTan2(agentVel[1].y(), agentVel[1].x())))); + + bool agentFoul[2]; // Boolean if an agent had committed a foul + + for (int i = 0; i <= 1; i++) { + // Minimum requirements for a foul + std::cout << "Agent " << agentUNum[i] << " team " << agentTeamIndex[i] << ":\tspeed = " << s[i] << "\tdist_from_ball = " << d[i] << "\tangle_speed_to_opp = " << agentAngleOfSpeedVectorToOpponent[i] << std::endl; + agentFoul[i] = s[i] >= mChargingMinSpeed && d[i] >= mChargingMinBallDist && agentAngleOfSpeedVectorToOpponent[i] < mChargingMaxOppSpeedAngle; + } + + if (d[0] < mChargingMinBallDist || d[1] < mChargingMinBallDist) { + // Don't call a foul if at least one of the agents is close to the ball + continue; + } + + if (agentFoul[0] && agentFoul[1]) { + // Handle case where both agent's are thought to have committed a foul + std::cout << "m = " << m << std::endl; + if (m < mChargingIllInterceptMinMutualSpeedAngel) { + // Handle foul from player behind case + salt::Vector3f midpoint = ((agentPos[0]+agentVel[0])+(agentPos[1]+agentVel[1]))/2.0; + + float agentDistFromMidpoint[2]; + for (int i = 0; i <= 1; i++) { + agentDistFromMidpoint[i] = sqrt(pow(agentPos[i].x()-midpoint.x(),2)+pow(agentPos[i].y()-midpoint.y(),2)); + std::cout << "Agent " << agentUNum[i] << " team " << agentTeamIndex[i] << ":\tdistance from midpoint = " << agentDistFromMidpoint[i] << std::endl; + } + + + if (agentDistFromMidpoint[0] < agentDistFromMidpoint[1]) { + agentFoul[0] = false; + } else if (agentDistFromMidpoint[1] < agentDistFromMidpoint[0]) { + agentFoul[1] = false; + } else { + // Mutual foul so no call + agentFoul[0] = false; + agentFoul[1] = false; + } + + + } else { + // Handle illegal interception case + for (int i = 0; i <= 1; i++) { + std::cout << "Agent " << agentUNum[i] << " team " << agentTeamIndex[i] << ":\tangle of speed vector to ball = " << a[i] << std::endl; + } + + if (a[0] < a[1]) { + agentFoul[0] = false; + } else if (a[1] < a[0]) { + agentFoul[1] = false; + } else { + // Mutual foul so no call + agentFoul[0] = false; + agentFoul[1] = false; + } + } + } + + for (int i = 0; i <= 1; i++) { + if (agentFoul[i]) { + playerFoulTime[agentUNum[i]][agentTeamIndex[i]]++; + playerLastFoul[agentUNum[i]][agentTeamIndex[i]] = FT_Charging; + std::cout << "FOUL on agent " << agentUNum[i] << " team " << agentTeamIndex[i] << std::endl; + // Should we remove fouling player from touch group? + + } + } + + } + } + // END FOUL DETECTION + } + SoccerBase::TAgentStateList::iterator i = agent_states.begin(); for (; i != agent_states.end(); ++i) { @@ -435,11 +585,14 @@ int unum = (*i)->GetUniformNumber(); if (playerFoulTime[unum][idx] > mMaxFoulTime / 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 + if (playerLastFoul[unum][idx] != FT_Charging) + { + // 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 + } ResetFoulCounterPlayer(unum, idx); // Record faul mFouls.push_back(Foul(mFouls.size() + 1, playerLastFoul[unum][idx], *i)); @@ -1514,6 +1667,11 @@ SoccerBase::GetSoccerVar(*this,"Min3PlDistance",mMin3PlDistance); SoccerBase::GetSoccerVar(*this,"MaxTouchGroupSize",mMaxTouchGroupSize); //SoccerBase::GetSoccerVar(*this,"MaxFoulTime",mMaxFoulTime); + SoccerBase::GetSoccerVar(*this,"UseCharging",mUseCharging); + SoccerBase::GetSoccerVar(*this,"ChargingMinSpeed",mChargingMinSpeed); + SoccerBase::GetSoccerVar(*this,"ChargingMinBallDist",mChargingMinBallDist); + SoccerBase::GetSoccerVar(*this,"IllegalInterceptMinAngle",mChargingIllInterceptMinMutualSpeedAngel); + SoccerBase::GetSoccerVar(*this,"UseCharging",mUseCharging); // cout << "MaxInside " << mMaxPlayersInsideOwnArea << endl << endl; Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2013-06-12 09:17:07 UTC (rev 359) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2013-06-12 10:28:06 UTC (rev 360) @@ -53,7 +53,8 @@ FT_IllegalDefence, FT_IllegalAttack, FT_Incapable, - FT_KickOff + FT_KickOff, + FT_Charging }; struct Foul @@ -67,6 +68,8 @@ EFoulType type; boost::shared_ptr<AgentState> agent; bool operator<(Foul const& other) const { return index < other.index; } + + int time; }; public: @@ -425,6 +428,20 @@ /** use offside law */ bool mUseOffside; + /** use charging law */ + bool mUseCharging; + + /** minimum player speed to apply charging rules */ + float mChargingMinSpeed; + /** minimum player distance to ball to apply charging rules */ + float mChargingMinBallDist; + /** maximum angle between move direction and opponent to apply + * charging rules */ + float mChargingMaxOppSpeedAngle; + /** minimum angle between move directions to apply illegal + * intercept part of charging rules */ + float mChargingIllInterceptMinMutualSpeedAngel; + /** the time of the kick in the last kick off mode */ TTime mLastKickOffKickTime; /** the player which kicked in the last kick off mode */ Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-12 09:17:07 UTC (rev 359) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-12 10:28:06 UTC (rev 360) @@ -76,6 +76,8 @@ addSoccerVar('UseOffside', false) addSoccerVar('MaxTouchGroupSize', 2) +addSoccerVar('UseCharging', true) + # auto ref parameters FCP 2010 addSoccerVar('NotStandingMaxTime',30) addSoccerVar('GoalieNotStandingMaxTime',60) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-06-12 15:07:24
|
Revision: 363 http://sourceforge.net/p/simspark/svn/363 Author: hedayat Date: 2013-06-12 15:07:21 +0000 (Wed, 12 Jun 2013) Log Message: ----------- Add Id svn keyword to all .cpp/.c/.h files Some Reformatting Adding charging foul variables to naosoccersim.rb Updating NEWS/Release/CmakeLists.txt for 0.6.7 release Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/NEWS trunk/rcssserver3d/RELEASE trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpaction.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector_c.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.cpp trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.h trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor_c.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp trunk/rcssserver3d/rcssagent3d/naobehavior.cpp trunk/rcssserver3d/rcssserver3d/naorobottypes.rb trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Property Changed: ---------------- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.c trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/compatible.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.c trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.c trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpaction.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector_c.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor_c.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpwrapper.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.cpp trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.h trunk/rcssserver3d/plugin/soccer/line/line.cpp trunk/rcssserver3d/plugin/soccer/line/line.h trunk/rcssserver3d/plugin/soccer/line/line_c.cpp trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.cpp trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.h trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor_c.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/CMakeLists.txt 2013-06-12 15:07:21 UTC (rev 363) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.6") +set(PACKAGE_VERSION "0.6.7") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/ChangeLog 2013-06-12 15:07:21 UTC (rev 363) @@ -1,3 +1,20 @@ +2013-06-12 Hedayat Vatankhah <hed...@gm...> + + * NEWS: + * RELEASE: + * CMakeLists.txt: + - Updated for 0.6.7 release + + * rcssagent3d/naobehavior.cpp: + - use the new style scene command to load standard Nao + + * rcssserver3d/naorobottypes.rb: + * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp: + - re-formatted for better readability & consistency + + * rcssserver3d/naosoccersim.rb: + - add charging foul parameters to silent 'variable not found' errors + 2013-06-12 Sander van Dijk <sgv...@gm...> * plugin/soccer/soccerruleaspect/soccerruleaspect.h: @@ -6,7 +23,6 @@ - added Patrick's charging foul rules, plus soccervar parameters to enable and configure them. these fouls are not penalized, only recorded and sent to the monitor - 2013-06-09 Hedayat Vatankhah <hed...@gm...> @@ -18,7 +34,7 @@ both the total number of heterogeneous players of each team (MaxTotalHeteroCount variable in naosoccersim.rb), and the number of heterogeneous players of each type (MaxHeteroTypeCount variable) - + 2013-06-06 Hedayat Vatankhah <hed...@gm...> * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.h: Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/NEWS 2013-06-12 15:07:21 UTC (rev 363) @@ -1,3 +1,46 @@ +[0.6.7] +This is the RoboCup 2013 release. It comes with some bug fixes, and also +compatibility with latest Boost libraries. New foulds and new debugging +facility are provided. Now, fouls are sent to the monitor so that it can +provide visual feedback about them. Finally, support for heterogeneous robots +is added and two sample types are provided. + +* Heterogeneous Players: + This release supports heterogeneous players. Currently, two extra Nao robots + are provided beside the standard Nao (thanks Stefan and Klaus). + + - Usage: to use the new heterogeneous players, a new scene command should be + used. While the old style scene commands work, for using hetero players you + should send "(scene rsg/agent/nao/nao_hetero.rsg TYPE_NO)", in which TYPE_NO + is the type number of the player type. Type 0 is the standard type, and + hetero types start from 1. Therefore, to load Nao type 1 the following + command should be sent: (scene rsg/agent/nao/nao_hetero.rsg 1). Notice that + you can use the new style command for loading standard Nao, using 0 as + TYPE_NO. + + - Heterogeneous Robot Parameters: The robot parameters for different types + are defined in a new file: "naorobottypes.rb". New types can be added to the + array. But to define new parameters, corresponding .rsg files should be + modified. + + - Rules: Each team can use a limited number of hetero players. The limits + can be configured in naosoccersim.rb using "MaxTotalHeteroCount" and + "MaxHeteroTypeCount" variables. The former limits the total number of hetero + players for each team, and the latter specifies the maximum number of players + of a single hetero player type. + +* Other Features/Changes: + - Charging fouls rules are added (thanks Patrick). These fouls are not + penalized, but recorded and sent to the monitor. New rules can be configured + in naosoccersim.rb. + - Fouls are added to the monitor protocol to provide visual feedback about + them to viewers. + - For debugging purposes, sensing the orientation of the agent can be + enabled using "setSenseMyOrien" option in the .rsg file of an agent (added + by Patrick) + - A player can kick the ball in kickoff if there are only 2 players in + the field to support current penalty mode. + [0.6.6] It's time for a new release! This release comes with a number of bug fixes and several minor enhancements here and there. Now, you can run the server for Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/RELEASE 2013-06-12 15:07:21 UTC (rev 363) @@ -1,64 +1,46 @@ -RELEASE News of rcssserver3d-0.6.6 +RELEASE News of rcssserver3d-0.6.7 -It's time for a new release! This release comes with a number of bug fixes and -several minor enhancements here and there. Now, you can run the server for -two complete halves. Teams now change their sides in the second half. Also, -automatic kick off and automatic quit modes are added. Field dimensions are -also increased to 20x30 meters, and free kick distance is 2.0 meters now. -More detailed information about this release follows: +This is the RoboCup 2013 release. It comes with some bug fixes, and also +compatibility with latest Boost libraries. New foulds and new debugging +facility are provided. Now, fouls are sent to the monitor so that it can +provide visual feedback about them. Finally, support for heterogeneous robots +is added and two sample types are provided. -* Rule Changes: - - automatic referee now enforces rules whenever players are permitted to - play, rather than only in playon play mode. - - it is no longer possible to score directly from kick off, the ball should - at least touch another player before going into the goal - - in kickoff playmode, the kicker cannot touch the ball again until another - player touches it. +* Heterogeneous Players: + This release supports heterogeneous players. Currently, two extra Nao robots + are provided beside the standard Nao (thanks Stefan and Klaus). + + - Usage: to use the new heterogeneous players, a new scene command should be + used. While the old style scene commands work, for using hetero players you + should send "(scene rsg/agent/nao/nao_hetero.rsg TYPE_NO)", in which TYPE_NO + is the type number of the player type. Type 0 is the standard type, and + hetero types start from 1. Therefore, to load Nao type 1 the following + command should be sent: (scene rsg/agent/nao/nao_hetero.rsg 1). Notice that + you can use the new style command for loading standard Nao, using 0 as + TYPE_NO. + + - Heterogeneous Robot Parameters: The robot parameters for different types + are defined in a new file: "naorobottypes.rb". New types can be added to the + array. But to define new parameters, corresponding .rsg files should be + modified. + + - Rules: Each team can use a limited number of hetero players. The limits + can be configured in naosoccersim.rb using "MaxTotalHeteroCount" and + "MaxHeteroTypeCount" variables. The former limits the total number of hetero + players for each team, and the latter specifies the maximum number of players + of a single hetero player type. -* Field/Dimension Changes: - - New dimensions: 20x30 - - Free kick distance: 2.0 - - Corner kick position: in the middle point between goal and corner of the - field, to facilitate faster corner kicks. - - Nao's foot height is now 0.02 rather than 0.03. Ankle's position changed - accordingly +* Other Features/Changes: + - Charging fouls rules are added (thanks Patrick). These fouls are not + penalized, but recorded and sent to the monitor. New rules can be configured + in naosoccersim.rb. + - Fouls are added to the monitor protocol to provide visual feedback about + them to viewers. + - For debugging purposes, sensing the orientation of the agent can be + enabled using "setSenseMyOrien" option in the .rsg file of an agent (added + by Patrick) + - A player can kick the ball in kickoff if there are only 2 players in + the field to support current penalty mode. -* Several Bug fixes. Some notable ones are: - - Penalty lines and middle circle are now visible at their actual position - (Thanks to Marcus for his bug report, and Sander). - - Fixed a small bug in parsing move paramter (Thanks to Andreas Seekircher) - - Fixed a mistake which prevented from touch group rules to be applied at all - - Fixed a small bug in goal counting which cause this function to always - count a goal when ball moved out of the field - -* Enhance Automatic Kickoff Support: - - Changed default value of 'WaitBeforeKickOff' to 30, since 5 seconds - is too small for any team to start. - - WaitBeforeKickOff is now calculated from when the first agent connects - rather than from the beginning of the before kickoff playmode (when the - simulator is started) - - A game can be started with kick off for the left team, or using 'coin toss' - to determine which team should start the game. CoinTossForKickOff variable - in naosoccersim.rb can be used to change the behavior. It is disabled - by default. - -* Enhance Support for 'Second Half': - - Automatic Kick Off mode assigns Kick off to the correct team in the second - half - - Change teams' sides in the second half if enabled (enabled by default). It - can be disabled using ChangeSidesInSecondHalf variable in naosoccersim.rb. - -* Automatic Quit: - - In Automatic Quit mode rcsssever3d shuts down automatically when the game - is over. It is disabled by default but can be enabled using 'AutomaticQuit' - variable in naosoccersim.rb - -* Other Enhancements: - - The location of init scripts (e.g. zeitgeist.rb) can now be specified using - --init-script-prefix (you still can put most of the scripts and data files - like rsg/ directory inside your ~/.simspark/ instead). - - Better Windows support - - Support creating Windows binaries under Linux using MinGW - You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Index: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: recorderhandler.h 176 2010-02-25 12:19:37Z a-held $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: recorderhandler_c.cpp 176 2010-02-25 12:19:37Z a-held $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler_c.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.c =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.c 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.c 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.h 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/base.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/compatible.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/compatible.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/compatible.h 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/compatible.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.c =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.c 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.c 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.h 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/hmdp_c.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.c =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.c 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.c 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.h 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdp_c/sine_fixed.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpaction.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpaction.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpaction.h 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: forceaction.h,v 1.3 2004/02/12 14:07:24 fruit Exp $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpaction.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: HMDPeffector.h,v 1.5 2007/06/14 17:55:18 jboedeck Exp $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector_c.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector_c.cpp 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: forceeffector_c.cpp,v 1.3 2004/02/21 15:51:39 fruit Exp $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector_c.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: gyrorateperceptor.h,v 1.2 2007/05/30 18:40:49 jboedeck Exp $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor_c.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor_c.cpp 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor_c.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpwrapper.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpwrapper.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpwrapper.cpp 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/hmdpwrapper.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.cpp 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.h 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/hmdp_effector/naospecific.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/line/line.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/line/line.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/line/line.cpp 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/line/line.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/line/line.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/line/line.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/line/line.h 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/line/line.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: trunk/rcssserver3d/plugin/soccer/line/line_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/line/line_c.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/line/line_c.cpp 2013-06-12 15:07:21 UTC (rev 363) Property changes on: trunk/rcssserver3d/plugin/soccer/line/line_c.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.cpp 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: RCS3DMonitor.cpp 246 2011-02-18 18:44:14Z sgvandijk $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.h 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: sparkmonitor.h 3 2008-11-21 02:38:08Z hedayat $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor_c.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor_c.cpp 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: sparkmonitor_c.cpp 3 2008-11-21 02:38:08Z hedayat $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/rcs3dmonitor/rcs3dmonitor_c.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-06-12 15:07:21 UTC (rev 363) @@ -290,7 +290,8 @@ { boost::shared_ptr<TouchGroup> touchGroup = (*asIt)->GetTouchGroup(); - if (touchGroup->size() != 2) { + if (touchGroup->size() != 2) + { continue; } @@ -299,7 +300,7 @@ float s[2]; //agentSpeed float d[2]; //agentDistToBall float a[2]; //agentAngleOfSpeedVectorToBall - float agentAngleOfSpeedVectorToOpponent[2]; + float agentAngleOfSpeedVectorToOpponent[2]; float m; //mutualAngleOfSpeed int agentUNum[2]; int agentTeamIndex[2]; @@ -310,7 +311,7 @@ for (TouchGroup::iterator agentIt = touchGroup->begin(); agentIt != touchGroup->end(); ++agentIt) { - + boost::shared_ptr<Transform> transform_parent; boost::shared_ptr<RigidBody> agent_body; @@ -321,105 +322,157 @@ agentPos[i] = agent_body->GetPosition(); // Compute agent distance to ball - d[i] = sqrt(pow(agentPos[i].x()-ballPos.x(),2)+pow(agentPos[i].y()-ballPos.y(),2)); - + d[i] = sqrt(pow(agentPos[i].x() - ballPos.x(), 2) + + pow(agentPos[i].y() - ballPos.y(), 2)); + // Get agent velocity agentVel[i] = agent_body->GetVelocity(); // Compute agent speed - s[i] = sqrt(pow(agentVel[i].x(),2)+pow(agentVel[i].y(),2)); + s[i] = sqrt(pow(agentVel[i].x(), 2) + pow(agentVel[i].y(), 2)); // Compute speed vector angle to ball - a[i] = abs(salt::gRadToDeg(salt::gNormalizeRad(salt::gArcTan2(agentVel[i].y(), agentVel[i].x()) - salt::gArcTan2(ballPos.y()-agentPos[i].y(), ballPos.x()-agentPos[i].x())))); + a[i] = abs(salt::gRadToDeg(salt::gNormalizeRad( + salt::gArcTan2(agentVel[i].y(), agentVel[i].x()) - + salt::gArcTan2(ballPos.y()-agentPos[i].y(), ballPos.x()-agentPos[i].x()) + ))); // Get agent uniform number and team index agentUNum[i] = (*agentIt)->GetUniformNumber(); agentTeamIndex[i] = (*agentIt)->GetTeamIndex(); - - std::cout << "Agent " << agentUNum[i] << " team " << agentTeamIndex[i] << ":\tposition = " << agentPos[i] << "\tvelocity = " << agentVel[i] << std::endl; +// GetLog()->Debug() << "Agent " << agentUNum[i] << " team " +// << agentTeamIndex[i] << ":\tposition = " << agentPos[i] +// << "\tvelocity = " << agentVel[i] << "\n"; + i++; } - + // Check if these are opponent agents meaning they have different team indexes bool haveOpponent = agentTeamIndex[0] != agentTeamIndex[1]; - if (haveOpponent) { + if (haveOpponent) + { // Compute speed vector angle to opponent - for (i = 0; i <= 1; i++) { - agentAngleOfSpeedVectorToOpponent[i] = abs(salt::gRadToDeg(salt::gNormalizeRad(salt::gArcTan2(agentVel[i].y(), agentVel[i].x()) - salt::gArcTan2(agentPos[1-i].y()-agentPos[i].y(), agentPos[1-i].x()-agentPos[i].x())))); + for (i = 0; i <= 1; i++) + { + agentAngleOfSpeedVectorToOpponent[i] = abs( + salt::gRadToDeg(salt::gNormalizeRad( + salt::gArcTan2(agentVel[i].y(), agentVel[i].x()) - + salt::gArcTan2(agentPos[1-i].y()-agentPos[i].y(), + agentPos[1-i].x()-agentPos[i].x())) + )); } // Compute mutual angle of speed - m = abs(salt::gRadToDeg(salt::gNormalizeRad(salt::gArcTan2(agentVel[0].y(), agentVel[0].x()) - salt::gArcTan2(agentVel[1].y(), agentVel[1].x())))); + m = abs(salt::gRadToDeg(salt::gNormalizeRad( + salt::gArcTan2(agentVel[0].y(), agentVel[0].x()) - + salt::gArcTan2(agentVel[1].y(), agentVel[1].x()) + ))); bool agentFoul[2]; // Boolean if an agent had committed a foul - for (int i = 0; i <= 1; i++) { + for (int i = 0; i <= 1; i++) + { // Minimum requirements for a foul - std::cout << "Agent " << agentUNum[i] << " team " << agentTeamIndex[i] << ":\tspeed = " << s[i] << "\tdist_from_ball = " << d[i] << "\tangle_speed_to_opp = " << agentAngleOfSpeedVectorToOpponent[i] << std::endl; - agentFoul[i] = s[i] >= mChargingMinSpeed && d[i] >= mChargingMinBallDist && agentAngleOfSpeedVectorToOpponent[i] < mChargingMaxOppSpeedAngle; +// GetLog()->Debug() << "Agent " << agentUNum[i] << " team " +// << agentTeamIndex[i] << ":\tspeed = " << s[i] +// << "\tdist_from_ball = " << d[i] +// << "\tangle_speed_to_opp = " +// << agentAngleOfSpeedVectorToOpponent[i] +// << "\n"; + agentFoul[i] = s[i] >= mChargingMinSpeed + && d[i] >= mChargingMinBallDist + && agentAngleOfSpeedVectorToOpponent[i] + < mChargingMaxOppSpeedAngle; } - if (d[0] < mChargingMinBallDist || d[1] < mChargingMinBallDist) { + if (d[0] < mChargingMinBallDist || d[1] < mChargingMinBallDist) + { // Don't call a foul if at least one of the agents is close to the ball continue; } - if (agentFoul[0] && agentFoul[1]) { + if (agentFoul[0] && agentFoul[1]) + { // Handle case where both agent's are thought to have committed a foul - std::cout << "m = " << m << std::endl; - if (m < mChargingIllInterceptMinMutualSpeedAngel) { +// GetLog()->Debug() << "m = " << m << "\n"; + if (m < mChargingIllInterceptMinMutualSpeedAngel) + { // Handle foul from player behind case - salt::Vector3f midpoint = ((agentPos[0]+agentVel[0])+(agentPos[1]+agentVel[1]))/2.0; + salt::Vector3f midpoint = ((agentPos[0] + agentVel[0]) + + (agentPos[1] + agentVel[1])) / 2.0; float agentDistFromMidpoint[2]; - for (int i = 0; i <= 1; i++) { - agentDistFromMidpoint[i] = sqrt(pow(agentPos[i].x()-midpoint.x(),2)+pow(agentPos[i].y()-midpoint.y(),2)); - std::cout << "Agent " << agentUNum[i] << " team " << agentTeamIndex[i] << ":\tdistance from midpoint = " << agentDistFromMidpoint[i] << std::endl; + for (int i = 0; i <= 1; i++) + { + agentDistFromMidpoint[i] = sqrt( + pow(agentPos[i].x() - midpoint.x(), 2) + + pow(agentPos[i].y() - midpoint.y(), 2)); +// GetLog()->Debug() << "Agent " << agentUNum[i] +// << " team " << agentTeamIndex[i] +// << ":\tdistance from midpoint = " +// << agentDistFromMidpoint[i] << "\n"; } - if (agentDistFromMidpoint[0] < agentDistFromMidpoint[1]) { + if (agentDistFromMidpoint[0] < agentDistFromMidpoint[1]) + { agentFoul[0] = false; - } else if (agentDistFromMidpoint[1] < agentDistFromMidpoint[0]) { + } + else if (agentDistFromMidpoint[1] < agentDistFromMidpoint[0]) + { agentFoul[1] = false; - } else { + } + else + { // Mutual foul so no call agentFoul[0] = false; agentFoul[1] = false; } - - } else { + } + else + { // Handle illegal interception case - for (int i = 0; i <= 1; i++) { - std::cout << "Agent " << agentUNum[i] << " team " << agentTeamIndex[i] << ":\tangle of speed vector to ball = " << a[i] << std::endl; +// for (int i = 0; i <= 1; i++) { +// GetLog()->Debug() << "Agent " << agentUNum[i] +// << " team " << agentTeamIndex[i] +// << ":\tangle of speed vector to ball = " +// << a[i] << "\n"; +// } + + if (a[0] < a[1]) + { + agentFoul[0] = false; } - - if (a[0] < a[1]) { - agentFoul[0] = false; - } else if (a[1] < a[0]) { + else if (a[1] < a[0]) + { agentFoul[1] = false; - } else { + } + else + { // Mutual foul so no call agentFoul[0] = false; agentFoul[1] = false; } } } - - for (int i = 0; i <= 1; i++) { - if (agentFoul[i]) { + + for (int i = 0; i <= 1; i++) + { + if (agentFoul[i]) + { playerFoulTime[agentUNum[i]][agentTeamIndex[i]]++; playerLastFoul[agentUNum[i]][agentTeamIndex[i]] = FT_Charging; - std::cout << "FOUL on agent " << agentUNum[i] << " team " << agentTeamIndex[i] << std::endl; + GetLog()->Debug() << "FOUL on agent " << agentUNum[i] + << " team " << agentTeamIndex[i] << "\n"; // Should we remove fouling player from touch group? - + } } - + } } // END FOUL DETECTION @@ -1671,7 +1724,6 @@ SoccerBase::GetSoccerVar(*this,"ChargingMinSpeed",mChargingMinSpeed); SoccerBase::GetSoccerVar(*this,"ChargingMinBallDist",mChargingMinBallDist); SoccerBase::GetSoccerVar(*this,"IllegalInterceptMinAngle",mChargingIllInterceptMinMutualSpeedAngel); - SoccerBase::GetSoccerVar(*this,"UseCharging",mUseCharging); // cout << "MaxInside " << mMaxPlayersInsideOwnArea << endl << endl; Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: gamestateitem.cpp 259 2011-03-24 20:25:24Z hedayat $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: gamestateitem.h 21 2009-01-14 14:38:57Z yxu $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp 2013-06-12 15:07:21 UTC (rev 363) @@ -4,7 +4,7 @@ Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id: gamestateitem_c.cpp 9 2008-11-24 02:39:02Z hedayat $ + $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Property changes on: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleitem_c.cpp ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/rcssserver3d/rcssagent3d/naobehavior.cpp =================================================================== --- trunk/rcssserver3d/rcssagent3d/naobehavior.cpp 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/rcssagent3d/naobehavior.cpp 2013-06-12 15:07:21 UTC (rev 363) @@ -64,7 +64,7 @@ mJointIDMap["raj4"] = JID_RARM_4; } -std::string gJointEff_2_Str[] = +std::string gJointEff_2_Str[] = { "he1", "he2", @@ -106,7 +106,7 @@ // use the scene effector to build the agent and beam to a // position near the center of the playing field return - "(scene rsg/agent/nao/nao.rsg)"; + "(scene rsg/agent/nao/nao_hetero.rsg 0)"; } void NaoBehavior::ParseHingeJointInfo(const oxygen::Predicate& predicate) @@ -178,7 +178,7 @@ { cerr << "(NaoBehavior) could not parse universal joint angle2!" << endl; return; - } + } // try to read axis2 rate // update the map @@ -193,7 +193,7 @@ double heartime; string sender; string message; - + Predicate::Iterator iter(predicate); if (! predicate.AdvanceValue(iter, heartime)) @@ -202,7 +202,7 @@ return; } - + if (! predicate.AdvanceValue(iter, sender)) { cerr << "could not get sender \n"; @@ -226,7 +226,7 @@ << " me said " << message << " at " << heartime << endl; } return; - + } @@ -264,7 +264,7 @@ const Predicate& predicate = (*iter); switch(predicate.name[0]) - { + { case 'H': // hinge joint (HJ) ParseHingeJointInfo(predicate); break; @@ -292,10 +292,10 @@ break; case S_Sit: - if (mCounter > 40) - { - mCounter = 0; - mState = S_SwingLeft; + if (mCounter > 40) + { + mCounter = 0; + mState = S_SwingLeft; ss << "(lae1 0)" << "(rae1 0)" << "(lae2 0)" @@ -326,8 +326,8 @@ << "(rae3 0)" << "(lae4 -0.8)" << "(rae4 0.8)" - << "(lle3 1)" - << "(rle3 1)" + << "(lle3 1)" + << "(rle3 1)" << "(lle4 -2)" << "(rle4 -2)" << "(lle5 1)" @@ -350,7 +350,7 @@ mCounter++; if (mCounter % 10 == 0) ss << "(say ComeOn!)"; - + //std::cout << "Sent: " << ss.str() << "\n"; return ss.str(); } Modified: trunk/rcssserver3d/rcssserver3d/naorobottypes.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2013-06-12 15:07:21 UTC (rev 363) @@ -1,8 +1,27 @@ NaoType = [ # Type 0 (Standard Nao) -{'ThighRelHip2_Z' => -0.04, 'AnkleRelShank_Z' => -0.055, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395, 'ElbowRelUpperArm_Y' => 0.07}, +{ + 'ThighRelHip2_Z' => -0.04, + 'AnkleRelShank_Z' => -0.055, + 'lj5_max_abs_speed' => 6.1395, + 'lj6_max_abs_speed' => 6.1395, + 'ElbowRelUpperArm_Y' => 0.07 +}, # Type 1 -{'ThighRelHip2_Z' => -0.06, 'AnkleRelShank_Z' => -0.075, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395, 'ElbowRelUpperArm_Y' => 0.11}, +{ + 'ThighRelHip2_Z' => -0.06, + 'AnkleRelShank_Z' => -0.075, + 'lj5_max_abs_speed' => 6.1395, + 'lj6_max_abs_speed' => 6.1395, + 'ElbowRelUpperArm_Y' => 0.11 +}, # Type 2 -{'ThighRelHip2_Z' => -0.04, 'AnkleRelShank_Z' => -0.055, 'lj5_max_abs_speed' => 9.21, 'lj6_max_abs_speed' => 4.605, 'ElbowRelUpperArm_Y' => 0.07} +{ + 'ThighRelHip2_Z' => -0.04, + 'AnkleRelShank_Z' => -0.055, + 'lj5_max_abs_speed' => 9.21, + 'lj6_max_abs_speed' => 4.605, + 'ElbowRelUpperArm_Y' => 0.07 +} + ] Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-12 14:58:36 UTC (rev 362) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-12 15:07:21 UTC (rev 363) @@ -76,7 +76,11 @@ addSoccerVar('UseOffside', false) addSoccerVar('MaxTouchGroupSize', 2) +# charging foul parameters addSoccerVar('UseCharging', true) +addSoccerVar('ChargingMinSpeed', 0.2) +addSoccerVar('ChargingMinBallDist', 0.2) +addSoccerVar('IllegalInterceptMinAngle', 70) # auto ref parameters FCP 2010 addSoccerVar('NotStandingMaxTime',30) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2013-06-12 19:49:27
|
Revision: 364 http://sourceforge.net/p/simspark/svn/364 Author: hedayat Date: 2013-06-12 19:49:24 +0000 (Wed, 12 Jun 2013) Log Message: ----------- Fix bugs in goal counting and other areas when teams change sides in the second half. Disabling changing team sides by default, since it is what we currently use in competitions. Update release notes accordingly Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/NEWS trunk/rcssserver3d/RELEASE trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2013-06-12 15:07:21 UTC (rev 363) +++ trunk/rcssserver3d/ChangeLog 2013-06-12 19:49:24 UTC (rev 364) @@ -1,3 +1,14 @@ +2013-06-13 Hedayat Vatankhah <hed...@gm...> + + * NEWS: + * RELEASE: + - added a note about fixing side changing bug in 0.6.7 release + + * rcssserver3d/naosoccersim.rb: + - disabled ChangeSidesInSecondHalf by default for 0.6.7 release, since this + is what we use currently in competitions. But it should work fine if + enabled. + 2013-06-12 Hedayat Vatankhah <hed...@gm...> * NEWS: @@ -11,10 +22,18 @@ * rcssserver3d/naorobottypes.rb: * plugin/soccer/soccerruleaspect/soccerruleaspect.cpp: - re-formatted for better readability & consistency + (SoccerRuleAspect::SwapTeamSides): + - swap gamestateaspect internal team data too (should fix bugs related to + changing team's sides in the second half) * rcssserver3d/naosoccersim.rb: - - add charging foul parameters to silent 'variable not found' errors + - added charging foul parameters to silent 'variable not found' errors + * plugin/soccer/gamestateaspect/gamestateaspect.h: + * plugin/soccer/gamestateaspect/gamestateaspect.cpp: + - added new functions to swap teams internal data structures when they + change sides + 2013-06-12 Sander van Dijk <sgv...@gm...> * plugin/soccer/soccerruleaspect/soccerruleaspect.h: Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2013-06-12 15:07:21 UTC (rev 363) +++ trunk/rcssserver3d/NEWS 2013-06-12 19:49:24 UTC (rev 364) @@ -40,6 +40,9 @@ by Patrick) - A player can kick the ball in kickoff if there are only 2 players in the field to support current penalty mode. + - Fixed bugs in goal counting when changing team sides in the second half. + Now, this feature should work fine. However, it is disabled by default now + since we don't use it currently in the competitions. [0.6.6] It's time for a new release! This release comes with a number of bug fixes and Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2013-06-12 15:07:21 UTC (rev 363) +++ trunk/rcssserver3d/RELEASE 2013-06-12 19:49:24 UTC (rev 364) @@ -41,6 +41,9 @@ by Patrick) - A player can kick the ball in kickoff if there are only 2 players in the field to support current penalty mode. + - Fixed bugs in goal counting when changing team sides in the second half. + Now, this feature should work fine. However, it is disabled by default now + since we don't use it currently in the competitions. You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp 2013-06-12 15:07:21 UTC (rev 363) +++ trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp 2013-06-12 19:49:24 UTC (rev 364) @@ -20,6 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "gamestateaspect.h" +#include <algorithm> #include <zeitgeist/logserver/logserver.h> #include <soccerbase/soccerbase.h> #include <agentstate/agentstate.h> @@ -53,6 +54,9 @@ mGamePaused = true; mMaxHeteroTypeCount = 3; mMaxTotalHeteroCount = 9; + mInternalIndex[TI_NONE] = -1; + mInternalIndex[TI_LEFT] = 0; + mInternalIndex[TI_RIGHT] = 1; } GameStateAspect::~GameStateAspect() @@ -163,30 +167,19 @@ void GameStateAspect::SetTeamName(TTeamIndex idx, const std::string& name) { - switch (idx) - { - case TI_LEFT: - mTeamName[0] = name; - break; - case TI_RIGHT: - mTeamName[1] = name; - break; - } + int i = GetInternalIndex(idx); + if (i > -1) + mTeamName[i] = name; return; } std::string GameStateAspect::GetTeamName(TTeamIndex idx) const { - switch (idx) - { - case TI_LEFT: - return mTeamName[0]; - case TI_RIGHT: - return mTeamName[1]; - default: + int i = GetInternalIndex(idx); + if (i < 0) return ""; - } + return mTeamName[i]; } TTeamIndex @@ -197,34 +190,30 @@ if (mTeamName[i].empty()) { mTeamName[i] = teamName; - return static_cast<TTeamIndex>(i + TI_LEFT); + return GetInternalIndex(TI_LEFT) == i ? TI_LEFT : TI_RIGHT; } if (mTeamName[i] == teamName) { - return static_cast<TTeamIndex>(i + TI_LEFT); + return GetInternalIndex(TI_LEFT) == i ? TI_LEFT : TI_RIGHT; } } return TI_NONE; } +inline int +GameStateAspect::GetInternalIndex(TTeamIndex idx) const +{ + return mInternalIndex[idx]; +} + bool GameStateAspect::InsertUnum(TTeamIndex idx, int unum) { - int i; - - switch (idx) - { - case TI_LEFT: - i = 0; - break; - case TI_RIGHT: - i = 1; - break; - default: + int i = GetInternalIndex(idx); + if (i < 0) return false; - } TUnumSet& set = mUnumSet[i]; @@ -244,19 +233,9 @@ bool GameStateAspect::EraseUnum(TTeamIndex idx, int unum) { - int i; - - switch (idx) - { - case TI_LEFT: - i = 0; - break; - case TI_RIGHT: - i = 1; - break; - default: + int i = GetInternalIndex(idx); + if (i < 0) return false; - } TUnumSet& set = mUnumSet[i]; @@ -275,19 +254,9 @@ bool GameStateAspect::InsertRobotType(TTeamIndex idx, int type) { - int i; - - switch (idx) - { - case TI_LEFT: - i = 0; - break; - case TI_RIGHT: - i = 1; - break; - default: + int i = GetInternalIndex(idx); + if (i < 0) return false; - } if (type) // heterogeneous player { @@ -321,19 +290,9 @@ bool GameStateAspect::EraseRobotType(TTeamIndex idx, int type) { - int i; - - switch (idx) - { - case TI_LEFT: - i = 0; - break; - case TI_RIGHT: - i = 1; - break; - default: + int i = GetInternalIndex(idx); + if (i < 0) return false; - } if (mRobotTypeCount[i].size() <= type || !mRobotTypeCount[i][type]) { @@ -447,30 +406,21 @@ void GameStateAspect::ScoreTeam(TTeamIndex idx) { - switch (idx) - { - case TI_LEFT: - ++mScore[0]; - break; - case TI_RIGHT: - ++mScore[1]; - break; - } - return; + int i = GetInternalIndex(idx); + if (i < 0) + return; + + ++mScore[i]; } int GameStateAspect::GetScore(TTeamIndex idx) const { - switch (idx) - { - case TI_LEFT: - return mScore[0]; - case TI_RIGHT: - return mScore[1]; - default: + int i = GetInternalIndex(idx); + if (i < 0) return 0; - } + + return mScore[i]; } Vector3f @@ -553,18 +503,9 @@ int GameStateAspect::RequestUniformNumber(TTeamIndex ti) const { - int idx; - switch (ti) - { - case TI_LEFT: - idx = 0; - break; - case TI_RIGHT: - idx = 1; - break; - default: + int idx = GetInternalIndex(ti); + if (idx < 0) return 0; - } for (int i = 1; i <=11; ++i) if (mUnumSet[idx].find(i) == mUnumSet[idx].end()) @@ -593,3 +534,8 @@ { mGamePaused = paused; } + +void GameStateAspect::SwapTeamIndexes() +{ + swap(mInternalIndex[TI_LEFT], mInternalIndex[TI_RIGHT]); +} Modified: trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h 2013-06-12 15:07:21 UTC (rev 363) +++ trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h 2013-06-12 19:49:24 UTC (rev 364) @@ -119,6 +119,9 @@ /** sets the game running state (paused or not) */ void SetPaused(bool paused); + /** swaps the team index (side) of current teams */ + void SwapTeamIndexes(); + protected: /** setup the init positions for the agents */ virtual void OnLink(); @@ -152,6 +155,13 @@ */ TTeamIndex GetTeamIndex(const std::string& teamName); + /** + * @param[in] idx the team index + * @return the internal index used for indexing variables storing data + * about teams. If idx is TI_NONE, it will return -1 + */ + int GetInternalIndex(TTeamIndex idx) const; + protected: /** the current play mode */ TPlayMode mPlayMode; @@ -177,6 +187,10 @@ /** the team that has to start the next half */ TTeamIndex mNextHalfKickOff; + /** the internal index for a team, since its TTeamIndex might change in + * the second half */ + int mInternalIndex[3]; + /** the names of the two teams */ std::string mTeamName[2]; Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-06-12 15:07:21 UTC (rev 363) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-06-12 19:49:24 UTC (rev 364) @@ -138,8 +138,9 @@ void SoccerRuleAspect::ResetFoulCounter(TTeamIndex idx) { - for(int t=1; t<=11; t++) { - ResetFoulCounterPlayer(t,idx); + for (int t = 1; t <= 11; t++) + { + ResetFoulCounterPlayer(t, idx); } } @@ -800,11 +801,17 @@ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states)) return; + mGameState->SwapTeamIndexes(); + SoccerBase::TAgentStateList::iterator it; for (it = agent_states.begin(); it != agent_states.end(); ++it) { (*it)->SetTeamIndex(SoccerBase::OpponentTeam((*it)->GetTeamIndex())); } + + // make sure that team names (and probably other things) are updated on + // monitors + GetActiveScene()->SetModified(true); } void Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-12 15:07:21 UTC (rev 363) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-12 19:49:24 UTC (rev 364) @@ -56,7 +56,7 @@ addSoccerVar('CoinTossForKickOff', false) addSoccerVar('AutomaticQuit', false) -addSoccerVar('ChangeSidesInSecondHalf', true) +addSoccerVar('ChangeSidesInSecondHalf', false) # agent parameters addSoccerVar('AgentRadius', 0.4) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2014-02-19 17:46:51
|
Revision: 371 http://sourceforge.net/p/simspark/svn/371 Author: patmac369 Date: 2014-02-19 17:46:49 +0000 (Wed, 19 Feb 2014) Log Message: ----------- This commit includes the following changes for the 2014 competition: - labeling of hear messages with team names - Ex: (hear teamName 9 10 text) - score reporting - Ex: (GS (unum 8) (team left) (sl 1) (sr 2) (t 0.00) (pm BeforeKickOff)) - robot type checking to ensure that enough robot types (3) are used and that not too many of any one (7) or two (9) types is used - Allowed formations include (7-1-1-1-1), (4-4-3), (3-3-3-2), (3-2-2-2-2), etc. but not (7-3-1) - Updating naorobottypes.rb with robot types for the 2014 competition (the same ones that were used at the 2013 competition) For backwards compatibility the following options have been added to naosoccersim.rb to toggle on and off these changes. LabelMessages - Toggles on/off labeling of messages (default on) ReportScores - Toggles on/off score reporting (default on) MaxRobotTypeCount - Maximum number of any one robot type that may be used (default 7 and can be set to 11 to preserve 2013 competition behavior) MinRobotTypesCount - Minimum number of robot types that must be used for a full team (default 3 and can be set to 1 to preserve 2013 competition behavior) MaxSumTwoRobotTypes - The maximum sum of robots for any two robot types (default 9 but can be set to 11 to preserve 2013 competition behavior) Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h trunk/rcssserver3d/plugin/soccer/gamestateperceptor/gamestateperceptor.cpp trunk/rcssserver3d/plugin/soccer/gamestateperceptor/gamestateperceptor.h trunk/rcssserver3d/plugin/soccer/hearperceptor/hearperceptor.cpp trunk/rcssserver3d/plugin/soccer/hearperceptor/hearperceptor.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/rcssserver3d/naorobottypes.rb trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2014-02-19 17:46:49 UTC (rev 371) @@ -136,7 +136,7 @@ } void -AgentState::AddMessage(const string& msg, float direction, bool teamMate) +AgentState::AddMessage(const string& msg, const string& team, float direction, bool teamMate) { if (teamMate) { @@ -148,6 +148,7 @@ mHearMateCap -= mHearDecay; mMateMsg = msg; + mMateTeam = team; mMateMsgDir = direction; mIfMateMsg = true; } @@ -161,6 +162,7 @@ mHearOppCap -= mHearDecay; mOppMsg = msg; + mOppTeam = team; mOppMsgDir = direction; mIfOppMsg = true; } @@ -174,7 +176,7 @@ } bool -AgentState::GetMessage(string& msg, float& direction, bool teamMate) +AgentState::GetMessage(string& msg, string& team, float& direction, bool teamMate) { if (teamMate) { @@ -189,6 +191,7 @@ } msg = mMateMsg; + team = mMateTeam; direction = mMateMsgDir; mIfMateMsg = false; return true; @@ -206,6 +209,7 @@ } msg = mOppMsg; + team = mOppTeam; direction = mOppMsgDir; mIfOppMsg = false; return true; Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2014-02-19 17:46:49 UTC (rev 371) @@ -94,11 +94,11 @@ bool ReduceBattery(float consumption); /** Add a new message to the list */ - void AddMessage(const std::string& msg, float direction, bool teamMate); + void AddMessage(const std::string& msg, const std::string& team, float direction, bool teamMate); void AddSelfMessage(const std::string& msg); /** Get the first message from the list */ - bool GetMessage(std::string& msg, float& direction, bool teamMate); + bool GetMessage(std::string& msg, std::string& team, float& direction, bool teamMate); bool GetSelfMessage(std::string& msg); /** Whether agent is selected */ @@ -143,10 +143,12 @@ /** team-mate's message */ std::string mMateMsg; + std::string mMateTeam; float mMateMsgDir; /** opponent's message */ std::string mOppMsg; + std::string mOppTeam; float mOppMsgDir; /** max hear capacity units */ Modified: trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.cpp 2014-02-19 17:46:49 UTC (rev 371) @@ -41,8 +41,6 @@ mGameHalf = GH_FIRST; mRobotTypeCount[0].push_back(0); // add count for type 0 (default type) mRobotTypeCount[1].push_back(0); - mHeteroCount[0] = 0; - mHeteroCount[1] = 0; mScore[0] = 0; mScore[1] = 0; mLastKickOffGameHalf = GH_NONE; @@ -52,8 +50,9 @@ mAgentRadius = 3.5; mFinished = false; mGamePaused = true; - mMaxHeteroTypeCount = 3; - mMaxTotalHeteroCount = 9; + mMaxRobotTypeCount = 7; + mMinRobotTypesCount = 3; + mMaxSumTwoRobotTypes = 9; mInternalIndex[TI_NONE] = -1; mInternalIndex[TI_LEFT] = 0; mInternalIndex[TI_RIGHT] = 1; @@ -258,26 +257,53 @@ if (i < 0) return false; - if (type) // heterogeneous player + int numRobots = 0; + int numRobotTypes = 0; + int maxSumTwoRobotTypes = 0; + + if (mRobotTypeCount[i].size() <= type) + mRobotTypeCount[i].resize(type+1); + + for (int j = 0; j < mRobotTypeCount[i].size(); j++) { - if (mHeteroCount[i] == mMaxTotalHeteroCount) + if (mRobotTypeCount[i][j] > 0) { - GetLog()->Error() - << "ERROR: (GameStateAspect::InsertRobotType) Hetero player" - " count limit reached.\n"; - return false; + numRobots += mRobotTypeCount[i][j]; + numRobotTypes++; } + int sumTwoRobotTypes = mRobotTypeCount[i][type]+1; + if (j != type) + sumTwoRobotTypes += mRobotTypeCount[i][j]; + + if (sumTwoRobotTypes > maxSumTwoRobotTypes) + maxSumTwoRobotTypes = sumTwoRobotTypes; + } - ++mHeteroCount[i]; + if (mRobotTypeCount[i][type] == mMaxRobotTypeCount) + { + GetLog()->Error() + << "ERROR: (GameStateAspect::InsertRobotType) No more robots " + "of type " << type << " are allowed.\n"; + return false; + } - if (mRobotTypeCount[i].size() <= type) - mRobotTypeCount[i].resize(type+1); - - if (mRobotTypeCount[i][type] == mMaxHeteroTypeCount) + if (maxSumTwoRobotTypes > mMaxSumTwoRobotTypes) + { + GetLog()->Error() + << "ERROR: (GameStateAspect::InsertRobotType) Maximum sum of " + "robots of two robot types limit reached. No more robots of " + "type " << type << " are allowed.\n"; + return false; + } + + if ((11-numRobots) <= (mMinRobotTypesCount-numRobotTypes)) + { + if (mRobotTypeCount[i][type] != 0) { GetLog()->Error() - << "ERROR: (GameStateAspect::InsertRobotType) No more robots " - "of type " << type << " are allowed.\n"; + << "ERROR: (GameStateAspect::InsertRobotType) Minimum number" + " of different robot types not reached. Only robots of a type" + " not yet used can be added.\n"; return false; } } @@ -299,9 +325,6 @@ return false; } - if (type) // heterogeneous player - --mHeteroCount[i]; - --mRobotTypeCount[i][type]; return true; @@ -496,8 +519,9 @@ if (!coinTossKickOff) mNextHalfKickOff = TI_LEFT; - SoccerBase::GetSoccerVar(*this, "MaxHeteroTypeCount", mMaxHeteroTypeCount); - SoccerBase::GetSoccerVar(*this, "MaxTotalHeteroCount", mMaxTotalHeteroCount); + SoccerBase::GetSoccerVar(*this, "MaxRobotTypeCount", mMaxRobotTypeCount); + SoccerBase::GetSoccerVar(*this, "MinRobotTypesCount", mMinRobotTypesCount); + SoccerBase::GetSoccerVar(*this, "MaxSumTwoRobotTypes", mMaxSumTwoRobotTypes); } int Modified: trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/gamestateaspect/gamestateaspect.h 2014-02-19 17:46:49 UTC (rev 371) @@ -200,9 +200,6 @@ /** the array of robot type counts for each team */ std::vector<int> mRobotTypeCount[2]; - /** the number of heterogeneous players for each team */ - int mHeteroCount[2]; - /** the scores of two teams */ int mScore[2]; @@ -221,11 +218,14 @@ /** flag if the game is running or paused (e.g. in goal_left/right state) */ bool mGamePaused; - /** the maximum number of heterogeneous players of a single type per team */ - int mMaxHeteroTypeCount; + /** the maximum number of players of a single type per team */ + int mMaxRobotTypeCount; - /** the maximum number of total heterogeneous players for a team */ - int mMaxTotalHeteroCount; + /** the minimum number of different robot types per team */ + int mMinRobotTypesCount; + + /** the maximum sum of robots for any two robot types */ + int mMaxSumTwoRobotTypes; }; DECLARE_CLASS(GameStateAspect); Modified: trunk/rcssserver3d/plugin/soccer/gamestateperceptor/gamestateperceptor.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateperceptor/gamestateperceptor.cpp 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/gamestateperceptor/gamestateperceptor.cpp 2014-02-19 17:46:49 UTC (rev 371) @@ -33,6 +33,7 @@ GameStatePerceptor::GameStatePerceptor() : oxygen::Perceptor() { mFirstPercept = true; + mReportScore = true; } GameStatePerceptor::~GameStatePerceptor() @@ -127,6 +128,18 @@ InsertInitialPercept(predicate); } + if (mReportScore) { + // score left + ParameterList& slElement = predicate.parameter.AddList(); + slElement.AddValue(string("sl")); + slElement.AddValue(mGameState->GetScore(TI_LEFT)); + + // score right + ParameterList& srElement = predicate.parameter.AddList(); + srElement.AddValue(string("sr")); + srElement.AddValue(mGameState->GetScore(TI_RIGHT)); + } + // time ParameterList& timeElement = predicate.parameter.AddList(); timeElement.AddValue(string("t")); @@ -145,6 +158,7 @@ { SoccerBase::GetGameState(*this,mGameState); SoccerBase::GetAgentState(*this,mAgentState); + SoccerBase::GetSoccerVar(*this,"ReportScore",mReportScore); } void Modified: trunk/rcssserver3d/plugin/soccer/gamestateperceptor/gamestateperceptor.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/gamestateperceptor/gamestateperceptor.h 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/gamestateperceptor/gamestateperceptor.h 2014-02-19 17:46:49 UTC (rev 371) @@ -73,6 +73,9 @@ is assigned to a team with a successful init command */ bool mFirstPercept; + + /** report game score to agent */ + bool mReportScore; }; DECLARE_CLASS(GameStatePerceptor); Modified: trunk/rcssserver3d/plugin/soccer/hearperceptor/hearperceptor.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/hearperceptor/hearperceptor.cpp 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/hearperceptor/hearperceptor.cpp 2014-02-19 17:46:49 UTC (rev 371) @@ -30,6 +30,7 @@ HearPerceptor::HearPerceptor() : oxygen::Perceptor() { + mLabelMessages = true; } HearPerceptor::~HearPerceptor() @@ -50,6 +51,7 @@ bool result = false; string message; + string team; float direction; if (mAgentState->GetSelfMessage(message)) @@ -58,28 +60,37 @@ Predicate& predicate = predList->AddPredicate(); predicate.name = "hear"; predicate.parameter.Clear(); + if (mLabelMessages) { + predicate.parameter.AddValue(mAgentState->GetPerceptName(ObjectState::PT_Player)); + } predicate.parameter.AddValue(mGameState->GetTime()); predicate.parameter.AddValue(self); predicate.parameter.AddValue(message); result = true; } - if (mAgentState->GetMessage(message, direction, true)) + if (mAgentState->GetMessage(message, team, direction, true)) { Predicate& predicate = predList->AddPredicate(); predicate.name = "hear"; predicate.parameter.Clear(); + if (mLabelMessages) { + predicate.parameter.AddValue(team); + } predicate.parameter.AddValue(mGameState->GetTime()); predicate.parameter.AddValue(direction); predicate.parameter.AddValue(message); result = true; } - if (mAgentState->GetMessage(message, direction, false)) + if (mAgentState->GetMessage(message, team, direction, false)) { Predicate& predicate = predList->AddPredicate(); predicate.name = "hear"; predicate.parameter.Clear(); + if (mLabelMessages) { + predicate.parameter.AddValue(team); + } predicate.parameter.AddValue(mGameState->GetTime()); predicate.parameter.AddValue(direction); predicate.parameter.AddValue(message); @@ -94,6 +105,7 @@ { SoccerBase::GetAgentState(*this, mAgentState); SoccerBase::GetGameState(*this, mGameState); + SoccerBase::GetSoccerVar(*this, "LabelMessages", mLabelMessages); } void Modified: trunk/rcssserver3d/plugin/soccer/hearperceptor/hearperceptor.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/hearperceptor/hearperceptor.h 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/hearperceptor/hearperceptor.h 2014-02-19 17:46:49 UTC (rev 371) @@ -53,6 +53,11 @@ /** reference to the GameStateAspect */ boost::shared_ptr<GameStateAspect> mGameState; + + /** label agent messages with the team of the sender */ + bool mLabelMessages; + + }; DECLARE_CLASS(HearPerceptor); Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2014-02-19 17:46:49 UTC (rev 371) @@ -1806,7 +1806,8 @@ Vector3f relPos = pos - new_pos; relPos = SoccerBase::FlipView(relPos, idx); float direction = salt::gRadToDeg(salt::gArcTan2(relPos[1], relPos[0])); - (*it)->AddMessage(message, direction, true); + std::string team = (*it)->GetPerceptName(ObjectState::PT_Player); + (*it)->AddMessage(message, team, direction, true); } } @@ -1828,7 +1829,8 @@ Vector3f relPos = pos - new_pos; relPos = SoccerBase::FlipView(relPos, SoccerBase::OpponentTeam(idx)); float direction = salt::gRadToDeg(salt::gArcTan2(relPos[1], relPos[0])); - (*it)->AddMessage(message, direction, false); + std::string team = (*it)->GetPerceptName(ObjectState::PT_Player); + (*it)->AddMessage(message, team, direction, false); } } } Modified: trunk/rcssserver3d/rcssserver3d/naorobottypes.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2014-02-19 17:46:49 UTC (rev 371) @@ -9,18 +9,18 @@ }, # Type 1 { - 'ThighRelHip2_Z' => -0.06, - 'AnkleRelShank_Z' => -0.075, + 'ThighRelHip2_Z' => -0.05832, + 'AnkleRelShank_Z' => -0.07332, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395, - 'ElbowRelUpperArm_Y' => 0.11 + 'ElbowRelUpperArm_Y' => 0.10664 }, # Type 2 { 'ThighRelHip2_Z' => -0.04, 'AnkleRelShank_Z' => -0.055, - 'lj5_max_abs_speed' => 9.21, - 'lj6_max_abs_speed' => 4.605, + 'lj5_max_abs_speed' => 8.80667, + 'lj6_max_abs_speed' => 3.47234, 'ElbowRelUpperArm_Y' => 0.07 } Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2013-06-19 20:55:49 UTC (rev 370) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2014-02-19 17:46:49 UTC (rev 371) @@ -60,8 +60,9 @@ # agent parameters addSoccerVar('AgentRadius', 0.4) -addSoccerVar('MaxHeteroTypeCount', 3) -addSoccerVar('MaxTotalHeteroCount', 9) +addSoccerVar('MaxRobotTypeCount', 7) +addSoccerVar('MinRobotTypesCount', 3) +addSoccerVar('MaxSumTwoRobotTypes', 9) # ball parameters addSoccerVar('BallRadius', 0.042) @@ -90,8 +91,12 @@ addSoccerVar('MaxPlayersInsideOwnArea',3) addSoccerVar('MinOppDistance',0.8) addSoccerVar('Min2PlDistance',0.4) -addSoccerVar('Min3PlDistance',1.0) +addSoccerVar('Min3PlDistance',1.0) +# 2014 server changes +addSoccerVar('ReportScore', true) +addSoccerVar('LabelMessages', true) + # auto ref parameters for testing (not for use in competition...) #addSoccerVar('NotStandingMaxTime',10) #addSoccerVar('GoalieNotStandingMaxTime',30) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2014-05-30 13:15:22
|
Revision: 376 http://sourceforge.net/p/simspark/svn/376 Author: hedayat Date: 2014-05-30 13:15:18 +0000 (Fri, 30 May 2014) Log Message: ----------- Preparing 0.6.8 release Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/NEWS trunk/rcssserver3d/RELEASE Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2014-05-29 20:42:29 UTC (rev 375) +++ trunk/rcssserver3d/CMakeLists.txt 2014-05-30 13:15:18 UTC (rev 376) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.7") +set(PACKAGE_VERSION "0.6.8") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2014-05-29 20:42:29 UTC (rev 375) +++ trunk/rcssserver3d/ChangeLog 2014-05-30 13:15:18 UTC (rev 376) @@ -1,3 +1,12 @@ +2014-05-30 Hedayat Vatankhah <hed...@gm...> + + * NEWS: + * RELEASE: + * CMakeLists.txt: + - prepared for 0.6.8 release; including changes in this release like hear + message labeling, score reporting and bug fixes not documented in + ChangeLog + 2013-06-20 Hedayat Vatankhah <hed...@gm...> * plugin/soccermonitor/CMakeLists.txt: Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2014-05-29 20:42:29 UTC (rev 375) +++ trunk/rcssserver3d/NEWS 2014-05-30 13:15:18 UTC (rev 376) @@ -1,6 +1,37 @@ +[0.6.8] +This release mainly comes with 2 new features: 1. labeling hear messages with +team names so that it is clear which team the message comes from. 2. Score +reporting. A few bug fixes are also included. + +* Hear message labeling: + - Now hear messages include team names - Ex: (hear teamName 9 10 text) + +* Score Reporting: + - Example: (GS (unum 8) (team left) (sl 1) (sr 2) (t 0.00) (pm BeforeKickOff)) + +* New Options in naosoccersim.rb: + - LabelMessages - Toggles on/off labeling of messages (default on) + - ReportScores - Toggles on/off score reporting (default on) + - MaxRobotTypeCount - Maximum number of any one robot type that may be + used (default 7 and can be set to 11 to preserve 2013 competition behavior) + - MinRobotTypesCount - Minimum number of robot types that must be used for a + full team (default 3 and can be set to 1 to preserve 2013 competition + behavior) + - MaxSumTwoRobotTypes - The maximum sum of robots for any two robot types + (default 9 but can be set to 11 to preserve 2013 competition behavior) + +* Other changes: + - Robot type checking to ensure that enough robot types (3) are used and that + not too many of any one (7) or two (9) types is used. + - Updating naorobottypes.rb with robot types used in 2013 competitions + - Clear Players in GoalLeft/Right before kickoff to make sure that opponent + doesn't touch ball at the middle of the field. + - Don't enforce crowding rules on kickoff, since opponent should not come + near the ball + [0.6.7] This is the RoboCup 2013 release. It comes with some bug fixes, and also -compatibility with latest Boost libraries. New foulds and new debugging +compatibility with latest Boost libraries. New fouls and new debugging facility are provided. Now, fouls are sent to the monitor so that it can provide visual feedback about them. Finally, support for heterogeneous robots is added and two sample types are provided. Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2014-05-29 20:42:29 UTC (rev 375) +++ trunk/rcssserver3d/RELEASE 2014-05-30 13:15:18 UTC (rev 376) @@ -1,49 +1,34 @@ -RELEASE News of rcssserver3d-0.6.7 +RELEASE News of rcssserver3d-0.6.8 -This is the RoboCup 2013 release. It comes with some bug fixes, and also -compatibility with latest Boost libraries. New foulds and new debugging -facility are provided. Now, fouls are sent to the monitor so that it can -provide visual feedback about them. Finally, support for heterogeneous robots -is added and two sample types are provided. +This release mainly comes with 2 new features: 1. labeling hear messages with +team names so that it is clear which team the message comes from. 2. Score +reporting. A few bug fixes are also included. -* Heterogeneous Players: - This release supports heterogeneous players. Currently, two extra Nao robots - are provided beside the standard Nao (thanks Stefan and Klaus). +* Hear message labeling: + - Now hear messages include team names - Ex: (hear teamName 9 10 text) - - Usage: to use the new heterogeneous players, a new scene command should be - used. While the old style scene commands work, for using hetero players you - should send "(scene rsg/agent/nao/nao_hetero.rsg TYPE_NO)", in which TYPE_NO - is the type number of the player type. Type 0 is the standard type, and - hetero types start from 1. Therefore, to load Nao type 1 the following - command should be sent: (scene rsg/agent/nao/nao_hetero.rsg 1). Notice that - you can use the new style command for loading standard Nao, using 0 as - TYPE_NO. - - - Heterogeneous Robot Parameters: The robot parameters for different types - are defined in a new file: "naorobottypes.rb". New types can be added to the - array. But to define new parameters, corresponding .rsg files should be - modified. - - - Rules: Each team can use a limited number of hetero players. The limits - can be configured in naosoccersim.rb using "MaxTotalHeteroCount" and - "MaxHeteroTypeCount" variables. The former limits the total number of hetero - players for each team, and the latter specifies the maximum number of players - of a single hetero player type. +* Score Reporting: + - Example: (GS (unum 8) (team left) (sl 1) (sr 2) (t 0.00) (pm BeforeKickOff)) -* Other Features/Changes: - - Charging fouls rules are added (thanks Patrick). These fouls are not - penalized, but recorded and sent to the monitor. New rules can be configured - in naosoccersim.rb. - - Fouls are added to the monitor protocol to provide visual feedback about - them to viewers. - - For debugging purposes, sensing the orientation of the agent can be - enabled using "setSenseMyOrien" option in the .rsg file of an agent (added - by Patrick) - - A player can kick the ball in kickoff if there are only 2 players in - the field to support current penalty mode. - - Fixed bugs in goal counting when changing team sides in the second half. - Now, this feature should work fine. However, it is disabled by default now - since we don't use it currently in the competitions. +* New Options in naosoccersim.rb: + - LabelMessages - Toggles on/off labeling of messages (default on) + - ReportScores - Toggles on/off score reporting (default on) + - MaxRobotTypeCount - Maximum number of any one robot type that may be + used (default 7 and can be set to 11 to preserve 2013 competition behavior) + - MinRobotTypesCount - Minimum number of robot types that must be used for a + full team (default 3 and can be set to 1 to preserve 2013 competition + behavior) + - MaxSumTwoRobotTypes - The maximum sum of robots for any two robot types + (default 9 but can be set to 11 to preserve 2013 competition behavior) + +* Other changes: + - Robot type checking to ensure that enough robot types (3) are used and that + not too many of any one (7) or two (9) types is used. + - Updating naorobottypes.rb with robot types used in 2013 competitions + - Clear Players in GoalLeft/Right before kickoff to make sure that opponent + doesn't touch ball at the middle of the field. + - Don't enforce crowding rules on kickoff, since opponent should not come + near the ball You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2014-06-02 11:08:44
|
Revision: 379 http://sourceforge.net/p/simspark/svn/379 Author: patmac369 Date: 2014-06-02 11:08:41 +0000 (Mon, 02 Jun 2014) Log Message: ----------- Allowing the automated referee for collision fouls to be turned on by setting the UseCharging variable to true (default value is false). Previously charging fouls were hard coded to be ignored regardless of the value of UseCharging. Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2014-06-02 10:39:21 UTC (rev 378) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2014-06-02 11:08:41 UTC (rev 379) @@ -58,7 +58,7 @@ mNotOffside(false), mLastModeWasPlayOn(false), mUseOffside(true), - mUseCharging(true), + mUseCharging(false), mChargingMinSpeed(0.2), mChargingMinBallDist(0.2), mChargingMaxOppSpeedAngle(90), @@ -647,14 +647,11 @@ int unum = (*i)->GetUniformNumber(); if (playerFoulTime[unum][idx] > mMaxFoulTime / 0.02) { - if (playerLastFoul[unum][idx] != FT_Charging) - { - // 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 - } + // 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 ResetFoulCounterPlayer(unum, idx); // Record faul mFouls.push_back(Foul(mFouls.size() + 1, playerLastFoul[unum][idx], *i)); Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2014-06-02 10:39:21 UTC (rev 378) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2014-06-02 11:08:41 UTC (rev 379) @@ -78,7 +78,7 @@ addSoccerVar('MaxTouchGroupSize', 2) # charging foul parameters -addSoccerVar('UseCharging', true) +addSoccerVar('UseCharging', false) addSoccerVar('ChargingMinSpeed', 0.2) addSoccerVar('ChargingMinBallDist', 0.2) addSoccerVar('IllegalInterceptMinAngle', 70) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2014-06-24 20:52:15
|
Revision: 381 http://sourceforge.net/p/simspark/svn/381 Author: hedayat Date: 2014-06-24 20:52:12 +0000 (Tue, 24 Jun 2014) Log Message: ----------- RoboCup 2014 Release (hopefully!) - Update version to 0.6.8.1 - Add robot types for RoboCup 2014 Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/NEWS trunk/rcssserver3d/RELEASE trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg trunk/rcssserver3d/rcssserver3d/naorobottypes.rb Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2014-06-08 07:29:26 UTC (rev 380) +++ trunk/rcssserver3d/CMakeLists.txt 2014-06-24 20:52:12 UTC (rev 381) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.8") +set(PACKAGE_VERSION "0.6.8.1") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2014-06-08 07:29:26 UTC (rev 380) +++ trunk/rcssserver3d/ChangeLog 2014-06-24 20:52:12 UTC (rev 381) @@ -1,3 +1,17 @@ +2014-06-25 Hedayat Vatankhah <hed...@gm...> + + * NEWS: + * RELEASE: + * CMakeLists.txt: + - prepared for 0.6.8.1 release + + * data/rsg/agent/nao/nao_hetero.rsg: + * data/rsg/agent/nao/naoleg.rsg: + * data/rsg/agent/nao/naolegtoe.rsg: + * rcssserver3d/naorobottypes.rb: + - Update robot types for RoboCup 2014 including two new types, one of which + has toes! Thanks to Patrick, Stefan and Klaus. + 2014-05-30 Hedayat Vatankhah <hed...@gm...> * NEWS: Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2014-06-08 07:29:26 UTC (rev 380) +++ trunk/rcssserver3d/NEWS 2014-06-24 20:52:12 UTC (rev 381) @@ -1,3 +1,8 @@ +[0.6.8.1] +This is a bug-fix release for 0.6.8, which had a bug in labeling hear messages. +It also includes few other changes: a small bug fix, and new hetero robot types +for RoboCup 2014. Now, our Nao robots can have toe! :) + [0.6.8] This release mainly comes with 2 new features: 1. labeling hear messages with team names so that it is clear which team the message comes from. 2. Score Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2014-06-08 07:29:26 UTC (rev 380) +++ trunk/rcssserver3d/RELEASE 2014-06-24 20:52:12 UTC (rev 381) @@ -1,5 +1,10 @@ -RELEASE News of rcssserver3d-0.6.8 +RELEASE News of rcssserver3d-0.6.8.1 +This is a bug-fix release for 0.6.8, which had a bug in labeling hear messages. +It also includes few other changes: a small bug fix, and new hetero robot types +for RoboCup 2014. Now, our Nao robots can have toe! :) + +And this is the release news for 0.6.8: This release mainly comes with 2 new features: 1. labeling hear messages with team names so that it is clear which team the message comes from. 2. Score reporting. A few bug fixes are also included. Modified: trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg 2014-06-08 07:29:26 UTC (rev 380) +++ trunk/rcssserver3d/data/rsg/agent/nao/nao_hetero.rsg 2014-06-24 20:52:12 UTC (rev 381) @@ -25,6 +25,9 @@ (def $TorsoInitZ 1.5) (def $loadObj (eval Nao.UseTexture)) + +(def $useToe (eval "NaoType["$type"]['UseToe']")) + ; ;Begin Construct of Nao ; @@ -131,18 +134,38 @@ ; ;The Right Leg ; - (importScene rsg/agent/nao/naoleg.rsg - 1 r - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj - $type) - + (switch $useToe + (true + (importScene rsg/agent/nao/naolegtoe.rsg + 1 r + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) + ) + (false + (importScene rsg/agent/nao/naoleg.rsg + 1 r + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) + ) + ) + ; ;The Left Leg ; - (importScene rsg/agent/nao/naoleg.rsg - -1 l - $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj - $type) + (switch $useToe + (true + (importScene rsg/agent/nao/naolegtoe.rsg + -1 l + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) + ) + (false + (importScene rsg/agent/nao/naoleg.rsg + -1 l + $TorsoInitX $TorsoInitY $TorsoInitZ $loadObj + $type) + ) + ) );end of nd Space Modified: trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg =================================================================== --- trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg 2014-06-08 07:29:26 UTC (rev 380) +++ trunk/rcssserver3d/data/rsg/agent/nao/naoleg.rsg 2014-06-24 20:52:12 UTC (rev 381) @@ -47,9 +47,11 @@ ; ;Position Parameters ; - (def $Hip1RelTorso_X (eval $LRFactor * 0.055)) + ;(def $Hip1RelTorso_X (eval $LRFactor * 0.055)) + (def $Hip1RelTorso_X (eval $LRFactor * (eval "NaoType["$type"]['Hip1RelTorso_X']"))) (def $Hip1RelTorso_Y -0.01) - (def $Hip1RelTorso_Z -0.115) + ;(def $Hip1RelTorso_Z -0.115) + (def $Hip1RelTorso_Z (eval "NaoType["$type"]['Hip1RelTorso_Z']")) (def $Hip2RelHip1_X 0) (def $Hip2RelHip1_Y 0) Modified: trunk/rcssserver3d/rcssserver3d/naorobottypes.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2014-06-08 07:29:26 UTC (rev 380) +++ trunk/rcssserver3d/rcssserver3d/naorobottypes.rb 2014-06-24 20:52:12 UTC (rev 381) @@ -1,27 +1,59 @@ NaoType = [ # Type 0 (Standard Nao) { + 'Hip1RelTorso_X' => 0.055, + 'Hip1RelTorso_Z' => -0.115, 'ThighRelHip2_Z' => -0.04, 'AnkleRelShank_Z' => -0.055, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395, - 'ElbowRelUpperArm_Y' => 0.07 + 'ElbowRelUpperArm_Y' => 0.07, + 'UseToe' => 'false' }, -# Type 1 +# Type 1 (longer legs and arms) { + 'Hip1RelTorso_X' => 0.055, + 'Hip1RelTorso_Z' => -0.115, 'ThighRelHip2_Z' => -0.05832, 'AnkleRelShank_Z' => -0.07332, 'lj5_max_abs_speed' => 6.1395, 'lj6_max_abs_speed' => 6.1395, - 'ElbowRelUpperArm_Y' => 0.10664 + 'ElbowRelUpperArm_Y' => 0.10664, + 'UseToe' => 'false' }, -# Type 2 +# Type 2 (faster ankle-pitch and slower ankle-roll speed) { + 'Hip1RelTorso_X' => 0.055, + 'Hip1RelTorso_Z' => -0.115, 'ThighRelHip2_Z' => -0.04, 'AnkleRelShank_Z' => -0.055, 'lj5_max_abs_speed' => 8.80667, 'lj6_max_abs_speed' => 3.47234, - 'ElbowRelUpperArm_Y' => 0.07 + 'ElbowRelUpperArm_Y' => 0.07, + 'UseToe' => 'false' +}, +# Type 3 (longer legs and arms + wider hip) +{ + 'Hip1RelTorso_X' => 0.072954143, + 'Hip1RelTorso_Z' => -0.115, + 'ThighRelHip2_Z' => -0.067868424, + 'AnkleRelShank_Z' => -0.082868424, + 'lj5_max_abs_speed' => 6.1395, + 'lj6_max_abs_speed' => 6.1395, + 'ElbowRelUpperArm_Y' => 0.125736848, + 'UseToe' => 'false' +}, +# Type 4 (Nao toes model) +{ + 'Hip1RelTorso_X' => 0.055, + 'Hip1RelTorso_Z' => -0.115, + 'ThighRelHip2_Z' => -0.04, + 'AnkleRelShank_Z' => -0.055, + 'lj5_max_abs_speed' => 6.1395, + 'lj6_max_abs_speed' => 6.1395, + 'ElbowRelUpperArm_Y' => 0.07, + 'UseToe' => 'true', + 'ToeLength' => 0.035517656 } ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2015-02-06 04:28:47
|
Revision: 385 http://sourceforge.net/p/simspark/svn/385 Author: patmac369 Date: 2015-02-06 04:28:44 +0000 (Fri, 06 Feb 2015) Log Message: ----------- Adding penalty shootout mode where a goal is awarded to the left team (penalty kicker) if the right team's player (penalty goalie) leaves the penalty area. Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2014-07-06 05:21:04 UTC (rev 384) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2015-02-06 04:28:44 UTC (rev 385) @@ -75,7 +75,8 @@ mMaxTouchGroupSize(1000), mMaxFoulTime(0.0), // maximum time allowed for a player to commit a positional foul before being repositioned mLastKickOffKickTime(0), - mCheckKickOffKickerFoul(false) + mCheckKickOffKickerFoul(false), + mPenaltyShootout(false) { mFreeKickPos = Vector3f(0.0,0.0,mBallRadius); } @@ -120,6 +121,28 @@ // Reset touch groups ResetTouchGroups(TI_LEFT); ResetTouchGroups(TI_RIGHT); + + // If in penalty shootout mode check that the goalie remains in the penalty area + if (mPenaltyShootout) + { + SoccerBase::TAgentStateList agent_states; + if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_RIGHT)) + return; + boost::shared_ptr<oxygen::Transform> agent_aspect; + SoccerBase::TAgentStateList::const_iterator i; + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { + SoccerBase::GetTransformParent(**i, agent_aspect); + Vector3f agentPos = agent_aspect->GetWorldTransform().Pos(); + if (agentPos.x() < mRightPenaltyArea.minVec[0] || agentPos.y() < mRightPenaltyArea.minVec[1] || agentPos.y() > mRightPenaltyArea.maxVec[1]) + { + // Penalty shootout goalie has left penalty area so award goal + mPenaltyShootout = false; + mGameState->ScoreTeam(TI_LEFT); + mGameState->SetPlayMode(PM_Goal_Left); + } + } + } } } @@ -1717,6 +1740,7 @@ SoccerBase::GetSoccerVar(*this,"GoalKickDist",mGoalKickDist); SoccerBase::GetSoccerVar(*this,"AutomaticKickOff",mAutomaticKickOff); SoccerBase::GetSoccerVar(*this,"WaitBeforeKickOff",mWaitBeforeKickOff); + SoccerBase::GetSoccerVar(*this,"PenaltyShootout",mPenaltyShootout); SoccerBase::GetSoccerVar(*this,"SingleHalfTime",mSingleHalfTime); SoccerBase::GetSoccerVar(*this,"AutomaticQuit",mAutomaticQuit); SoccerBase::GetSoccerVar(*this,"ChangeSidesInSecondHalf",mChangeSidesInSecondHalf); Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2014-07-06 05:21:04 UTC (rev 384) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2015-02-06 04:28:44 UTC (rev 385) @@ -448,6 +448,8 @@ boost::shared_ptr<oxygen::AgentAspect> mLastKickOffTaker; /** if kickoff taker should be checked for single kick rule */ bool mCheckKickOffKickerFoul; + /** if in penalty shootout mode */ + bool mPenaltyShootout; /** complete foul history */ std::vector<Foul> mFouls; Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2014-07-06 05:21:04 UTC (rev 384) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2015-02-06 04:28:44 UTC (rev 385) @@ -54,6 +54,7 @@ addSoccerVar('AutomaticKickOff', false) addSoccerVar('WaitBeforeKickOff', 30.0) addSoccerVar('CoinTossForKickOff', false) +addSoccerVar('PenaltyShootout', false) addSoccerVar('AutomaticQuit', false) addSoccerVar('ChangeSidesInSecondHalf', false) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2015-04-23 01:45:11
|
Revision: 388 http://sourceforge.net/p/simspark/svn/388 Author: patmac369 Date: 2015-04-23 01:45:03 +0000 (Thu, 23 Apr 2015) Log Message: ----------- This commit adds the following new rules and fixes: - Adding new rule requiring that the ball must either touch an opponent, or touch a teammate outside the center circle, before a team taking a kickoff can score. - Adding noise to the beam effector with the amount of noise added controlled by the 'BeamNoiseXY' (in meters) and 'BeamNoiseAngle' (in degrees) values in naosoccersim.rb. Noise is added to beam X and Y values from a uniform distribution within the range [-BeamNoiseXY,BeamNoiseXY] and to beam angle values from a uniform distribution within the range [-BeamNoiseAngle,BeamNoiseAngle]. - Fixing a bug where a player would be incorrectly called for double touching the ball on a kickoff if the player first kicked the ball directly in the opponent's goal from a kickoff, resulting in no goal being awarded and the opposing team being given a kickoff, and then is the next player to touch the ball in the PlayOn playmode after a dropball when the opponent doesn't take their kickoff. Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.cpp trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.h trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.cpp trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.cpp 2015-03-27 19:39:48 UTC (rev 387) +++ trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.cpp 2015-04-23 01:45:03 UTC (rev 388) @@ -26,6 +26,7 @@ #include <oxygen/agentaspect/agentaspect.h> #include <oxygen/physicsserver/recorderhandler.h> #include <gamestateaspect/gamestateaspect.h> +#include <agentstate/agentstate.h> #include <soccerbase/soccerbase.h> #include <ball/ball.h> @@ -40,6 +41,8 @@ mLastValidBallPos = Vector3f(0,0,0); mGoalState = TI_NONE; mLastAgentCollisionTime = 0; + mCollidingWithLeftTeamAgent = false; + mCollidingWithRightTeamAgent = false; } BallStateAspect::~BallStateAspect() @@ -66,6 +69,9 @@ void BallStateAspect::UpdateLastCollidingAgent() { + mCollidingWithLeftTeamAgent = false; + mCollidingWithRightTeamAgent = false; + // get a list of agents that collided with the ball since the last // update of the recorder and remember the first returned node as // the last agent that collided with the ball. @@ -78,6 +84,26 @@ (agents.front().lock()); mLastAgentCollisionTime = mGameState->GetTime(); + + for (RecorderHandler::TParentList::iterator it = agents.begin(); + it != agents.end(); ++it) { + boost::shared_ptr<oxygen::AgentAspect> agent = + static_pointer_cast<AgentAspect>(it->lock()); + boost::shared_ptr<AgentState> agentState; + if (!SoccerBase::GetAgentState(agent, agentState)) + { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Cannot" + " get AgentState from an AgentAspect\n"; + } + else { + TTeamIndex team = agentState->GetTeamIndex(); + if (team == TI_LEFT) { + mCollidingWithLeftTeamAgent = true; + } else if (team == TI_RIGHT) { + mCollidingWithRightTeamAgent = true; + } + } + } } // empty the recorder buffer @@ -206,3 +232,16 @@ { return mLastValidBallPos; } + +bool BallStateAspect::GetBallCollidingWithAgentTeam(TTeamIndex team) +{ + if (team == TI_LEFT) { + return mCollidingWithLeftTeamAgent; + } else if (team == TI_RIGHT) { + return mCollidingWithRightTeamAgent; + } else if (team == TI_NONE) { + return !mCollidingWithLeftTeamAgent && !mCollidingWithRightTeamAgent; + } + + return false; +} Modified: trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.h 2015-03-27 19:39:48 UTC (rev 387) +++ trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.h 2015-04-23 01:45:03 UTC (rev 388) @@ -76,6 +76,11 @@ /** updates the reference to the last agent that kicked the ball */ void UpdateLastKickingAgent(boost::shared_ptr<oxygen::AgentAspect> agent); + /** returns if ball is currently colliding with an agent from the given + team + */ + bool GetBallCollidingWithAgentTeam(TTeamIndex team); + protected: /** set up the reference to the ball and field collider */ virtual void OnLink(); @@ -128,6 +133,12 @@ /** then time when the last agent collided with the ball */ TTime mLastAgentCollisionTime; + /** if ball is currently colliding with left team agent */ + bool mCollidingWithLeftTeamAgent; + + /** if ball is currently colliding with right team agent */ + bool mCollidingWithRightTeamAgent; + /** then time when the last agent kicked the ball */ TTime mLastAgentKickTime; Modified: trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.cpp 2015-03-27 19:39:48 UTC (rev 387) +++ trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.cpp 2015-04-23 01:45:03 UTC (rev 388) @@ -37,6 +37,8 @@ BeamEffector::~BeamEffector() { + mXYRng.reset(); + mThetaRng.reset(); } #ifdef __APPLE_CC__ @@ -54,7 +56,9 @@ (mAction.get() == 0) || (mBody.get() == 0) || (mGameState.get() == 0) || - (mAgentState.get() == 0) + (mAgentState.get() == 0) || + (mXYRng.get() == 0) || + (mThetaRng.get() == 0) ) { return; @@ -78,10 +82,10 @@ || mGameState->GetPlayMode() == PM_Goal_Right) { Vector3f pos; - pos[0] = beamAction->GetPosX(); - pos[1] = beamAction->GetPosY(); + pos[0] = beamAction->GetPosX() + (*(mXYRng.get()))(); + pos[1] = beamAction->GetPosY() + (*(mXYRng.get()))(); - float angle = beamAction->GetXYAngle(); + float angle = beamAction->GetXYAngle() + (*(mThetaRng.get()))(); // reject nan or infinite numbers in the beam position if ( @@ -181,6 +185,17 @@ mAgentRadius = 0.22f; SoccerBase::GetSoccerVar(*this,"AgentRadius",mAgentRadius); + + mBeamNoiseXY = 0.05f; + SoccerBase::GetSoccerVar(*this, "BeamNoiseXY",mBeamNoiseXY); + + mBeamNoiseAngle = 10.0f; + SoccerBase::GetSoccerVar(*this, "BeamNoiseAngle",mBeamNoiseAngle); + + UniformRngPtr rng1(new salt::UniformRNG<>(-mBeamNoiseXY,mBeamNoiseXY)); + mXYRng = rng1; + UniformRngPtr rng2(new salt::UniformRNG<>(-mBeamNoiseAngle,mBeamNoiseAngle)); + mThetaRng = rng2; } void @@ -189,5 +204,7 @@ mBody.reset(); mGameState.reset(); mAgentState.reset(); + mXYRng.reset(); + mThetaRng.reset(); } Modified: trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.h 2015-03-27 19:39:48 UTC (rev 387) +++ trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.h 2015-04-23 01:45:03 UTC (rev 388) @@ -25,9 +25,13 @@ #include <oxygen/agentaspect/effector.h> #include <oxygen/physicsserver/rigidbody.h> #include <gamestateaspect/gamestateaspect.h> +#include <salt/random.h> class BeamEffector : public oxygen::Effector { +protected: + typedef boost::shared_ptr<salt::UniformRNG<> > UniformRngPtr; + public: BeamEffector(); virtual ~BeamEffector(); @@ -65,8 +69,20 @@ /** the cached field width */ float mFieldWidth; - /** thec cached agent radius */ + /** the cached agent radius */ float mAgentRadius; + + /** random number generator for beam X and Y noise */ + UniformRngPtr mXYRng; + + /** random number generator for beam angle noise */ + UniformRngPtr mThetaRng; + + /** amount of noise added to beam X and Y values */ + float mBeamNoiseXY; + + /** amount of noise added to beam angle value */ + float mBeamNoiseAngle; }; DECLARE_CLASS(BeamEffector); Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2015-03-27 19:39:48 UTC (rev 387) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2015-04-23 01:45:03 UTC (rev 388) @@ -76,6 +76,7 @@ mMaxFoulTime(0.0), // maximum time allowed for a player to commit a positional foul before being repositioned mLastKickOffKickTime(0), mCheckKickOffKickerFoul(false), + mAllowKickOffTeamToScore(true), mPenaltyShootout(false) { mFreeKickPos = Vector3f(0.0,0.0,mBallRadius); @@ -1022,6 +1023,9 @@ { mGameState->SetPaused(false); + mCheckKickOffKickerFoul = false; + mAllowKickOffTeamToScore = true; + ClearPlayersBeforeKickOff(idx); // if no player touched the ball for mDropBallTime, we move away @@ -1045,10 +1049,12 @@ if (time > mGameState->GetLastModeChange()) { boost::shared_ptr<GameControlServer> game_control; - if (SoccerBase::GetGameControlServer(*this, game_control) - && game_control->GetAgentCount() > 2) // todo: remove this when there is a "penalty" playmode + if ((SoccerBase::GetGameControlServer(*this, game_control) + && game_control->GetAgentCount() > 2) // todo: remove this when there is a "penalty" playmode + && !mPenaltyShootout) { mCheckKickOffKickerFoul = true; + mAllowKickOffTeamToScore = false; } mLastKickOffKickTime = time; mLastKickOffTaker = agent; @@ -1444,9 +1450,34 @@ if (WasLastKickFromKickOff(agent)) { PunishKickOffFoul(agent); - return false; + // Return true so that we know the ball is in the goal and don't check + // for other conditions such as the ball being out of bounds + return true; } + /* Don't allow goals kicked from inside center circle directly after + kickoff + */ + if (!mAllowKickOffTeamToScore) { + boost::shared_ptr<AgentState> agentState; + if (!SoccerBase::GetAgentState(mLastKickOffTaker, agentState)) + { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Cannot" + " get AgentState from an AgentAspect\n"; + } + else { + TTeamIndex team = agentState->GetTeamIndex(); + if (idx != team) { + // Team that scored is same team that took kickoff + PunishKickOffFoul(mLastKickOffTaker); + // Return true so that we know the ball is in the goal and + // don't check for other conditions such as the ball being out + // of bounds + return true; + } + } + } + // score the lucky team mGameState->ScoreTeam((idx == TI_LEFT) ? TI_RIGHT : TI_LEFT); mGameState->SetPlayMode((idx == TI_LEFT) ? PM_Goal_Right : PM_Goal_Left); @@ -1478,6 +1509,13 @@ { mGameState->SetPaused(false); + // check that player who took kickoff doesn't touch the ball a second + // time before another agent touches the ball + if (CheckKickOffTakerFoul()) + { + return; + } + // check if the ball is in one of the goals if (CheckGoal()) { @@ -1498,11 +1536,6 @@ } #endif - if (CheckKickOffTakerFoul()) - { - return; - } - // other checks go here... } @@ -1602,6 +1635,28 @@ mLastModeWasPlayOn = false; + if (!mAllowKickOffTeamToScore) { + // Check if requirements/rules have been met for team taking kickoff + // to score + boost::shared_ptr<AgentState> agentState; + if (!SoccerBase::GetAgentState(mLastKickOffTaker, agentState)) + { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Cannot" + " get AgentState from an AgentAspect\n"; + } + else { + TTeamIndex team = agentState->GetTeamIndex(); + bool ballTouchedByKickOffTeam = + mBallState->GetBallCollidingWithAgentTeam(team); + bool ballTouchedByNonKickOffTeam = + mBallState->GetBallCollidingWithAgentTeam(SoccerBase::OpponentTeam(team)); + salt::Vector2f ball_pos(mBallBody->GetPosition().x(), mBallBody->GetPosition().y()); + bool ballOutsideCenterCircle = ball_pos.Length() > mFreeKickDist; + mAllowKickOffTeamToScore = ballTouchedByNonKickOffTeam || + (ballTouchedByKickOffTeam && ballOutsideCenterCircle); + } + } + switch (playMode) { case PM_BeforeKickOff: Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2015-03-27 19:39:48 UTC (rev 387) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2015-04-23 01:45:03 UTC (rev 388) @@ -448,6 +448,8 @@ boost::shared_ptr<oxygen::AgentAspect> mLastKickOffTaker; /** if kickoff taker should be checked for single kick rule */ bool mCheckKickOffKickerFoul; + /** if kickoff taking team has met requirements/rules to score */ + bool mAllowKickOffTeamToScore; /** if in penalty shootout mode */ bool mPenaltyShootout; Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2015-03-27 19:39:48 UTC (rev 387) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2015-04-23 01:45:03 UTC (rev 388) @@ -98,6 +98,10 @@ addSoccerVar('ReportScore', true) addSoccerVar('LabelMessages', true) +# Noise added to requested beam positions +addSoccerVar('BeamNoiseXY',0.05) +addSoccerVar('BeamNoiseAngle',10.0) + # auto ref parameters for testing (not for use in competition...) #addSoccerVar('NotStandingMaxTime',10) #addSoccerVar('GoalieNotStandingMaxTime',30) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2015-05-10 19:53:17
|
Revision: 391 http://sourceforge.net/p/simspark/svn/391 Author: hedayat Date: 2015-05-10 19:53:15 +0000 (Sun, 10 May 2015) Log Message: ----------- Prepare release notes for rcssserver3d-0.6.9 release Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/RELEASE trunk/rcssserver3d/doc/TEXT_INSTEAD_OF_A_MANUAL.txt Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2015-05-09 20:31:23 UTC (rev 390) +++ trunk/rcssserver3d/ChangeLog 2015-05-10 19:53:15 UTC (rev 391) @@ -1,3 +1,11 @@ +2015-05-11 Hedayat Vatankhah <hed...@gm...> + + * RELEASE: + - prepared release notes for 0.6.9 release + + * doc/TEXT_INSTEAD_OF_A_MANUAL.txt: + - add small doc for new trainer commands to set score and time + 2014-06-25 Hedayat Vatankhah <hed...@gm...> * NEWS: @@ -9,7 +17,7 @@ * data/rsg/agent/nao/naoleg.rsg: * data/rsg/agent/nao/naolegtoe.rsg: * rcssserver3d/naorobottypes.rb: - - Update robot types for RoboCup 2014 including two new types, one of which + - update robot types for RoboCup 2014 including two new types, one of which has toes! Thanks to Patrick, Stefan and Klaus. 2014-05-30 Hedayat Vatankhah <hed...@gm...> Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2015-05-09 20:31:23 UTC (rev 390) +++ trunk/rcssserver3d/RELEASE 2015-05-10 19:53:15 UTC (rev 391) @@ -1,39 +1,46 @@ -RELEASE News of rcssserver3d-0.6.8.1 +RELEASE News of rcssserver3d-0.6.9 -This is a bug-fix release for 0.6.8, which had a bug in labeling hear messages. -It also includes few other changes: a small bug fix, and new hetero robot types -for RoboCup 2014. Now, our Nao robots can have toe! :) +This release comes with a number of bug fixes and also adds some new features +to enhance managing games and also to add more challenges to games, most notably +adding noise to the beam effector. The changes are: -And this is the release news for 0.6.8: -This release mainly comes with 2 new features: 1. labeling hear messages with -team names so that it is clear which team the message comes from. 2. Score -reporting. A few bug fixes are also included. +* Rule Changes: + - Added new rule requiring that the ball must either touch an opponent, or + touch a teammate outside the center circle, before a team taking a + kickoff can score. + - Penalty shootout kickoffs are direct now. -* Hear message labeling: - - Now hear messages include team names - Ex: (hear teamName 9 10 text) - -* Score Reporting: - - Example: (GS (unum 8) (team left) (sl 1) (sr 2) (t 0.00) (pm BeforeKickOff)) +* New Features: + - Added noise to the beam effector with the amount of noise added controlled + by the 'BeamNoiseXY' (in meters) and 'BeamNoiseAngle' (in degrees) + values in naosoccersim.rb. Noise is added to beam X and Y values from + a uniform distribution within the range [-BeamNoiseXY, BeamNoiseXY] + and to beam angle values from a uniform distribution within the range + [-BeamNoiseAngle, BeamNoiseAngle]. + - Added new training command parser commands for setting the game time and + score. They are the following commands: + (time <time>) + (score (left <score>) (right <score>)) + - Added penalty shootout mode where a goal is awarded to the left team + (penalty kicker) if the right team's player (penalty goalie) leaves the + penalty area. -* New Options in naosoccersim.rb: - - LabelMessages - Toggles on/off labeling of messages (default on) - - ReportScores - Toggles on/off score reporting (default on) - - MaxRobotTypeCount - Maximum number of any one robot type that may be - used (default 7 and can be set to 11 to preserve 2013 competition behavior) - - MinRobotTypesCount - Minimum number of robot types that must be used for a - full team (default 3 and can be set to 1 to preserve 2013 competition - behavior) - - MaxSumTwoRobotTypes - The maximum sum of robots for any two robot types - (default 9 but can be set to 11 to preserve 2013 competition behavior) - -* Other changes: - - Robot type checking to ensure that enough robot types (3) are used and that - not too many of any one (7) or two (9) types is used. - - Updating naorobottypes.rb with robot types used in 2013 competitions - - Clear Players in GoalLeft/Right before kickoff to make sure that opponent - doesn't touch ball at the middle of the field. - - Don't enforce crowding rules on kickoff, since opponent should not come - near the ball +* Bug fixes: + - Fixing a bug with free kicks where as soon as the ball was touched, + and the playmode transitioned from freekick to play on, the ball was + still moved back to the location of the freekick preventing the ball from + being directly kicked out of a free kick. Also ensuring that the ball + position for free kicks is updated correctly as this wasn't happening + right after the ball was placed back at the center of the field after + a goal was scored. + - Fixing a bug where a player would be incorrectly called for double + touching the ball on a kickoff if the player first kicked the ball + directly in the opponent's goal from a kickoff, resulting in no goal + being awarded a nd the opposing team being given a kickoff, and then is + the next player to touch the ball in the PlayOn playmode after a dropball + when the opponent doesn't take their kickoff. + - Fixing a bug where rules such as too many players in their own penalty + area was not being enforced. -You can get the package on the Simspark page on SourceForge -at http://sourceforge.net/projects/simspark/ +You can get the package on the Simspark page on SourceForge at +http://sourceforge.net/projects/simspark/ Modified: trunk/rcssserver3d/doc/TEXT_INSTEAD_OF_A_MANUAL.txt =================================================================== --- trunk/rcssserver3d/doc/TEXT_INSTEAD_OF_A_MANUAL.txt 2015-05-09 20:31:23 UTC (rev 390) +++ trunk/rcssserver3d/doc/TEXT_INSTEAD_OF_A_MANUAL.txt 2015-05-10 19:53:15 UTC (rev 391) @@ -760,8 +760,13 @@ Example: ((ball (pos 0.0 0.0 50.0))(getAck moved_ball_in_the_air)) +- (time <time>): + Set current game time +- (score (left <score>) (right <score>)): + Set current game score + 4. External Links ----------------- This section contains links to external resources that may be This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2015-05-15 18:13:37
|
Revision: 392 http://sourceforge.net/p/simspark/svn/392 Author: hedayat Date: 2015-05-15 18:13:36 +0000 (Fri, 15 May 2015) Log Message: ----------- Update version to 0.6.9 Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/NEWS Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2015-05-10 19:53:15 UTC (rev 391) +++ trunk/rcssserver3d/CMakeLists.txt 2015-05-15 18:13:36 UTC (rev 392) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.8.1") +set(PACKAGE_VERSION "0.6.9") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2015-05-10 19:53:15 UTC (rev 391) +++ trunk/rcssserver3d/ChangeLog 2015-05-15 18:13:36 UTC (rev 392) @@ -1,3 +1,9 @@ +2015-05-15 Hedayat Vatankhah <hed...@gm...> + + * CMakeLists.txt: + * NEWS: + - updated for version 0.6.9 + 2015-05-11 Hedayat Vatankhah <hed...@gm...> * RELEASE: Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2015-05-10 19:53:15 UTC (rev 391) +++ trunk/rcssserver3d/NEWS 2015-05-15 18:13:36 UTC (rev 392) @@ -1,3 +1,46 @@ +[0.6.9] +This release comes with a number of bug fixes and also adds some new features +to enhance managing games and also to add more challenges to games, most notably +adding noise to the beam effector. The changes are: + +* Rule Changes: + - Added new rule requiring that the ball must either touch an opponent, or + touch a teammate outside the center circle, before a team taking a + kickoff can score. + - Penalty shootout kickoffs are direct now. + +* New Features: + - Added noise to the beam effector with the amount of noise added controlled + by the 'BeamNoiseXY' (in meters) and 'BeamNoiseAngle' (in degrees) + values in naosoccersim.rb. Noise is added to beam X and Y values from + a uniform distribution within the range [-BeamNoiseXY, BeamNoiseXY] + and to beam angle values from a uniform distribution within the range + [-BeamNoiseAngle, BeamNoiseAngle]. + - Added new training command parser commands for setting the game time and + score. They are the following commands: + (time <time>) + (score (left <score>) (right <score>)) + - Added penalty shootout mode where a goal is awarded to the left team + (penalty kicker) if the right team's player (penalty goalie) leaves the + penalty area. + +* Bug fixes: + - Fixing a bug with free kicks where as soon as the ball was touched, + and the playmode transitioned from freekick to play on, the ball was + still moved back to the location of the freekick preventing the ball from + being directly kicked out of a free kick. Also ensuring that the ball + position for free kicks is updated correctly as this wasn't happening + right after the ball was placed back at the center of the field after + a goal was scored. + - Fixing a bug where a player would be incorrectly called for double + touching the ball on a kickoff if the player first kicked the ball + directly in the opponent's goal from a kickoff, resulting in no goal + being awarded a nd the opposing team being given a kickoff, and then is + the next player to touch the ball in the PlayOn playmode after a dropball + when the opponent doesn't take their kickoff. + - Fixing a bug where rules such as too many players in their own penalty + area was not being enforced. + [0.6.8.1] This is a bug-fix release for 0.6.8, which had a bug in labeling hear messages. It also includes few other changes: a small bug fix, and new hetero robot types This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2015-07-14 21:56:36
|
Revision: 397 http://sourceforge.net/p/simspark/svn/397 Author: hedayat Date: 2015-07-14 21:56:34 +0000 (Tue, 14 Jul 2015) Log Message: ----------- Prepared for 0.6.10 release Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/NEWS trunk/rcssserver3d/RELEASE Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2015-07-09 03:02:47 UTC (rev 396) +++ trunk/rcssserver3d/CMakeLists.txt 2015-07-14 21:56:34 UTC (rev 397) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.9") +set(PACKAGE_VERSION "0.6.10") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2015-07-09 03:02:47 UTC (rev 396) +++ trunk/rcssserver3d/NEWS 2015-07-14 21:56:34 UTC (rev 397) @@ -1,3 +1,15 @@ +[0.6.10] +This is the final release of rcssserver3d for RoboCup 2015, which brings a few +bug fixes and enhancements for the competitions: + * Turning off penalty shootout mode as soon as a goal is scored by the left + team so that a later second goal won't be recorded if the goalie leaves + the penalty area after the goal was scored. + * Added models for visually differentiating between different robot body + types. This changes some of the black coloring on the robot's body to be + a different type dependent neutral color. + * Fixed bug where the server may hang on certain systems if beam effector + noise (BeamNoiseXY and BeamNoiseAngle) are set to 0. + [0.6.9] This release comes with a number of bug fixes and also adds some new features to enhance managing games and also to add more challenges to games, most notably Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2015-07-09 03:02:47 UTC (rev 396) +++ trunk/rcssserver3d/RELEASE 2015-07-14 21:56:34 UTC (rev 397) @@ -1,46 +1,15 @@ -RELEASE News of rcssserver3d-0.6.9 +RELEASE News of rcssserver3d-0.6.10 -This release comes with a number of bug fixes and also adds some new features -to enhance managing games and also to add more challenges to games, most notably -adding noise to the beam effector. The changes are: +This is the final release of rcssserver3d for RoboCup 2015, which brings a few +bug fixes and enhancements for the competitions: + * Turning off penalty shootout mode as soon as a goal is scored by the left + team so that a later second goal won't be recorded if the goalie leaves + the penalty area after the goal was scored. + * Added models for visually differentiating between different robot body + types. This changes some of the black coloring on the robot's body to be + a different type dependent neutral color. + * Fixed bug where the server may hang on certain systems if beam effector + noise (BeamNoiseXY and BeamNoiseAngle) are set to 0. -* Rule Changes: - - Added new rule requiring that the ball must either touch an opponent, or - touch a teammate outside the center circle, before a team taking a - kickoff can score. - - Penalty shootout kickoffs are direct now. - -* New Features: - - Added noise to the beam effector with the amount of noise added controlled - by the 'BeamNoiseXY' (in meters) and 'BeamNoiseAngle' (in degrees) - values in naosoccersim.rb. Noise is added to beam X and Y values from - a uniform distribution within the range [-BeamNoiseXY, BeamNoiseXY] - and to beam angle values from a uniform distribution within the range - [-BeamNoiseAngle, BeamNoiseAngle]. - - Added new training command parser commands for setting the game time and - score. They are the following commands: - (time <time>) - (score (left <score>) (right <score>)) - - Added penalty shootout mode where a goal is awarded to the left team - (penalty kicker) if the right team's player (penalty goalie) leaves the - penalty area. - -* Bug fixes: - - Fixing a bug with free kicks where as soon as the ball was touched, - and the playmode transitioned from freekick to play on, the ball was - still moved back to the location of the freekick preventing the ball from - being directly kicked out of a free kick. Also ensuring that the ball - position for free kicks is updated correctly as this wasn't happening - right after the ball was placed back at the center of the field after - a goal was scored. - - Fixing a bug where a player would be incorrectly called for double - touching the ball on a kickoff if the player first kicked the ball - directly in the opponent's goal from a kickoff, resulting in no goal - being awarded a nd the opposing team being given a kickoff, and then is - the next player to touch the ball in the PlayOn playmode after a dropball - when the opponent doesn't take their kickoff. - - Fixing a bug where rules such as too many players in their own penalty - area was not being enforced. - You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2015-09-12 01:48:33
|
Revision: 400 http://sourceforge.net/p/simspark/svn/400 Author: hedayat Date: 2015-09-12 01:48:31 +0000 (Sat, 12 Sep 2015) Log Message: ----------- Fix cmake error when Carbon library is not found * Enable C++11 support only when Carbon is found. If C++11 support is enabled, compilation will fail with currently released simspark library versions. For the next release, C++11 support will be always enabled. Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt Added Paths: ----------- trunk/rcssserver3d/cmake/EnableCXX11.cmake Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2015-09-12 01:48:23 UTC (rev 399) +++ trunk/rcssserver3d/CMakeLists.txt 2015-09-12 01:48:31 UTC (rev 400) @@ -42,16 +42,17 @@ add_definitions(-DHAVE_CONFIG_H ${ODE_CFLAGS}) include_directories(${CMAKE_BINARY_DIR} ${Boost_INCLUDE_DIRS} ${ODE_INCLUDE_DIR} ${SPARK_INCLUDE_DIR} ${SALT_INCLUDE_DIR} ${ZEITGEIST_INCLUDE_DIR} - ${OXYGEN_INCLUDE_DIR} ${KEROSIN_INCLUDE_DIR} ${CARBON_INCLUDE_DIR}) + ${OXYGEN_INCLUDE_DIR} ${KEROSIN_INCLUDE_DIR}) + +if (CARBON_FOUND) + include(EnableCXX11) + include_directories(${CARBON_INCLUDE_DIR}) +endif (CARBON_FOUND) + link_directories(${Boost_LIBRARY_DIRS}) if (UNIX) - set(CMAKE_CXX_FLAGS $ENV{CXXFLAGS} "-std=gnu++11" CACHE - STRING "Common C++ compiler flags" FORCE) - set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -W -Wall -Woverloaded-virtual" CACHE - STRING "C++ compiler flags for Debug builds" FORCE) - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE - STRING "C++ compiler flags for Release builds" FORCE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Woverloaded-virtual") endif (UNIX) if(WIN32) Added: trunk/rcssserver3d/cmake/EnableCXX11.cmake =================================================================== --- trunk/rcssserver3d/cmake/EnableCXX11.cmake (rev 0) +++ trunk/rcssserver3d/cmake/EnableCXX11.cmake 2015-09-12 01:48:31 UTC (rev 400) @@ -0,0 +1,21 @@ +# - Use C++11 standard +# +# Author: +# Kevin M. Godby <ke...@go...> +# +# Hedayat: modified to support gnu++11/gnu++0x instead +# Note that Microsoft Visual C++ compiler enables C++11 by default + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX) + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-std=gnu++11 SUPPORTS_STD_GNUXX11) + check_cxx_compiler_flag(-std=gnu++0x SUPPORTS_STD_GNUXX0X) + if(SUPPORTS_STD_GNUXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + elseif(SUPPORTS_STD_GNUXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") + else() + message(ERROR "Compiler does not support -std=gnu++11 or -std=gnu++0x.") + endif() +endif() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2016-05-29 05:27:59
|
Revision: 405 http://sourceforge.net/p/simspark/svn/405 Author: patmac369 Date: 2016-05-29 05:27:56 +0000 (Sun, 29 May 2016) Log Message: ----------- Adding changes for the RoboCup 2016 competition. Additions are the following: - Updated and revised foul model - Most free kicks are now indirect and direct_free_kick playmodes are added - Keepaway mode - Say messages with illegal characters are thrown out - Plugin for sending draw commands to roboviz (rvdraw) Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/cmake/FindODE.cmake trunk/rcssserver3d/plugin/soccer/CMakeLists.txt trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.cpp trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.h trunk/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.cpp trunk/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.h trunk/rcssserver3d/plugin/soccer/sayeffector/sayeffector.cpp trunk/rcssserver3d/plugin/soccer/soccerbase/soccerbase.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h trunk/rcssserver3d/plugin/soccer/soccertypes.h trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp trunk/rcssserver3d/plugin/soccermonitor/soccerinput.cpp trunk/rcssserver3d/plugin/soccermonitor/soccerinput.h trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb trunk/rcssserver3d/rcssserver3d/main.cpp trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Added Paths: ----------- trunk/rcssserver3d/plugin/soccer/rvdraw/ trunk/rcssserver3d/plugin/soccer/rvdraw/rvdraw.cpp trunk/rcssserver3d/plugin/soccer/rvdraw/rvdraw.h Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/CMakeLists.txt 2016-05-29 05:27:56 UTC (rev 405) @@ -1,8 +1,13 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.10") +set(PACKAGE_VERSION "0.6.11") +option(RVDRAW "Enable roboviz drawings" OFF) +if (RVDRAW) + add_definitions(-DRVDRAW) +endif (RVDRAW) + ########## check for headerfiles/libraries ########## include(CheckIncludeFile) check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H) @@ -26,7 +31,7 @@ find_package(Spark REQUIRED) find_package(Freetype REQUIRED) -find_package(Boost REQUIRED system) +find_package(Boost REQUIRED system regex) find_package(SDL REQUIRED) find_package(DevIL REQUIRED) find_package(ODE REQUIRED) Modified: trunk/rcssserver3d/cmake/FindODE.cmake =================================================================== --- trunk/rcssserver3d/cmake/FindODE.cmake 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/cmake/FindODE.cmake 2016-05-29 05:27:56 UTC (rev 405) @@ -97,6 +97,7 @@ ${ODE_CONFIG_PREFIX}/lib /usr/lib /usr/lib64 + /usr/lib/x86_64-linux-gnu /usr/local/lib $ENV{ODE_HOME}/lib C:/library/ode/lib/ Modified: trunk/rcssserver3d/plugin/soccer/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/plugin/soccer/CMakeLists.txt 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/CMakeLists.txt 2016-05-29 05:27:56 UTC (rev 405) @@ -51,6 +51,11 @@ rcs3dmonitor/rcs3dmonitor.h ) +if (RVDRAW) + list(APPEND soccer_LIB_HDRS rvdraw/rvdraw.h) +endif (RVDRAW) + + set(soccer_LIB_SRCS export.cpp agentstate/agentstate.cpp @@ -131,6 +136,11 @@ rcs3dmonitor/rcs3dmonitor_c.cpp ) +if (RVDRAW) + list(APPEND soccer_LIB_SRCS rvdraw/rvdraw.cpp) +endif (RVDRAW) + + include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${FREETYPE_INCLUDE_DIRS} ${IL_INCLUDE_DIR}) Modified: trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/agentcollisionhandler/agentcollisionhandler.cpp 2016-05-29 05:27:56 UTC (rev 405) @@ -7,6 +7,8 @@ { } +#include <ode/ode.h> + void AgentCollisionHandler::HandleCollision(boost::shared_ptr<Collider> collidee, GenericContact& contact) { if (!mAgentState.get()) @@ -44,6 +46,14 @@ myGroup->clear(); mAgentState->SetTouchGroup(otherGroup); } + dContact& ODEContact = (dContact&) contact; + //GetLog()->Error() << "(AgentCollisionHandler) contact pos " << ODEContact.geom.pos[0]<<","<< ODEContact.geom.pos[1] << ","<< ODEContact.geom.pos[2] << "\n"; + mAgentState->mCollisionPos.x() = ODEContact.geom.pos[0]; + mAgentState->mCollisionPos.y() = ODEContact.geom.pos[1]; + mAgentState->mCollisionPos.z() = ODEContact.geom.pos[2]; + other->mCollisionPos.x() = ODEContact.geom.pos[0]; + other->mCollisionPos.y() = ODEContact.geom.pos[1]; + other->mCollisionPos.z() = ODEContact.geom.pos[2]; } } Modified: trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2016-05-29 05:27:56 UTC (rev 405) @@ -122,6 +122,9 @@ /** Set the current touch group */ void SetTouchGroup(boost::shared_ptr<TouchGroup> group); + /** Point at which collision with another agent occurred */ + salt::Vector3f mCollisionPos; + protected: /** team index */ TTeamIndex mTeamIndex; Modified: trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.cpp 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.cpp 2016-05-29 05:27:56 UTC (rev 405) @@ -49,6 +49,13 @@ { } + +bool BallStateAspect::GetCollidingAgents(list<boost::shared_ptr<AgentAspect> >& agents) +{ + agents = mCollidingAgents; + return agents.size() > 0; +} + bool BallStateAspect::GetLastCollidingAgent(boost::shared_ptr<AgentAspect>& agent, TTime& time) { @@ -67,10 +74,11 @@ return (agent.get() != 0); } -void BallStateAspect::UpdateLastCollidingAgent() +void BallStateAspect::UpdateCollidingAgents() { mCollidingWithLeftTeamAgent = false; mCollidingWithRightTeamAgent = false; + mCollidingAgents = list<boost::shared_ptr<AgentAspect> >(); // get a list of agents that collided with the ball since the last // update of the recorder and remember the first returned node as @@ -96,6 +104,7 @@ " get AgentState from an AgentAspect\n"; } else { + mCollidingAgents.push_back(agent); TTeamIndex team = agentState->GetTeamIndex(); if (team == TI_LEFT) { mCollidingWithLeftTeamAgent = true; @@ -184,7 +193,7 @@ return; } - UpdateLastCollidingAgent(); + UpdateCollidingAgents(); UpdateBallOnField(); UpdateLastValidBallPos(); UpdateGoalState(); Modified: trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.h 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/ballstateaspect/ballstateaspect.h 2016-05-29 05:27:56 UTC (rev 405) @@ -47,6 +47,11 @@ */ virtual void Update(float deltaTime); + /** returns list of agents colliding with the ball + */ + bool GetCollidingAgents + (std::list<boost::shared_ptr<oxygen::AgentAspect> >& agents); + /** returns the last agent that collided with the ball and the time when this happened*/ bool GetLastCollidingAgent @@ -88,10 +93,8 @@ /** reset the reference to the ball and field recorder */ virtual void OnUnlink(); - /** updates the reference to the last agent that collided with the - ball - */ - void UpdateLastCollidingAgent(); + /** updates the references to agents colliding with the ball */ + void UpdateCollidingAgents(); /** checks if the ball is on the playing field an updates the mBallOnField flag @@ -120,6 +123,9 @@ /** reference to the right goal recorder */ boost::shared_ptr<oxygen::RecorderHandler> mRightGoalRecorder; + /** list of references to agents currently colliding with the ball */ + std::list<boost::shared_ptr<oxygen::AgentAspect> > mCollidingAgents; + /** holds a reference to the last agent that collided with the ball */ boost::shared_ptr<oxygen::AgentAspect> mLastCollidingAgent; Modified: trunk/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.cpp 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.cpp 2016-05-29 05:27:56 UTC (rev 405) @@ -61,6 +61,8 @@ //JAN scriptServer->CreateVariable("Command.FreeKickLeft", CmdFreeKickLeft); scriptServer->CreateVariable("Command.FreeKickRight", CmdFreeKickRight); + scriptServer->CreateVariable("Command.DirectFreeKickLeft", CmdDirectFreeKickLeft); + scriptServer->CreateVariable("Command.DirectFreeKickRight", CmdDirectFreeKickRight); scriptServer->CreateVariable("Command.NextCamera", CmdNextCamera); scriptServer->CreateVariable("Command.PreviousCamera", CmdPreviousCamera); @@ -255,6 +257,19 @@ } break; + case CmdDirectFreeKickLeft: + if (input.GetKeyPress()) + { + mGameState->SetPlayMode(PM_DIRECT_FREE_KICK_LEFT); + } + break; + case CmdDirectFreeKickRight: + if (input.GetKeyPress()) + { + mGameState->SetPlayMode(PM_DIRECT_FREE_KICK_RIGHT); + + } + break; case CmdKillAgentLeft: if (input.GetKeyPress()) { Modified: trunk/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.h 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.h 2016-05-29 05:27:56 UTC (rev 405) @@ -56,7 +56,9 @@ //JAN CmdFreeKickLeft = CmdCameraRightGoal + 1, CmdFreeKickRight = CmdFreeKickLeft + 1, - CmdKillAgentLeft = CmdFreeKickRight + 1, + CmdDirectFreeKickLeft = CmdFreeKickRight + 1, + CmdDirectFreeKickRight = CmdDirectFreeKickLeft + 1, + CmdKillAgentLeft = CmdDirectFreeKickRight + 1, CmdKillAgentRight = CmdKillAgentLeft + 1, CmdNextCamera = CmdKillAgentRight + 1, Added: trunk/rcssserver3d/plugin/soccer/rvdraw/rvdraw.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/rvdraw/rvdraw.cpp (rev 0) +++ trunk/rcssserver3d/plugin/soccer/rvdraw/rvdraw.cpp 2016-05-29 05:27:56 UTC (rev 405) @@ -0,0 +1,719 @@ +/* + * Copyright (C) 2011 Justin Stoecker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "rvdraw.h" +#include "soccertypes.h" + +long RVSender::uniqueIdNum; + + +/** + * sockfd = -1 on error! + * This creates a socket, which + * is then closed by the + * destructor. Do not close the + * socket! + */ +RVSender::RVSender() +{ + socketCreated = false; + sockfd = -1; + + struct addrinfo hints, *servinfo, *p_ptr; + int rv; + + char *mHost = getenv("RVDRAW_HOST"); + if (mHost == NULL) { + return; + } + + memset(&hints, 0, sizeof hints); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + + if ((rv = getaddrinfo(mHost, ROBOVIS_PORT, &hints, &servinfo)) != 0) { + fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); + return; + } + + // loop through all the results and make a socket + for(p_ptr = servinfo; p_ptr != NULL; p_ptr = p_ptr->ai_next) { + if ((sockfd = socket(p_ptr->ai_family, p_ptr->ai_socktype, + p_ptr->ai_protocol)) == -1) { + perror("socket"); + continue; + } + + p = *p_ptr; + + break; + } + + if (p_ptr == NULL) { + fprintf(stderr, "failed to bind socket\n"); + freeaddrinfo(servinfo); + return; + } + + socketCreated = true; + + //freeaddrinfo(servinfo); +} + +/** + * Give a socket and addrinfo. + * Whoever created the socket is + * responsible for closing it! + */ +RVSender::RVSender(int sockfd_, struct addrinfo p_) +{ + socketCreated = false; + p = p_; + sockfd = sockfd_; +} + +RVSender::~RVSender() +{ + if (socketCreated) + close(sockfd); +} + +/* +int RVSender::getSockFD() + { + return sockfd; + } + +struct addrinfo RVSender::getP() + { + return p; + } +*/ + + +char RVSender::getTeamAgent(int uNum, int side) { + return (side == TI_LEFT ? uNum : uNum + 128) - 1; +} + +//drawing colors are uniform & team specific +//this must match the enum in rvdraw.h +void RVSender::getColor(int uNum, float &r, float &g, float &b, bool shade) { + switch(uNum) { + case 1: //red + r = 1; + g = 0; + b = 0; + break; + case 2: //orange + r = 1; + g = 0.5f; + b = 0; + break; + case 3: //yellow + r = 1; + g = 1; + b = 0; + break; + case 4: //green + r = 0; + g = 1; + b = 0; + break; + case 5: //blue-green + r = 0; + g = 1; + b = 0.5f; + break; + case 6: //light blue + r = 0; + g = 1; + b = 1; + break; + case 7: //blue + r = 0; + g = 0.5f; + b = 1; + break; + case 8: //dark blue + r = 0; + g = 0; + b = 1; + break; + case 9: //violet + r = 0.5f; + g = 0; + b = 1; + break; + case 10: //pink + r = 1; + g = 0; + b = 1; + break; + case 11: //magenta + r = 1; + g = 0; + b = 0.5f; + break; + default: + r = 0; + g = 0; + b = 0; + } + + // Get darker color + if (shade) { + r /= 2.0f; + g /= 2.0f; + b /= 2.0f; + } +} + +string RVSender::getMyId() { + return "rcss"; +} + +string RVSender::getDrawingId(const string* name) { + stringstream stream; + stream << getMyId() << '.' << *name; + return stream.str(); +} + +string RVSender::getUniqueId(long unique) { + stringstream stream; + stream << '_' << unique << '.' << getMyId(); + return stream.str(); +} + +string RVSender::getUniqueId() { + return getUniqueId(uniqueIdNum++); +} + +void RVSender::flipPolygon(float *v, int numVerts) { + /* must flip each number, there are three numbers (x, y, z) for each vertex */ + for (int i = 0; i < numVerts * 3; i++) { + v[i] = -v[i]; + } +} + +void RVSender::updateDrawings(string id, string buf) { + drawings[id] = buf; +} + + +// === Public Methods === + +void RVSender::clear() { + for (map<string,string>::iterator it = drawings.begin(); + it != drawings.end(); ++it) { + it->second = ""; + } +} + +void RVSender::refresh() { + string myId(getMyId()); + swapBuffers(&myId); +} + +void RVSender::clearStaticDrawings() { + for (long i = 0; i < uniqueIdNum; i++) { + string uniqueId = getUniqueId(i); + swapBuffers(&uniqueId); + } + uniqueIdNum = 0; +} + +void RVSender::drawCircle(string name, double x, double y, double radius, + RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawCircle(name, x, y, radius, r, g, b); +} + +void RVSender::drawCircle(string name, double x, double y, double radius, float r, float g, float b) { + string id = getDrawingId(&name); + string buf = string(id); + drawCircle(x, y, radius, 3, r, g, b, &buf); + updateDrawings(id, buf); +} + +void RVSender::drawCircle(double x, double y, double radius, RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawCircle(x, y, radius, r, g, b); +} + +void RVSender::drawCircle(double x, double y, double radius, float r, float g, float b) { + string id = getUniqueId(); + string buf = string(id); + drawCircle(x, y, radius, 3, r, g, b, &buf); + swapBuffers(&id); +} + +void RVSender::drawLine(string name, double x1, double y1, double x2, double y2, + RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawLine(name, x1, y1, x2, y2, r, g, b); +} + +void RVSender::drawLine(string name, double x1, double y1, double x2, double y2, + float r, float g, float b) { + string id = getDrawingId(&name); + string buf = string(id); + drawLine(x1, y1, 0, x2, y2, 0, 3, r, g, b, &buf); + updateDrawings(id, buf); +} + +void RVSender::drawLine(double x1, double y1, double x2, double y2, RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawLine(x1, y1, x2, y2, r, g, b); +} + +void RVSender::drawLine(double x1, double y1, double x2, double y2, float r, float g, float b) { + string id = getUniqueId(); + string buf = string(id); + drawLine(x1, y1, 0, x2, y2, 0, 3, r, g, b, &buf); + swapBuffers(&id); +} + +void RVSender::drawText(string name, string text, double x, double y, + RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawText(name, text, x, y, r, g, b); +} + +void RVSender::drawText(string name, string text, double x, double y, + float r, float g, float b) { + string id = getDrawingId(&name); + string buf = string(id); + drawAnnotation(&text, x, y, 0, r, g, b, &buf); + updateDrawings(id, buf); +} + +void RVSender::drawText(string text, double x, double y, + RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawText(text, x, y, r, g, b); +} + +void RVSender::drawText(string text, double x, double y, + float r, float g, float b) { + string id = getUniqueId(); + string buf = string(id); + drawAnnotation(&text, x, y, 0, r, g, b, &buf); + swapBuffers(&id); +} + +void RVSender::drawPoint(string name, double x, double y, double radius, + RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawPoint(name, x, y, radius, r, g, b); +} + +void RVSender::drawPoint(string name, double x, double y, double radius, + float r, float g, float b) { + string id = getDrawingId(&name); + string buf = string(id); + drawPoint(x, y, 0, radius, r, g, b, &buf); + updateDrawings(id, buf); +} + +void RVSender::drawPoint(double x, double y, double radius, + RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawPoint(x, y, radius, r, g, b); +} + +void RVSender::drawPoint(double x, double y, double radius, + float r, float g, float b) { + string id = getUniqueId(); + string buf = string(id); + drawPoint(x, y, 0, radius, r, g, b, &buf); + swapBuffers(&id); +} + +void RVSender::drawSphere(string name, double x, double y, double z, + double radius, RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawSphere(name, x, y, z, radius, r, g, b); +} + +void RVSender::drawSphere(string name, double x, double y, double z, + double radius, float r, float g, float b) { + string id = getDrawingId(&name); + string buf = string(id); + drawSphere(x, y, z, radius, r, g, b, &buf); + updateDrawings(id, buf); +} + +void RVSender::drawSphere(double x, double y, double z, + double radius, RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawSphere(x, y, z, radius, r, g, b); +} + +void RVSender::drawSphere(double x, double y, double z, + double radius, float r, float g, float b) { + string id = getUniqueId(); + string buf = string(id); + drawSphere(x, y, z, radius, r, g, b, &buf); + swapBuffers(&id); +} + +void RVSender::drawPolygon(string name, float *v, int numVerts, + RVSender::Color c, bool shade, float a) { + float r, g, b; + getColor(c, r, g, b, shade); + drawPolygon(name, v, numVerts, r, g, b, a); +} + +void RVSender::drawPolygon(string name, float *v, int numVerts, + float r, float g, float b, float a) { + string id = getDrawingId(&name); + string buf = string(id); + drawPolygon((float*)v, numVerts, r, g, b, a, &buf); + updateDrawings(id, buf); +} + +void RVSender::drawPolygon(float *v, int numVerts, + RVSender::Color c, bool shade, float a) { + float r, g, b; + getColor(c, r, g, b, shade); + drawPolygon(v, numVerts, r, g, b, a); +} + +void RVSender::drawPolygon(float *v, int numVerts, + float r, float g, float b, float a) { + string id = getUniqueId(); + string buf = string(id); + drawPolygon((float*)v, numVerts, r, g, b, a, &buf); + swapBuffers(&id); +} + +void RVSender::drawAgentText(string text, int uNum, int side, RVSender::Color c, bool shade) { + float r, g, b; + getColor(c, r, g, b, shade); + drawAgentText(text, uNum, side, r, g, b); +} + +void RVSender::drawAgentText(string text, int uNum, int side, float r, float g, float b) { + char teamAgent = getTeamAgent(uNum, side); + drawAgentAnnotation(&text, teamAgent, r, g, b); +} + +void RVSender::removeAgentText(int u, int s) { + char teamAgent = getTeamAgent(u, s); + removeAgentAnnotation(teamAgent); +} + +void RVSender::selectAgent(int u, int s) { + char teamAgent = getTeamAgent(u, s); + selectAgent(teamAgent); +} + +void RVSender::swapBuffers(const string* setName) { + int bufSize = -1; + unsigned char* buf = newBufferSwap(setName, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::drawLine(float x1, float y1, float z1, float x2, float y2, float z2, float thickness, float r, float g, float b, + const string* setName) { + float pa[3] = {x1,y1,z1}; + float pb[3] = {x2,y2,z2}; + float color[3] = {r,g,b}; + + int bufSize = -1; + unsigned char* buf = newLine(pa, pb, thickness, color, setName, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::drawCircle(float x, float y, float radius, float thickness, float r, float g, float b, const string* setName) { + float center[2] = {x,y}; + float color[3] = {r,g,b}; + + int bufSize = -1; + unsigned char* buf = newCircle(center, radius, thickness, color, setName, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::drawSphere(float x, float y, float z, float radius, float r, float g, float b, const string* setName) { + float center[3] = {x,y,z}; + float color[3] = {r,g,b}; + + int bufSize = -1; + unsigned char* buf = newSphere(center, radius, color, setName, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::drawPoint(float x, float y, float z, float size, float r, float g, float b, const string* setName) { + float center[3] = {x,y,z}; + float color[3] = {r,g,b}; + + //printf("Point: (%f, %f, %f)\n", x, y, z); + + int bufSize = -1; + unsigned char* buf = newPoint(center, size, color, setName, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::drawPolygon(const float* v, int numVerts, float r, float g, float b, float a, + const string* setName) { + float color[4] = {r,g,b,a}; + + int bufSize = -1; + unsigned char* buf = newPolygon(v, numVerts, color, setName, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::drawAnnotation(const string *txt, float x, float y, float z, + float r, float g, float b, const string *setName) +{ + float color[3] = {r,g,b}; + float point[3] = {x,y,z}; + int bufSize = -1; + unsigned char *buf = newAnnotation(txt, point, color, setName, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::drawAgentAnnotation(const string *txt, char teamAgent, + float r, float g, float b) +{ + float color[3] = {r,g,b}; + int bufSize = -1; + unsigned char *buf = newAgentAnnotation(txt, teamAgent, color, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::removeAgentAnnotation(char teamAgent) +{ + int bufSize = -1; + unsigned char *buf = newRemoveAgentAnnotation(teamAgent, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +void RVSender::selectAgent(char teamAgent) +{ + int bufSize = -1; + unsigned char *buf = newSelectAgent(teamAgent, &bufSize); + sendto(sockfd, buf, bufSize, 0, p.ai_addr, p.ai_addrlen); + delete[] buf; +} + +// The following commands allocate memory, if you use them be sure to deallocate +// the memory later. + +unsigned char* RVSender::newBufferSwap(const string* name, int* bufSize) { + *bufSize = 3 + ((name != NULL) ? name->length() : 0); + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 0); + i += writeCharToBuf(buf+i, 0); + i += writeStringToBuf(buf+i, name); + + return buf; +} + +unsigned char* RVSender::newCircle(const float* center, float radius, float thickness, + const float* color, const string* setName, int* bufSize) { + + *bufSize = 30 + ((setName != NULL) ? setName->length() : 0); + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 1); + i += writeCharToBuf(buf+i, 0); + i += writeFloatToBuf(buf+i, center[0]); + i += writeFloatToBuf(buf+i, center[1]); + i += writeFloatToBuf(buf+i, radius); + i += writeFloatToBuf(buf+i, thickness); + i += writeColorToBuf(buf+i, color, 3); + i += writeStringToBuf(buf+i, setName); + + return buf; +} + +unsigned char* RVSender::newLine(const float* a, const float* b, float thickness, + const float* color, const string* setName, int* bufSize) { + + *bufSize = 48 + ((setName != NULL) ? setName->length() : 0); + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 1); + i += writeCharToBuf(buf+i, 1); + i += writeFloatToBuf(buf+i, a[0]); + i += writeFloatToBuf(buf+i, a[1]); + i += writeFloatToBuf(buf+i, a[2]); + i += writeFloatToBuf(buf+i, b[0]); + i += writeFloatToBuf(buf+i, b[1]); + i += writeFloatToBuf(buf+i, b[2]); + i += writeFloatToBuf(buf+i, thickness); + i += writeColorToBuf(buf+i, color, 3); + i += writeStringToBuf(buf+i, setName); + + return buf; +} + +unsigned char* RVSender::newPoint(const float* p, float size, const float* color, + const string* setName, int* bufSize) { + + *bufSize = 30 + ((setName != NULL) ? setName->length() : 0); + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 1); + i += writeCharToBuf(buf+i, 2); + i += writeFloatToBuf(buf+i, p[0]); + i += writeFloatToBuf(buf+i, p[1]); + i += writeFloatToBuf(buf+i, p[2]); + i += writeFloatToBuf(buf+i, size); + i += writeColorToBuf(buf+i, color, 3); + i += writeStringToBuf(buf+i, setName); + + return buf; +} + +unsigned char* RVSender::newSphere(const float* p, float radius, const float* color, + const string* setName, int* bufSize) { + + *bufSize = 30 + ((setName != NULL) ? setName->length() : 0); + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 1); + i += writeCharToBuf(buf+i, 3); + i += writeFloatToBuf(buf+i, p[0]); + i += writeFloatToBuf(buf+i, p[1]); + i += writeFloatToBuf(buf+i, p[2]); + i += writeFloatToBuf(buf+i, radius); + i += writeColorToBuf(buf+i, color, 3); + i += writeStringToBuf(buf+i, setName); + + return buf; +} + +unsigned char* RVSender::newPolygon(const float* v, int numVerts, const float* color, + const string* setName, int* bufSize) { + + *bufSize = 18 * numVerts + 8 + ((setName != NULL) ? setName->length() : 0); + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 1); + i += writeCharToBuf(buf+i, 4); + i += writeCharToBuf(buf+i, numVerts); + i += writeColorToBuf(buf+i, color, 4); + + for (int j = 0; j < numVerts; j++) { + i += writeFloatToBuf(buf+i, v[j*3+0]); + i += writeFloatToBuf(buf+i, v[j*3+1]); + i += writeFloatToBuf(buf+i, v[j*3+2]); + } + + i += writeStringToBuf(buf+i, setName); + + return buf; +} + +unsigned char* RVSender::newAnnotation(const string *txt, const float *p, const float* color, + const string* setName, int* bufSize) { + + *bufSize = 25 + ((setName != NULL) ? setName->length() : 0) + + ((txt != NULL) ? txt->length(): 0); + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 2); + i += writeCharToBuf(buf+i, 0); + i += writeFloatToBuf(buf+i, p[0]); + i += writeFloatToBuf(buf+i, p[1]); + i += writeFloatToBuf(buf+i, p[2]); + i += writeColorToBuf(buf+i, color, 3); + i += writeStringToBuf(buf+i, txt); + i += writeStringToBuf(buf+i, setName); + + return buf; +} + +unsigned char* RVSender::newAgentAnnotation(const string *txt, const char teamAgent, const float* color, int* bufSize) { + + *bufSize = 7 + ((txt != NULL) ? txt->length(): 0); + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 2); + i += writeCharToBuf(buf+i, 1); + i += writeCharToBuf(buf+i, teamAgent); + i += writeColorToBuf(buf+i, color, 3); + i += writeStringToBuf(buf+i, txt); + + return buf; +} + +unsigned char* RVSender::newRemoveAgentAnnotation(const char teamAgent, int* bufSize) { + + *bufSize = 3; + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 2); + i += writeCharToBuf(buf+i, 2); + i += writeCharToBuf(buf+i, teamAgent); + + return buf; +} + +unsigned char* RVSender::newSelectAgent(const char teamAgent, int* bufSize) { + + *bufSize = 3; + unsigned char* buf = new unsigned char[*bufSize]; + + long i = 0; + i += writeCharToBuf(buf+i, 3); + i += writeCharToBuf(buf+i, 0); + i += writeCharToBuf(buf+i, teamAgent); + + return buf; +} + +/* +int main() + { + RVSender send = RVSender(); + string str = string("thing"); + send.drawPoint(1, 1, 1, 4, 1, 0, 0, &str); + send.swapBuffers(&str); + } +//*/ + Added: trunk/rcssserver3d/plugin/soccer/rvdraw/rvdraw.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/rvdraw/rvdraw.h (rev 0) +++ trunk/rcssserver3d/plugin/soccer/rvdraw/rvdraw.h 2016-05-29 05:27:56 UTC (rev 405) @@ -0,0 +1,301 @@ +#ifndef RVDRAW_H +#define RVDRAW_H + +/* + * Copyright (C) 2011 Justin Stoecker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include <cstdio> +#include <cstring> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <netdb.h> +#include <string> +#include <math.h> +#include <map> +#include <boost/lexical_cast.hpp> +#include <sstream> +#include <iomanip> + +#define ROBOVIS_PORT "32769" + +//class RVSender; + +//RVSender* pRVSender; + +using namespace std; + +//extern string mRVDrawHost; + +inline int writeCharToBuf(unsigned char* buf, unsigned char value) { + *buf = value; + return 1; +} + +inline int writeFloatToBuf(unsigned char* buf, float value) { + char temp[20]; + sprintf(temp, "%6f", value); + memcpy(buf, temp, 6); + return 6; +} + +inline int writeColorToBuf(unsigned char* buf, const float* color, int channels) { + int i; + for (i = 0; i < channels; i++) + writeCharToBuf(buf+i, (unsigned char)(color[i]*255)); + return i; +} + +inline int writeStringToBuf(unsigned char* buf, const string* text) { + long i = 0; + if (text != NULL) + i += text->copy((char*)buf+i, text->length(), 0); + i += writeCharToBuf(buf+i, 0); + return i; +} + +//for the drawings map +struct DrawObject { + string id; + string buf; +}; + +class RVSender +{ +private: + static long uniqueIdNum; + map<string, string> drawings; + char getTeamAgent(int uNum, int side); //for AgentAnnotation commands + void getColor(int uNum, float &r, float &g, float &b, bool shade=false); + string getMyId(); + string getDrawingId(const string* name); + string getUniqueId(long unique); + string getUniqueId(); + void flipPolygon(float *v, const int numVerts); //for agents on SIDE_RIGHT + void updateDrawings(string id, string buf); + + int sockfd; + struct addrinfo p; + bool socketCreated; + + unsigned char* newBufferSwap(const string* name, int* bufSize); + unsigned char* newCircle(const float* center, + float radius, float thickness, + const float* color, + const string* setName, + int *bufSize); + unsigned char* newLine(const float* a, + const float* b, + float thickness, + const float* color, + const string* setName, + int* bufSize); + unsigned char* newPoint(const float* p, + float size, + const float* color, + const string* setName, + int* bufSize); + unsigned char* newSphere(const float* p, + float radius, + const float* color, + const string* setName, + int* bufSize); + unsigned char* newPolygon(const float* v, + int numVerts, + const float* color, + const string* setName, + int* bufSize); + unsigned char* newAnnotation(const string *txt, + const float *p, + const float* color, + const string* setName, + int* bufSize); + unsigned char* newAgentAnnotation(const string *txt, + const char teamAgent, + const float* color, + int* bufSize); + unsigned char* newRemoveAgentAnnotation(const char teamAgent, + int* bufSize); + unsigned char* newSelectAgent(const char teamAgent, + int* bufSize); + +public: + RVSender(); + RVSender(int sockfd_, struct addrinfo p); + ~RVSender(); + + inline int getSockFD() { + return sockfd; + } + inline struct addrinfo getP() { + return p; + } + + //this must match the switch in getColor. See rvdraw.cc before changing + enum Color { + RED = 1, ORANGE = 2, YELLOW = 3, GREEN = 4, + BLUEGREEN = 5, LIGHTBLUE = 6, BLUE = 7, DARKBLUE = 8, + VIOLET = 9, PINK = 10, MAGENTA = 11 + }; + + + /* + * These draw commands support animation. + * + * Every time a draw command is called, a map is updated with + * key = string name (the first argument to each of these commands), and + * value = the draw command's buffer (no need to understand that part). + * + * Call refresh() to write these buffers to the screen. + * + * Call clear() to erase what's in the buffers. That allows old shapes to be removed from the + * screen and prevents clutter. It allows you to know what your agents are thinking right now. + * + * It's important to give shapes unique a unique 'string name' argument. + * A shape created with some 'string name' argument will overwrite an older shape with the + * same 'string name' argument. That's how the animation works. + * + * You can use the RVSender::Color enum to specify colors, or specify your own r,g,b values. + */ + + /* draws all elements of drawings map to the screen */ + void refresh(); + + /* erases all elements of drawings map */ + void clear(); + + void drawCircle(string name, double x, double y, double radius, + RVSender::Color c, bool shade=false); + void drawCircle(string name, double x, double y, double radius, float r, float g, float b); + + void drawLine(string name, double x1, double y1, double x2, double y2, + RVSender::Color c, bool shade=false); + void drawLine(string name, double x1, double y1, double x2, double y2, float r, float g, float b); + + void drawText(string name, string text, double x, double y, + RVSender::Color c, bool shade=false); + void drawText(string name, string text, double x, double y, float r, float g, float b); + + void drawPoint(string name, double x, double y, double radius, + RVSender::Color c, bool shade=false); + void drawPoint(string name, double x, double y, double radius, float r, float g, float b); + + void drawSphere(string name, double x, double y, double z, double radius, + RVSender::Color c, bool shade=false); + void drawSphere(string name, double x, double y, double z, double radius, + float r, float g, float b); + + /* format your *v array as {x1, y1, z1, x2, y2, z2, ...} */ + /* the 'a' arguments are for alpha channel (transparency) */ + void drawPolygon(string name, float *v, int numVerts, RVSender::Color c, + bool shade=false, float a=1.0f); + void drawPolygon(string name, float *v, int numVerts, float r, float g, float b, float a=1.0f); + + /* + * These draw commands are for static shapes that remain on the screen indefinitely, + * or until you call clearStaticDrawings() to remove all of them. Use that method on + * a timer to keep only a recent history of drawings on screen. + */ + + /* use this to erase all static shapes. */ + void clearStaticDrawings(); + + void drawCircle(double x, double y, double radius, + RVSender::Color c, bool shade=false); + void drawCircle(double x, double y, double radius, float r, float g, float b); + + void drawLine(double x1, double y1, double x2, double y2, + RVSender::Color c, bool shade=false); + void drawLine(double x1, double y1, double x2, double y2, float r, float g, float b); + + //these two are causing strange errors in roboviz + /*void drawText(string text, double x, double y, + RVSender::Color c, bool shade=false); + void drawText(string text, double x, double y, float r, float g, float b);*/ + + void drawPoint(double x, double y, double radius, + RVSender::Color c, bool shade=false); + void drawPoint(double x, double y, double radius, float r, float g, float b); + + void drawSphere(double x, double y, double z, double radius, + RVSender::Color c, bool shade=false); + void drawSphere(double x, double y, double z, double radius, + float r, float g, float b); + + void drawPolygon(float *v, int numVerts, RVSender::Color c, bool shade=false, float a=1.0f); + void drawPolygon(float *v, int numVerts, float r, float g, float b, float a=1.0f); + + /* + * These agentText commands work differently. No animation involved, you don't need + * the refresh() and clear() commands for these to work. No unique 'string name' either. + */ + + void drawText(string text, double x, double y, + RVSender::Color c, bool shade=false); + void drawText(string text, double x, double y, float r, float g, float b); + + /* draw to player on team "side", with uniform "uNum" */ + void drawAgentText(string text, int uNum, int side, RVSender::Color c, bool shade=false); + void drawAgentText(string text, int uNum, int side, float r, float g, float b); + + /* removes text from a player */ + void removeAgentText(int u, int s); + + void selectAgent(int u, int s); + + + /* old draw commands, don't support the animation */ + void swapBuffers(const string* setName); + void drawLine(float x1, float y1, float z1, + float x2, float y2, float z2, + float thickness, + float r, float g, float b, + const string* setName); + void drawCircle(float x, float y, float radius, + float thickness, + float r, float g, float b, + const string* setName); + void drawSphere(float x, float y, float z, + float radius, + float r, float g, float b, + const string* setName); + void drawPoint(float x, float y, float z, + float size, + float r, float g, float b, + const string *setName); + void drawPolygon(const float *v, int numVerts, + float r, float g, float b, + float a, + const string *setName); + void drawAnnotation(const string *txt, + float x, float y, float z, + float r, float g, float b, + const string *setName); + void drawAgentAnnotation(const string *txt, + char teamAgent, + float r, float g, float b); + void removeAgentAnnotation(char teamAgent); + void selectAgent(char teamAgent); +}; + +#endif // !RVDRAW_H Modified: trunk/rcssserver3d/plugin/soccer/sayeffector/sayeffector.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/sayeffector/sayeffector.cpp 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/sayeffector/sayeffector.cpp 2016-05-29 05:27:56 UTC (rev 405) @@ -25,6 +25,7 @@ #include <agentstate/agentstate.h> #include <soccerbase/soccerbase.h> #include <soccerruleaspect/soccerruleaspect.h> +#include <boost/regex.hpp> using namespace boost; using namespace oxygen; @@ -76,12 +77,24 @@ sayAction->GetMessage(mMessage); ifText=true; - // If " ", "(" or ")" are in mMessage, return false - if (mMessage.find_first_of("() ") != std::string::npos) + // If characters outside allowed value range or " ", "(" or ")" are in mMessage, return false + boost::regex allowedCharacterRange("[\x20-\x7E]*"); + if (!boost::regex_match(mMessage, allowedCharacterRange) + || mMessage.find_first_of("() ") != std::string::npos) { - GetLog()->Debug() + std::string teamName = mAgentState->GetTeamIndex() == TI_RIGHT ? "Right" : "Left"; + + // get the GameStateAspect + boost::shared_ptr<GameStateAspect> mGameState = dynamic_pointer_cast<GameStateAspect> + (SoccerBase::GetControlAspect(*this, "GameStateAspect")); + if (mGameState.get() != 0) + { + teamName = mGameState->GetTeamName(mAgentState->GetTeamIndex()); + } + GetLog()->Error() << "(SayEffector) found illegal character. Ignoring message [" - << mMessage << "]\n"; + << mMessage << "] from " << teamName << " " + << mAgentState->GetUniformNumber() << "\n"; ifText=false; Modified: trunk/rcssserver3d/plugin/soccer/soccerbase/soccerbase.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerbase/soccerbase.cpp 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/soccerbase/soccerbase.cpp 2016-05-29 05:27:56 UTC (rev 405) @@ -608,6 +608,12 @@ case PM_FREE_KICK_RIGHT: return STR_PM_FREE_KICK_RIGHT; + case PM_DIRECT_FREE_KICK_LEFT: + return STR_PM_DIRECT_FREE_KICK_LEFT; + + case PM_DIRECT_FREE_KICK_RIGHT: + return STR_PM_DIRECT_FREE_KICK_RIGHT; + default: return STR_PM_Unknown; }; Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2015-09-12 01:48:59 UTC (rev 404) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2016-05-29 05:27:56 UTC (rev 405) @@ -32,6 +32,10 @@ #include <agentstate/agentstate.h> #include <algorithm> +#ifdef RVDRAW +#include <rvdraw/rvdraw.h> +#endif // RVDRAW + using namespace oxygen; using namespace boost; using namespace std; @@ -40,11 +44,15 @@ SoccerRuleAspect::SoccerRuleAspect() : SoccerControlAspect(), mBallRadius(0.111), + mAgentRadius(0.4), mGoalPauseTime(3), mKickInPauseTime(1), mHalfTime(2.25 * 60), + mDropBallTime(15), mFreeKickDist(9.15), mFreeKickMoveDist(15.15), + mRepelPlayersForKick(false), + mKickRepelDist(0.5), mGoalKickDist(1.0), mAutomaticKickOff(false), mWaitBeforeKickOff(1.0), @@ -54,32 +62,69 @@ mAutoKickOffTimeOrigin(1000000.0), mSayMsgSize(20), mAudioCutDist(50.0), - mFirstCollidingAgent(true), - mNotOffside(false), - mLastModeWasPlayOn(false), - mUseOffside(true), - mUseCharging(false), - mChargingMinSpeed(0.2), - mChargingMinBallDist(0.2), - mChargingMaxOppSpeedAngle(90), - mChargingIllInterceptMinMutualSpeedAngel(70), - mDropBallTime(15), mNotStandingMaxTime(1000), // max time player may be sitted or laying down before being repositioned + mGroundMaxTime(1000), // max time player may be on the ground 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 + mMaxPlayersInsideOwnArea(1000), // maximum number of players of the defending team that may be inside own penalty area mMaxTouchGroupSize(1000), mMaxFoulTime(0.0), // maximum time allowed for a player to commit a positional foul before being repositioned - mLastKickOffKickTime(0), - mCheckKickOffKickerFoul(false), + mFirstCollidingAgent(true), + mNotOffside(false), + mLastModeWasPlayOn(false), + mUseOffside(true), + mUseCharging(false), + mChargingMinSpeed(0.2), + mChargingMinBallSpeedAngle(15), + mChargingMinDeltaDist(0.2), + mChargingMinDeltaAng(30), + mChargingImmunityTime(1), + mChargingCollisionMinTime(0.2), + mChargingMaxBallRulesDist(100), + mChargingMinCollBallDist(0.1), + mMinCollisionSpeed(0.15), + mFoulHoldTime(0.5), + mLastFreeKickKickTime(0), + mCheckFreeKickKickerFoul(false), mAllowKickOffTeamToScore(true), - mPenaltyShootout(false) + mIndirectKick(false), + mPenaltyShootout(false), + mKeepaway(false), + mKeepawayCenterX(0.0), + mKeepawayCenterY(0.0), + mKeepawayLength(20.0), + mKeepawayWidth(20.0), + mKeepawayLengthReductionRate(4.0), + mKeepawayWidthReductionRate(4.0) { mFreeKickPos = Vector3f(0.0,0.0,mBallRadius); + ResetFoulCounter(TI_LEFT); + ResetFoulCounter(TI_RIGHT); + +#ifdef RVDRAW + // Create connection for sending draw commands to roboviz + mRVSender = boost::shared_ptr<RVSender>(new RVSender()); + if (mRVSender->getSockFD() == -1) + { + mRVSender.reset(); + } +#endif // RVDRAW + + // Initialize values + for (int i = 0; i <= 11; i++) + { + for (int t = 0; t <= 2; t++) + { + playerTimeSinceLastWasMoved[i][t] = 1/.02; + for(int j = 0; j < AVERAGE_VELOCITY_MEASUREMENTS; j++) + { + playerVelocities[i][t][j] = salt::Vector3f(0,0,0); + } + } + } } SoccerRuleAspect::~SoccerRuleAspect() @@ -101,27 +146,71 @@ /* Uses only Ball and Players positions and detects overcrowind near ball and areas and players inappropriate behavior (laying on the ground or not walking for too much time) */ void -SoccerRuleAspect::AutomaticSimpleReferee(TPlayMode playMode) +SoccerRuleAspect::AutomaticSimpleReferee() { + if (mKeepaway) + { + TTime game_time = mGameState->GetTime(); + + float areaMinX = mKeepawayCenterX - mKeepawayLength/2.0 + (mKeepawayLengthReductionRate/2.0*game_time/60.0); + float areaMaxX = mKeepawayCenterX + mKeepawayLength/2.0 - (mKeepawayLengthReductionRate/2.0*game_time/60.0); + float areaMinY = mKeepawayCenterY - mKeepawayWidth/2.0 + (mKeepawayWidthReductionRate/2.0*game_time/60.0); + float areaMaxY = mKeepawayCenterY + mKeepawayWidth/2.0 - (mKeepawayWidthReductionRate/2.0*game_time/60.0); + +#ifdef RVDRAW + if (mRVSender) + { + mRVSender->clear(); + mRVSender->drawLine("KeepawayArea", areaMinX, areaMinY, areaMinX, areaMaxY, RVSender::RED); + mRVSender->drawLine("KeepawayArea", areaMinX, areaMaxY, areaMaxX, areaMaxY, RVSender::RED); + mRVSender->drawLine("KeepawayArea", areaMaxX, areaMaxY, areaMaxX, areaMinY, RVSender::RED); + mRVSender->drawLine("KeepawayArea", areaMaxX, areaMinY, areaMinX, areaMinY, RVSender::RED); + mRVSender->refresh(); + } +#endif // RVDRAW + + if (game_time > 0) + { + bool fBallOutsideKeepawayBox = false; + Vector3f ball_pos = mBallBody->GetPosition(); + if (ball_pos.x() < areaMinX + || ball_pos.x() > areaMaxX + || ball_pos.y() < areaMinY + || ball_pos.y() > areaMaxY) + { + fBallOutsideKeepawayBox = true; + } + + bool fBallCollidedWithTaker = mBallState->GetBallCollidingWithAgentTeam(TI_RIGHT); + + if (fBallOutsideKeepawayBox || fBallCollidedWithTaker) + { + mGameState->SetPlayMode(PM_GameOver); + } + } + } + + if (mPenaltyShootout && mGameState->GetPlayMode() == PM_Goal_Left) { + // Cancel penalty shootout mode now that a goal has been scored + mPenaltyShootout = false; + } + // Reset counters and do not consider players' fouls when game is not - // running + // running (when players can beam) if (mGameState->IsPaused()) { ResetFoulCounter(TI_LEFT); ResetFoulCounter(TI_RIGHT); - - if (mPenaltyShootout && mGameState->GetPlayMode() == PM_Goal_Left) { - // Cancel penalty shootout mode now that a goal has been scored - mPenaltyShootout = false; - } } else { CalculateDistanceArrays(TI_LEFT); // Calculates distance arrays for left team CalculateDistanceArrays(TI_RIGHT); // Calculates distance arrays for right team + UpdateTimesSinceLastBallTouch(); // Resets time since last ball touch for agents currently colliding with ball + AnalyseChargingFouls(); // Analyzes if there are any charging fouls AnalyseFouls(TI_LEFT); // Analyzes simple fouls for the left team AnalyseFouls(TI_RIGHT); // Analyzes simple fouls for the right team - AnalyseTouchGroups(TI_LEFT); // Analyzes how many players are touching for the left team + AnalyseTouchGroups(TI_LEFT); // Analyzes whether too many players are touching for the left team AnalyseTouchGroups(TI_RIGHT); // Analyzes whether too many players are touching for the right team ClearPlayersAutomatic(TI_LEFT); // enforce standing and not overcrowding rules for left team @@ -165,6 +254,9 @@ prevPlayerInsideOwnArea[unum][idx] = 0; playerInsideOwnArea[unum][idx] = 0; playerFoulTime[unum][idx] = 0; + playerTimeSinceLastBallTouch[unum][idx] = mChargingImmunityTime/0.02; + playerChargingTime[unum][idx] = mChargingCollisionMinTime/0.02; + playerLastFoul[unum][idx] = FT_None; } void @@ -176,6 +268,36 @@ } } +// Resets time since last ball touch for agents currently colliding with ball +void +SoccerRuleAspect::UpdateTimesSinceLastBallTouch() +{ + if (mBallState.get() == 0) + return; + + list<boost::shared_ptr<AgentAspect> > agents; + if (mBallState->GetCollidingAgents(agents)) + { + for (list<boost::shared_ptr<AgentAspect> > ::const_iterator agentIt = agents.begin(); + agentIt != agents.end(); + agentIt++) + { + boost::shared_ptr<AgentState> agentState; + if (!SoccerBase::GetAgentState(*agentIt, agentState)) + { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Cannot get " + "AgentState from an AgentAspect\n"; + } + else + { + int unum = agentState->GetUniformNumber(); + int idx = agentState->GetTeamIndex(); + playerTimeSinceLastBallTouch[unum][idx] = 0; + } + } + } +} + // Process agent state: standing, sitted, laying down, ... void SoccerRuleAspect::ProcessAgentState(salt::Vector3f pos, int unum, TTeamIndex idx) @@ -207,18 +329,32 @@ if (playerStanding[unum][idx] > 0.5 / 0.02) { playerNotStanding[unum][idx] = 0; } + + playerTimeSinceLastBallTouch[unum][idx]++; + playerChargingTime[unum][idx]++; + playerTimeSinceLastWasMoved[unum][idx]++; } // 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++) + for(int t1 = 1; t1 <= 11; t1++) { + if (HaveEnforceableFoul(t1,idx)) { + // Don't count players who have committed a foul + oArr[t1][idx] = -1; + continue; + } + for(int t2 = t1 + 1; t2 <= 11; t2++) { + if (HaveEnforceableFoul(t2,idx)) { + // Don't count players who have committed a foul + continue; + } if (dArr[t1][idx] >= dArr[t2][idx]) oArr[t1][idx]++; else oArr[t2][idx]++; - + } + } // DEBUG // if (dArr[1][idx]<1000.0) { // cout << "Team: " << idx << " --> "; @@ -279,8 +415,9 @@ 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()))) + if (((idx == TI_LEFT && mLeftPenaltyArea.Contains(Vector2f(agentPos.x(), agentPos.y()))) || + (idx == TI_RIGHT && mRightPenaltyArea.Contains(Vector2f(agentPos.x(), agentPos.y())))) + && !HaveEnforceableFoul(unum,idx)) { numPlInsideOwnArea[idx]++; playerInsideOwnArea[unum][idx] = 1; @@ -304,243 +441,346 @@ SimpleOrder(distGArr, ordGArr, idx); } -void SoccerRuleAspect::AnalyseTouchGroups(TTeamIndex idx) +void SoccerRuleAspect::AnalyseChargingFouls() { - if (idx == TI_NONE || mBallState.get() == 0) + if (!mUseCharging) + { return; + } + + if (mBallState.get() == 0) + return; SoccerBase::TAgentStateList agent_states; - if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) + if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_LEFT)) return; - random_shuffle(agent_states.begin(), agent_states.end()); - - // BEGIN FOUL DETECTION - if (mUseCharging) + SoccerBase::TAgentStateList::iterator asIt = agent_states.begin(); + for (; asIt != agent_states.end(); ++asIt) { - - SoccerBase::TAgentStateList::iterator asIt = agent_states.begin(); - for (; asIt != agent_states.end(); ++asIt) + boost::shared_ptr<TouchGroup> touchGroup = (*asIt)->GetTouchGroup(); + if (touchGroup->size() != 2) { - boost::shared_ptr<TouchGroup> touchGroup = (*asIt)->GetTouchGroup(); + continue; + } + + salt::Vector3f agentAvgVel[2]; + salt::Vector3f agentPos[2]; + float s[2]; //agentSpeed + float d[2]; //agentDistToBall + float aVB[2]; //agentAngleOfSpeedVectorToBall + float aVO[2]; //agentAngleOfSpeedVectorToOpponent + int agentUNum[2]; + TTeamIndex agentTeamIndex[2]; + bool isCharging[2]; // Boolean if an agent had co... [truncated message content] |
From: <he...@us...> - 2016-05-31 20:58:31
|
Revision: 408 http://sourceforge.net/p/simspark/svn/408 Author: hedayat Date: 2016-05-31 20:58:29 +0000 (Tue, 31 May 2016) Log Message: ----------- Prepare rcssserver3d 0.7.0 release Modified Paths: -------------- trunk/rcssserver3d/CMakeLists.txt trunk/rcssserver3d/NEWS trunk/rcssserver3d/RELEASE Modified: trunk/rcssserver3d/CMakeLists.txt =================================================================== --- trunk/rcssserver3d/CMakeLists.txt 2016-05-31 20:58:23 UTC (rev 407) +++ trunk/rcssserver3d/CMakeLists.txt 2016-05-31 20:58:29 UTC (rev 408) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(rcssserver3d CXX C) -set(PACKAGE_VERSION "0.6.11") +set(PACKAGE_VERSION "0.7.0") option(RVDRAW "Enable roboviz drawings" OFF) if (RVDRAW) Modified: trunk/rcssserver3d/NEWS =================================================================== --- trunk/rcssserver3d/NEWS 2016-05-31 20:58:23 UTC (rev 407) +++ trunk/rcssserver3d/NEWS 2016-05-31 20:58:29 UTC (rev 408) @@ -1,3 +1,125 @@ +[0.7.0] +A new GUI application is developed to run and control simspark simulations. +Additinoally, there are a number changes to the soccer rules enforced in +the simulator. More details about changes in this release follows: + +* Updates to charging foul model and other fouls: +An initial implementation of the charging foul model is documented at +http://www.acso.uneb.br/bahiart/uploads/Main/FoulModel2016.pdf. The +following are some updates to the charging foul model which will hopefully +be added to the documentation of the charging foul model soon: + + - Rules for charging involving agents' relative positions to the ball + are only active for agents within 1 meter (ChargingMaxBallRulesDist) of + the ball + - Players are immune to committing a charging foul after touching the + ball for 1 second (ChargingImmunityTime) + - There is no maximum distance from the ball that a charging foul will + be called -- charging fouls can be called at any position on or off the + field + - After a player is moved/beamed by the server no charging fouls in any + collision involving that agent will be called for 1 second after the + player is moved. + - There is no longer a concept of ChargingMinCollisionPoint. Instead a + threshold of velocity exerted in a collision (ChargingMinCollisionSpeed + with a default value of 0.2) must be exceeded for a charging foul to be + called. This value is calculated as a cross product between an agent's + velocity vector and the normalized vector from the agent to the average of + the opponent agent and collision point. + +General foul changes: + + - For visualization purposes after any foul (charging, crowding, illegal + defense, touching, incapable) agents are lifted up in the air for + FoulHoldTime (default 0.5 seconds) before being beamed to the sideline. + - Touching fouls in groups of three or more are no longer called on + goalies (a goalie's teammate will be called for a touching foul instead). + + +* New kick rules: + +The following is a summary of the rule changes for kicking: + - A player taking a kick can't touch the ball more than once before + another player touches the ball -- touching the ball more than once + results in an indirect free kick for the opponent (same as in human + soccer). Note that a goal kick doesn't count as having been taken until + the ball leaves the penalty area + - You can never score an own goal directly off your own kick -- the + result of such an own goal is a corner kick for the opponent (same as in + human soccer). + - Kick-ins are indirect (same as throw-ins in human soccer). + - Goal kicks and corner kicks are direct (same as in human soccer). + - Scoring a goal directly from an indirect kick results in a goal kick + for the opponent (same as in human soccer). + - Kickoffs are still indirect and the ball must be touched outside the + center circle, or an opponent must first touch the ball, before the team + taking a kickoff can score (in human soccer kickoffs are direct, but this + artificial rule is needed to prevent "kickoff taking contests"). + - Players within KickRepelDist (defined in naosoccersim.rb) of the ball + when it is placed for a kick are moved back to a position exactly + KickRepelDist from the ball to prevent players from accidentally touching + the ball and losing a kick if the ball is placed right underneath their + current position on the field. + - Two new direct kick playmodes have been added + (direct_free_kick_[left|right]). While there is no plan to use these + playmodes at this year's competition, shift+L and shift+R key bindings for + them have been added to rcssmonitor3d and roboviz. + + +* Keepaway mode: + +The keepaway playmode sets the playmode to GameOver if a player on the +right team touches the ball or if the ball leaves a predefined keepaway +area. During keepaway no charging fouls will be called on agents on the +right team (the team trying to take the ball). + +The keepaway mode adds the following parameters to naosoccersim.rb: + +// if in keepaway mode +Keepaway +// center X value of keepaway box +KeepawayCenterX +// center Y value of keepaway box +KeepawayCenterY +// length of keepaway box +KeepawayLength +// width of keepaway box +KeepawayWidth +// reduction rate of length of keepaway box per minute +KeepawayLengthReductionRate +// reduction rate of width of keepaway box per minute +KeepawayWidthReductionRate + + +* Blocking of say messages with illegal characters: + +While most agents have been sending legal say messages, there have been a +few instances of agents sending say messages with illegal characters. The +server now throws out say messages containing illegal characters (space, +parenthesis, and those outside the range [0x20-0x7E]). The server also +prints an error message containing the illegal say message and the agent +who said it. When running in sync mode the proxy still needs to be used +to protect against bad say messages that break parsing (or really any +unparseable messages sent to the server) -- this change only throws out +say messages with illegal that were able to be parsed. + + +* Plugin for drawing objects in roboviz: + +You can activate a new plugin (rvdraw) within rcssserver3d allowing it to +draw objects in roboviz by using the "-DRVDRAW=ON" command line argument +when running cmake before building rcssserver3d. The plugin likely only +works in linux which is why it isn't enabled by default. Currently this +plugin is set to draw debugging information for the charging foul model, +but one might find it useful to add their own code to the server to draw +things in roboviz. + +After rcssserver3d is compiled with the rvdraw plugin enabled use the +following command line argument when running the server to have it send +draw commands to roboviz: +rcssserver3d --rvdraw-host <roboviz_host_machine> + + [0.6.10] This is the final release of rcssserver3d for RoboCup 2015, which brings a few bug fixes and enhancements for the competitions: Modified: trunk/rcssserver3d/RELEASE =================================================================== --- trunk/rcssserver3d/RELEASE 2016-05-31 20:58:23 UTC (rev 407) +++ trunk/rcssserver3d/RELEASE 2016-05-31 20:58:29 UTC (rev 408) @@ -1,15 +1,125 @@ -RELEASE News of rcssserver3d-0.6.10 +RELEASE News of rcssserver3d-0.7.0 -This is the final release of rcssserver3d for RoboCup 2015, which brings a few -bug fixes and enhancements for the competitions: - * Turning off penalty shootout mode as soon as a goal is scored by the left - team so that a later second goal won't be recorded if the goalie leaves - the penalty area after the goal was scored. - * Added models for visually differentiating between different robot body - types. This changes some of the black coloring on the robot's body to be - a different type dependent neutral color. - * Fixed bug where the server may hang on certain systems if beam effector - noise (BeamNoiseXY and BeamNoiseAngle) are set to 0. +A new GUI application is developed to run and control simspark simulations. +Additinoally, there are a number changes to the soccer rules enforced in +the simulator. More details about changes in this release follows: +* Updates to charging foul model and other fouls: +An initial implementation of the charging foul model is documented at +http://www.acso.uneb.br/bahiart/uploads/Main/FoulModel2016.pdf. The +following are some updates to the charging foul model which will hopefully +be added to the documentation of the charging foul model soon: + + - Rules for charging involving agents' relative positions to the ball + are only active for agents within 1 meter (ChargingMaxBallRulesDist) of + the ball + - Players are immune to committing a charging foul after touching the + ball for 1 second (ChargingImmunityTime) + - There is no maximum distance from the ball that a charging foul will + be called -- charging fouls can be called at any position on or off the + field + - After a player is moved/beamed by the server no charging fouls in any + collision involving that agent will be called for 1 second after the + player is moved. + - There is no longer a concept of ChargingMinCollisionPoint. Instead a + threshold of velocity exerted in a collision (ChargingMinCollisionSpeed + with a default value of 0.2) must be exceeded for a charging foul to be + called. This value is calculated as a cross product between an agent's + velocity vector and the normalized vector from the agent to the average of + the opponent agent and collision point. + +General foul changes: + + - For visualization purposes after any foul (charging, crowding, illegal + defense, touching, incapable) agents are lifted up in the air for + FoulHoldTime (default 0.5 seconds) before being beamed to the sideline. + - Touching fouls in groups of three or more are no longer called on + goalies (a goalie's teammate will be called for a touching foul instead). + + +* New kick rules: + +The following is a summary of the rule changes for kicking: + - A player taking a kick can't touch the ball more than once before + another player touches the ball -- touching the ball more than once + results in an indirect free kick for the opponent (same as in human + soccer). Note that a goal kick doesn't count as having been taken until + the ball leaves the penalty area + - You can never score an own goal directly off your own kick -- the + result of such an own goal is a corner kick for the opponent (same as in + human soccer). + - Kick-ins are indirect (same as throw-ins in human soccer). + - Goal kicks and corner kicks are direct (same as in human soccer). + - Scoring a goal directly from an indirect kick results in a goal kick + for the opponent (same as in human soccer). + - Kickoffs are still indirect and the ball must be touched outside the + center circle, or an opponent must first touch the ball, before the team + taking a kickoff can score (in human soccer kickoffs are direct, but this + artificial rule is needed to prevent "kickoff taking contests"). + - Players within KickRepelDist (defined in naosoccersim.rb) of the ball + when it is placed for a kick are moved back to a position exactly + KickRepelDist from the ball to prevent players from accidentally touching + the ball and losing a kick if the ball is placed right underneath their + current position on the field. + - Two new direct kick playmodes have been added + (direct_free_kick_[left|right]). While there is no plan to use these + playmodes at this year's competition, shift+L and shift+R key bindings for + them have been added to rcssmonitor3d and roboviz. + + +* Keepaway mode: + +The keepaway playmode sets the playmode to GameOver if a player on the +right team touches the ball or if the ball leaves a predefined keepaway +area. During keepaway no charging fouls will be called on agents on the +right team (the team trying to take the ball). + +The keepaway mode adds the following parameters to naosoccersim.rb: + +// if in keepaway mode +Keepaway +// center X value of keepaway box +KeepawayCenterX +// center Y value of keepaway box +KeepawayCenterY +// length of keepaway box +KeepawayLength +// width of keepaway box +KeepawayWidth +// reduction rate of length of keepaway box per minute +KeepawayLengthReductionRate +// reduction rate of width of keepaway box per minute +KeepawayWidthReductionRate + + +* Blocking of say messages with illegal characters: + +While most agents have been sending legal say messages, there have been a +few instances of agents sending say messages with illegal characters. The +server now throws out say messages containing illegal characters (space, +parenthesis, and those outside the range [0x20-0x7E]). The server also +prints an error message containing the illegal say message and the agent +who said it. When running in sync mode the proxy still needs to be used +to protect against bad say messages that break parsing (or really any +unparseable messages sent to the server) -- this change only throws out +say messages with illegal that were able to be parsed. + + +* Plugin for drawing objects in roboviz: + +You can activate a new plugin (rvdraw) within rcssserver3d allowing it to +draw objects in roboviz by using the "-DRVDRAW=ON" command line argument +when running cmake before building rcssserver3d. The plugin likely only +works in linux which is why it isn't enabled by default. Currently this +plugin is set to draw debugging information for the charging foul model, +but one might find it useful to add their own code to the server to draw +things in roboviz. + +After rcssserver3d is compiled with the rvdraw plugin enabled use the +following command line argument when running the server to have it send +draw commands to roboviz: +rcssserver3d --rvdraw-host <roboviz_host_machine> + + You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2017-07-08 15:42:41
|
Revision: 415 http://sourceforge.net/p/simspark/svn/415 Author: patmac369 Date: 2017-07-08 15:42:38 +0000 (Sat, 08 Jul 2017) Log Message: ----------- Adding changes for the RoboCup 2017 competition. Additions are the following: - Fixed bug where double touches on kicks (kickoffs, free kicks, kick-ins, corner kicks) were not always being detected correctly - Fixed bug where if a player is touching the ball right when the wait time at the beginning of a kick play mode ends the play mode could end up recording the touch and inadvertently end the kick. - Fixed bug where if two players enter their own penalty area at the same time, and in doing so cause the maximum allowed number of players in the penalty area to be exceeded, both players will be called for illegal defense even if the team is only one player over the allowed number of players in the penalty area. - The automated referee will no longer move/reposition agents on top of each other or into their own penalty area if it will trigger an illegal defense penalty. This is accomplished by doing a breadth first search around the position that an agent is to be repositioned to until a safe position is found. The number of positions that will be considered by the breadth first search is bounded by the MaxNumSafeRepositionAttempts value (default 100) in naosocersim.rb. Setting this value to 0 turns this feature off. If ever the server isn't able to safely reposition a player it will print an error message. - The order in which players are evaluated for fouls and are penalized is now randomized so as to not have any bias associated with players' teams and uniform numbers. - Fixed issue where free kicks and kicks-in printed an error message and didn't behave correctly if the ball has yet to be touched by an agent. - Averaging the velocity of an agent over the last 3 time steps instead of 5 when determining charging fouls. This allows agents to reduce their effective velocities faster so as to have a better chance of avoiding charging fouls when colliding with an opponent. - Removing code that takes into account the opponent's velocity moving away from a colliding agent when determining fouls. This code was decreasing the likelihood of an agent being called for a foul when running down an opponent from behind. - Turning off crowding rules in naosoccersim.rb - Adding StartAnyFieldPosition flag (default false) to naosoccersim.rb. Turning this flag on allows agents to be at, beam, or be moved to any position on the field at the start of kickoffs including the opponent's side of the field. Modified Paths: -------------- trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.cpp trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.h trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h trunk/rcssserver3d/rcssserver3d/naosoccersim.rb Modified: trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.cpp 2017-03-24 21:15:15 UTC (rev 414) +++ trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.cpp 2017-07-08 15:42:38 UTC (rev 415) @@ -94,16 +94,19 @@ return; } - // an agent can only beam within it's own field half - float minX = -mFieldLength/2; - pos[0] = std::max<float>(pos[0],minX); - pos[0] = std::min<float>(pos[0],0.0f); + if (!mStartAnyFieldPosition) + { + // an agent can only beam within it's own field half + float minX = -mFieldLength/2; + pos[0] = std::max<float>(pos[0],minX); + pos[0] = std::min<float>(pos[0],0.0f); + + float minY = -mFieldWidth/2; + float maxY = mFieldWidth/2; + pos[1] = std::max<float>(minY,pos[1]); + pos[1] = std::min<float>(maxY,pos[1]); + } - float minY = -mFieldWidth/2; - float maxY = mFieldWidth/2; - pos[1] = std::max<float>(minY,pos[1]); - pos[1] = std::min<float>(maxY,pos[1]); - // fix z coordinate pos[2] = mAgentRadius; @@ -190,6 +193,9 @@ mBeamNoiseAngle = 10.0f; SoccerBase::GetSoccerVar(*this, "BeamNoiseAngle",mBeamNoiseAngle); + mStartAnyFieldPosition = false; + SoccerBase::GetSoccerVar(*this,"StartAnyFieldPosition",mStartAnyFieldPosition); + UniformRngPtr rng1(new salt::UniformRNG<>(-1,1)); mNoiseRng = rng1; } Modified: trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.h 2017-03-24 21:15:15 UTC (rev 414) +++ trunk/rcssserver3d/plugin/soccer/beameffector/beameffector.h 2017-07-08 15:42:38 UTC (rev 415) @@ -80,6 +80,10 @@ /** amount of noise added to beam angle value */ float mBeamNoiseAngle; + + /** Allow starting at any field position including on opponent's + side of the field */ + bool mStartAnyFieldPosition; }; DECLARE_CLASS(BeamEffector); Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2017-03-24 21:15:15 UTC (rev 414) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2017-07-08 15:42:38 UTC (rev 415) @@ -98,7 +98,9 @@ mKeepawayLength(20.0), mKeepawayWidth(20.0), mKeepawayLengthReductionRate(4.0), - mKeepawayWidthReductionRate(4.0) + mKeepawayWidthReductionRate(4.0), + mMaxNumSafeRepositionAttempts(100), + mStartAnyFieldPosition(false) { mFreeKickPos = Vector3f(0.0,0.0,mBallRadius); ResetFoulCounter(TI_LEFT); @@ -188,7 +190,7 @@ mGameState->SetPlayMode(PM_GameOver); } } - } + } if (mPenaltyShootout && mGameState->GetPlayMode() == PM_Goal_Left) { // Cancel penalty shootout mode now that a goal has been scored @@ -213,8 +215,13 @@ AnalyseTouchGroups(TI_LEFT); // Analyzes whether too many players are touching for the left team AnalyseTouchGroups(TI_RIGHT); // Analyzes whether too many players are touching 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 + if (rand()%2 == 0) { + ClearPlayersAutomatic(TI_LEFT); // enforce standing and not overcrowding rules for left team + ClearPlayersAutomatic(TI_RIGHT); // enforce standing and not overcrowding rules for right team + } else { + ClearPlayersAutomatic(TI_RIGHT); // enforce standing and not overcrowding rules for right team + ClearPlayersAutomatic(TI_LEFT); // enforce standing and not overcrowding rules for left team + } // Reset touch groups ResetTouchGroups(TI_LEFT); @@ -384,6 +391,7 @@ SoccerBase::TAgentStateList::const_iterator i; numPlInsideOwnArea[idx] = 0; + numPlReposInsideOwnArea[idx] = 0; closestPlayer[idx] = 1; closestPlayerDist[idx] = 1000.0; for(int t = 1; t <= 11; t++) @@ -605,17 +613,11 @@ for (int i = 0; i <= 1; i++) { - // Take into account the opponent's velocity vector when determining - // collision speed and subtract half the opponent's speed moving - // away from the the collision point as that speed reduces the - // collision force. - agentCollisionSpeed[i] = (agentAvgVel[i].x()*agentToCollisionVec[i].x() + agentAvgVel[i].y()*agentToCollisionVec[i].y()) + - 0.5*min(0.0f, agentAvgVel[1-i].x()*agentToCollisionVec[1-i].x() + agentAvgVel[1-i].y()*agentToCollisionVec[1-i].y()); - + // Get collision speed + agentCollisionSpeed[i] = agentAvgVel[i].x()*agentToCollisionVec[i].x() + agentAvgVel[i].y()*agentToCollisionVec[i].y(); isCharging[i] = (isCharging[i] && s[i] >= mChargingMinSpeed - && agentCollisionSpeed[i] >= mMinCollisionSpeed); - + && agentCollisionSpeed[i] >= mMinCollisionSpeed); } #ifdef RVDRAW @@ -814,9 +816,16 @@ void SoccerRuleAspect::AnalyseFouls(TTeamIndex idx) { TTeamIndex idx2 = SoccerBase::OpponentTeam(idx); // //Other team + + // Randomize order of agents evaluated + std::vector<unsigned int> unums(11); + for (unsigned int i = 0; i < unums.size(); i++) {unums[i] = i+1;} + std::random_shuffle(unums.begin(), unums.end()); - for(unsigned int unum=1; unum<=11; unum++) + for(std::vector<unsigned int>::const_iterator it = unums.begin(); it != unums.end(); ++it) { + unsigned int unum = *it; + if (HaveEnforceableFoul(unum,idx)) { // Once a player has been called for a foul don't check for @@ -853,6 +862,7 @@ { playerFoulTime[unum][idx]++; playerLastFoul[unum][idx] = FT_IllegalDefence; + numPlInsideOwnArea[idx]--; } // I am a field player and on the ground for too much time else if (unum != 1 && playerGround[unum][idx] > mGroundMaxTime / 0.02) @@ -901,6 +911,327 @@ } +bool SoccerRuleAspect::GetSafeRepositionHelper_AdjustPositionForPenaltyArea(const salt::Vector2f agent_pos, int unum, TTeamIndex idx, salt::Vector2f ¤t_pos) +{ + // Check that we're not being moved into our penalty area when there + // are already the maximum number of teammates allowed in the penalty + // area + if (playerInsideOwnArea[unum][idx] == 0 && numPlInsideOwnArea[idx]+numPlReposInsideOwnArea[idx] >= mMaxPlayersInsideOwnArea) { + if ((idx == TI_LEFT + && current_pos.x() > mLeftPenaltyArea.minVec[0]-mAgentRadius + && current_pos.x() < mLeftPenaltyArea.maxVec[0]+mAgentRadius + && current_pos.y() > mLeftPenaltyArea.minVec[1]-mAgentRadius + && current_pos.y() < mLeftPenaltyArea.maxVec[1]+mAgentRadius) + || (idx == TI_RIGHT + && current_pos.x() > mRightPenaltyArea.minVec[0]-mAgentRadius + && current_pos.x() < mRightPenaltyArea.maxVec[0]+mAgentRadius + && current_pos.y() > mRightPenaltyArea.minVec[1]-mAgentRadius + && current_pos.y() < mRightPenaltyArea.maxVec[1]+mAgentRadius)) { + /* +#ifdef RVDRAW + if (mRVSender) { + //mRVSender->clearStaticDrawings(); + mRVSender->drawPoint(current_pos.x(), current_pos.y(), 10, RVSender::YELLOW); + } +#endif + */ + if (idx == TI_LEFT) { + if (current_pos.x() > agent_pos.x()) { + // Move beyond the top of the penalty area + current_pos[0] = mLeftPenaltyArea.maxVec[0]+mAgentRadius; + } else { + // Move to a side of the penalty area + if (current_pos.y() > agent_pos.y() || (current_pos.y() == agent_pos.y() && current_pos.y() < 0)) { + current_pos[1] = mLeftPenaltyArea.maxVec[1]+mAgentRadius; + } else { + current_pos[1] = mLeftPenaltyArea.minVec[1]-mAgentRadius; + } + } + } else { + if (current_pos.x() < agent_pos.x()) { + // Move beyond the top of the penalty area + current_pos[0] = mRightPenaltyArea.minVec[0]-mAgentRadius; + } else { + // Move to a side of the penalty area + if (current_pos.y() > agent_pos.y() || (current_pos.y() == agent_pos.y() && current_pos.y() < 0)) { + current_pos[1] = mRightPenaltyArea.maxVec[1]+mAgentRadius; + } else { + current_pos[1] = mRightPenaltyArea.minVec[1]-mAgentRadius; + } + } + } + return true; + } + } + return false; +} + +void SoccerRuleAspect::GetSafeRepositionHelper_SamplePositions(const salt::Vector2f agent_pos, int unum, TTeamIndex idx, salt::Vector2f current_pos, std::list<salt::Vector2f> &candidatePosList) +{ + std::list<salt::Vector2f> newPosList; + salt::Vector2f agent_pos_xmove = current_pos; + if (idx == TI_LEFT) { + agent_pos_xmove[0] = current_pos.x() + mAgentRadius * (agent_pos.x() < current_pos.x() ? 1 : -1); + } else { + agent_pos_xmove[0] = current_pos.x() + mAgentRadius * (agent_pos.x() > current_pos.x() ? -1 : 1); + } + if (abs(agent_pos_xmove.x()) <= mFieldLength/2.0) { + GetSafeRepositionHelper_AdjustPositionForPenaltyArea(agent_pos, unum, idx, agent_pos_xmove); + newPosList.push_back(agent_pos_xmove); + } + + if (current_pos.x() == agent_pos.x()) { + // Also add x position moving in other direction + salt::Vector2f agent_pos_xmove2 = current_pos; + if (idx == TI_LEFT) { + agent_pos_xmove2[0] = current_pos.x() + mAgentRadius; + } else { + agent_pos_xmove2[0] = current_pos.x() - mAgentRadius; + } + if (abs(agent_pos_xmove2.x()) <= mFieldLength/2.0) { + GetSafeRepositionHelper_AdjustPositionForPenaltyArea(agent_pos, unum, idx, agent_pos_xmove2); + newPosList.push_back(agent_pos_xmove2); + } + } + + salt::Vector2f agent_pos_ymove = current_pos; + if (current_pos.y() == agent_pos.y()) { + // Move towards the center of the field + agent_pos_ymove[1] = current_pos.y() + mAgentRadius * (agent_pos.y() < 0 ? 1 : -1); + GetSafeRepositionHelper_AdjustPositionForPenaltyArea(agent_pos, unum, idx, agent_pos_ymove); + newPosList.push_back(agent_pos_ymove); + + // Move away from the center of the field + salt::Vector2f agent_pos_ymove2 = current_pos; + agent_pos_ymove2[1] = current_pos.y() + mAgentRadius * (agent_pos.y() < 0 ? -1 : 1); + GetSafeRepositionHelper_AdjustPositionForPenaltyArea(agent_pos, unum, idx, agent_pos_ymove2); + newPosList.push_back(agent_pos_ymove2); + } else { + agent_pos_ymove[1] = current_pos.y() + mAgentRadius * (agent_pos.y() < current_pos.y() ? 1 : -1); + GetSafeRepositionHelper_AdjustPositionForPenaltyArea(agent_pos, unum, idx, agent_pos_ymove); + newPosList.push_back(agent_pos_ymove); + } + + std::list<salt::Vector2f>::const_iterator i; + for (i = newPosList.begin(); i != newPosList.end(); ++i) { + salt::Vector2f newPos = *i; + float newPosDistToAgent = sqrt((newPos.x()-agent_pos.x())*(newPos.x()-agent_pos.x()) + + (newPos.y()-agent_pos.y())*(newPos.y()-agent_pos.y())); + bool fAddPos = true; + std::list<salt::Vector2f>::reverse_iterator c; + for (c = candidatePosList.rbegin(); c != candidatePosList.rend(); ++c) { + salt::Vector2f candidatePos = *c; + float candidatePosDistToNewPos = sqrt((candidatePos.x()-newPos.x())*(candidatePos.x()-newPos.x()) + + (candidatePos.y()-newPos.y())*(candidatePos.y()-newPos.y())); + if (candidatePosDistToNewPos < mAgentRadius/2.0) { + fAddPos = false; + break; + } + + float candidatePosDistToAgent = sqrt((candidatePos.x()-agent_pos.x())*(candidatePos.x()-agent_pos.x()) + + (candidatePos.y()-agent_pos.y())*(candidatePos.y()-agent_pos.y())); + if (newPosDistToAgent >= candidatePosDistToAgent) { + break; + } + } + if (fAddPos) { + /* +#ifdef RVDRAW + if (mRVSender) { + //mRVSender->clearStaticDrawings(); + mRVSender->drawPoint(newPos.x(), newPos.y(), 10, RVSender::LIGHTBLUE); + } +#endif + */ + candidatePosList.insert(c.base(), newPos); + } + + /* + std::list<salt::Vector2f>::const_iterator d; + std::cout << "-----------------\n"; + for (d = candidatePosList.begin(); d != candidatePosList.end(); ++d) { + salt::Vector2f candidatePos = *d; + float candidatePosDistToAgent = sqrt((candidatePos.x()-agent_pos.x())*(candidatePos.x()-agent_pos.x()) + + (candidatePos.y()-agent_pos.y())*(candidatePos.y()-agent_pos.y())); + std::cout << candidatePosDistToAgent << "\n"; + } + std::cout << "-----------------\n"; + */ + } +} + +salt::Vector3f SoccerRuleAspect::GetSafeReposition(salt::Vector3f posIni, int unum, TTeamIndex idx) +{ + salt::Vector3f pos = posIni; + if (mMaxNumSafeRepositionAttempts == 0 || idx == TI_NONE || mBallState.get() == 0 || mAgentRadius <= 0) + return pos; + + bool fFoundAgentPos = false; + salt::Vector3f agentPos = Vector3f(0,0,0); + SoccerBase::TAgentStateList agent_states; + if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) { + boost::shared_ptr<oxygen::Transform> agent_aspect; + SoccerBase::TAgentStateList::const_iterator i; + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { + int unumAgent = (*i)->GetUniformNumber(); + if (unum == unumAgent) { + SoccerBase::GetTransformParent(**i, agent_aspect); + agentPos = agent_aspect->GetWorldTransform().Pos(); + fFoundAgentPos = true; + break; + } + } + } else { + return pos; + } + + if (!fFoundAgentPos) { + return pos; + } + + std::list<salt::Vector2f> candidatePosList; + + Vector2f agent_pos = Vector2f(agentPos.x(),agentPos.y()); + Vector2f initial_pos = Vector2f(posIni.x(),posIni.y()); + bool fUnsafePosition = GetSafeRepositionHelper_AdjustPositionForPenaltyArea(agent_pos, unum, idx, initial_pos); + if (fUnsafePosition) { + Vector2f current_pos = Vector2f(posIni.x(),posIni.y()); + GetSafeRepositionHelper_SamplePositions(agent_pos, unum, idx, current_pos, candidatePosList); + if (candidatePosList.empty()) { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Failed to safely reposition player " << unum << " " << (idx == TI_LEFT ? "(left)" : "(right)") << "\n"; + return posIni; + } + Vector2f candidatePos = candidatePosList.front(); + candidatePosList.pop_front(); + pos[0] = candidatePos.x(); + pos[1] = candidatePos.y(); + } + + // Count the number of times we've repositioned an agent from colliding, + // and bound this so as to avoid the possibility of an infinite loop + int repositionAttempts = 0; + while (repositionAttempts < mMaxNumSafeRepositionAttempts) { + fUnsafePosition = false; + SoccerBase::TAgentStateList agent_states; + salt::BoundingSphere sphere(pos, mAgentRadius); + + // Check for collisions with teammates + if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) { + SoccerBase::TAgentStateList::const_iterator i; + + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { + int unumAgent = (*i)->GetUniformNumber(); + if (unum == unumAgent) { + continue; + } + + boost::shared_ptr<oxygen::Transform> agent_aspect; + SoccerBase::GetTransformParent(**i, agent_aspect); + AABB3 agentAABB = SoccerBase::GetAgentBoundingBox(*agent_aspect); + if (sphere.Intersects(agentAABB)) { + /* +#ifdef RVDRAW + if (mRVSender) { + //mRVSender->clearStaticDrawings(); + mRVSender->drawPoint(pos.x(), pos.y(), 10, RVSender::RED); + } +#endif + */ + Vector2f current_pos = Vector2f(pos.x(),pos.y()); + GetSafeRepositionHelper_SamplePositions(agent_pos, unum, idx, current_pos, candidatePosList); + fUnsafePosition = true; + break; + } + } + } + + // Check for collision with opponents + agent_states.clear(); + if (!fUnsafePosition && SoccerBase::GetAgentStates(*mBallState.get(), agent_states, SoccerBase::OpponentTeam(idx))) { + SoccerBase::TAgentStateList::const_iterator i; + + for (i = agent_states.begin(); i != agent_states.end(); ++i) + { + boost::shared_ptr<oxygen::Transform> agent_aspect; + SoccerBase::GetTransformParent(**i, agent_aspect); + AABB3 agentAABB = SoccerBase::GetAgentBoundingBox(*agent_aspect); + if (sphere.Intersects(agentAABB)) { +#ifdef RVDRAW + if (mRVSender) { + //mRVSender->clearStaticDrawings(); + mRVSender->drawPoint(pos.x(), pos.y(), 10, RVSender::RED); + } +#endif + Vector2f current_pos = Vector2f(pos.x(),pos.y()); + GetSafeRepositionHelper_SamplePositions(agent_pos, unum, idx, current_pos, candidatePosList); + fUnsafePosition = true; + break; + } + } + } + + if (!fUnsafePosition) { + // Check for collisions with other repositioned agents + list<Vector2f>::const_iterator i; + for (i = reposLocs.begin(); i != reposLocs.end(); ++i) + { + Vector2f repos_agent_pos = *i; + float dist = sqrt((repos_agent_pos.x()-pos.x())*(repos_agent_pos.x()-pos.x()) + + (repos_agent_pos.y()-pos.y())*(repos_agent_pos.y()-pos.y())); + if (dist < mAgentRadius*2) { + /* +#ifdef RVDRAW + if (mRVSender) { + //mRVSender->clearStaticDrawings(); + mRVSender->drawPoint(pos.x(), pos.y(), 10, RVSender::ORANGE); + } +#endif + */ + Vector2f current_pos = Vector2f(pos.x(),pos.y()); + GetSafeRepositionHelper_SamplePositions(agent_pos, unum, idx, current_pos, candidatePosList); + fUnsafePosition = true; + break; + } + } + } + + if (!fUnsafePosition || candidatePosList.empty()) { + break; + } + + Vector2f candidatePos = candidatePosList.front(); + candidatePosList.pop_front(); + pos[0] = candidatePos.x(); + pos[1] = candidatePos.y(); + repositionAttempts++; + } + + //std::cout << repositionAttempts << "\n"; + + if (fUnsafePosition) { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Failed to safely reposition player " << unum << " " << (idx == TI_LEFT ? "(left)" : "(right)") << "\n"; + pos = posIni; + } + + if (playerInsideOwnArea[unum][idx] == 0 && ((idx == TI_LEFT && mLeftPenaltyArea.Contains(Vector2f(pos.x(), pos.y()))) || + (idx == TI_RIGHT && mRightPenaltyArea.Contains(Vector2f(pos.x(), pos.y()))))) + { + numPlReposInsideOwnArea[idx]++; + } + else if (playerInsideOwnArea[unum][idx] == 1 && ((idx == TI_LEFT && !mLeftPenaltyArea.Contains(Vector2f(pos.x(), pos.y()))) || + (idx == TI_RIGHT && !mRightPenaltyArea.Contains(Vector2f(pos.x(), pos.y()))))) + { + numPlReposInsideOwnArea[idx]--; + } + + reposLocs.push_back(Vector2f(pos.x(), pos.y())); + + return pos; +} + + // Clear Players that are violating the rules void SoccerRuleAspect::ClearPlayersAutomatic(TTeamIndex idx) @@ -912,6 +1243,8 @@ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; + random_shuffle(agent_states.begin(), agent_states.end()); + salt::Vector3f ballPos = mBallBody->GetPosition(); boost::shared_ptr<oxygen::Transform> agent_aspect; @@ -931,7 +1264,7 @@ if (playerFoulTime[unum][idx] <= mFoulHoldTime/0.02) { playerFoulTime[unum][idx]++; agentPos[2] = 1.0 + playerFoulTime[unum][idx]*0.01; - MoveAgent(agent_aspect, agentPos); + MoveAgent(agent_aspect, agentPos, false /*fSafe*/); } else { // I am not a very good soccer player... I am violating the rules... salt::Vector3f new_pos = RepositionOutsidePos(ballPos, unum, idx); @@ -959,6 +1292,8 @@ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; + random_shuffle(agent_states.begin(), agent_states.end()); + salt::BoundingSphere sphere(pos, radius); boost::shared_ptr<oxygen::Transform> agent_aspect; SoccerBase::TAgentStateList::const_iterator i; @@ -1004,6 +1339,8 @@ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; + random_shuffle(agent_states.begin(), agent_states.end()); + boost::shared_ptr<oxygen::Transform> agent_aspect; SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) @@ -1031,7 +1368,7 @@ void SoccerRuleAspect::ClearPlayersBeforeKickOff(TTeamIndex idx) { - if (idx == TI_NONE || mBallState.get() == 0) return; + if (mStartAnyFieldPosition || idx == TI_NONE || mBallState.get() == 0) return; // move the non-kick off team to own half field except the center // circle @@ -1049,6 +1386,8 @@ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; + random_shuffle(agent_states.begin(), agent_states.end()); + salt::AABB2 box; if ( TI_RIGHT == idx ){ box = mLeftHalf; @@ -1098,6 +1437,8 @@ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; + random_shuffle(agent_states.begin(), agent_states.end()); + boost::shared_ptr<oxygen::Transform> agent_aspect; SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) @@ -1116,6 +1457,7 @@ Vector2f updated_pos = avoid_pos+pos2Agent.Normalize()*radius; new_pos[0] = updated_pos[0]; new_pos[1] = updated_pos[1]; + new_pos = GetSafeReposition(new_pos, (*i)->GetUniformNumber(), idx); SoccerBase::MoveAgent(agent_aspect, new_pos); } } @@ -1297,9 +1639,29 @@ TTime kickTime; // notice that a kick is not necessarily an immediate action, it can // take some time... - return mBallState->GetLastCollidingAgent(lastKicker, kickTime) - && kickTime - mLastFreeKickKickTime < 0.1 // kick duration = 0.1 - && lastKicker == mLastFreeKickTaker; + if (!mLastFreeKickTaker || !mBallState->GetLastCollidingAgent(lastKicker, kickTime)) { + return false; + } + + boost::shared_ptr<AgentState> agentStateLastKicker; + if (!SoccerBase::GetAgentState(lastKicker, agentStateLastKicker)) + { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Cannot get " + "AgentState from an AgentAspect\n"; + return false; + } + + boost::shared_ptr<AgentState> agentStateLastFreeKickTaker; + if (!SoccerBase::GetAgentState(mLastFreeKickTaker, agentStateLastFreeKickTaker)) + { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Cannot get " + "AgentState from an AgentAspect\n"; + return false; + } + + return kickTime - mLastFreeKickKickTime < 0.1 // kick duration = 0.1 + && agentStateLastKicker->GetUniformNumber() == agentStateLastFreeKickTaker->GetUniformNumber() + && agentStateLastKicker->GetTeamIndex() == agentStateLastFreeKickTaker->GetTeamIndex(); } void @@ -1310,6 +1672,8 @@ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE)) return; + random_shuffle(agent_states.begin(), agent_states.end()); + boost::shared_ptr<oxygen::Transform> agent_aspect; SoccerBase::TAgentStateList::const_iterator i; for (i = agent_states.begin(); i != agent_states.end(); ++i) @@ -1395,9 +1759,17 @@ MoveBall(pos); - ClearPlayers(pos, mFreeKickDist, mFreeKickMoveDist, TI_LEFT); - ClearPlayers(pos, mFreeKickDist, mFreeKickMoveDist, TI_RIGHT); - + if (rand()%2 == 0) + { + ClearPlayers(pos, mFreeKickDist, mFreeKickMoveDist, TI_LEFT); + ClearPlayers(pos, mFreeKickDist, mFreeKickMoveDist, TI_RIGHT); + } + else + { + ClearPlayers(pos, mFreeKickDist, mFreeKickMoveDist, TI_RIGHT); + ClearPlayers(pos, mFreeKickDist, mFreeKickMoveDist, TI_LEFT); + } + // After a drop ball allow anyone to touch it ResetKickChecks(); @@ -1425,8 +1797,20 @@ MoveBall(pos); mGameState->SetPaused(true); - ClearPlayers(mRightHalf, mFreeKickMoveDist, TI_LEFT); - ClearPlayers(mLeftHalf, mFreeKickMoveDist, TI_RIGHT); + + if (!mStartAnyFieldPosition) + { + if (rand()%2 == 0) + { + ClearPlayers(mRightHalf, mFreeKickMoveDist, TI_LEFT); + ClearPlayers(mLeftHalf, mFreeKickMoveDist, TI_RIGHT); + } + else + { + ClearPlayers(mLeftHalf, mFreeKickMoveDist, TI_RIGHT); + ClearPlayers(mRightHalf, mFreeKickMoveDist, TI_LEFT); + } + } #if 0 // @@ -1493,6 +1877,9 @@ void SoccerRuleAspect::UpdateKickIn(TTeamIndex idx) { + // [patmac] This method is almost identical to UpdateFreeKick + // and could probably just call UpdateFreeKick(idx, true /*indirect*/) + mGameState->SetPaused(false); // do nothing for the duration of mKickInPauseTime @@ -1523,14 +1910,10 @@ // change to the KickIn mode *plus* pause time boost::shared_ptr<AgentAspect> agent; TTime time; - if (! mBallState->GetLastCollidingAgent(agent,time)) - { - GetLog()->Error() << "ERROR: (SoccerRuleAspect) " << "no agent collided yet\n"; - return; - } + bool fHaveAgentCollidedWithBall = mBallState->GetLastCollidingAgent(agent,time); TTime lastChange = mGameState->GetLastModeChange(); - if (time > lastChange + mKickInPauseTime && !mRepelPlayersForKick) + if (fHaveAgentCollidedWithBall && time > lastChange + mKickInPauseTime + 0.03 && !mRepelPlayersForKick) { SetKickTakenValues(time, agent, true); mGameState->SetPlayMode(PM_PlayOn); @@ -1600,14 +1983,10 @@ // change to the KickIn mode boost::shared_ptr<AgentAspect> agent; TTime time; - if (! mBallState->GetLastCollidingAgent(agent,time)) - { - GetLog()->Error() << "ERROR: (SoccerRuleAspect) " << "no agent collided yet\n"; - return; - } + bool fHaveAgentCollidedWithBall = mBallState->GetLastCollidingAgent(agent,time); TTime lastChange = mGameState->GetLastModeChange(); - if (time > lastChange + mKickInPauseTime && !mRepelPlayersForKick) + if (fHaveAgentCollidedWithBall && time > lastChange + mKickInPauseTime + 0.03 && !mRepelPlayersForKick) { SetKickTakenValues(time, agent, indirect); mGameState->SetPlayMode(PM_PlayOn); @@ -1666,7 +2045,7 @@ TTime lastChange = mGameState->GetLastModeChange(); // if the team with the goal kick touched the ball and the ball is // outside the penalty area, we switch to play on. - if (time > lastChange + mKickInPauseTime && !mRepelPlayersForKick) + if (time > lastChange + mKickInPauseTime + 0.03 && !mRepelPlayersForKick) { Vector2f pos(mBallBody->GetPosition().x(), mBallBody->GetPosition().y()); @@ -1737,7 +2116,7 @@ } TTime lastChange = mGameState->GetLastModeChange(); - if (time > lastChange + mKickInPauseTime && !mRepelPlayersForKick) + if (time > lastChange + mKickInPauseTime + 0.03 && !mRepelPlayersForKick) { SetKickTakenValues(time, agent, false); mGameState->SetPlayMode(PM_PlayOn); @@ -1956,7 +2335,7 @@ bool SoccerRuleAspect::CheckFreeKickTakerFoul() { - if (!mCheckFreeKickKickerFoul) + if (!mCheckFreeKickKickerFoul || !mLastFreeKickTaker) return false; boost::shared_ptr<AgentAspect> agent; @@ -1964,8 +2343,26 @@ { mCheckFreeKickKickerFoul = false; mIndirectKick = false; - if (agent == mLastFreeKickTaker) + + boost::shared_ptr<AgentState> agentStateLastKicker; + if (!SoccerBase::GetAgentState(agent, agentStateLastKicker)) { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Cannot get " + "AgentState from an AgentAspect\n"; + return false; + } + + boost::shared_ptr<AgentState> agentStateLastFreeKickTaker; + if (!SoccerBase::GetAgentState(mLastFreeKickTaker, agentStateLastFreeKickTaker)) + { + GetLog()->Error() << "ERROR: (SoccerRuleAspect) Cannot get " + "AgentState from an AgentAspect\n"; + return false; + } + + if (agentStateLastKicker->GetUniformNumber() == agentStateLastFreeKickTaker->GetUniformNumber() + && agentStateLastKicker->GetTeamIndex() == agentStateLastFreeKickTaker->GetTeamIndex()) + { PunishFreeKickFoul(mLastFreeKickTaker); return true; } @@ -2167,6 +2564,8 @@ return; } + reposLocs.clear(); + CheckTime(); TPlayMode playMode = mGameState->GetPlayMode(); @@ -2420,7 +2819,10 @@ SoccerBase::GetSoccerVar(*this,"ChargingMinCollisionSpeed",mMinCollisionSpeed); SoccerBase::GetSoccerVar(*this,"FoulHoldTime",mFoulHoldTime); + SoccerBase::GetSoccerVar(*this,"MaxNumSafeRepositionAttempts",mMaxNumSafeRepositionAttempts); + SoccerBase::GetSoccerVar(*this,"StartAnyFieldPosition",mStartAnyFieldPosition); + // cout << "MaxInside " << mMaxPlayersInsideOwnArea << endl << endl; // set up bounding boxes for halfs and goal areas @@ -2806,7 +3208,7 @@ TTeamIndex collidingAgentIdx = agentState->GetTeamIndex(); TTime lastChange = mGameState->GetLastModeChange(); - if (time > lastChange && collidingAgentIdx==idx && !mRepelPlayersForKick) + if (time > lastChange + 0.03 && collidingAgentIdx==idx && !mRepelPlayersForKick) { mGameState->SetPlayMode(PM_PlayOn); } @@ -2830,6 +3232,8 @@ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, idx)) return; + random_shuffle(agent_states.begin(), agent_states.end()); + salt::BoundingSphere sphere(pos, radius); boost::shared_ptr<oxygen::Transform> agent_aspect; SoccerBase::TAgentStateList::const_iterator i; @@ -2919,8 +3323,10 @@ bool -SoccerRuleAspect::MoveAgent(boost::shared_ptr<Transform> agent_aspect, const Vector3f& pos) +SoccerRuleAspect::MoveAgent(boost::shared_ptr<Transform> agent_aspect, const Vector3f& pos, bool fSafe) { + Vector3f move_pos = pos; + boost::shared_ptr<AgentState> agentState; if (!SoccerBase::GetAgentState(agent_aspect, agentState)) { @@ -2930,11 +3336,15 @@ else { int unum = agentState->GetUniformNumber(); - int idx = agentState->GetTeamIndex(); + TTeamIndex idx = agentState->GetTeamIndex(); playerTimeSinceLastWasMoved[unum][idx] = 0; + + if (fSafe) { + move_pos = GetSafeReposition(pos, unum, idx); + } } - return SoccerBase::MoveAgent(agent_aspect, pos); + return SoccerBase::MoveAgent(agent_aspect, move_pos); } bool Modified: trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h =================================================================== --- trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2017-03-24 21:15:15 UTC (rev 414) +++ trunk/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2017-07-08 15:42:38 UTC (rev 415) @@ -102,6 +102,23 @@ */ salt::Vector3f RepositionOutsidePos(salt::Vector3f initPos, int unum, TTeamIndex idx); + /** Helper for GetSafeReposition that adjusts positions if they are in + a team's penalty area and would cause an illegal defense foul if an + agent was moved there + */ + bool GetSafeRepositionHelper_AdjustPositionForPenaltyArea(const salt::Vector2f agent_pos, int unum, TTeamIndex idx, salt::Vector2f ¤t_pos); + + /** Helper for GetSafeReposition that samples new positions to try and + move an agent to for repositioning + */ + void GetSafeRepositionHelper_SamplePositions(const salt::Vector2f agent_pos, int unum, TTeamIndex idx, salt::Vector2f current_pos, std::list<salt::Vector2f> &candidatePosList); + + /** Checks the current position for an agent to be repositioned to for + potential collisions with other agents, and adjusts the position if need + be to avoid collisions + */ + salt::Vector3f GetSafeReposition(salt::Vector3f posIni, 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 */ @@ -367,13 +384,13 @@ bool WasLastKickFromFreeKick( boost::shared_ptr<oxygen::AgentAspect> &lastKicker); - bool MoveAgent(boost::shared_ptr<oxygen::Transform> agent_aspect, const salt::Vector3f& pos); + bool MoveAgent(boost::shared_ptr<oxygen::Transform> agent_aspect, const salt::Vector3f& pos, bool fSafe=true); /** if a player has committed a foul that should be enforced */ bool HaveEnforceableFoul(int unum, TTeamIndex ti); protected: - static const int AVERAGE_VELOCITY_MEASUREMENTS = 5; + static const int AVERAGE_VELOCITY_MEASUREMENTS = 3; /** reference to the body node of the Ball */ boost::shared_ptr<oxygen::RigidBody> mBallBody; @@ -485,6 +502,8 @@ int playerFoulTime[12][3]; //Time player is commiting a positional foul EFoulType playerLastFoul[12][3]; //Type of last foul committed by player int numPlInsideOwnArea[3]; //Number of players inside own area + int numPlReposInsideOwnArea[3]; //Number of players repositioned inside own area + std::list<salt::Vector2f> reposLocs; // List of locations players have been repositioned to int closestPlayer[3]; //Closest Player from each team float closestPlayerDist[3]; //Closest Player distance to ball from each team salt::Vector3f playerVelocities[12][3][AVERAGE_VELOCITY_MEASUREMENTS]; // Player velocities over last AVERAGE_VELOCITY_MEASUREMENTS cycles @@ -594,6 +613,13 @@ /** reduction rate of width of keepaway box per minute */ float mKeepawayWidthReductionRate; + /** Maximum number of attempts made to safely reposition an agent */ + int mMaxNumSafeRepositionAttempts; + + /** Allow starting at any field position including on opponent's + side of the field */ + bool mStartAnyFieldPosition; + #ifdef RVDRAW boost::shared_ptr<RVSender> mRVSender; #endif // RVDRAW Modified: trunk/rcssserver3d/rcssserver3d/naosoccersim.rb =================================================================== --- trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2017-03-24 21:15:15 UTC (rev 414) +++ trunk/rcssserver3d/rcssserver3d/naosoccersim.rb 2017-07-08 15:42:38 UTC (rev 415) @@ -56,6 +56,7 @@ addSoccerVar('WaitBeforeKickOff', 30.0) addSoccerVar('CoinTossForKickOff', false) addSoccerVar('PenaltyShootout', false) +addSoccerVar('StartAnyFieldPosition', false) addSoccerVar('AutomaticQuit', false) addSoccerVar('ChangeSidesInSecondHalf', false) @@ -106,9 +107,13 @@ addSoccerVar('GroundMaxTime',15) addSoccerVar('GoalieGroundMaxTime', 30) addSoccerVar('MaxPlayersInsideOwnArea',3) -addSoccerVar('MinOppDistance',0.8) -addSoccerVar('Min2PlDistance',0.4) -addSoccerVar('Min3PlDistance',1.0) +#addSoccerVar('MinOppDistance',0.8) +#addSoccerVar('Min2PlDistance',0.4) +#addSoccerVar('Min3PlDistance',1.0) +# Turning off crowding for 2017 competition +addSoccerVar('MinOppDistance',0.0) +addSoccerVar('Min2PlDistance',0.0) +addSoccerVar('Min3PlDistance',0.0) addSoccerVar('FoulHoldTime', 0.5) @@ -128,8 +133,10 @@ #addSoccerVar('MaxPlayersInsideOwnArea',2) #addSoccerVar('MinOppDistance',1.0) #addSoccerVar('Min2PlDistance',0.6) -#addSoccerVar('Min3PlDistance',1.5) +#addSoccerVar('Min3PlDistance',1.5) +addSoccerVar('MaxNumSafeRepositionAttempts', 100) + # recorders addSoccerVar('BallRecorder',"Ball/geometry/recorder") addSoccerVar('LeftGoalRecorder',"leftgoal/GoalBox/BoxCollider/recorder") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |