Skip to content

Commit

Permalink
stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Umbrella167 committed May 15, 2024
1 parent a440c07 commit 626720c
Show file tree
Hide file tree
Showing 11 changed files with 465 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Core/HuRocos-2024/PlayConfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ gRefConfig = {
TheirBallPlacement = "theirBallPlacement",
OurBallPlacement = "our_BallPlacement",
TheirPenaltyKick = "STOP",
OurPenaltyKick = "STOP",
NormalPlay = "NORMALPLAY",
OurPenaltyKick = "our_Penalty",
NormalPlay = "NORMALPLAY" -- {"NORMALPLAY", "NORMALPLAYV2"},
}
--]]
364 changes: 364 additions & 0 deletions Core/HuRocos-2024/play/NORMALPLAY.lua

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Core/HuRocos-2024/play/Nor_DefendV2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ return {
switch = function()

end,
Breaker = function() return task.defend_normV2("Tier", 0, 1) end,
Fronter = function() return task.defend_normV2("Defender", 1, 1) end,
Breaker = function() return task.defend_normV2("Tier", 0, 0) end,
Fronter = function() return task.defend_normV2("Defender", 1, 0) end,
match = "[TD]"
},
["defend_front"] = {
Expand Down
79 changes: 79 additions & 0 deletions Core/HuRocos-2024/play/our_Penalty.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
local DSS_FLAG = flag.allow_dss + flag.dodge_ball
local p1 = CGeoPoint(- param.pitchLength / 2 + 300,param.pitchWidth / 2 - 300)
local p2 = CGeoPoint(- param.pitchLength / 2 + 300,param.pitchWidth / 2 - 600)
local p3 = CGeoPoint(- param.pitchLength / 2 + 300, -param.pitchWidth / 2 + 300)
local p4 = CGeoPoint(- param.pitchLength / 2 + 300,-param.pitchWidth / 2 + 600)
local p5 = CGeoPoint(- param.pitchLength / 2 , 0)
local canShoot = function(role,shootThreshold)
if ball.posX() > shootThreshold then
return true
else
return false
end
end

local theirGoalie = function()
for i=0,param.maxPlayer do
if enemy.valid(i) then
if enemy.pos(i):x() > ball.posX() then
return i
end
end
end
return -1
end

local shootFlag = function(role)
if player.pos(role):dist(enemy.pos(theirGoalie)) < 500 then

end
end
gPlayTable.CreatePlay{
firstState = "Init",

["Init"] = {
switch = function()
debugEngine:gui_debug_msg(CGeoPoint(0,0),ball.posX())
if cond.isNormalStart() then
return "Getball"
end
end,
Leader = function() return task.goCmuRush(function() return ball.pos() + Utils.Polar2Vector(-180,0) end, player.toBallDir("Leader"), a, DSS_FLAG) end,
Kicker = task.goCmuRush(p1, 0, a, DSS_FLAG, r, v, s, force_manual),
Special = task.goCmuRush(p2, 0, a, DSS_FLAG, r, v, s, force_manual),
Tier = task.goCmuRush(p3, 0, a, DSS_FLAG, r, v, s, force_manual),
Defender = task.goCmuRush(p4, 0, a, DSS_FLAG, r, v, s, force_manual),
Goalie = task.goCmuRush(p5, 0, a, DSS_FLAG, r, v, s, force_manual),
match = "{L}[KS]{TDG}"
},

["Getball"] = {
switch = function()
debugEngine:gui_debug_msg(CGeoPoint(0,0),ball.posX())
if player.myinfraredCount > 15 and (not canShoot) then
return "shoot_dribbling"
end
end,
Leader = task.getball(function() return shoot_pos end,playerVel,getballMode),
match = "{L}"
},


["shoot_dribbling"] = {
switch = function()
debugEngine:gui_debug_msg(CGeoPoint(0,0),ball.posX())
if player.myinfraredCount > 15 and (not canShoot) then
return "closeTheir"
end

end,
match = "{L}"
},
name = "our_Penalty",
applicable ={
exp = "a",
a = true
},
attribute = "attack",
timeout = 99999
}
2 changes: 1 addition & 1 deletion Core/HuRocos-2024/play/their_IndirectKick.lua
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ firstState = "Init",
Goalie = task.goalie("Goalie"),
match = "(AKS){TDG}"
},
name = "their_BallPlacement",
name = "their_IndirectKick",
applicable ={
exp = "a",
a = true
Expand Down
8 changes: 6 additions & 2 deletions Core/src/Utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ namespace Utils
{

Tick[now].task[i].player_num = i;
if (Tick[now].task[i].infrared_count == 0)
if (i != Tick[now].our.dribbling_num)
Tick[now].task[i].infrared_count = 0;
if (Tick[now].task[i].infrared_count == 0 )
Tick[now].task[i].infrared_off_count += 1;


// 如果球的视野消失,但是有红外信息,认为球的位置在触发红外的机器人上
if(!pVision ->ball().Valid())
if(RobotSensor.InfraredOnCount(i)>5)
Expand Down Expand Up @@ -195,7 +199,7 @@ namespace Utils
Tick[now].ball.rights = 0;
// 顶牛 或 抢球对抗
// printf("our minTob%f,their %f", our_min_dist, their_min_dist);
if((RobotSensor.InfraredOnCount(Tick[now].our.to_balldist_min_num) > 5 || our_min_dist < playerBallRightsBuffer) && their_min_dist < playerBallRightsBuffer - 15)
if((RobotSensor.InfraredOnCount(Tick[now].our.to_balldist_min_num) > 5 || our_min_dist < playerBallRightsBuffer + 5) && their_min_dist < playerBallRightsBuffer +5)
{
Tick[now].ball.rights = 2;
}
Expand Down
2 changes: 1 addition & 1 deletion Core/tactics/play/TestCircleRun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ firstState = "ready1",
debugEngine:gui_debug_msg(CGeoPoint:new_local(0,0),player.rotVel("Assister"))
end,

Assister = task.TurnRun(CGeoPoint(60,60),4),
Assister = task.TurnRun(CGeoPoint(300,0),5),
match = "[A]"
},

Expand Down
1 change: 1 addition & 0 deletions ZBin/lua_scripts/Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ gRoleFixNum = {
["Goalie"] = { param.our_goalie_num },
["Defender"] = { param.defend_num1 },
["Tier"] = { param.defend_num2 },
["Leader"] = { param.LeaderNum },
}

-- 用来进行定位球的保持
Expand Down
11 changes: 5 additions & 6 deletions ZBin/lua_scripts/worldmodel/ball.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
module(..., package.seeall)

function pos()
local ballPos = vision:ball():Pos()
if not vision:ball():Valid() then
ballPos = GlobalMessage.Tick().ball.pos
end
local ballPos = GlobalMessage.Tick().ball.pos
return CGeoPoint(ballPos:x(),ballPos:y())
end

function posX()
return vision:ball():X()
local ballPos = GlobalMessage.Tick().ball.pos
return ballPos:x()
end

function posY()
return vision:ball():Y()
local ballPos = GlobalMessage.Tick().ball.pos
return ballPos:y()
end

function rawPos()
Expand Down
2 changes: 1 addition & 1 deletion ZBin/lua_scripts/worldmodel/param.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ playerInfraredCountBuffer = CGetSettings("ZJHU/playerInfraredCountBuffer", "Int"
our_goalie_num = CGetSettings("ZJHU/our_goalie_num", "Int")
defend_num1 = CGetSettings("ZJHU/defend_num1", "Int")
defend_num2 = CGetSettings("ZJHU/defend_num2", "Int")

LeaderNum = 3
-----------------------------------------------|
-- feild参数 --|
-----------------------------------------------|
Expand Down
6 changes: 3 additions & 3 deletions ZBin/lua_scripts/worldmodel/task.lua
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ function ShootdotV2(p, error_, flag_,role)
end


function ShootdotDribbling(error_, flag_)
function ShootdotDribbling(error_, flag_,power)
return function()
local irole = role or "Assister"
local p1
Expand All @@ -492,7 +492,7 @@ function ShootdotDribbling(error_, flag_)
local error__ = function()
return error_ * math.pi / 180.0
end
local iPower = param.isReality and kp.specified(110) or kp.specified(1300)
local iPower = param.isReality and kp.specified(power) or kp.specified(1300)
local mexe, mpos = GoCmuRush { pos = shootpos, dir = idir, acc = a, flag = flag.dribbling, rec = r, vel = v }
return { mexe, mpos, flag_, idir, error__,iPower , iPower, flag.dribbling }
end
Expand Down Expand Up @@ -1274,7 +1274,7 @@ function defender_marking(role,pos)
-- 初始化 获取需要盯防的对象 <= 2
-- if markingTableLen == 0 and ball.rawPos():x() > param.markingThreshold then
for i=0,param.maxPlayer-1 do
if enemy.valid(i) and i ~= enemyDribblingNum and enemy.posX(i) < param.markingThreshold then
if enemy.valid(i) and i ~= enemyDribblingNum and enemy.posX(i) < param.markingThreshold then
markingTable[markingTableLen] = i
markingTableLen = markingTableLen + 1
if markingTableLen > 1 then
Expand Down

0 comments on commit 626720c

Please sign in to comment.