diff --git a/Core/src/LuaModule/utils.pkg b/Core/src/LuaModule/utils.pkg index 28a3f1f..dd63dfe 100644 --- a/Core/src/LuaModule/utils.pkg +++ b/Core/src/LuaModule/utils.pkg @@ -16,7 +16,7 @@ namespace Utils{ // 小工具 CGeoPoint GetBallMaxPos(const CVisionModule *pVision); - bool InExclusionZone(CGeoPoint Point, double buffer = 0); + bool InExclusionZone(CGeoPoint Point, double buffer = 0,std::string dir = "all"); bool InField(CGeoPoint Point); bool InOurField(CGeoPoint Point); diff --git a/Core/src/Utils/utils.cpp b/Core/src/Utils/utils.cpp index ef8012c..02093f8 100644 --- a/Core/src/Utils/utils.cpp +++ b/Core/src/Utils/utils.cpp @@ -312,7 +312,7 @@ namespace Utils // GDebugEngine::Instance() ->gui_debug_x(CGeoPoint(x,y)); // GDebugEngine::Instance() ->gui_debug_msg(CGeoPoint(x,y),to_string(grade),1,0,60); } - GDebugEngine::Instance() ->gui_debug_arc(Tick[now].ball.first_dribbling_pos,1000,0,360,3); + GDebugEngine::Instance() ->gui_debug_arc(Tick[now].ball.first_dribbling_pos,1000,0,360,8); GDebugEngine::Instance() ->gui_debug_x(max_grade_point,3); return max_grade_point; @@ -1391,22 +1391,44 @@ namespace Utils * @param {double} y : * @return {bool} : */ - bool InExclusionZone(CGeoPoint Point, double buffer) + bool InExclusionZone(CGeoPoint Point, double buffer,string dir) { double x = Point.x(); double y = Point.y(); - if (((x < (-1 * PARAM::Field::PITCH_LENGTH / 2) + PARAM::Field::PENALTY_AREA_DEPTH + buffer) || - (x > (PARAM::Field::PITCH_LENGTH / 2) - PARAM::Field::PENALTY_AREA_DEPTH - buffer)) && - (y > -1 * PARAM::Field::PENALTY_AREA_WIDTH / 2 - buffer && y < PARAM::Field::PENALTY_AREA_WIDTH / 2 + buffer)) + if (dir == "our") { - return true; + + if ((x < (-1 * PARAM::Field::PITCH_LENGTH / 2) + PARAM::Field::PENALTY_AREA_DEPTH + buffer) && + (y > -1 * PARAM::Field::PENALTY_AREA_WIDTH / 2 - buffer && y < PARAM::Field::PENALTY_AREA_WIDTH / 2 + buffer)) + return true; + else + return false; + + + + + + } + else if(dir == "their") + { + if ((x > (PARAM::Field::PITCH_LENGTH / 2) - PARAM::Field::PENALTY_AREA_DEPTH - buffer)&& + (y > -1 * PARAM::Field::PENALTY_AREA_WIDTH / 2 - buffer && y < PARAM::Field::PENALTY_AREA_WIDTH / 2 + buffer)) + return true; + else + return false; + } else { - return false; + if (((x < (-1 * PARAM::Field::PITCH_LENGTH / 2) + PARAM::Field::PENALTY_AREA_DEPTH + buffer) || + (x > (PARAM::Field::PITCH_LENGTH / 2) - PARAM::Field::PENALTY_AREA_DEPTH - buffer)) && + (y > -1 * PARAM::Field::PENALTY_AREA_WIDTH / 2 - buffer && y < PARAM::Field::PENALTY_AREA_WIDTH / 2 + buffer)) + return true; + else + return false; + } } - /** * 判断是否在场地内 * @brief InField diff --git a/Core/src/Utils/utils.h b/Core/src/Utils/utils.h index 8f0c44a..bdb3101 100644 --- a/Core/src/Utils/utils.h +++ b/Core/src/Utils/utils.h @@ -35,7 +35,7 @@ namespace Utils extern std::string GlobalComputingPos(const CVisionModule *pVision); // 计算所有点位 extern double map(double value, double min_in, double max_in, double min_out, double max_out); // 映射 extern bool InField(CGeoPoint Point); // 判断点是否在场地内 - extern bool InExclusionZone(CGeoPoint Point, double buffer = 0); // 判断点是否在禁区内 + extern bool InExclusionZone(CGeoPoint Point, double buffer = 0,std::string dir = "all"); // 判断点是否在禁区内 extern bool InOurField(CGeoPoint Point); extern double NumberNormalize(double data, double max_data, double min_data); // [0,1] 标准化 extern bool isValidPass(const CVisionModule *pVision, CGeoPoint start, CGeoPoint end, double buffer = 150); diff --git a/Core/tactics/play/newNormalPlay.lua b/Core/tactics/play/newNormalPlay.lua index 77b1f60..f0ed811 100644 --- a/Core/tactics/play/newNormalPlay.lua +++ b/Core/tactics/play/newNormalPlay.lua @@ -179,7 +179,7 @@ local getBallRoleMatch = function(resState) if NowAssisterNum ~= AssisterNumLast then matchChangeCount = matchChangeCount + 1 end - if matchChangeCount > 3 and firstAssisterNum ~= NowAssisterNum then + if matchChangeCount > 2 and firstAssisterNum ~= NowAssisterNum then matchChangeCount = 0 return resState end diff --git a/Core/tactics/play/shootPoint.lua b/Core/tactics/play/shootPoint.lua index 67d7870..5181bb4 100644 --- a/Core/tactics/play/shootPoint.lua +++ b/Core/tactics/play/shootPoint.lua @@ -21,11 +21,7 @@ local shootPosFun = function() return param.shootPos end end -local debugMesg = function () - -- debugEngine:gui_debug_msg(CGeoPoint(-1000,1000),shootPosFun():x() .. " " .. shootPosFun():y(),3) - debugEngine:gui_debug_line(player.pos("Assister"),player.pos("Assister") + Utils.Polar2Vector(9999,player.dir("Assister")),4) - -- debugEngine:gui_debug_line(player.pos("Assister"),player.pos("Assister") + Utils.Polar2Vector(9999,player.dir("Assister") - param.shootError / 57.3)) -end + local shoot_kp = param.shootKp local resShootPos = CGeoPoint(4500,0) @@ -34,7 +30,15 @@ local shootKPFun = function() return shoot_kp end end - +local debugMesg = function () + + if(task.playerDirToPointDirSub("Assister",resShootPos) < param.shootError) then + debugEngine:gui_debug_line(player.pos("Assister"),player.pos("Assister") + Utils.Polar2Vector(9999,player.dir("Assister")),1) + else + debugEngine:gui_debug_line(player.pos("Assister"),player.pos("Assister") + Utils.Polar2Vector(9999,player.dir("Assister")),4) + + end +end return { firstState = "ready1", diff --git a/ZBin/lua_scripts/worldmodel/task.lua b/ZBin/lua_scripts/worldmodel/task.lua index 4223378..8de822d 100644 --- a/ZBin/lua_scripts/worldmodel/task.lua +++ b/ZBin/lua_scripts/worldmodel/task.lua @@ -183,8 +183,8 @@ function power(p, Kp) --根据目标点与球之间的距离求出合适的 击 if res > 6000 then res = 6000 end - if res < 3500 then - res = 3500 + if res < 4000 then + res = 4000 end debugEngine:gui_debug_msg(CGeoPoint:new_local(0,3200),"Power" .. res .. " toTargetDist: " .. dist,3) return res