/** * @file MainWindow.h * @brief 机器人控制测试工具主窗口 */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include "FairinoRobotWrapper.h" class QLabel; class QLineEdit; class QPushButton; class QSpinBox; class QDoubleSpinBox; class QGroupBox; class QTextEdit; class QTabWidget; /** * @class MainWindow * @brief 机器人控制测试工具主窗口类 */ class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: // 连接控制 void onConnectClicked(); void onDisconnectClicked(); void onEnableClicked(); void onDisableClicked(); void onResetErrorClicked(); // 运动控制 void onMoveLClicked(); void onMoveJPoseClicked(); void onMoveJJointClicked(); void onStopClicked(); void onPauseClicked(); void onResumeClicked(); // 状态更新 void onRefreshStateClicked(); void onAutoRefreshToggled(bool checked); void updateRobotState(); // 运动学计算 void onForwardKinClicked(); void onInverseKinClicked(); // 同步当前位置到输入框 void onSyncPoseClicked(); void onSyncJointClicked(); private: void setupUI(); void setupConnections(); void log(const QString& msg); void updateConnectionState(bool connected); private: // 机器人封装对象 std::unique_ptr robot_; // 状态刷新定时器 QTimer* refreshTimer_; // === UI 控件 === // 连接控制区 QLineEdit* editIP_; QPushButton* btnConnect_; QPushButton* btnDisconnect_; QPushButton* btnEnable_; QPushButton* btnDisable_; QPushButton* btnResetError_; QLabel* lblConnectionStatus_; QLabel* lblSDKVersion_; // 运动参数区 QSpinBox* spinVel_; QSpinBox* spinAcc_; QSpinBox* spinTool_; QSpinBox* spinUser_; // 位姿输入区(MoveL 和 MoveJ 共用) QDoubleSpinBox* spinPoseX_; QDoubleSpinBox* spinPoseY_; QDoubleSpinBox* spinPoseZ_; QDoubleSpinBox* spinPoseRx_; QDoubleSpinBox* spinPoseRy_; QDoubleSpinBox* spinPoseRz_; QPushButton* btnMoveL_; QPushButton* btnMoveJPose_; QPushButton* btnSyncPose_; // MoveJ (Joint) 区 QDoubleSpinBox* spinJoint1_; QDoubleSpinBox* spinJoint2_; QDoubleSpinBox* spinJoint3_; QDoubleSpinBox* spinJoint4_; QDoubleSpinBox* spinJoint5_; QDoubleSpinBox* spinJoint6_; QPushButton* btnMoveJJoint_; QPushButton* btnSyncJoint_; // 运动控制区 QPushButton* btnStop_; QPushButton* btnPause_; QPushButton* btnResume_; // 状态显示区(固定显示,不在Tab中) QLabel* lblJoint1_; QLabel* lblJoint2_; QLabel* lblJoint3_; QLabel* lblJoint4_; QLabel* lblJoint5_; QLabel* lblJoint6_; QLabel* lblTcpX_; QLabel* lblTcpY_; QLabel* lblTcpZ_; QLabel* lblTcpRx_; QLabel* lblTcpRy_; QLabel* lblTcpRz_; QLabel* lblRobotState_; QLabel* lblMotionDone_; QLabel* lblErrorCode_; QPushButton* btnRefreshState_; QPushButton* btnAutoRefresh_; // 运动学计算区 QDoubleSpinBox* spinFKJ1_; QDoubleSpinBox* spinFKJ2_; QDoubleSpinBox* spinFKJ3_; QDoubleSpinBox* spinFKJ4_; QDoubleSpinBox* spinFKJ5_; QDoubleSpinBox* spinFKJ6_; QLabel* lblFKResult_; QPushButton* btnForwardKin_; QDoubleSpinBox* spinIKX_; QDoubleSpinBox* spinIKY_; QDoubleSpinBox* spinIKZ_; QDoubleSpinBox* spinIKRx_; QDoubleSpinBox* spinIKRy_; QDoubleSpinBox* spinIKRz_; QLabel* lblIKResult_; QPushButton* btnInverseKin_; // 日志区 QTextEdit* textLog_; // Tab 控件 QTabWidget* tabWidget_; }; #endif // MAINWINDOW_H