优化设备状态显示逻辑,调整UI布局,更新相机和机械臂状态的样式设置,增强日志记录功能。

This commit is contained in:
杰仔 2025-06-26 00:40:36 +08:00
parent 2afa5b1983
commit 5a59efcabc
13 changed files with 336 additions and 164 deletions

View File

@ -302,15 +302,10 @@ int GrabBagPresenter::InitAlgorithmParams()
m_algoParam.growParam.minLTypeTreeLen = xmlParams.growParam.minLTypeTreeLen; m_algoParam.growParam.minLTypeTreeLen = xmlParams.growParam.minLTypeTreeLen;
m_algoParam.growParam.minVTypeTreeLen = xmlParams.growParam.minVTypeTreeLen; m_algoParam.growParam.minVTypeTreeLen = xmlParams.growParam.minVTypeTreeLen;
// 初始化平面校准参数(单位矩阵,表示不进行额外的平面校准) // 设置平面校准参数使用从XML配置文件读取的数据
double initCalib[9] = {
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
};
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
m_planeCalibParam.planeCalib[i] = initCalib[i]; m_planeCalibParam.planeCalib[i] = xmlParams.planeCalibParam.planeCalib[i];
m_planeCalibParam.invRMatrix[i] = initCalib[i]; m_planeCalibParam.invRMatrix[i] = xmlParams.planeCalibParam.invRMatrix[i];
} }
m_planeCalibParam.planeHeight = xmlParams.planeCalibParam.planeHeight; m_planeCalibParam.planeHeight = xmlParams.planeCalibParam.planeHeight;
@ -318,6 +313,14 @@ int GrabBagPresenter::InitAlgorithmParams()
LOG_INFO(" Bag: L=%.1f, W=%.1f, H=%.1f\n", m_algoParam.bagParam.bagL, m_algoParam.bagParam.bagW, m_algoParam.bagParam.bagH); LOG_INFO(" Bag: L=%.1f, W=%.1f, H=%.1f\n", m_algoParam.bagParam.bagL, m_algoParam.bagParam.bagW, m_algoParam.bagParam.bagH);
LOG_INFO(" Filter: continuityTh=%.1f, outlierTh=%d\n", m_algoParam.filterParam.continuityTh, m_algoParam.filterParam.outlierTh); LOG_INFO(" Filter: continuityTh=%.1f, outlierTh=%d\n", m_algoParam.filterParam.continuityTh, m_algoParam.filterParam.outlierTh);
LOG_INFO(" Plane calibration: height=%.1f\n", m_planeCalibParam.planeHeight); LOG_INFO(" Plane calibration: height=%.1f\n", m_planeCalibParam.planeHeight);
LOG_INFO(" Plane calibration matrix:\n");
LOG_INFO(" [%.3f, %.3f, %.3f]\n", m_planeCalibParam.planeCalib[0], m_planeCalibParam.planeCalib[1], m_planeCalibParam.planeCalib[2]);
LOG_INFO(" [%.3f, %.3f, %.3f]\n", m_planeCalibParam.planeCalib[3], m_planeCalibParam.planeCalib[4], m_planeCalibParam.planeCalib[5]);
LOG_INFO(" [%.3f, %.3f, %.3f]\n", m_planeCalibParam.planeCalib[6], m_planeCalibParam.planeCalib[7], m_planeCalibParam.planeCalib[8]);
LOG_INFO(" Inverse rotation matrix:\n");
LOG_INFO(" [%.3f, %.3f, %.3f]\n", m_planeCalibParam.invRMatrix[0], m_planeCalibParam.invRMatrix[1], m_planeCalibParam.invRMatrix[2]);
LOG_INFO(" [%.3f, %.3f, %.3f]\n", m_planeCalibParam.invRMatrix[3], m_planeCalibParam.invRMatrix[4], m_planeCalibParam.invRMatrix[5]);
LOG_INFO(" [%.3f, %.3f, %.3f]\n", m_planeCalibParam.invRMatrix[6], m_planeCalibParam.invRMatrix[7], m_planeCalibParam.invRMatrix[8]);
return SUCCESS; return SUCCESS;
} }

View File

