From c2a3c28cddbbc281a1d42543cd752e6246f407c7 Mon Sep 17 00:00:00 2001 From: tangchao0503 <735056338@qq.com> Date: Mon, 13 Oct 2025 14:17:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA2=E8=BD=B4=E6=8E=A7=E5=88=B6=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E2=80=9C=E7=A7=BB=E5=8A=A8=E8=87=B3?= =?UTF-8?q?=E2=80=9D=E5=8A=9F=E8=83=BD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HPPA/TwoMotorControl.cpp | 21 ++- HPPA/TwoMotorControl.h | 2 + HPPA/twoMotorControl.ui | 298 ++++++++++++++++++++++++++++++++------- 3 files changed, 269 insertions(+), 52 deletions(-) diff --git a/HPPA/TwoMotorControl.cpp b/HPPA/TwoMotorControl.cpp index 63a5d63..485cfb3 100644 --- a/HPPA/TwoMotorControl.cpp +++ b/HPPA/TwoMotorControl.cpp @@ -184,12 +184,13 @@ void TwoMotorControl::onConnectMotor() connect(this->ui.ymotor_backward_btn, SIGNAL(pressed()), this, SLOT(onyMotorbackward())); connect(this->ui.ymotor_backward_btn, SIGNAL(released()), this, SLOT(onyMotorStop())); - //connect(this->ui.move2loc_pushButton, SIGNAL(pressed()), this, SLOT(onxMove2Loc())); + connect(this->ui.move2loc_x_pushButton, SIGNAL(pressed()), this, SLOT(onxMove2Loc())); + connect(this->ui.move2loc_y_pushButton, SIGNAL(pressed()), this, SLOT(onyMove2Loc())); connect(m_multiAxisController, SIGNAL(broadcastLocationSignal(std::vector)), this, SLOT(displayRealTimeLoc(std::vector))); connect(this, SIGNAL(moveSignal(int, bool, double, int)), m_multiAxisController, SLOT(move(int, bool, double, int))); - //connect(this, SIGNAL(move2LocSignal(int, double, double, int)), m_multiAxisController, SLOT(moveTo(int, double, double, int))); + connect(this, SIGNAL(move2LocSignal(int, double, double, int)), m_multiAxisController, SLOT(moveTo(int, double, double, int))); connect(this, SIGNAL(stopSignal(int)), m_multiAxisController, SLOT(stop(int))); connect(this->ui.zero_start_btn, SIGNAL(released()), this, SLOT(zeroStart())); @@ -291,6 +292,22 @@ void TwoMotorControl::onyMotorStop() emit stopSignal(1); } +void TwoMotorControl::onxMove2Loc() +{ + double s = ui.xmotor_move_speed_lineEdit->text().toDouble(); + double l = ui.move2loc_x_lineEdit->text().toDouble(); + + emit move2LocSignal(0, l, s, 1000); +} + +void TwoMotorControl::onyMove2Loc() +{ + double s = ui.ymotor_move_speed_lineEdit->text().toDouble(); + double l = ui.move2loc_y_lineEdit->text().toDouble(); + + emit move2LocSignal(1, l, s, 1000); +} + void TwoMotorControl::displayRealTimeLoc(std::vector loc) { double tmp = round(loc[0] * 100) / 100; diff --git a/HPPA/TwoMotorControl.h b/HPPA/TwoMotorControl.h index 383a38a..e7cfa56 100644 --- a/HPPA/TwoMotorControl.h +++ b/HPPA/TwoMotorControl.h @@ -48,10 +48,12 @@ public Q_SLOTS: void onxMotorRight(); void onxMotorLeft(); void onxMotorStop(); + void onxMove2Loc(); void onyMotorforward(); void onyMotorbackward(); void onyMotorStop(); + void onyMove2Loc(); void onAddRecordLine_btn(); void onRemoveRecordLine_btn(); diff --git a/HPPA/twoMotorControl.ui b/HPPA/twoMotorControl.ui index bdf59a0..d08a105 100644 --- a/HPPA/twoMotorControl.ui +++ b/HPPA/twoMotorControl.ui @@ -7,7 +7,7 @@ 0 0 684 - 674 + 799 @@ -43,18 +43,24 @@ 0 0 684 - 674 + 799 - + 0 0 + + + 16777215 + 150 + + @@ -62,26 +68,21 @@ 控制 - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - 运行 - - - + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + @@ -247,6 +248,13 @@ + + + + 运行 + + + @@ -254,17 +262,39 @@ + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 0 + + + + - + 0 0 + + + 16777215 + 127 + + #QGroupBox{border:none} @@ -272,6 +302,37 @@ x马达 + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 1 + + + + @@ -399,19 +460,6 @@ - - - Qt::Vertical - - - - 20 - 112 - - - - - @@ -444,6 +492,66 @@ + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 50 + 16777215 + + + + 移动至 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + background-color: rgb(255, 255, 255); + + + 0 + + + Qt::AlignCenter + + + + + @@ -455,6 +563,12 @@ 0 + + + 16777215 + 125 + + @@ -462,6 +576,18 @@ y马达 + + 0 + + + 0 + + + 0 + + + 0 + @@ -588,7 +714,20 @@ - + + + + Qt::Vertical + + + + 20 + 0 + + + + + @@ -621,18 +760,65 @@ - - - - Qt::Vertical - - - - 20 - 0 - - - + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 50 + 16777215 + + + + 移动至 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + background-color: rgb(255, 255, 255); + + + 0 + + + Qt::AlignCenter + + + + @@ -643,6 +829,18 @@ 采集线 + + 0 + + + 0 + + + 0 + + + 0 +