Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Umbrella167/Rocos
Browse files Browse the repository at this point in the history
  • Loading branch information
Umbrella167 committed May 13, 2024
2 parents e93194b + 81a0e9f commit 9897553
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 99 deletions.
60 changes: 32 additions & 28 deletions Core/src/Main/zeus_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,43 @@
#include <QCoreApplication>
#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;
/// <summary> For GPU. </summary>
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();
Expand All @@ -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();
Expand Down
32 changes: 0 additions & 32 deletions Core/tactics/play/testsalta.lua

This file was deleted.

53 changes: 27 additions & 26 deletions ZBin/lua_scripts/worldmodel/param.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)


-- 是否为真实场地
Expand All @@ -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 --

-----------------------------------------------|
-- 球权和红外参数 --|
Expand Down Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions share/staticparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
15 changes: 8 additions & 7 deletions share/staticparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 9897553

Please sign in to comment.