Skip to content

Commit

Permalink
[Core] add gui_debug_x size
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-tz committed Apr 15, 2024
1 parent ef6ee87 commit 93eaa98
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions Core/src/Strategy/skill/GotoPosition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ CPlayerCommand* CGotoPositionV2::execute(const CVisionModule* pVision)
bool ignoreNotStop = false;
target = avoidPenaltyArea(pVision, vecPos, target, avoidLength, vecNumber);

// 记录当前的规划执行目标点
GDebugEngine::Instance()->gui_debug_x(target, TASK_TARGET_COLOR);
GDebugEngine::Instance()->gui_debug_line(self.Pos(), target, TASK_TARGET_COLOR);
if(task().player.vel.mod() > 1e-8) {
GDebugEngine::Instance()->gui_debug_line(target, target + task().player.vel / 10, COLOR_WHITE);
}
Expand Down Expand Up @@ -185,6 +182,12 @@ CPlayerCommand* CGotoPositionV2::execute(const CVisionModule* pVision)
final.SetDir((playerFlag & (PlayerStatus::TURN_AROUND_FRONT)) ? self.Dir() : task().player.angle);
final.SetVel(task().player.vel);
final.SetRotVel(task().player.rotvel);

// 记录当前的规划执行目标点
GDebugEngine::Instance()->gui_debug_x(final.Pos(), TASK_TARGET_COLOR, 0, 20);
GDebugEngine::Instance()->gui_debug_line(target, target+Utils::Polar2Vector(100,final.Dir()), TASK_TARGET_COLOR);
GDebugEngine::Instance()->gui_debug_line(self.Pos(), target, TASK_TARGET_COLOR);

/// 调用控制方法
CControlModel control;
float usedtime = target.dist(self.Pos()) / capability.maxSpeed / 1.414; // 单位:秒
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Utils/GDebugEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ CGDebugEngine::CGDebugEngine(){
CGDebugEngine::~CGDebugEngine(){
}

void CGDebugEngine::gui_debug_x(const CGeoPoint& p, int debug_color,int RGB_value){
void CGDebugEngine::gui_debug_x(const CGeoPoint& p, int debug_color,int RGB_value, const int size){
CGeoPoint basePos = p;
static const int x_line_length = 30;
const int x_line_length = size/2;
const CGeoPoint p1 = basePos + CVector( x_line_length, x_line_length);
const CGeoPoint p2 = basePos + CVector(-x_line_length,-x_line_length);
gui_debug_line(p1, p2, debug_color,RGB_value);
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Utils/GDebugEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CGDebugEngine{
public:
CGDebugEngine();
~CGDebugEngine();
void gui_debug_x(const CGeoPoint& p, int debug_color = 1,int RGB_value=0);
void gui_debug_x(const CGeoPoint& p, int debug_color = 1,int RGB_value=0, const int size = 60 /*mm*/);
void gui_debug_points(const std::vector<CGeoPoint> points, int debug_color = 1,int RGB_value=0);
void gui_debug_line(const CGeoPoint& p1, const CGeoPoint& p2, int debug_color = 1,int RGB_value=0);
void gui_debug_arc(const CGeoPoint& p, double r, double start_angle, double span_angle, int debug_color = 1, int RGB_value=0);
Expand Down

0 comments on commit 93eaa98

Please sign in to comment.