修改避障日志
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QMutexLocker>
|
||||
@@ -34,7 +35,17 @@ QJsonObject readObject(const QString &path, QString *error)
|
||||
|
||||
QString operationMessage(const QJsonObject &result)
|
||||
{
|
||||
const QString message = result.value("message").toString();
|
||||
QString message = result.value("message").toString();
|
||||
for (const QJsonValue &value : result.value("cameras").toArray()) {
|
||||
const QJsonObject camera = value.toObject();
|
||||
const QString error = camera.value("error").toString();
|
||||
if (error.isEmpty()) continue;
|
||||
const QString side = camera.value("camera").toString();
|
||||
message += QString(";%1(%2):%3")
|
||||
.arg(side == "left" ? QStringLiteral("左相机")
|
||||
: side == "right" ? QStringLiteral("右相机") : QStringLiteral("相机"))
|
||||
.arg(camera.value("serial").toString()).arg(error);
|
||||
}
|
||||
return message.isEmpty() ? QStringLiteral("DLL 未返回详细原因") : message;
|
||||
}
|
||||
}
|
||||
@@ -181,11 +192,13 @@ void VisionDllWorker::initializeDevices(int initializeTimeoutMs)
|
||||
};
|
||||
|
||||
HikVisionGuidanceQt::Reply reply = timedCall("InitializeCamera", {{"camera", "both"}});
|
||||
// A failed initialization can still leave partially opened or stale camera handles.
|
||||
m_cameraConnected = true;
|
||||
if (!reply.ok()) {
|
||||
rollbackDevices();
|
||||
emit devicesInitialized(false, reply.json, replyError("初始化相机", reply));
|
||||
return;
|
||||
}
|
||||
m_cameraConnected = true;
|
||||
|
||||
reply = timedCall("InitializeLight");
|
||||
if (!reply.ok()) {
|
||||
|
||||
@@ -247,7 +247,9 @@ void VisionService::finishAvoidance(int code, const QJsonObject &result)
|
||||
if (!m_avoidanceDiscarded && m_avoidanceEnabled && !m_shuttingDown && !m_releasing) {
|
||||
const double distance = result.value("distance_mm").toDouble();
|
||||
const bool warning = distance < m_config.warningDistanceMm;
|
||||
if (code != HVG_OK) {
|
||||
if (code == HVG_DISTANCE_UNKNOWN) {
|
||||
m_avoidanceLogKey.clear();
|
||||
} else if (code != HVG_OK) {
|
||||
logAvoidance("ERROR", QString("避障检测失败(code=%1):%2")
|
||||
.arg(code).arg(result.value("message").toString()));
|
||||
if (code == HVG_NOT_READY || code == HVG_DEVICE_ERROR || code == HVG_CONFIG_ERROR)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 20.0.2, 2026-11-11T20:08:15. -->
|
||||
<!-- Written by QtCreator 20.0.2, 2026-11-12T09:47:00. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -84,9 +84,13 @@ Copy-FileIfChanged (Join-Path $qt 'plugins/sqldrivers/qsqlpsql.dll') `
|
||||
(Join-Path $output 'sqldrivers/qsqlpsql.dll')
|
||||
|
||||
foreach ($name in @('libpq.dll', 'libssl-3-x64.dll', 'libcrypto-3-x64.dll',
|
||||
'libintl-9.dll', 'libiconv-2.dll', 'libwinpthread-1.dll')) {
|
||||
'libintl-9.dll', 'libiconv-2.dll')) {
|
||||
Copy-FileIfChanged (Join-Path $postgres $name) (Join-Path $output $name)
|
||||
}
|
||||
# PostgreSQL loads libwinpthread first. Use the SDK version for both consumers:
|
||||
# the older PostgreSQL copy lacks clock_gettime64/nanosleep64 required by MVS FFmpeg.
|
||||
Copy-FileIfChanged (Join-Path $sdkBin 'ThirdParty/libwinpthread-1.dll') `
|
||||
(Join-Path $output 'libwinpthread-1.dll')
|
||||
|
||||
if (-not $RuntimeOnly) {
|
||||
Copy-FileIfChanged (Join-Path $project 'config.ini') (Join-Path $output 'config.ini')
|
||||
@@ -99,7 +103,8 @@ $requiredRuntime = @(
|
||||
'VisionGuide.dll', 'VisionGuide_cpp.dll', 'MvCameraControl.dll',
|
||||
'Qt5Core.dll', 'Qt5Gui.dll', 'Qt5Widgets.dll', 'Qt5Network.dll',
|
||||
'Qt5SerialPort.dll', 'Qt5SerialBus.dll', 'Qt5Sql.dll',
|
||||
'platforms/qwindows.dll', 'sqldrivers/qsqlpsql.dll', 'libpq.dll'
|
||||
'platforms/qwindows.dll', 'sqldrivers/qsqlpsql.dll', 'libpq.dll',
|
||||
'libwinpthread-1.dll', 'ThirdParty/libwinpthread-1.dll'
|
||||
)
|
||||
foreach ($relative in $requiredRuntime) {
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $output $relative) -PathType Leaf)) {
|
||||
|
||||
Reference in New Issue
Block a user