From 0557bb8e2c2c462733dd2da1bc9310a272d0dd2a Mon Sep 17 00:00:00 2001 From: Umbrella167 <1670187757@qq.com> Date: Sat, 4 May 2024 13:03:21 +0800 Subject: [PATCH] STAGE --- Core/HuRocos-2024/play/our_BallPlacement.lua | 2 + Core/tactics/play/TestballRightAndInfraed.lua | 111 ++---------------- ZBin/lua_scripts/worldmodel/player.lua | 11 +- ZBin/lua_scripts/worldmodel/task.lua | 5 +- share/staticparams.h | 3 +- 5 files changed, 22 insertions(+), 110 deletions(-) diff --git a/Core/HuRocos-2024/play/our_BallPlacement.lua b/Core/HuRocos-2024/play/our_BallPlacement.lua index 5ba0246..93d1558 100644 --- a/Core/HuRocos-2024/play/our_BallPlacement.lua +++ b/Core/HuRocos-2024/play/our_BallPlacement.lua @@ -148,6 +148,8 @@ firstState = "start", ["getball"] = { switch = function() GlobalMessage.Tick = Utils.UpdataTickMessage(vision,param.our_goalie_num,param.defend_num1,param.defend_num2) + debugEngine:gui_debug_msg(CGeoPoint(0,2800),"ballRights: " .. GlobalMessage.Tick.ball.rights,2) + debugEngine:gui_debug_msg(CGeoPoint(0,2600),"InfraredCount: " .. player.myinfraredCount("Assister"),3) if ball.pos():dist(ball.placementPos()) < 200 then return "avoid" end diff --git a/Core/tactics/play/TestballRightAndInfraed.lua b/Core/tactics/play/TestballRightAndInfraed.lua index 41d6050..ba68761 100644 --- a/Core/tactics/play/TestballRightAndInfraed.lua +++ b/Core/tactics/play/TestballRightAndInfraed.lua @@ -13,7 +13,7 @@ local KP = 0.00000002 local defendPos = function(role) return function() local posdefend = enemy.pos(role) + Utils.Polar2Vector(300,(ball.pos() - enemy.pos(role)):dir()) - return CGeoPoint:new_local( posdefend:x(),posdefend:y() ) + return CGeoPoint:new_local(posdefend:x(),posdefend:y() ) end end local run_pos = CGeoPoint:new_local(0,0) @@ -31,118 +31,21 @@ firstState = "ready1", ["ready1"] = { switch = function() - debugEngine:gui_debug_msg(CGeoPoint(1000, 1000), player.dir("Goalie")) GlobalMessage.Tick = Utils.UpdataTickMessage(vision,0,1,2) - -- debugEngine:gui_debug_msg(CGeoPoint(0,0),task.angleDiff((ball.pos() - player.pos("Assister")):dir(),(player.pos("Assister") - CGeoPoint(0,0)):dir())) - -- if(player.infraredCount("Assister") > 5) then - -- return "shoot" - -- end - + debugEngine:gui_debug_msg(CGeoPoint(0,2800),"ballRights: " .. GlobalMessage.Tick.ball.rights) + debugEngine:gui_debug_msg(CGeoPoint(0,2600),"InfraredCount: " .. player.myinfraredCount(0),2) + debugEngine:gui_debug_msg(CGeoPoint(0,2400),"RawBallPos: " .. ball.rawPos():x() .. " " .. ball.rawPos():y() ,3) + debugEngine:gui_debug_msg(CGeoPoint(0,2200),"BallPos: " .. ball.pos():x() .. " " .. ball.pos():y() ,4) end, - Assister = task.goCmuRush(CGeoPoint(3671,1148)), - -- Assister = task.getballV2("Assister", param.playerVel, 1, CGeoPoint(0, 0), 0), - -- Kicker = task.getball("Assister",param.playerVel,param.getballMode,CGeoPoint:new_local(0,0)), - -- Kicker = function() return task.defender_marking("Kicker",CGeoPoint(0,0)) end, + Assister = task.stop(), match = "[A]" }, -["shoot"] = { - switch = function() - if(not bufcnt(player.infraredOn("Assister"),1)) then - return "ready1" - end - local Vy = player.rotVel("Assister") - local ToTargetDist = player.toPointDist("Assister",shoot_pos) - resPos = task.compensateAngle(Vy,shoot_pos,ToTargetDist * 0.07) - - if(task.playerDirToPointDirSub("Assister",resPos) < 4) then - return "shoot1" - end - - - end, - -- = task.TurnRun("Assister"), - Assister = function() return (task.TurnToPointV2("Assister",function() return resPos end ,param.rotVel)) end, - -- match = "[AKS]{TDG}" - match = "[A]" -}, - - -["shoot1"] = { - switch = function() -if(not bufcnt(player.infraredOn("Assister"),1)) then - return "ready1" - end - end, - -- = task.TurnRun("Assister"), - Assister = task.ShootdotV2(function() return resPos end,10,8,kick.flat), - -- match = "[AKS]{TDG}" - match = "[A]" -}, -["dribbling"] = { - switch = function() - Utils.UpdataTickMessage(vision,1,2) - run_pos = Utils.GetShowDribblingPos(vision,CGeoPoint:new_local(player.pos("Assister"):x(),player.pos("Assister"):y()),CGeoPoint(0,0)) - - if(bufcnt(true,35)) then - return "ready" - end - end, - Assister = task.goCmuRush(runPos(),balldir(),800,flag.dribbling), - - match = "[AKS]{TDG}" -}, - - --- ["touch"] = { --- switch = function() --- -- Utils.UpdataTickMessage(vision,1,2) --- -- Utils.GlobalComputingPos(vision) - --- end, --- Assister = task.touchKick("Assister",CGeoPoint(4500,0)), - --- match = "[AKS]{TDG}" --- }, - --- ["readyShoot"] = { --- switch = function() --- Utils.GetTouchPos(vision,CGeoPoint:new_local(ball.posX(),ball.posY())) --- -- local pos1 = Utils.GetBestInterPos(vision,playerPos(),4,2) --- -- debugEngine:gui_debug_x(pos1,3) --- -- debugEngine:gui_debug_msg(CGeoPoint:new_local(0,0),pos1:x() .. " " .. pos1:y()) --- -- Utils.UpdataTickMessage(vision,1,2) --- -- Utils.GlobalComputingPos(vision) --- -- aa = player.canTouch("Assister",CGeoPoint:new_local(4500,0)) --- -- debugEngine:gui_debug_msg(CGeoPoint:new_local(0,0),tostring(aa)) --- -- if(player.infraredCount("Assister") > 30) then --- -- return "Shoot" --- -- end --- end, --- Assister = task.goCmuRush(defendPOs(4)),--task.touchKick(_,_,500,kick.flat);--task.getball("Assister",6,2),--task.GetBallV2("Assister",CGeoPoint(4500,0)), --- Kicker = task.goCmuRush(defendPOs(5)), - --- match = "(AK)" --- }, --- ["Shoot"] = { --- switch = function() --- -- Utils.UpdataTickMessage(vision,1,2) --- -- Utils.GlobalComputingPos(vision) --- if(player.kickBall("Assister")) then --- return "readyShoot" --- end --- end, --- Assister = task.ShootdotV2(CGeoPoint(4500,0),KP,error_dir,kick.flat), - --- match = "[AKS]{TDG}" --- }, - - -name = "testSkill", +name = "TestballRightAndInfraed", applicable ={ exp = "a", a = true diff --git a/ZBin/lua_scripts/worldmodel/player.lua b/ZBin/lua_scripts/worldmodel/player.lua index 6ff0cd6..9053cf6 100644 --- a/ZBin/lua_scripts/worldmodel/player.lua +++ b/ZBin/lua_scripts/worldmodel/player.lua @@ -282,7 +282,16 @@ end function myinfraredCount(role) local robotNum = num(role) if robotNum ~= -1 then - return GlobalMessage.Tick.task[robotNum].infrared_count + local OfficalInfraredCount = world:InfraredOnCount(robotNum) + local MyInfraredCount = GlobalMessage.Tick.task[robotNum].infrared_count + if OfficalInfraredCount ~= 0 then + if OfficalInfraredCount > MyInfraredCount then + return OfficalInfraredCount + else + return MyInfraredCount + end + end + return MyInfraredCount else return 0 end diff --git a/ZBin/lua_scripts/worldmodel/task.lua b/ZBin/lua_scripts/worldmodel/task.lua index 0ad5ea1..156c944 100644 --- a/ZBin/lua_scripts/worldmodel/task.lua +++ b/ZBin/lua_scripts/worldmodel/task.lua @@ -6,8 +6,6 @@ module(..., package.seeall) --- /// /// --- /// /// --- /// /// --- /// /// --- /// /// --- - - function getBall_BallPlacement(role) return function() local ballPos = GlobalMessage.Tick.ball.pos @@ -36,12 +34,11 @@ function getBall_BallPlacement(role) end else -- debugEngine:gui_debug_msg(CGeoPoint(100,1000),player.myinfraredCount(role)) + if player.myinfraredCount(role) < 20 then - local toballDir = math.abs((ball.rawPos() - player.rawPos(role)):dir() * 57.3) local playerDir = math.abs((player.pos(role) - ballPlacementPos):dir()) * 57.3 local Subdir = math.abs(toballDir-playerDir) - if bufcnt( Subdir < 18 and player.toBallDist(role) < 200,60) then debugEngine:gui_debug_msg(CGeoPoint(0,0),"3") placementflag = flag.our_ball_placement + flag.dribbling diff --git a/share/staticparams.h b/share/staticparams.h index 0f6a3be..2dc9b59 100644 --- a/share/staticparams.h +++ b/share/staticparams.h @@ -54,7 +54,8 @@ namespace PARAM { const int playerFrontToCenter = 76; // 机器人圆心到嘴的距离 const int playerRadiusr = 90; // 机器人半径 const int playerBuffer = 100; // 检测敌人是否在某直线上的缓冲值 - const double playerBallRightsBuffer = 95; // 球权判断缓冲值 + const double playerBallRightsBuffer = 102; // 球权判断缓冲值 + const int playerTouchAngle = 60; } namespace Tick{