107 lines
2.6 KiB
C++
107 lines
2.6 KiB
C++
#ifndef NETWORKCONFIGWIDGET_H
|
|
#define NETWORKCONFIGWIDGET_H
|
|
|
|
#include <QComboBox>
|
|
#include <QGroupBox>
|
|
#include <QLabel>
|
|
#include <QLineEdit>
|
|
#include <QWidget>
|
|
|
|
struct NetworkConfigData
|
|
{
|
|
int eulerOrder = 11;
|
|
int poseOutputOrder = 0; // 机器人姿态输入/输出顺序
|
|
int dirVectorInvert = 0;
|
|
int byteOrder = 0;
|
|
int longAxisDir = 0;
|
|
|
|
QString plcServerIp = "192.168.0.88";
|
|
int plcServerPort = 502;
|
|
int addrPhotoRequest = 1001;
|
|
int addrDataComplete = 1003;
|
|
int addrCoordDataStart = 2002;
|
|
|
|
int tcpServerPort = 5020;
|
|
};
|
|
|
|
enum NetworkEulerOrder
|
|
{
|
|
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
|
|
};
|
|
|
|
enum NetworkDirVectorInvert
|
|
{
|
|
NET_DIR_INVERT_NONE = 0,
|
|
NET_DIR_INVERT_XY = 1,
|
|
NET_DIR_INVERT_XZ = 2,
|
|
NET_DIR_INVERT_YZ = 3
|
|
};
|
|
|
|
enum NetworkByteOrder
|
|
{
|
|
NET_BYTE_ORDER_BIG = 0,
|
|
NET_BYTE_ORDER_LITTLE = 1
|
|
};
|
|
|
|
class NetworkConfigWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit NetworkConfigWidget(bool showPlcConfig = true,
|
|
bool showTcpConfig = false,
|
|
QWidget* parent = nullptr);
|
|
~NetworkConfigWidget();
|
|
|
|
void setConfig(const NetworkConfigData& config);
|
|
NetworkConfigData getConfig() const;
|
|
|
|
int eulerOrder() const;
|
|
int poseOutputOrder() const;
|
|
int dirVectorInvert() const;
|
|
int byteOrder() const;
|
|
int longAxisDir() const;
|
|
|
|
private:
|
|
void setupUI(bool showPlcConfig, bool showTcpConfig);
|
|
void initEulerOrderComboBox();
|
|
void initPoseOutputOrderComboBox();
|
|
void initDirVectorInvertComboBox();
|
|
void initByteOrderComboBox();
|
|
void initLongAxisDirComboBox();
|
|
|
|
private:
|
|
QComboBox* m_comboEulerOrder = nullptr;
|
|
QComboBox* m_comboPoseOutputOrder = nullptr;
|
|
QComboBox* m_comboDirVectorInvert = nullptr;
|
|
QComboBox* m_comboByteOrder = nullptr;
|
|
QComboBox* m_comboLongAxisDir = nullptr;
|
|
|
|
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;
|
|
};
|
|
|
|
#endif // NETWORKCONFIGWIDGET_H
|