2026-03-22 17:31:41 +08:00
|
|
|
|
#ifndef NETWORKCONFIGWIDGET_H
|
|
|
|
|
|
#define NETWORKCONFIGWIDGET_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QComboBox>
|
2026-04-17 10:18:03 +08:00
|
|
|
|
#include <QGroupBox>
|
2026-03-22 17:31:41 +08:00
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
#include <QLineEdit>
|
2026-04-17 10:18:03 +08:00
|
|
|
|
#include <QWidget>
|
2026-03-22 17:31:41 +08:00
|
|
|
|
|
|
|
|
|
|
struct NetworkConfigData
|
|
|
|
|
|
{
|
2026-04-17 10:18:03 +08:00
|
|
|
|
int eulerOrder = 11;
|
2026-04-19 12:28:59 +08:00
|
|
|
|
int outputEulerOrder = 10; // 输出欧拉角解码约定(仅影响旋转矩阵 → 欧拉角的展示/下发,不影响坐标转换)
|
2026-04-17 10:18:03 +08:00
|
|
|
|
int poseOutputOrder = 0; // 机器人姿态输入/输出顺序
|
|
|
|
|
|
int dirVectorInvert = 0;
|
|
|
|
|
|
int byteOrder = 0;
|
|
|
|
|
|
int longAxisDir = 0;
|
2026-03-22 17:31:41 +08:00
|
|
|
|
|
|
|
|
|
|
QString plcServerIp = "192.168.0.88";
|
|
|
|
|
|
int plcServerPort = 502;
|
|
|
|
|
|
int addrPhotoRequest = 1001;
|
|
|
|
|
|
int addrDataComplete = 1003;
|
|
|
|
|
|
int addrCoordDataStart = 2002;
|
|
|
|
|
|
|
|
|
|
|
|
int tcpServerPort = 5020;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum NetworkEulerOrder
|
|
|
|
|
|
{
|
2026-04-17 10:18:03 +08:00
|
|
|
|
EULER_ORDER_XYZ = 10,
|
|
|
|
|
|
EULER_ORDER_ZYX = 11,
|
|
|
|
|
|
EULER_ORDER_ZXY = 12,
|
|
|
|
|
|
EULER_ORDER_YXZ = 13,
|
|
|
|
|
|
EULER_ORDER_YZX = 14,
|
|
|
|
|
|
EULER_ORDER_XZY = 15
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum NetworkPoseOutputOrder
|
|
|
|
|
|
{
|
|
|
|
|
|
NET_POSE_OUTPUT_RX_RY_RZ = 0,
|
|
|
|
|
|
NET_POSE_OUTPUT_RX_RZ_RY = 1,
|
|
|
|
|
|
NET_POSE_OUTPUT_RY_RX_RZ = 2,
|
|
|
|
|
|
NET_POSE_OUTPUT_RY_RZ_RX = 3,
|
|
|
|
|
|
NET_POSE_OUTPUT_RZ_RX_RY = 4,
|
|
|
|
|
|
NET_POSE_OUTPUT_RZ_RY_RX = 5
|
2026-03-22 17:31:41 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum NetworkDirVectorInvert
|
|
|
|
|
|
{
|
2026-04-17 10:18:03 +08:00
|
|
|
|
NET_DIR_INVERT_NONE = 0,
|
|
|
|
|
|
NET_DIR_INVERT_XY = 1,
|
|
|
|
|
|
NET_DIR_INVERT_XZ = 2,
|
|
|
|
|
|
NET_DIR_INVERT_YZ = 3
|
2026-03-22 17:31:41 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum NetworkByteOrder
|
|
|
|
|
|
{
|
2026-04-17 10:18:03 +08:00
|
|
|
|
NET_BYTE_ORDER_BIG = 0,
|
|
|
|
|
|
NET_BYTE_ORDER_LITTLE = 1
|
2026-03-22 17:31:41 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class NetworkConfigWidget : public QWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
explicit NetworkConfigWidget(bool showPlcConfig = true,
|
2026-04-17 10:18:03 +08:00
|
|
|
|
bool showTcpConfig = false,
|
|
|
|
|
|
QWidget* parent = nullptr);
|
2026-03-22 17:31:41 +08:00
|
|
|
|
~NetworkConfigWidget();
|
|
|
|
|
|
|
|
|
|
|
|
void setConfig(const NetworkConfigData& config);
|
|
|
|
|
|
NetworkConfigData getConfig() const;
|
|
|
|
|
|
|
|
|
|
|
|
int eulerOrder() const;
|
2026-04-19 12:28:59 +08:00
|
|
|
|
int outputEulerOrder() const;
|
2026-04-17 10:18:03 +08:00
|
|
|
|
int poseOutputOrder() const;
|
2026-03-22 17:31:41 +08:00
|
|
|
|
int dirVectorInvert() const;
|
|
|
|
|
|
int byteOrder() const;
|
2026-03-29 20:37:36 +08:00
|
|
|
|
int longAxisDir() const;
|
2026-03-22 17:31:41 +08:00
|
|
|
|
|
2026-04-20 16:37:25 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @brief 隐藏由手眼标定页负责的参数(欧拉角顺序 / 输出欧拉角 / 方向向量调整 / 长轴对应轴)
|
|
|
|
|
|
*
|
|
|
|
|
|
* 当某应用将这些外参迁移到 HandEyeCalibWidget(因为其按相机独立配置)时,
|
|
|
|
|
|
* 在此控件中将对应的 ComboBox 隐藏;相关字段仍保留在 NetworkConfigData,
|
|
|
|
|
|
* 以便与尚未迁移的应用保持 API 兼容。
|
|
|
|
|
|
*/
|
|
|
|
|
|
void setExtrinsicControlsVisible(bool visible);
|
|
|
|
|
|
|
2026-03-22 17:31:41 +08:00
|
|
|
|
private:
|
|
|
|
|
|
void setupUI(bool showPlcConfig, bool showTcpConfig);
|
|
|
|
|
|
void initEulerOrderComboBox();
|
2026-04-19 12:28:59 +08:00
|
|
|
|
void initOutputEulerOrderComboBox();
|
2026-04-17 10:18:03 +08:00
|
|
|
|
void initPoseOutputOrderComboBox();
|
2026-03-22 17:31:41 +08:00
|
|
|
|
void initDirVectorInvertComboBox();
|
|
|
|
|
|
void initByteOrderComboBox();
|
2026-03-29 20:37:36 +08:00
|
|
|
|
void initLongAxisDirComboBox();
|
2026-03-22 17:31:41 +08:00
|
|
|
|
|
|
|
|
|
|
private:
|
2026-04-17 10:18:03 +08:00
|
|
|
|
QComboBox* m_comboEulerOrder = nullptr;
|
2026-04-19 12:28:59 +08:00
|
|
|
|
QComboBox* m_comboOutputEulerOrder = nullptr;
|
2026-04-17 10:18:03 +08:00
|
|
|
|
QComboBox* m_comboPoseOutputOrder = nullptr;
|
|
|
|
|
|
QComboBox* m_comboDirVectorInvert = nullptr;
|
|
|
|
|
|
QComboBox* m_comboByteOrder = nullptr;
|
|
|
|
|
|
QComboBox* m_comboLongAxisDir = nullptr;
|
|
|
|
|
|
|
2026-04-20 16:37:25 +08:00
|
|
|
|
QLabel* m_labelEulerOrder = nullptr;
|
|
|
|
|
|
QLabel* m_labelOutputEulerOrder = nullptr;
|
|
|
|
|
|
QLabel* m_labelDirVectorInvert = nullptr;
|
|
|
|
|
|
QLabel* m_labelLongAxisDir = nullptr;
|
|
|
|
|
|
|
2026-04-17 10:18:03 +08:00
|
|
|
|
QGroupBox* m_groupPlc = nullptr;
|
|
|
|
|
|
QLineEdit* m_editPlcIp = nullptr;
|
|
|
|
|
|
QLineEdit* m_editPlcPort = nullptr;
|
|
|
|
|
|
QLineEdit* m_editAddrPhotoRequest = nullptr;
|
|
|
|
|
|
QLineEdit* m_editAddrDataComplete = nullptr;
|
|
|
|
|
|
QLineEdit* m_editAddrCoordDataStart = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
QGroupBox* m_groupTcp = nullptr;
|
|
|
|
|
|
QLineEdit* m_editTcpPort = nullptr;
|
2026-03-22 17:31:41 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // NETWORKCONFIGWIDGET_H
|