⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 naosoccersim.rb

📁 rcssserver3d Robocup 3D比赛官方指定平台
💻 RB
字号:
## prepare soccer simulation## setup soccer specific materials# run "scripts/rcs-materials.rb"run "scripts/rcs-materials-textures.rb"material = sparkCreate('kerosin/Material2DTexture', $serverPath+'material/matGrass');material.setDiffuse(1.0,1.0,1.0,1.0)material.setAmbient(0.5,0.5,0.5,1.0)material.setDiffuseTexture('textures/rcs-naofield.png')importBundle "soccer"# soccer namespace$soccerNameSpace = "Soccer"# register a variable in the soccer namespacedef addSoccerVar(name, value)   createVariable($soccerNameSpace, name, value)end# helper to get the value of a variable in the soccer namespacedef getSoccerVar(name)  eval <<-EOS     #{$soccerNameSpace}.#{name}   EOSend# set a random seed (a seed of 0 means: use a random random seed)randomServer = get($serverPath+'random')if (randomServer != nil)  randomServer.seed(0)end# the soccer field dimensions in metersaddSoccerVar('FieldLength', 12.0)addSoccerVar('FieldWidth', 8.0)addSoccerVar('FieldHeight', 40.0)addSoccerVar('GoalWidth', 1.4)addSoccerVar('GoalDepth', 0.4)addSoccerVar('GoalHeight', 0.8)addSoccerVar('PenaltyLength',1.2)addSoccerVar('PenaltyWidth',2.6)addSoccerVar('FreeKickDistance', 1.3)addSoccerVar('FreeKickMoveDist', 1.5)addSoccerVar('GoalKickDist', 1.0)addSoccerVar('AutomaticKickOff', false)addSoccerVar('WaitBeforeKickOff', 2.0)# agent parametersaddSoccerVar('AgentRadius',  0.4)# ball parametersaddSoccerVar('BallRadius', 0.042)addSoccerVar('BallMass',0.026)# soccer rule parametersaddSoccerVar('RuleGoalPauseTime',3.0)addSoccerVar('RuleKickInPauseTime',1.0)addSoccerVar('RuleHalfTime',8.0 * 60)addSoccerVar('RuleDropBallTime',30)addSoccerVar('SingleHalfTime', true)addSoccerVar('UseOffside',false)# recordersaddSoccerVar('BallRecorder',"Ball/geometry/recorder")addSoccerVar('LeftGoalRecorder',"leftgoal/GoalBox/BoxCollider/recorder")addSoccerVar('RightGoalRecorder',"rightgoal/GoalBox/BoxCollider/recorder")# texturescreateVariable('Nao', 'UseTexture', 'true')scene = get($scenePath)if (scene != nil)  scene.importScene('rsg/agent/nao/soccer.rsg')end# setup the GameControlServergameControlServer = get($serverPath+'gamecontrol')if (gameControlServer != nil)  gameControlServer.initControlAspect('GameStateAspect')  gameControlServer.initControlAspect('BallStateAspect')  gameControlServer.initControlAspect('SoccerRuleAspect')end# init monitorItems to transmit game state informationmonitorServer = get($serverPath+'monitor')if (monitorServer != nil)  monitorServer.registerMonitorItem('GameStateItem')end# install the TrainerCommandParser to parse commands received from a# monitor clientsparkRegisterMonitorCmdParser 'TrainerCommandParser'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -