拆包更新伯朗特的协议
This commit is contained in:
parent
5019a37916
commit
b0108a4602
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
| 版本 | 日期 | 修改内容 |
|
| 版本 | 日期 | 修改内容 |
|
||||||
|------|------|----------|
|
|------|------|----------|
|
||||||
|
| v1.3 | 2026-01-27 | 1.附加命令改为根据检测结果动态生成 <br/>2.PostCoordinateCommand配置项拆分为DsID、Address、SuccessValue、FailValue <br/>3.检测成功发送SuccessValue(默认10),失败发送FailValue(默认12) |
|
||||||
| v1.2 | 2026-01-24 | 1.架构改为视觉系统作为TCP服务端,机械臂作为客户端 <br/>2.移除Enabled配置,服务端始终启动 <br/>3.移除IpAddress配置,只需配置监听端口 <br/>4.camID回复与请求匹配 |
|
| v1.2 | 2026-01-24 | 1.架构改为视觉系统作为TCP服务端,机械臂作为客户端 <br/>2.移除Enabled配置,服务端始终启动 <br/>3.移除IpAddress配置,只需配置监听端口 <br/>4.camID回复与请求匹配 |
|
||||||
| v1.1 | 2026-01-24 | 1.收到拍照命令不再回复结果 <br/>2.移除packID字段 <br/>3.旋转角度填到U,Angel改为Angle <br/>4.发送坐标后100ms发送附加命令 <br/>5.只发送第一个检测结果,并自动生成第二个坐标(Z+偏移量) <br/>6.端口默认改为5000 |
|
| v1.1 | 2026-01-24 | 1.收到拍照命令不再回复结果 <br/>2.移除packID字段 <br/>3.旋转角度填到U,Angel改为Angle <br/>4.发送坐标后100ms发送附加命令 <br/>5.只发送第一个检测结果,并自动生成第二个坐标(Z+偏移量) <br/>6.端口默认改为5000 |
|
||||||
| v1.0 | 2026-01-20 | 完善协议说明、添加字段详解、错误处理和使用示例 |
|
| v1.0 | 2026-01-20 | 完善协议说明、添加字段详解、错误处理和使用示例 |
|
||||||
@ -144,22 +145,56 @@
|
|||||||
|
|
||||||
**方向**:视觉系统 → 机械臂
|
**方向**:视觉系统 → 机械臂
|
||||||
|
|
||||||
**说明**:发送坐标数据后100ms自动发送附加命令,内容可配置。
|
**说明**:发送坐标数据后100ms自动发送附加命令,**根据检测结果动态生成**:
|
||||||
|
- **检测成功**(有目标):发送 SuccessValue(默认10)
|
||||||
|
- **检测失败**(无目标):发送 FailValue(默认12)
|
||||||
|
|
||||||
**默认JSON格式**:
|
**JSON格式**:
|
||||||
```json
|
```json
|
||||||
{ "dsID":"www.hc-system.com.RemoteMonitor", "reqType":"command", "cmdData":["rewriteData","800","10","0"] }
|
{ "dsID":"www.hc-system.com.RemoteMonitor", "reqType":"command", "cmdData":["rewriteData","800","10","0"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
**配置方法**:在配置文件中设置 `PostCoordinateCommand` 字段,传入空字符串则不发送。
|
**字段说明**:
|
||||||
|
|
||||||
|
| 字段 | 类型 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| dsID | String | 附加命令的数据源标识,可配置(PostCoordinateDsID) |
|
||||||
|
| reqType | String | 固定为 "command" |
|
||||||
|
| cmdData | Array | 命令数据数组 |
|
||||||
|
|
||||||
|
**cmdData 数组说明**:
|
||||||
|
|
||||||
|
| 索引 | 值 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| 0 | "rewriteData" | 固定命令类型 |
|
||||||
|
| 1 | "800" | 地址,可配置(PostCoordinateAddress,默认800) |
|
||||||
|
| 2 | "10" 或 "12" | 检测结果值:成功=SuccessValue(默认10),失败=FailValue(默认12) |
|
||||||
|
| 3 | "0" | 固定值 |
|
||||||
|
|
||||||
|
**配置方法**:在配置文件中设置以下字段:
|
||||||
|
- `PostCoordinateDsID`:附加命令的dsID,为空则不发送附加命令
|
||||||
|
- `PostCoordinateAddress`:地址(默认800)
|
||||||
|
- `PostCoordinateSuccessValue`:检测成功时的值(默认10)
|
||||||
|
- `PostCoordinateFailValue`:检测失败时的值(默认12)
|
||||||
|
|
||||||
## 5. 配置说明
|
## 5. 配置说明
|
||||||
|
|
||||||
视觉系统启动时自动启动TCP服务端,默认监听端口5000。机械臂作为客户端连接到视觉系统即可。
|
视觉系统启动时自动启动TCP服务端,默认监听端口5000。机械臂作为客户端连接到视觉系统即可。
|
||||||
|
|
||||||
主要配置项:
|
主要配置项:
|
||||||
- **监听端口**:默认5000,可在配置文件中修改
|
|
||||||
- **数据源标识(dsID)**:默认 "www.hc-system.com.cam",需与机械臂配置一致
|
| 配置项 | 默认值 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| Port | 5000 | TCP服务端监听端口 |
|
||||||
|
| DsID | www.hc-system.com.cam | 数据源标识,需与机械臂配置一致 |
|
||||||
|
| ZOffset | 300.0 | 第二个坐标的Z轴偏移量 |
|
||||||
|
| ZMin | -1500.0 | Z轴最小值限制 |
|
||||||
|
| ZMax | 2500.0 | Z轴最大值限制 |
|
||||||
|
| AngleOffset | 0.0 | 旋转角度补偿 |
|
||||||
|
| PostCoordinateDsID | www.hc-system.com.RemoteMonitor | 附加命令的dsID,为空则不发送 |
|
||||||
|
| PostCoordinateAddress | 800 | 附加命令的地址 |
|
||||||
|
| PostCoordinateSuccessValue | 10 | 检测成功时发送的值 |
|
||||||
|
| PostCoordinateFailValue | 12 | 检测失败时发送的值 |
|
||||||
|
|
||||||
## 6. 数据格式约束
|
## 6. 数据格式约束
|
||||||
|
|
||||||
@ -215,7 +250,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 100ms后发送附加命令
|
// 100ms后发送附加命令(检测成功,发送SuccessValue=10)
|
||||||
{ "dsID":"www.hc-system.com.RemoteMonitor", "reqType":"command", "cmdData":["rewriteData","800","10","0"] }
|
{ "dsID":"www.hc-system.com.RemoteMonitor", "reqType":"command", "cmdData":["rewriteData","800","10","0"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -233,6 +268,9 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 100ms后发送附加命令(检测失败,发送FailValue=12)
|
||||||
|
{ "dsID":"www.hc-system.com.RemoteMonitor", "reqType":"command", "cmdData":["rewriteData","800","12","0"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
## 8. 注意事项
|
## 8. 注意事项
|
||||||
@ -245,7 +283,10 @@
|
|||||||
- 视觉系统发送坐标使用 "AddPoints"(注意大小写)
|
- 视觉系统发送坐标使用 "AddPoints"(注意大小写)
|
||||||
5. **坐标系统**:所有坐标已通过手眼标定转换到机械臂坐标系,可直接使用
|
5. **坐标系统**:所有坐标已通过手眼标定转换到机械臂坐标系,可直接使用
|
||||||
6. **旋转角度**:旋转角度填入U字段,Angle字段固定为0
|
6. **旋转角度**:旋转角度填入U字段,Angle字段固定为0
|
||||||
7. **附加命令**:发送坐标后100ms自动发送附加命令,可通过配置文件设置
|
7. **附加命令**:发送坐标后100ms自动发送附加命令,根据检测结果动态生成
|
||||||
|
- 检测成功(有目标):发送 PostCoordinateSuccessValue(默认10)
|
||||||
|
- 检测失败(无目标):发送 PostCoordinateFailValue(默认12)
|
||||||
|
- PostCoordinateDsID 为空则不发送附加命令
|
||||||
8. **双坐标输出**:只取第一个检测结果,自动生成第二个坐标
|
8. **双坐标输出**:只取第一个检测结果,自动生成第二个坐标
|
||||||
- ModelID=0:Z + ZOffset(偏移后的Z)
|
- ModelID=0:Z + ZOffset(偏移后的Z)
|
||||||
- ModelID=1:原始Z
|
- ModelID=1:原始Z
|
||||||
|
|||||||
@ -69,10 +69,13 @@ public:
|
|||||||
void SetDsID(const std::string& dsID);
|
void SetDsID(const std::string& dsID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 设置坐标发送后的附加命令
|
* @brief 设置坐标发送后附加命令的参数
|
||||||
* @param command 附加命令JSON字符串,为空则不发送
|
* @param dsID 附加命令的dsID
|
||||||
|
* @param address 附加命令的地址
|
||||||
|
* @param successValue 检测成功时的值
|
||||||
|
* @param failValue 检测失败时的值
|
||||||
*/
|
*/
|
||||||
void SetPostCoordinateCommand(const std::string& command);
|
void SetPostCoordinateParams(const std::string& dsID, int address, int successValue, int failValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 设置第二个坐标的Z轴偏移量
|
* @brief 设置第二个坐标的Z轴偏移量
|
||||||
@ -132,7 +135,10 @@ private:
|
|||||||
bool m_bConnected; // 连接状态
|
bool m_bConnected; // 连接状态
|
||||||
uint16_t m_nPort; // TCP端口
|
uint16_t m_nPort; // TCP端口
|
||||||
std::string m_strDsID; // 数据源标识
|
std::string m_strDsID; // 数据源标识
|
||||||
std::string m_strPostCoordCmd; // 坐标发送后的附加命令
|
std::string m_strPostCoordDsID; // 坐标发送后附加命令的dsID
|
||||||
|
int m_nPostCoordAddress; // 坐标发送后附加命令的地址
|
||||||
|
int m_nPostCoordSuccessValue; // 检测成功时的值
|
||||||
|
int m_nPostCoordFailValue; // 检测失败时的值
|
||||||
double m_dZOffset; // 第二个坐标Z轴偏移量
|
double m_dZOffset; // 第二个坐标Z轴偏移量
|
||||||
double m_dZMin; // Z轴最小值
|
double m_dZMin; // Z轴最小值
|
||||||
double m_dZMax; // Z轴最大值
|
double m_dZMax; // Z轴最大值
|
||||||
|
|||||||
@ -12,7 +12,10 @@ BolunteProtocol::BolunteProtocol()
|
|||||||
, m_bConnected(false)
|
, m_bConnected(false)
|
||||||
, m_nPort(5000)
|
, m_nPort(5000)
|
||||||
, m_strDsID("www.hc-system.com.cam")
|
, m_strDsID("www.hc-system.com.cam")
|
||||||
, m_strPostCoordCmd(R"({ "dsID":"www.hc-system.com.RemoteMonitor", "reqType":"command", "cmdData":["rewriteData","800","10","0"] })")
|
, m_strPostCoordDsID("www.hc-system.com.RemoteMonitor")
|
||||||
|
, m_nPostCoordAddress(800)
|
||||||
|
, m_nPostCoordSuccessValue(10)
|
||||||
|
, m_nPostCoordFailValue(12)
|
||||||
, m_dZOffset(300.0)
|
, m_dZOffset(300.0)
|
||||||
, m_dZMin(-1500.0)
|
, m_dZMin(-1500.0)
|
||||||
, m_dZMax(2500.0)
|
, m_dZMax(2500.0)
|
||||||
@ -132,12 +135,32 @@ int BolunteProtocol::SendCoordinateData(const MultiTargetData& multiTargetData)
|
|||||||
{
|
{
|
||||||
LOG_INFO("Sent coordinate data: count=%d\n", multiTargetData.count);
|
LOG_INFO("Sent coordinate data: count=%d\n", multiTargetData.count);
|
||||||
|
|
||||||
// 100ms后发送附加命令
|
// 100ms后发送附加命令,根据检测结果拼接成功/失败值
|
||||||
if (!m_strPostCoordCmd.empty())
|
if (!m_strPostCoordDsID.empty())
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
m_pTcpServer->SendAllData(m_strPostCoordCmd.c_str(), m_strPostCoordCmd.length());
|
|
||||||
LOG_INFO("Sent post coordinate command\n");
|
// 根据检测结果选择成功/失败值
|
||||||
|
bool detectionSuccess = !multiTargetData.targets.empty();
|
||||||
|
int resultValue = detectionSuccess ? m_nPostCoordSuccessValue : m_nPostCoordFailValue;
|
||||||
|
|
||||||
|
// 动态生成附加命令JSON
|
||||||
|
VA::Json::Value postCmd;
|
||||||
|
postCmd["dsID"] = m_strPostCoordDsID;
|
||||||
|
postCmd["reqType"] = "command";
|
||||||
|
|
||||||
|
VA::Json::Value cmdData(VA::Json::arrayValue);
|
||||||
|
cmdData.append("rewriteData");
|
||||||
|
cmdData.append(std::to_string(m_nPostCoordAddress));
|
||||||
|
cmdData.append(std::to_string(resultValue));
|
||||||
|
cmdData.append("0");
|
||||||
|
postCmd["cmdData"] = cmdData;
|
||||||
|
|
||||||
|
VA::Json::FastWriter writer;
|
||||||
|
std::string postCmdStr = writer.write(postCmd);
|
||||||
|
|
||||||
|
m_pTcpServer->SendAllData(postCmdStr.c_str(), postCmdStr.length());
|
||||||
|
LOG_INFO("Sent post coordinate command: success=%d, value=%d\n", detectionSuccess, resultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@ -169,9 +192,12 @@ void BolunteProtocol::SetDsID(const std::string& dsID)
|
|||||||
m_strDsID = dsID;
|
m_strDsID = dsID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BolunteProtocol::SetPostCoordinateCommand(const std::string& command)
|
void BolunteProtocol::SetPostCoordinateParams(const std::string& dsID, int address, int successValue, int failValue)
|
||||||
{
|
{
|
||||||
m_strPostCoordCmd = command;
|
m_strPostCoordDsID = dsID;
|
||||||
|
m_nPostCoordAddress = address;
|
||||||
|
m_nPostCoordSuccessValue = successValue;
|
||||||
|
m_nPostCoordFailValue = failValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BolunteProtocol::SetZOffset(double zOffset)
|
void BolunteProtocol::SetZOffset(double zOffset)
|
||||||
|
|||||||
@ -448,7 +448,11 @@ int GrabBagPresenter::InitBolunteProtocol()
|
|||||||
m_pBolunteProtocol->SetZOffset(configResult.bolunteConfig.zOffset);
|
m_pBolunteProtocol->SetZOffset(configResult.bolunteConfig.zOffset);
|
||||||
m_pBolunteProtocol->SetZRange(configResult.bolunteConfig.zMin, configResult.bolunteConfig.zMax);
|
m_pBolunteProtocol->SetZRange(configResult.bolunteConfig.zMin, configResult.bolunteConfig.zMax);
|
||||||
m_pBolunteProtocol->SetAngleOffset(configResult.bolunteConfig.angleOffset);
|
m_pBolunteProtocol->SetAngleOffset(configResult.bolunteConfig.angleOffset);
|
||||||
m_pBolunteProtocol->SetPostCoordinateCommand(configResult.bolunteConfig.postCoordinateCommand);
|
m_pBolunteProtocol->SetPostCoordinateParams(
|
||||||
|
configResult.bolunteConfig.postCoordinateDsID,
|
||||||
|
configResult.bolunteConfig.postCoordinateAddress,
|
||||||
|
configResult.bolunteConfig.postCoordinateSuccessValue,
|
||||||
|
configResult.bolunteConfig.postCoordinateFailValue);
|
||||||
|
|
||||||
// 设置连接状态回调
|
// 设置连接状态回调
|
||||||
m_pBolunteProtocol->SetConnectionCallback([this](bool connected) {
|
m_pBolunteProtocol->SetConnectionCallback([this](bool connected) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
#define GRABBAG_VERSION_STRING "1.3.5"
|
#define GRABBAG_VERSION_STRING "1.3.5"
|
||||||
#define GRABBAG_BUILD_STRING "4"
|
#define GRABBAG_BUILD_STRING "5"
|
||||||
#define GRABBAG_FULL_VERSION_STRING "V" GRABBAG_VERSION_STRING "_" GRABBAG_BUILD_STRING
|
#define GRABBAG_FULL_VERSION_STRING "V" GRABBAG_VERSION_STRING "_" GRABBAG_BUILD_STRING
|
||||||
|
|
||||||
// 获取版本信息的便捷函数
|
// 获取版本信息的便捷函数
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
# 1.3.5
|
# 1.3.5
|
||||||
|
## build_5 20260126
|
||||||
|
1. 修改协议附属命令结果
|
||||||
|
|
||||||
|
|
||||||
## build_4 20260124
|
## build_4 20260124
|
||||||
1. 修复算法检测线程在析构时未退出的问题
|
1. 修复算法检测线程在析构时未退出的问题
|
||||||
|
|
||||||
|
|||||||
@ -389,7 +389,10 @@ void DialogCamera::LoadBolunteConfig()
|
|||||||
ui->doubleSpinBox_bolunte_zmin->setValue(configResult->bolunteConfig.zMin);
|
ui->doubleSpinBox_bolunte_zmin->setValue(configResult->bolunteConfig.zMin);
|
||||||
ui->doubleSpinBox_bolunte_zmax->setValue(configResult->bolunteConfig.zMax);
|
ui->doubleSpinBox_bolunte_zmax->setValue(configResult->bolunteConfig.zMax);
|
||||||
ui->doubleSpinBox_bolunte_angleoffset->setValue(configResult->bolunteConfig.angleOffset);
|
ui->doubleSpinBox_bolunte_angleoffset->setValue(configResult->bolunteConfig.angleOffset);
|
||||||
ui->lineEdit_bolunte_postcmd->setText(QString::fromStdString(configResult->bolunteConfig.postCoordinateCommand));
|
ui->lineEdit_bolunte_postcmd->setText(QString::fromStdString(configResult->bolunteConfig.postCoordinateDsID));
|
||||||
|
ui->spinBox_bolunte_postaddr->setValue(configResult->bolunteConfig.postCoordinateAddress);
|
||||||
|
ui->spinBox_bolunte_postsuccess->setValue(configResult->bolunteConfig.postCoordinateSuccessValue);
|
||||||
|
ui->spinBox_bolunte_postfail->setValue(configResult->bolunteConfig.postCoordinateFailValue);
|
||||||
|
|
||||||
LOG_INFO("Loaded Bolunte config: port=%d, zOffset=%.1f\n",
|
LOG_INFO("Loaded Bolunte config: port=%d, zOffset=%.1f\n",
|
||||||
configResult->bolunteConfig.port,
|
configResult->bolunteConfig.port,
|
||||||
@ -418,7 +421,10 @@ bool DialogCamera::SaveBolunteConfig()
|
|||||||
configResult->bolunteConfig.zMin = ui->doubleSpinBox_bolunte_zmin->value();
|
configResult->bolunteConfig.zMin = ui->doubleSpinBox_bolunte_zmin->value();
|
||||||
configResult->bolunteConfig.zMax = ui->doubleSpinBox_bolunte_zmax->value();
|
configResult->bolunteConfig.zMax = ui->doubleSpinBox_bolunte_zmax->value();
|
||||||
configResult->bolunteConfig.angleOffset = ui->doubleSpinBox_bolunte_angleoffset->value();
|
configResult->bolunteConfig.angleOffset = ui->doubleSpinBox_bolunte_angleoffset->value();
|
||||||
configResult->bolunteConfig.postCoordinateCommand = ui->lineEdit_bolunte_postcmd->text().toStdString();
|
configResult->bolunteConfig.postCoordinateDsID = ui->lineEdit_bolunte_postcmd->text().toStdString();
|
||||||
|
configResult->bolunteConfig.postCoordinateAddress = ui->spinBox_bolunte_postaddr->value();
|
||||||
|
configResult->bolunteConfig.postCoordinateSuccessValue = ui->spinBox_bolunte_postsuccess->value();
|
||||||
|
configResult->bolunteConfig.postCoordinateFailValue = ui->spinBox_bolunte_postfail->value();
|
||||||
|
|
||||||
LOG_INFO("Saving Bolunte config: port=%d, zOffset=%.1f\n",
|
LOG_INFO("Saving Bolunte config: port=%d, zOffset=%.1f\n",
|
||||||
configResult->bolunteConfig.port,
|
configResult->bolunteConfig.port,
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>660</width>
|
<width>660</width>
|
||||||
<height>620</height>
|
<height>650</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -226,7 +226,7 @@ QPushButton:disabled {
|
|||||||
<x>50</x>
|
<x>50</x>
|
||||||
<y>330</y>
|
<y>330</y>
|
||||||
<width>560</width>
|
<width>560</width>
|
||||||
<height>200</height>
|
<height>261</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -266,7 +266,7 @@ QPushButton:disabled {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>110</x>
|
<x>110</x>
|
||||||
<y>35</y>
|
<y>35</y>
|
||||||
<width>120</width>
|
<width>100</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -293,8 +293,8 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>75</y>
|
<y>70</y>
|
||||||
<width>120</width>
|
<width>100</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -307,15 +307,15 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<string notr="true">color: rgb(221, 225, 233);</string>
|
<string notr="true">color: rgb(221, 225, 233);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>数据源标识:</string>
|
<string>数据标识:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLineEdit" name="lineEdit_bolunte_dsid">
|
<widget class="QLineEdit" name="lineEdit_bolunte_dsid">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>140</x>
|
<x>110</x>
|
||||||
<y>75</y>
|
<y>70</y>
|
||||||
<width>380</width>
|
<width>411</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -336,8 +336,8 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>115</y>
|
<y>105</y>
|
||||||
<width>100</width>
|
<width>80</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -356,9 +356,9 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bolunte_zoffset">
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_bolunte_zoffset">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>120</x>
|
<x>110</x>
|
||||||
<y>115</y>
|
<y>105</y>
|
||||||
<width>100</width>
|
<width>91</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -384,8 +384,8 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<widget class="QLabel" name="label_bolunte_zmin">
|
<widget class="QLabel" name="label_bolunte_zmin">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>240</x>
|
<x>200</x>
|
||||||
<y>115</y>
|
<y>105</y>
|
||||||
<width>60</width>
|
<width>60</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -405,9 +405,9 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bolunte_zmin">
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_bolunte_zmin">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>300</x>
|
<x>260</x>
|
||||||
<y>115</y>
|
<y>105</y>
|
||||||
<width>100</width>
|
<width>101</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -433,8 +433,8 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<widget class="QLabel" name="label_bolunte_zmax">
|
<widget class="QLabel" name="label_bolunte_zmax">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>420</x>
|
<x>360</x>
|
||||||
<y>115</y>
|
<y>105</y>
|
||||||
<width>60</width>
|
<width>60</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -454,8 +454,8 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bolunte_zmax">
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_bolunte_zmax">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>480</x>
|
<x>420</x>
|
||||||
<y>115</y>
|
<y>105</y>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -483,8 +483,8 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>155</y>
|
<y>140</y>
|
||||||
<width>100</width>
|
<width>80</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -503,9 +503,9 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bolunte_angleoffset">
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_bolunte_angleoffset">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>120</x>
|
<x>110</x>
|
||||||
<y>155</y>
|
<y>140</y>
|
||||||
<width>100</width>
|
<width>80</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -531,9 +531,9 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<widget class="QLabel" name="label_bolunte_postcmd">
|
<widget class="QLabel" name="label_bolunte_postcmd">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>240</x>
|
<x>20</x>
|
||||||
<y>155</y>
|
<y>180</y>
|
||||||
<width>100</width>
|
<width>80</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -546,15 +546,15 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<string notr="true">color: rgb(221, 225, 233);</string>
|
<string notr="true">color: rgb(221, 225, 233);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>附加命令:</string>
|
<string>附加标识:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLineEdit" name="lineEdit_bolunte_postcmd">
|
<widget class="QLineEdit" name="lineEdit_bolunte_postcmd">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>340</x>
|
<x>110</x>
|
||||||
<y>155</y>
|
<y>180</y>
|
||||||
<width>180</width>
|
<width>411</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -571,12 +571,159 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<string>为空则不发送</string>
|
<string>为空则不发送</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_bolunte_postaddr">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>81</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(221, 225, 233);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>附加地址:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="spinBox_bolunte_postaddr">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>110</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(221, 225, 233);
|
||||||
|
background-color: rgb(47, 48, 52);</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>800</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_bolunte_postsuccess">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>210</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>60</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(221, 225, 233);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>成功值:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="spinBox_bolunte_postsuccess">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>270</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>70</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(221, 225, 233);
|
||||||
|
background-color: rgb(47, 48, 52);</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_bolunte_postfail">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>360</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>60</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(221, 225, 233);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>失败值:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="spinBox_bolunte_postfail">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>420</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>70</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(221, 225, 233);
|
||||||
|
background-color: rgb(47, 48, 52);</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="btn_save">
|
<widget class="QPushButton" name="btn_save">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>190</x>
|
<x>190</x>
|
||||||
<y>560</y>
|
<y>600</y>
|
||||||
<width>111</width>
|
<width>111</width>
|
||||||
<height>38</height>
|
<height>38</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -597,7 +744,7 @@ background-color: rgb(47, 48, 52);</string>
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>340</x>
|
<x>340</x>
|
||||||
<y>560</y>
|
<y>600</y>
|
||||||
<width>111</width>
|
<width>111</width>
|
||||||
<height>38</height>
|
<height>38</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
|||||||
@ -67,7 +67,10 @@ struct BolunteConfig
|
|||||||
double zMin = -1500.0; // Z轴最小值
|
double zMin = -1500.0; // Z轴最小值
|
||||||
double zMax = 2500.0; // Z轴最大值
|
double zMax = 2500.0; // Z轴最大值
|
||||||
double angleOffset = 0.0; // 旋转角度补偿
|
double angleOffset = 0.0; // 旋转角度补偿
|
||||||
std::string postCoordinateCommand = R"({ "dsID":"www.hc-system.com.RemoteMonitor", "reqType":"command", "cmdData":["rewriteData","800","10","0"] })"; // 坐标发送后的附加命令
|
std::string postCoordinateDsID = "www.hc-system.com.RemoteMonitor"; // 坐标发送后附加命令的dsID
|
||||||
|
int postCoordinateAddress = 800; // 坐标发送后附加命令的地址
|
||||||
|
int postCoordinateSuccessValue = 10; // 检测成功时的值
|
||||||
|
int postCoordinateFailValue = 12; // 检测失败时的值
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -476,10 +476,28 @@ ConfigResult CVrConfig::LoadConfig(const std::string& filePath)
|
|||||||
result.bolunteConfig.angleOffset = angleOffsetElement->DoubleText();
|
result.bolunteConfig.angleOffset = angleOffsetElement->DoubleText();
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLElement* postCmdElement = bolunteConfigElement->FirstChildElement("PostCoordinateCommand");
|
XMLElement* postDsIDElement = bolunteConfigElement->FirstChildElement("PostCoordinateDsID");
|
||||||
if (postCmdElement && postCmdElement->GetText())
|
if (postDsIDElement && postDsIDElement->GetText())
|
||||||
{
|
{
|
||||||
result.bolunteConfig.postCoordinateCommand = postCmdElement->GetText();
|
result.bolunteConfig.postCoordinateDsID = postDsIDElement->GetText();
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLElement* postAddressElement = bolunteConfigElement->FirstChildElement("PostCoordinateAddress");
|
||||||
|
if (postAddressElement)
|
||||||
|
{
|
||||||
|
result.bolunteConfig.postCoordinateAddress = postAddressElement->IntText();
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLElement* postSuccessElement = bolunteConfigElement->FirstChildElement("PostCoordinateSuccessValue");
|
||||||
|
if (postSuccessElement)
|
||||||
|
{
|
||||||
|
result.bolunteConfig.postCoordinateSuccessValue = postSuccessElement->IntText();
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLElement* postFailElement = bolunteConfigElement->FirstChildElement("PostCoordinateFailValue");
|
||||||
|
if (postFailElement)
|
||||||
|
{
|
||||||
|
result.bolunteConfig.postCoordinateFailValue = postFailElement->IntText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,9 +776,21 @@ bool CVrConfig::SaveConfig(const std::string& filePath, ConfigResult& configResu
|
|||||||
bolunteAngleOffsetElement->SetText(configResult.bolunteConfig.angleOffset);
|
bolunteAngleOffsetElement->SetText(configResult.bolunteConfig.angleOffset);
|
||||||
bolunteConfigElement->InsertEndChild(bolunteAngleOffsetElement);
|
bolunteConfigElement->InsertEndChild(bolunteAngleOffsetElement);
|
||||||
|
|
||||||
XMLElement* boluntePostCmdElement = doc.NewElement("PostCoordinateCommand");
|
XMLElement* boluntePostDsIDElement = doc.NewElement("PostCoordinateDsID");
|
||||||
boluntePostCmdElement->SetText(configResult.bolunteConfig.postCoordinateCommand.c_str());
|
boluntePostDsIDElement->SetText(configResult.bolunteConfig.postCoordinateDsID.c_str());
|
||||||
bolunteConfigElement->InsertEndChild(boluntePostCmdElement);
|
bolunteConfigElement->InsertEndChild(boluntePostDsIDElement);
|
||||||
|
|
||||||
|
XMLElement* boluntePostAddressElement = doc.NewElement("PostCoordinateAddress");
|
||||||
|
boluntePostAddressElement->SetText(configResult.bolunteConfig.postCoordinateAddress);
|
||||||
|
bolunteConfigElement->InsertEndChild(boluntePostAddressElement);
|
||||||
|
|
||||||
|
XMLElement* boluntePostSuccessElement = doc.NewElement("PostCoordinateSuccessValue");
|
||||||
|
boluntePostSuccessElement->SetText(configResult.bolunteConfig.postCoordinateSuccessValue);
|
||||||
|
bolunteConfigElement->InsertEndChild(boluntePostSuccessElement);
|
||||||
|
|
||||||
|
XMLElement* boluntePostFailElement = doc.NewElement("PostCoordinateFailValue");
|
||||||
|
boluntePostFailElement->SetText(configResult.bolunteConfig.postCoordinateFailValue);
|
||||||
|
bolunteConfigElement->InsertEndChild(boluntePostFailElement);
|
||||||
|
|
||||||
// 保存工作点配置(新增)
|
// 保存工作点配置(新增)
|
||||||
SaveWorkPositions(doc, root, configResult.workPositions);
|
SaveWorkPositions(doc, root, configResult.workPositions);
|
||||||
|
|||||||
@ -276,6 +276,9 @@
|
|||||||
<ZMin>-1500.0</ZMin>
|
<ZMin>-1500.0</ZMin>
|
||||||
<ZMax>2500.0</ZMax>
|
<ZMax>2500.0</ZMax>
|
||||||
<AngleOffset>0.0</AngleOffset>
|
<AngleOffset>0.0</AngleOffset>
|
||||||
<PostCoordinateCommand>{ "dsID":"www.hc-system.com.RemoteMonitor", "reqType":"command", "cmdData":["rewriteData","800","10","0"] }</PostCoordinateCommand>
|
<PostCoordinateDsID>www.hc-system.com.RemoteMonitor</PostCoordinateDsID>
|
||||||
|
<PostCoordinateAddress>800</PostCoordinateAddress>
|
||||||
|
<PostCoordinateSuccessValue>10</PostCoordinateSuccessValue>
|
||||||
|
<PostCoordinateFailValue>12</PostCoordinateFailValue>
|
||||||
</BolunteConfig>
|
</BolunteConfig>
|
||||||
</GrabBagConfig>
|
</GrabBagConfig>
|
||||||
Loading…
x
Reference in New Issue
Block a user