@ -3,8 +3,8 @@
#define GRABBAG_VERSION_STRING "1.0.0" #define GRABBAG_VERSION_STRING "1.0.0"
#define GRABBAG_BUILD_STRING "4" #define GRABBAG_BUILD_STRING "6"
#define GRABBAG_FULL_VERSION_STRING "V1.0.0_4" #define GRABBAG_FULL_VERSION_STRING "V1.0.0_6"
// 获取版本信息的便捷函数 // 获取版本信息的便捷函数
inline const char* GetGrabBagVersion() { inline const char* GetGrabBagVersion() {

View File

@ -30,7 +30,6 @@ devstatus::~devstatus()
// 设置devstatus的样式 // 设置devstatus的样式
void devstatus::setItemStyle() void devstatus::setItemStyle()
{ {
// 参考ResultItem的样式设置添加边框作为格子间分隔线
this->setStyleSheet( this->setStyleSheet(
"devstatus { " "devstatus { "
" border: 2px solid #191A1C; " // 添加边框作为格子间分隔线 " border: 2px solid #191A1C; " // 添加边框作为格子间分隔线
@ -45,9 +44,8 @@ void devstatus::setCameraStatusImage(QWidget* widget, bool isOnline) {
QString imagePath = isOnline ? ":/resource/camera_online.png" : ":/resource/camera_offline.png"; QString imagePath = isOnline ? ":/resource/camera_online.png" : ":/resource/camera_offline.png";
widget->setStyleSheet(QString("image: url(%1);") widget->setStyleSheet(QString("image: url(%1);").arg(imagePath));
.arg(imagePath)); // widget->setFixedSize(32, 32); // 调整大小以适应图片
widget->setFixedSize(32, 32); // 调整大小以适应图片
} }
// 设置机械臂状态图片的私有成员函数 // 设置机械臂状态图片的私有成员函数
@ -56,9 +54,8 @@ void devstatus::setRobotStatusImage(QWidget* widget, bool isOnline) {
QString imagePath = isOnline ? ":/resource/robot_online.png" : ":/resource/robot_offline.png"; QString imagePath = isOnline ? ":/resource/robot_online.png" : ":/resource/robot_offline.png";
widget->setStyleSheet(QString("image: url(%1); ") widget->setStyleSheet(QString("image: url(%1); ").arg(imagePath));
.arg(imagePath)); // widget->setFixedSize(32, 32); // 调整大小以适应图片
widget->setFixedSize(32, 32); // 调整大小以适应图片
} }
// 更新相机1状态 // 更新相机1状态
@ -105,6 +102,12 @@ void devstatus::setCameraCount(int cameraCount)
LOG_DEBUG("setCameraCount: %d \n", cameraCount); LOG_DEBUG("setCameraCount: %d \n", cameraCount);
ui->dev_camer_2_img->setVisible(showCamera2); // 隐藏整个相机2的frame而不是单独隐藏图片和文字
ui->dev_camera_2_txt->setVisible(showCamera2); if (ui->frame_camera_2) {
ui->frame_camera_2->setVisible(showCamera2);
} else {
// 如果frame_camera_2不存在则单独隐藏图片和文字控件
ui->dev_camer_2_img->setVisible(showCamera2);
ui->dev_camera_2_txt->setVisible(showCamera2);
}
} }

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>272</width> <width>556</width>
<height>200</height> <height>80</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -19,90 +19,153 @@
<widget class="QWidget" name="layoutWidget"> <widget class="QWidget" name="layoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>50</x> <x>0</x>
<y>20</y> <y>0</y>
<width>151</width> <width>551</width>
<height>161</height> <height>81</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QFrame" name="frame_camera_1">
<item> <property name="styleSheet">
<widget class="QWidget" name="dev_camer_1_img" native="true"> <string notr="true">background-color: rgb(37, 38, 42);</string>
<property name="styleSheet"> </property>
<string notr="true">image: url(:/resource/camera_offline.png);</string> <property name="frameShape">
</property> <enum>QFrame::Shape::StyledPanel</enum>
</widget> </property>
</item> <property name="frameShadow">
<item> <enum>QFrame::Shadow::Raised</enum>
<widget class="QLabel" name="dev_camera_1_txt"> </property>
<property name="font"> <widget class="QLabel" name="dev_camera_1_txt">
<font> <property name="geometry">
<pointsize>12</pointsize> <rect>
</font> <x>85</x>
</property> <y>26</y>
<property name="styleSheet"> <width>80</width>
<string notr="true">color: rgb(0, 255, 0);</string> <height>26</height>
</property> </rect>
<property name="text"> </property>
<string>相机在线</string> <property name="font">
</property> <font>
</widget> <pointsize>12</pointsize>
</item> </font>
</layout> </property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 255, 0);</string>
</property>
<property name="text">
<string>相机在线</string>
</property>
</widget>
<widget class="QWidget" name="dev_camer_1_img" native="true">
<property name="geometry">
<rect>
<x>25</x>
<y>16</y>
<width>48</width>
<height>48</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">image: url(:/resource/camera_offline.png);</string>
</property>
</widget>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QFrame" name="frame_camera_2">
<item> <property name="styleSheet">
<widget class="QWidget" name="dev_camer_2_img" native="true"> <string notr="true">background-color: rgb(37, 38, 42);</string>
<property name="styleSheet"> </property>
<string notr="true">image: url(:/resource/camera_offline.png);</string> <property name="frameShape">
</property> <enum>QFrame::Shape::StyledPanel</enum>
</widget> </property>
</item> <property name="frameShadow">
<item> <enum>QFrame::Shadow::Raised</enum>
<widget class="QLabel" name="dev_camera_2_txt"> </property>
<property name="font"> <widget class="QLabel" name="dev_camera_2_txt">
<font> <property name="geometry">
<pointsize>12</pointsize> <rect>
</font> <x>85</x>
</property> <y>26</y>
<property name="styleSheet"> <width>80</width>
<string notr="true">color: rgb(0, 255, 0);</string> <height>26</height>
</property> </rect>
<property name="text"> </property>
<string>相机在线</string> <property name="font">
</property> <font>
</widget> <pointsize>12</pointsize>
</item> </font>
</layout> </property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 255, 0);</string>
</property>
<property name="text">
<string>相机在线</string>
</property>
</widget>
<widget class="QWidget" name="dev_camer_2_img" native="true">
<property name="geometry">
<rect>
<x>25</x>
<y>16</y>
<width>48</width>
<height>48</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">image: url(:/resource/camera_offline.png);</string>
</property>
</widget>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <widget class="QFrame" name="frame_robot">
<item> <property name="styleSheet">
<widget class="QWidget" name="dev_robot_img" native="true"> <string notr="true">background-color: rgb(37, 38, 42);</string>
<property name="styleSheet"> </property>
<string notr="true">image: url(:/resource/robot_offline.png);</string> <property name="frameShape">
</property> <enum>QFrame::Shape::StyledPanel</enum>
</widget> </property>
</item> <property name="frameShadow">
<item> <enum>QFrame::Shadow::Raised</enum>
<widget class="QLabel" name="dev_robot_txt"> </property>
<property name="font"> <widget class="QLabel" name="dev_robot_txt">
<font> <property name="geometry">
<pointsize>12</pointsize> <rect>
</font> <x>85</x>
</property> <y>26</y>
<property name="styleSheet"> <width>80</width>
<string notr="true">color: rgb(0, 255, 0);</string> <height>26</height>
</property> </rect>
<property name="text"> </property>
<string>机械臂在线</string> <property name="font">
</property> <font>
</widget> <pointsize>12</pointsize>
</item> </font>
</layout> </property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 255, 0);</string>
</property>
<property name="text">
<string>机械臂在线</string>
</property>
</widget>
<widget class="QWidget" name="dev_robot_img" native="true">
<property name="geometry">
<rect>
<x>25</x>
<y>16</y>
<width>48</width>
<height>48</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">image: url(:/resource/robot_offline.png);</string>
</property>
</widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -18,6 +18,7 @@
#include <QIcon> #include <QIcon>
#include <QMetaType> #include <QMetaType>
#include <QLabel> #include <QLabel>
#include <QVBoxLayout>
#include "Version.h" #include "Version.h"
#include "VrSimpleLog.h" #include "VrSimpleLog.h"
@ -59,6 +60,9 @@ MainWindow::MainWindow(QWidget *parent)
// 启动后自动最大化显示 // 启动后自动最大化显示
this->showMaximized(); this->showMaximized();
// 初始化时隐藏label_work
ui->label_work->setVisible(false);
// 初始化GraphicsScene // 初始化GraphicsScene
QGraphicsScene* scene = new QGraphicsScene(this); QGraphicsScene* scene = new QGraphicsScene(this);
ui->detect_image->setScene(scene); ui->detect_image->setScene(scene);
@ -130,13 +134,10 @@ void MainWindow::Init()
m_deviceStatusWidget = new devstatus(); //因为初始化回调的数据要存储所以要在init前创建好 m_deviceStatusWidget = new devstatus(); //因为初始化回调的数据要存储所以要在init前创建好
// 初始化完成后在detect_result_list中增加设备状态widget // 将设备状态widget添加到frame_dev中
QListWidgetItem* deviceStatusItem = new QListWidgetItem(); QVBoxLayout* frameDevLayout = new QVBoxLayout(ui->frame_dev);
deviceStatusItem->setBackground(QBrush(Qt::transparent)); frameDevLayout->setContentsMargins(0, 0, 0, 0);
deviceStatusItem->setSizeHint(QSize(272, 200)); frameDevLayout->addWidget(m_deviceStatusWidget);
ui->detect_result_list->addItem(deviceStatusItem);
ui->detect_result_list->setItemWidget(deviceStatusItem, m_deviceStatusWidget);
// 设置列表视图模式 // 设置列表视图模式
ui->detect_result_list->setViewMode(QListView::IconMode); ui->detect_result_list->setViewMode(QListView::IconMode);
@ -181,31 +182,25 @@ void MainWindow::displayImage(const QImage& image)
// 添加扩展版本的检测结果函数 // 添加扩展版本的检测结果函数
void MainWindow::addDetectionResult(const DetectionResult& result) void MainWindow::addDetectionResult(const DetectionResult& result)
{ {
// 清空之前的数据除了第一个设备状态item // 清空之前的所有检测结果数据
while (ui->detect_result_list->count() > 1) { ui->detect_result_list->clear();
QListWidgetItem* item = ui->detect_result_list->takeItem(1);
delete item;
}
// 更新现有设备状态显示第一个item就是设备状态
if (m_deviceStatusWidget) {
// m_deviceStatusWidget会自动从其内部状态获取设备状态信息
// 不需要手动更新因为状态变化时会直接更新到widget中
}
// 设置为图标模式,实现网格布局(多列显示) // 设置为图标模式,实现网格布局(多列显示)
ui->detect_result_list->setViewMode(QListView::IconMode); ui->detect_result_list->setViewMode(QListView::IconMode);
ui->detect_result_list->setResizeMode(QListView::Adjust); ui->detect_result_list->setResizeMode(QListView::Adjust);
// 设置滚动条策略:始终显示垂直滚动条,隐藏水平滚动条 // 设置滚动条策略:强制隐藏所有滚动条
ui->detect_result_list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); ui->detect_result_list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
ui->detect_result_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui->detect_result_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// 计算gridWidth考虑12px间距确保两列布局 // 计算gridWidth考虑12px间距确保两列布局
int totalWidth = ui->detect_result_list->width(); int totalWidth = ui->detect_result_list->width();
int itemSpacing = 12; int totalHeight = ui->detect_result_list->height();
int gridWidth = (totalWidth - itemSpacing - 17) / 2; //20是滚动条的宽度 int itemSpacing = 0;
int gridHeight = 200; int gridWidth = (totalWidth - 20) / 2; //20是滚动条的宽度
int gridHeight = totalHeight / 3 - 1;
LOG_DEBUG("totalWidth: %d, totalHeight: %d, gridWidth: %d, gridHeight: %d", totalWidth, totalHeight, gridWidth, gridHeight);
ui->detect_result_list->setGridSize(QSize(gridWidth, gridHeight)); // 设置每个格子的大小 ui->detect_result_list->setGridSize(QSize(gridWidth, gridHeight)); // 设置每个格子的大小
ui->detect_result_list->setSpacing(itemSpacing); // 设置item间距为12px ui->detect_result_list->setSpacing(itemSpacing); // 设置item间距为12px
@ -491,14 +486,12 @@ void MainWindow::on_btn_hide_clicked()
this->showMinimized(); this->showMinimized();
} }
void MainWindow::on_btn_close_clicked() void MainWindow::on_btn_close_clicked()
{ {
// 关闭应用程序 // 关闭应用程序
this->close(); this->close();
} }
void MainWindow::on_btn_test_clicked() void MainWindow::on_btn_test_clicked()
{ {
// 打开文件选择对话框 // 打开文件选择对话框

View File

@ -37,9 +37,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1344</x> <x>1344</x>
<y>726</y> <y>868</y>
<width>556</width> <width>556</width>
<height>304</height> <height>162</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
@ -81,13 +81,13 @@ background-color: rgba(255, 255, 255, 0);</string>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1344</x> <x>1344</x>
<y>140</y> <y>232</y>
<width>556</width> <width>556</width>
<height>571</height> <height>624</height>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgb(37, 38, 42);</string> <string notr="true">background-color:rgb(37, 38, 42)</string>
</property> </property>
<property name="modelColumn"> <property name="modelColumn">
<number>0</number> <number>0</number>
@ -195,9 +195,9 @@ background-color: rgba(255, 255, 255, 0);</string>
<widget class="QLabel" name="label_work"> <widget class="QLabel" name="label_work">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1630</x> <x>1450</x>
<y>20</y> <y>20</y>
<width>171</width> <width>311</width>
<height>81</height> <height>81</height>
</rect> </rect>
</property> </property>
@ -219,14 +219,15 @@ background-color: rgba(255, 255, 255, 0);</string>
<widget class="QPushButton" name="btn_close"> <widget class="QPushButton" name="btn_close">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1870</x> <x>1841</x>
<y>40</y> <y>32</y>
<width>41</width> <width>56</width>
<height>41</height> <height>56</height>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">image: url(:/resource/close.png);</string> <string notr="true">background-image: url(:/resource/close.png);
background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -235,14 +236,15 @@ background-color: rgba(255, 255, 255, 0);</string>
<widget class="QPushButton" name="btn_hide"> <widget class="QPushButton" name="btn_hide">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1800</x> <x>1762</x>
<y>40</y> <y>32</y>
<width>41</width> <width>56</width>
<height>41</height> <height>56</height>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">image: url(:/resource/hide.png);</string> <string notr="true">background-image: url(:/resource/hide.png);
background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -251,8 +253,8 @@ background-color: rgba(255, 255, 255, 0);</string>
<widget class="QPushButton" name="btn_start"> <widget class="QPushButton" name="btn_start">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1460</x> <x>1525</x>
<y>20</y> <y>21</y>
<width>80</width> <width>80</width>
<height>80</height> <height>80</height>
</rect> </rect>
@ -263,7 +265,8 @@ background-color: rgba(255, 255, 255, 0);</string>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-image: url(:/resource/start.png);</string> <string notr="true">background-image: url(:/resource/start.png);
background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -272,8 +275,8 @@ background-color: rgba(255, 255, 255, 0);</string>
<widget class="QPushButton" name="btn_stop"> <widget class="QPushButton" name="btn_stop">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1562</x> <x>1645</x>
<y>20</y> <y>21</y>
<width>80</width> <width>80</width>
<height>80</height> <height>80</height>
</rect> </rect>
@ -284,13 +287,33 @@ background-color: rgba(255, 255, 255, 0);</string>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-image: url(:/resource/stop.png);</string> <string notr="true">background-image: url(:/resource/stop.png);
background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QFrame" name="frame_dev">
<property name="geometry">
<rect>
<x>1344</x>
<y>140</y>
<width>556</width>
<height>80</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(37, 38, 42, 0);</string>
</property>
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
</widget>
<zorder>groupBox</zorder> <zorder>groupBox</zorder>
<zorder>detect_image</zorder> <zorder>detect_image</zorder>
<zorder>detect_log</zorder> <zorder>detect_log</zorder>
@ -300,6 +323,7 @@ background-color: rgba(255, 255, 255, 0);</string>
<zorder>btn_algo_config</zorder> <zorder>btn_algo_config</zorder>
<zorder>btn_camera_levelling</zorder> <zorder>btn_camera_levelling</zorder>
<zorder>btn_camera</zorder> <zorder>btn_camera</zorder>
<zorder>frame_dev</zorder>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">

View File

@ -40,11 +40,11 @@ void ResultItem::setResultData(int targetIndex, const GrabBagPosition& position)
void ResultItem::setItemStyle() void ResultItem::setItemStyle()
{ {
// 只设置黄色边框作为格子间分隔线不修改背景和QLineEdit样式 // 只设置右侧和下侧边框作为格子间分隔线不修改背景和QLineEdit样式
this->setStyleSheet( this->setStyleSheet(
"ResultItem { " "ResultItem { "
" border: 2px solid #191A1C; " // 只添加黄色边框作为格子间分隔线 " border: 6px solid #191A1C; " // 右侧边框
" border-radius: 0px; " // 去掉圆角,让分隔线更清晰 " border-radius: 0px; " // 去掉圆角,让分隔线更清晰
"} " "} "
); );
} }

View File

@ -135,6 +135,9 @@ border: 1px solid #3B3D47;
padding: 5px; padding: 5px;
font-size: 12px;</string> font-size: 12px;</string>
</property> </property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -151,6 +154,9 @@ border: 1px solid #3B3D47;
padding: 5px; padding: 5px;
font-size: 12px;</string> font-size: 12px;</string>
</property> </property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -167,6 +173,9 @@ border: 1px solid #3B3D47;
padding: 5px; padding: 5px;
font-size: 12px;</string> font-size: 12px;</string>
</property> </property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -183,6 +192,9 @@ border: 1px solid #3B3D47;
padding: 5px; padding: 5px;
font-size: 12px;</string> font-size: 12px;</string>
</property> </property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -193,7 +205,7 @@ font-size: 12px;</string>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>52</x> <x>52</x>
<y>10</y> <y>8</y>
<width>191</width> <width>191</width>
<height>30</height> <height>30</height>
</rect> </rect>

View File

@ -90,9 +90,9 @@ struct VrTreeGrowParam
*/ */
struct VrPlaneCalibParam struct VrPlaneCalibParam
{ {
double planeCalib[9]; // 旋转矩阵,将数据调平 double planeCalib[9] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}; // 旋转矩阵,将数据调平(默认单位矩阵)
double planeHeight = -1.0; // 参考平面的高度,用于去除地面数据 double planeHeight = -1.0; // 参考平面的高度,用于去除地面数据
double invRMatrix[9]; // 逆旋转矩阵,回到原坐标系 double invRMatrix[9] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}; // 逆旋转矩阵,回到原坐标系(默认单位矩阵)
}; };
/** /**

View File

@ -176,6 +176,46 @@ ConfigResult CVrConfig::LoadConfig(const std::string& filePath)
{ {
if (planeCalibParamElement->Attribute("planeHeight")) if (planeCalibParamElement->Attribute("planeHeight"))
result.algorithmParams.planeCalibParam.planeHeight = planeCalibParamElement->DoubleAttribute("planeHeight"); result.algorithmParams.planeCalibParam.planeHeight = planeCalibParamElement->DoubleAttribute("planeHeight");
// 读取旋转矩阵planeCalib[9] (3x3矩阵)
if (planeCalibParamElement->Attribute("planeCalib_00"))
result.algorithmParams.planeCalibParam.planeCalib[0] = planeCalibParamElement->DoubleAttribute("planeCalib_00");
if (planeCalibParamElement->Attribute("planeCalib_01"))
result.algorithmParams.planeCalibParam.planeCalib[1] = planeCalibParamElement->DoubleAttribute("planeCalib_01");
if (planeCalibParamElement->Attribute("planeCalib_02"))
result.algorithmParams.planeCalibParam.planeCalib[2] = planeCalibParamElement->DoubleAttribute("planeCalib_02");
if (planeCalibParamElement->Attribute("planeCalib_10"))
result.algorithmParams.planeCalibParam.planeCalib[3] = planeCalibParamElement->DoubleAttribute("planeCalib_10");
if (planeCalibParamElement->Attribute("planeCalib_11"))
result.algorithmParams.planeCalibParam.planeCalib[4] = planeCalibParamElement->DoubleAttribute("planeCalib_11");
if (planeCalibParamElement->Attribute("planeCalib_12"))
result.algorithmParams.planeCalibParam.planeCalib[5] = planeCalibParamElement->DoubleAttribute("planeCalib_12");
if (planeCalibParamElement->Attribute("planeCalib_20"))
result.algorithmParams.planeCalibParam.planeCalib[6] = planeCalibParamElement->DoubleAttribute("planeCalib_20");
if (planeCalibParamElement->Attribute("planeCalib_21"))
result.algorithmParams.planeCalibParam.planeCalib[7] = planeCalibParamElement->DoubleAttribute("planeCalib_21");
if (planeCalibParamElement->Attribute("planeCalib_22"))
result.algorithmParams.planeCalibParam.planeCalib[8] = planeCalibParamElement->DoubleAttribute("planeCalib_22");
// 读取逆旋转矩阵invRMatrix[9] (3x3矩阵)
if (planeCalibParamElement->Attribute("invRMatrix_00"))
result.algorithmParams.planeCalibParam.invRMatrix[0] = planeCalibParamElement->DoubleAttribute("invRMatrix_00");
if (planeCalibParamElement->Attribute("invRMatrix_01"))
result.algorithmParams.planeCalibParam.invRMatrix[1] = planeCalibParamElement->DoubleAttribute("invRMatrix_01");
if (planeCalibParamElement->Attribute("invRMatrix_02"))
result.algorithmParams.planeCalibParam.invRMatrix[2] = planeCalibParamElement->DoubleAttribute("invRMatrix_02");
if (planeCalibParamElement->Attribute("invRMatrix_10"))
result.algorithmParams.planeCalibParam.invRMatrix[3] = planeCalibParamElement->DoubleAttribute("invRMatrix_10");
if (planeCalibParamElement->Attribute("invRMatrix_11"))
result.algorithmParams.planeCalibParam.invRMatrix[4] = planeCalibParamElement->DoubleAttribute("invRMatrix_11");
if (planeCalibParamElement->Attribute("invRMatrix_12"))
result.algorithmParams.planeCalibParam.invRMatrix[5] = planeCalibParamElement->DoubleAttribute("invRMatrix_12");
if (planeCalibParamElement->Attribute("invRMatrix_20"))
result.algorithmParams.planeCalibParam.invRMatrix[6] = planeCalibParamElement->DoubleAttribute("invRMatrix_20");
if (planeCalibParamElement->Attribute("invRMatrix_21"))
result.algorithmParams.planeCalibParam.invRMatrix[7] = planeCalibParamElement->DoubleAttribute("invRMatrix_21");
if (planeCalibParamElement->Attribute("invRMatrix_22"))
result.algorithmParams.planeCalibParam.invRMatrix[8] = planeCalibParamElement->DoubleAttribute("invRMatrix_22");
} }
} }
@ -296,6 +336,29 @@ bool CVrConfig::SaveConfig(const std::string& filePath, ConfigResult& configResu
// 添加平面校准参数 // 添加平面校准参数
XMLElement* planeCalibParamElement = doc.NewElement("PlaneCalibParam"); XMLElement* planeCalibParamElement = doc.NewElement("PlaneCalibParam");
planeCalibParamElement->SetAttribute("planeHeight", configResult.algorithmParams.planeCalibParam.planeHeight); planeCalibParamElement->SetAttribute("planeHeight", configResult.algorithmParams.planeCalibParam.planeHeight);
// 保存旋转矩阵planeCalib[9] (3x3矩阵)
planeCalibParamElement->SetAttribute("planeCalib_00", configResult.algorithmParams.planeCalibParam.planeCalib[0]);
planeCalibParamElement->SetAttribute("planeCalib_01", configResult.algorithmParams.planeCalibParam.planeCalib[1]);
planeCalibParamElement->SetAttribute("planeCalib_02", configResult.algorithmParams.planeCalibParam.planeCalib[2]);
planeCalibParamElement->SetAttribute("planeCalib_10", configResult.algorithmParams.planeCalibParam.planeCalib[3]);
planeCalibParamElement->SetAttribute("planeCalib_11", configResult.algorithmParams.planeCalibParam.planeCalib[4]);
planeCalibParamElement->SetAttribute("planeCalib_12", configResult.algorithmParams.planeCalibParam.planeCalib[5]);
planeCalibParamElement->SetAttribute("planeCalib_20", configResult.algorithmParams.planeCalibParam.planeCalib[6]);
planeCalibParamElement->SetAttribute("planeCalib_21", configResult.algorithmParams.planeCalibParam.planeCalib[7]);
planeCalibParamElement->SetAttribute("planeCalib_22", configResult.algorithmParams.planeCalibParam.planeCalib[8]);
// 保存逆旋转矩阵invRMatrix[9] (3x3矩阵)
planeCalibParamElement->SetAttribute("invRMatrix_00", configResult.algorithmParams.planeCalibParam.invRMatrix[0]);
planeCalibParamElement->SetAttribute("invRMatrix_01", configResult.algorithmParams.planeCalibParam.invRMatrix[1]);
planeCalibParamElement->SetAttribute("invRMatrix_02", configResult.algorithmParams.planeCalibParam.invRMatrix[2]);
planeCalibParamElement->SetAttribute("invRMatrix_10", configResult.algorithmParams.planeCalibParam.invRMatrix[3]);
planeCalibParamElement->SetAttribute("invRMatrix_11", configResult.algorithmParams.planeCalibParam.invRMatrix[4]);
planeCalibParamElement->SetAttribute("invRMatrix_12", configResult.algorithmParams.planeCalibParam.invRMatrix[5]);
planeCalibParamElement->SetAttribute("invRMatrix_20", configResult.algorithmParams.planeCalibParam.invRMatrix[6]);
planeCalibParamElement->SetAttribute("invRMatrix_21", configResult.algorithmParams.planeCalibParam.invRMatrix[7]);
planeCalibParamElement->SetAttribute("invRMatrix_22", configResult.algorithmParams.planeCalibParam.invRMatrix[8]);
algoParamsElement->InsertEndChild(planeCalibParamElement); algoParamsElement->InsertEndChild(planeCalibParamElement);
// 添加调试参数在AlgorithmParams外面 // 添加调试参数在AlgorithmParams外面

View File

@ -33,7 +33,13 @@
zDeviation_max="80.0" minLTypeTreeLen="50.0" minVTypeTreeLen="50.0" /> zDeviation_max="80.0" minLTypeTreeLen="50.0" minVTypeTreeLen="50.0" />
<!-- 平面校准参数 --> <!-- 平面校准参数 -->
<PlaneCalibParam planeHeight="-1.0" /> <PlaneCalibParam planeHeight="-1.0"
planeCalib_00="1.0" planeCalib_01="0.0" planeCalib_02="0.0"
planeCalib_10="0.0" planeCalib_11="1.0" planeCalib_12="0.0"
planeCalib_20="0.0" planeCalib_21="0.0" planeCalib_22="1.0"
invRMatrix_00="1.0" invRMatrix_01="0.0" invRMatrix_02="0.0"
invRMatrix_10="0.0" invRMatrix_11="1.0" invRMatrix_12="0.0"
invRMatrix_20="0.0" invRMatrix_21="0.0" invRMatrix_22="1.0" />
<!-- 调试参数 --> <!-- 调试参数 -->
</AlgorithmParams> </AlgorithmParams>

View File

@ -86,6 +86,10 @@ int CVrEyeDevice::OpenDevice(const char* sIP, VzNL_OnNotifyStatusCBEx fNotify, v
VzNL_GetSwingMotorInfo(m_pHandle, &swingMotorDevInfo); VzNL_GetSwingMotorInfo(m_pHandle, &swingMotorDevInfo);
// VzNL_SetSwingStopAngle(m_pHandle, swingMotorDevInfo.fMotorMaxAngle / 2.f); // VzNL_SetSwingStopAngle(m_pHandle, swingMotorDevInfo.fMotorMaxAngle / 2.f);
SVzNLVersionInfo sVersionInfo;
VzNL_GetVersion(m_pHandle, &sVersionInfo);
LOG_DEBUG("version : %s\n", sVersionInfo.szSDKVersion);
// 版本信息打印 // 版本信息打印
unsigned int versionCode = VzNL_GetSwingVersionCode(m_pHandle); unsigned int versionCode = VzNL_GetSwingVersionCode(m_pHandle);
LOG_DEBUG("swing versiong : %u\n", versionCode); LOG_DEBUG("swing versiong : %u\n", versionCode);
@ -93,6 +97,12 @@ int CVrEyeDevice::OpenDevice(const char* sIP, VzNL_OnNotifyStatusCBEx fNotify, v
int nnnRet = VzNL_SetEthSendDataLength(m_pHandle, 1024); int nnnRet = VzNL_SetEthSendDataLength(m_pHandle, 1024);
LOG_DEBUG("SenddataLen ret : %d\n", nnnRet); LOG_DEBUG("SenddataLen ret : %d\n", nnnRet);
#if 0
//启用RGBD
VzNL_EnableRGB(m_pHandle, VzTrue);
float exposeThres = VzNL_GetRGBAutoExposeThres(m_pHandle, &nnnRet);
//白平衡 //白平衡
VzBool bEnable = VzNL_IsEnableRGBAWB(m_pHandle, &nnnRet); VzBool bEnable = VzNL_IsEnableRGBAWB(m_pHandle, &nnnRet);
LOG_DEBUG("EnableRGBAWB : %d [%d]\n", bEnable, nnnRet); LOG_DEBUG("EnableRGBAWB : %d [%d]\n", bEnable, nnnRet);
@ -104,11 +114,6 @@ int CVrEyeDevice::OpenDevice(const char* sIP, VzNL_OnNotifyStatusCBEx fNotify, v
nnnRet = VzNL_EnableRGBAutoExpose(m_pHandle, VzTrue); nnnRet = VzNL_EnableRGBAutoExpose(m_pHandle, VzTrue);
LOG_DEBUG("EnableRGBAutoExpose [%d]\n", nnnRet); LOG_DEBUG("EnableRGBAutoExpose [%d]\n", nnnRet);
} }
#if 0
//启用RGBD
VzNL_EnableRGB(m_pHandle, VzTrue);
float exposeThres = VzNL_GetRGBAutoExposeThres(m_pHandle, &nnnRet);
LOG_DEBUG("RGBAutoExposeThres : %f [%d]\n", exposeThres, nnnRet); LOG_DEBUG("RGBAutoExposeThres : %f [%d]\n", exposeThres, nnnRet);
#endif #endif
//设置回调 //设置回调

View File

@ -27,13 +27,13 @@
#pragma comment(lib, "advapi32.lib") #pragma comment(lib, "advapi32.lib")
#endif #endif
#define LOG_VERBOSE(...) VrLogUtils::EchoLog(KELOGLEVEL_Verbose, logfilename(__FILE__), __LINE__, "VrAPPV", ##__VA_ARGS__) #define LOG_VERBOSE(...) VrLogUtils::EchoLog(KELOGLEVEL_Verbose, logfilename(__FILE__), __LINE__, "APPV", ##__VA_ARGS__)
#define LOG_DEBUG(...) VrLogUtils::EchoLog(KELOGLEVEL_Debug, logfilename(__FILE__), __LINE__, "VrAPPD", ##__VA_ARGS__) #define LOG_DEBUG(...) VrLogUtils::EchoLog(KELOGLEVEL_Debug, logfilename(__FILE__), __LINE__, "APPD", ##__VA_ARGS__)
#define LOG_INFO(...) VrLogUtils::EchoLog(KELOGLEVEL_Info, logfilename(__FILE__), __LINE__, "VrAPPI", ##__VA_ARGS__) #define LOG_INFO(...) VrLogUtils::EchoLog(KELOGLEVEL_Info, logfilename(__FILE__), __LINE__, "APPI", ##__VA_ARGS__)
#define LOG_WARNING(...) VrLogUtils::EchoLog(KELOGLEVEL_Warning, logfilename(__FILE__), __LINE__, "VrAPPW", ##__VA_ARGS__) #define LOG_WARNING(...) VrLogUtils::EchoLog(KELOGLEVEL_Warning, logfilename(__FILE__), __LINE__, "APPW", ##__VA_ARGS__)
#define LOG_ERROR(...) VrLogUtils::EchoLog(KELOGLEVEL_Error, logfilename(__FILE__), __LINE__, "VrAPPE", ##__VA_ARGS__) #define LOG_ERROR(...) VrLogUtils::EchoLog(KELOGLEVEL_Error, logfilename(__FILE__), __LINE__, "APPE", ##__VA_ARGS__)
#define LOG_ERRO(...) VrLogUtils::EchoLog(KELOGLEVEL_Error, logfilename(__FILE__), __LINE__, "VrAPPE", ##__VA_ARGS__) #define LOG_ERRO(...) VrLogUtils::EchoLog(KELOGLEVEL_Error, logfilename(__FILE__), __LINE__, "APPE", ##__VA_ARGS__)
#define LOG_ERR(...) VrLogUtils::EchoLog(KELOGLEVEL_Error, logfilename(__FILE__), __LINE__, "VrAPPE", ##__VA_ARGS__) #define LOG_ERR(...) VrLogUtils::EchoLog(KELOGLEVEL_Error, logfilename(__FILE__), __LINE__, "APPE", ##__VA_ARGS__)
/// @brief /// @brief
/// 日志等级 /// 日志等级