diff --git a/Core/src/Main/zeus_main.cpp b/Core/src/Main/zeus_main.cpp index 1dad2f5..6180046 100644 --- a/Core/src/Main/zeus_main.cpp +++ b/Core/src/Main/zeus_main.cpp @@ -18,41 +18,43 @@ #include #include "utils.h" /*! \mainpage Zeus - Run for number one -* -* \section Introduction -* -* ZJUNlict is robot soccer team of Robocup in Small Size League. -* -* \section Strategy -* Frame : GameState -> Play -> Agent -> Skill -> Motion Control -> Wireless -* -* \subsection step1: GameState -* \subsection step2: Play -* \subsection step3: Agent -* \subsection step4: Skill -* \subsection step5: Motion Control : PathPlan and Trajectory Generation -* -* etc... -*/ + * + * \section Introduction + * + * ZJUNlict is robot soccer team of Robocup in Small Size League. + * + * \section Strategy + * Frame : GameState -> Play -> Agent -> Skill -> Motion Control -> Wireless + * + * \subsection step1: GameState + * \subsection step2: Play + * \subsection step3: Agent + * \subsection step4: Skill + * \subsection step5: Motion Control : PathPlan and Trajectory Generation + * + * etc... + */ extern Semaphore visionEvent; extern std::mutex decisionMutex; /// For GPU. -std::mutex* _best_visiondata_copy_mutex = nullptr; -std::mutex* _value_getter_mutex = nullptr; +std::mutex *_best_visiondata_copy_mutex = nullptr; +std::mutex *_value_getter_mutex = nullptr; using PARAM::Latency::TOTAL_LATED_FRAME; bool VERBOSE_MODE = true; bool IS_SIMULATION = false; bool record_run_pos_on = false; -namespace { -COptionModule *option; -CDecisionModule *decision; -CActionModule *action; -CServerInterface::VisualInfo visionInfo; +namespace +{ + COptionModule *option; + CDecisionModule *decision; + CActionModule *action; + CServerInterface::VisualInfo visionInfo; } -int runLoop() { +int runLoop() +{ ZSS::ZParamManager::instance()->loadParam(IS_SIMULATION, "Alert/IsSimulation", false); initializeSingleton(); option = new COptionModule(); @@ -70,15 +72,17 @@ int runLoop() { /* */ - while (true) { + while (true) + { vision->setNewVision(); - Utils::UpdateTickMessage(vision,PARAM::Player::our_goalie_num,PARAM::Player::defend_num1,PARAM::Player::defend_num2); + Utils::UpdateTickMessage(vision, PARAM::ZJHU::our_goalie_num, PARAM::ZJHU::defend_num1, PARAM::ZJHU::defend_num2); decision->DoDecision(); action->sendAction(); - GDebugEngine::Instance()->send(option->MyColor() == PARAM::BLUE); //Show two teams debug messages + GDebugEngine::Instance()->send(option->MyColor() == PARAM::BLUE); // Show two teams debug messages } } -int main(int argc, char* argv[]) { +int main(int argc, char *argv[]) +{ QCoreApplication a(argc, argv); std::thread t(runLoop); t.detach(); diff --git a/Core/tactics/play/testsalta.lua b/Core/tactics/play/testsalta.lua deleted file mode 100644 index 69c6fb4..0000000 --- a/Core/tactics/play/testsalta.lua +++ /dev/null @@ -1,32 +0,0 @@ -gPlayTable.CreatePlay { - firstState = "Init", - - ["Init"] = { - switch = function() - param.player_goalie = 1000 - return "Init1" - end, - Assister = task.stop(), - match = "[A]" - }, - - ["Init1"] = { - switch = function() - debugEngine:gui_debug_msg(CGeoPoint(0, 1500), param.player_goalie) - end, - Assister = task.stop(), - match = "[A]" - }, - - name = 'testsalta', -} - - ---[[ NOTE: 怎么修改的,写个备忘 ]] ---[[ -~/zss.ini 是拿来存放参数的 -~/Client/src/field.cpp 利用 PARAM::FIELD::init 加了个初始化,从 zss.ini 里面加载 -~/share/staticparams.h 里面定义了 PARAM::ZJHU -~/share/staticparams.cpp 里面定义了 PARAM::ZJHU -~/ZBin/lua_scripts/worldmodel/param.lua lua 层的也从 zss.ini 里面加载 - ]] diff --git a/ZBin/lua_scripts/worldmodel/param.lua b/ZBin/lua_scripts/worldmodel/param.lua index 2e86fc9..429eec8 100644 --- a/ZBin/lua_scripts/worldmodel/param.lua +++ b/ZBin/lua_scripts/worldmodel/param.lua @@ -19,25 +19,26 @@ defend_num2 = CGetSettings("ZJHU/defend_num2", "Int") -----------------------------------------------| -- feild参数 --| -----------------------------------------------| -pitchLength = CGetSettings("field/width", "Int") -pitchWidth = CGetSettings("field/height", "Int") -freeKickAvoidBallDist = 500 -penaltyWidth = CGetSettings("field/penaltyLength", "Int") -penaltyDepth = CGetSettings("field/penaltyWidth", "Int") -penaltyRadius = penaltyWidth / 2 -penaltySegment = 500 -ourTopRightPenaltyPos = CGeoPoint:new_local(-pitchLength / 2 + penaltyDepth, penaltyRadius) -ourTopPenaltyPos = CGeoPoint:new_local(-pitchLength / 2, penaltyRadius) -ourButtomPenaltyPos = CGeoPoint:new_local(-pitchLength / 2, -penaltyRadius) +pitchLength = CGetSettings("field/width", "Int") +pitchWidth = CGetSettings("field/height", "Int") +freeKickAvoidBallDist = 500 +penaltyWidth = CGetSettings("field/penaltyLength", "Int") +penaltyDepth = CGetSettings("field/penaltyWidth", "Int") +penaltyRadius = penaltyWidth / 2 +penaltySegment = 500 +ourTopRightPenaltyPos = CGeoPoint:new_local(-pitchLength / 2 + penaltyDepth, penaltyRadius) +ourTopPenaltyPos = CGeoPoint:new_local(-pitchLength / 2, penaltyRadius) +ourButtomPenaltyPos = CGeoPoint:new_local(-pitchLength / 2, -penaltyRadius) -- 球门参数 -goalWidth = CGetSettings("field/goalWidth", "Int") -goalDepth = CGetSettings("field/goalDepth", "Int") -goalRadius = goalWidth / 2 -ourGoalLine = CGeoSegment(CGeoPoint:new_local(-pitchLength / 2, -INF), CGeoPoint:new_local(-pitchLength / 2, - INF)) -ourGoalPos = CGeoPoint:new_local(-pitchLength / 2, 0) -ourTopGoalPos = CGeoPoint:new_local(-pitchLength / 2, goalRadius) -ourButtomGoalPos = CGeoPoint:new_local(-pitchLength / 2, -goalRadius) +goalWidth = CGetSettings("field/goalWidth", "Int") +goalDepth = CGetSettings("field/goalDepth", "Int") +goalRadius = goalWidth / 2 +ourGoalLine = CGeoSegment(CGeoPoint:new_local(-pitchLength / 2, -INF), + CGeoPoint:new_local(-pitchLength / 2, + INF)) +ourGoalPos = CGeoPoint:new_local(-pitchLength / 2, 0) +ourTopGoalPos = CGeoPoint:new_local(-pitchLength / 2, goalRadius) +ourButtomGoalPos = CGeoPoint:new_local(-pitchLength / 2, -goalRadius) -- 是否为真实场地 @@ -48,12 +49,12 @@ Team = "ONE" -----------------------------------------------| -- Getball参数 --| -----------------------------------------------| -playerVel = 1 -- 机器人速度 -getballMode = 1 -- [0[激进模式], 1[保守模式], 2[middle]] -local V_DECAY_RATE_Reality = 700 -- 场地摩擦 -lastInterPos = CGeoPoint:new_local(-INF,-INF) -- 上一次算点结果 +playerVel = 1 -- 机器人速度 +getballMode = 1 -- [0[激进模式], 1[保守模式], 2[middle]] +local V_DECAY_RATE_Reality = 700 -- 场地摩擦 +lastInterPos = CGeoPoint:new_local(-INF, -INF) -- 上一次算点结果 rushToBallCount = 0 -distRate = 0.2 -- +distRate = 0.2 -- -----------------------------------------------| -- 球权和红外参数 --| @@ -84,9 +85,9 @@ canTouchAngle = 45 -- 可以touch的角度 rotPos = CGeoPoint(60, 60) --CGeoPoint(80,80) --旋转坐标 rotVel = 4 --旋转速度 local rotCompensate_Reality = -0.015 --旋转补偿 --- -----------------------------------------------| --- -- Tick固定匹配参数 --| --- -----------------------------------------------| +-----------------------------------------------| +-- Tick固定匹配参数 --| +-----------------------------------------------| -- our_goalie_num = 0 -- defend_num1 = 1 -- defend_num2 = 2 diff --git a/share/staticparams.cpp b/share/staticparams.cpp index 58aac9d..766d2cf 100644 --- a/share/staticparams.cpp +++ b/share/staticparams.cpp @@ -15,10 +15,13 @@ namespace PARAM const double GOAL_DEPTH = zpm->value("field/goalDepth", QVariant(200)).toFloat(); } - const double enemy_buffer = zpm->value("ZJHU/enemy_buffer", QVariant(130)).toFloat(); - const double playerBallRightsBuffer_BUFFER = zpm->value("ZJHU/playerBallRightsBuffer", QVariant(120)).toFloat(); - const double playerInfraredCountBuffer = zpm->value("ZJHU/playerInfraredCountBuffer", QVariant(120)).toFloat(); - const double our_goalie_num = zpm->value("ZJHU/our_goalie_num", QVariant(0)).toFloat(); - const double defend_num1 = zpm->value("ZJHU/defend_num1", QVariant(1)).toFloat(); - const double defend_num2 = zpm->value("ZJHU/defend_num2", QVariant(2)).toFloat(); + namespace ZJHU + { + const double enemy_buffer = zpm->value("ZJHU/enemy_buffer", QVariant(130)).toFloat(); + const double playerBallRightsBuffer_BUFFER = zpm->value("ZJHU/playerBallRightsBuffer", QVariant(120)).toFloat(); + const double playerInfraredCountBuffer = zpm->value("ZJHU/playerInfraredCountBuffer", QVariant(120)).toFloat(); + const double our_goalie_num = zpm->value("ZJHU/our_goalie_num", QVariant(0)).toFloat(); + const double defend_num1 = zpm->value("ZJHU/defend_num1", QVariant(1)).toFloat(); + const double defend_num2 = zpm->value("ZJHU/defend_num2", QVariant(2)).toFloat(); + } } \ No newline at end of file diff --git a/share/staticparams.h b/share/staticparams.h index e2dfead..566ec12 100644 --- a/share/staticparams.h +++ b/share/staticparams.h @@ -15,16 +15,17 @@ namespace PARAM const int BALLMERGEDISTANCE = 0; const int TEAMS = 2; + /* ZJHU */ namespace ZJHU { - - extern const int enemy_buffer; - extern const int playerBallRightsBuffer; - extern const int playerInfraredCountBuffer; - extern const int our_goalie_num; - extern const int defend_num1; - extern const int defend_num2; + extern const double enemy_buffer; + extern const double playerBallRightsBuffer; + extern const double playerInfraredCountBuffer; + extern const double our_goalie_num; + extern const double defend_num1; + extern const double defend_num2; } + /* ZJHU */ namespace Field {