feat: enhance arm position and point workflow controls
This commit is contained in:
parent
798ac83a8e
commit
165343b0a3
181
resources/joint_programs.json
Normal file
181
resources/joint_programs.json
Normal file
@ -0,0 +1,181 @@
|
||||
{
|
||||
"activeGroup": "挥手",
|
||||
"groups": [
|
||||
{
|
||||
"flow": [
|
||||
],
|
||||
"moveJAcceleration": 0.1,
|
||||
"moveJVelocity": 0.1,
|
||||
"name": "默认组",
|
||||
"points": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"flow": [
|
||||
{
|
||||
"collapsed": false,
|
||||
"id": "860308d9-f0fb-46f6-a0d3-30013b46827a",
|
||||
"intervalSeconds": 0.5,
|
||||
"loopCount": 1,
|
||||
"nodeName": "初始位置",
|
||||
"order": 0,
|
||||
"parentId": "",
|
||||
"pointName": "初始位置",
|
||||
"type": "single",
|
||||
"x": 40,
|
||||
"y": 40
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"id": "0ddff873-9e76-4635-917d-1d7357dddcc1",
|
||||
"intervalSeconds": 0.5,
|
||||
"loopCount": 3,
|
||||
"nodeName": "循环左右",
|
||||
"order": 1,
|
||||
"parentId": "",
|
||||
"pointName": "",
|
||||
"type": "loop",
|
||||
"x": 260,
|
||||
"y": 40
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"id": "c1a33717-b636-4eb4-80f4-91305edc64ff",
|
||||
"intervalSeconds": 0.5,
|
||||
"loopCount": 1,
|
||||
"nodeName": "挥手-右",
|
||||
"order": 0,
|
||||
"parentId": "0ddff873-9e76-4635-917d-1d7357dddcc1",
|
||||
"pointName": "挥手-右",
|
||||
"type": "single",
|
||||
"x": 40,
|
||||
"y": 140
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"id": "9851e4a8-91bd-4182-a5f5-cdd19180d0a3",
|
||||
"intervalSeconds": 0.5,
|
||||
"loopCount": 1,
|
||||
"nodeName": "挥手-左",
|
||||
"order": 1,
|
||||
"parentId": "0ddff873-9e76-4635-917d-1d7357dddcc1",
|
||||
"pointName": "挥手-左",
|
||||
"type": "single",
|
||||
"x": 260,
|
||||
"y": 140
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"id": "3b89feb6-c457-4a93-b81f-28e5b1423046",
|
||||
"intervalSeconds": 0.5,
|
||||
"loopCount": 1,
|
||||
"nodeName": "初始位置",
|
||||
"order": 2,
|
||||
"parentId": "",
|
||||
"pointName": "初始位置",
|
||||
"type": "single",
|
||||
"x": 480,
|
||||
"y": 40
|
||||
}
|
||||
],
|
||||
"moveJAcceleration": 1,
|
||||
"moveJVelocity": 1,
|
||||
"name": "挥手",
|
||||
"points": [
|
||||
{
|
||||
"deviceId": "right_ethercat_arm",
|
||||
"jointNames": [
|
||||
"right_arm_J1",
|
||||
"right_arm_J2",
|
||||
"right_arm_J3",
|
||||
"right_arm_J4",
|
||||
"right_arm_J5",
|
||||
"right_arm_J6",
|
||||
"right_arm_J7"
|
||||
],
|
||||
"name": "零位",
|
||||
"positions": [
|
||||
-9.492455370579462e-07,
|
||||
0,
|
||||
-9.492455370579462e-07,
|
||||
0,
|
||||
0,
|
||||
-9.492455370579462e-07,
|
||||
-9.492455370579462e-07
|
||||
],
|
||||
"side": "right"
|
||||
},
|
||||
{
|
||||
"deviceId": "right_ethercat_arm",
|
||||
"jointNames": [
|
||||
"right_arm_J1",
|
||||
"right_arm_J2",
|
||||
"right_arm_J3",
|
||||
"right_arm_J4",
|
||||
"right_arm_J5",
|
||||
"right_arm_J6",
|
||||
"right_arm_J7"
|
||||
],
|
||||
"name": "初始位置",
|
||||
"positions": [
|
||||
0.014501624069634246,
|
||||
-1.4912457538072925,
|
||||
-1.2003475604848106,
|
||||
-0.02585080371069905,
|
||||
-0.07927434253632026,
|
||||
-0.06444807649301221,
|
||||
-0.11000426830749717
|
||||
],
|
||||
"side": "right"
|
||||
},
|
||||
{
|
||||
"deviceId": "right_ethercat_arm",
|
||||
"jointNames": [
|
||||
"right_arm_J1",
|
||||
"right_arm_J2",
|
||||
"right_arm_J3",
|
||||
"right_arm_J4",
|
||||
"right_arm_J5",
|
||||
"right_arm_J6",
|
||||
"right_arm_J7"
|
||||
],
|
||||
"name": "挥手-右",
|
||||
"positions": [
|
||||
0.742245461282794,
|
||||
-1.490991356003361,
|
||||
-1.3799808874265822,
|
||||
1.543379267948052,
|
||||
0.14546428458983382,
|
||||
-0.06442149761797458,
|
||||
-0.4555106588858484
|
||||
],
|
||||
"side": "right"
|
||||
},
|
||||
{
|
||||
"deviceId": "right_ethercat_arm",
|
||||
"jointNames": [
|
||||
"right_arm_J1",
|
||||
"right_arm_J2",
|
||||
"right_arm_J3",
|
||||
"right_arm_J4",
|
||||
"right_arm_J5",
|
||||
"right_arm_J6",
|
||||
"right_arm_J7"
|
||||
],
|
||||
"name": "挥手-左",
|
||||
"positions": [
|
||||
0.9055916332997255,
|
||||
-1.4894905988092724,
|
||||
-1.8256241389547136,
|
||||
1.5302806287821893,
|
||||
0.019423462179279694,
|
||||
-0.06441770063582634,
|
||||
-0.4553255560061222
|
||||
],
|
||||
"side": "right"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 1
|
||||
}
|
||||
@ -65,7 +65,7 @@ public:
|
||||
closeButton->setObjectName(QStringLiteral("jointFlowDialogCloseButton"));
|
||||
closeButton->setFixedSize(46, 43);
|
||||
closeButton->setIcon(UiIcons::icon(QStringLiteral(":/icons/x.svg"),
|
||||
QColor(QStringLiteral("#4f5964")), QColor(QStringLiteral("#ffffff"))));
|
||||
QColor(QStringLiteral("#4f5964")), QColor(QStringLiteral("#4f5964"))));
|
||||
titleLayout->addWidget(mark);
|
||||
titleLayout->addWidget(titleLabel);
|
||||
titleLayout->addStretch(1);
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include <QDir>
|
||||
#include <QEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QFrame>
|
||||
#include <QHeaderView>
|
||||
@ -33,6 +34,7 @@
|
||||
#include <QImage>
|
||||
#include <QKeyEvent>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QListView>
|
||||
@ -45,8 +47,11 @@
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QSettings>
|
||||
#include <QSaveFile>
|
||||
#include <QSignalBlocker>
|
||||
#include <QSpinBox>
|
||||
#include <QStackedWidget>
|
||||
#include <QStandardPaths>
|
||||
#include <QStyle>
|
||||
#include <QTableWidget>
|
||||
#include <QTextEdit>
|
||||
@ -1197,6 +1202,54 @@ void MainWindow::rebuildArmJointTables(const QStringList &jointNames)
|
||||
m_jointTable->setItem(row, column, new QTableWidgetItem(QStringLiteral("--")));
|
||||
}
|
||||
|
||||
if (m_motionTable) {
|
||||
m_motionTable->clearContents();
|
||||
m_motionTable->setColumnCount(5);
|
||||
m_motionTable->setRowCount(jointNames.size());
|
||||
m_targetSpins.clear();
|
||||
m_targetRadianSpins.clear();
|
||||
for (int row = 0; row < jointNames.size(); ++row) {
|
||||
m_motionTable->setItem(row, 0, new QTableWidgetItem(jointNames.at(row)));
|
||||
QLineEdit *currentDegrees = new QLineEdit(QStringLiteral("--"), m_motionTable);
|
||||
QLineEdit *currentRadians = new QLineEdit(QStringLiteral("--"), m_motionTable);
|
||||
for (QLineEdit *current : {currentDegrees, currentRadians}) {
|
||||
current->setReadOnly(true);
|
||||
current->setFrame(false);
|
||||
current->setAlignment(Qt::AlignCenter);
|
||||
current->setToolTip(QStringLiteral("只读;可选中文本后复制"));
|
||||
}
|
||||
m_motionTable->setCellWidget(row, 1, currentDegrees);
|
||||
m_motionTable->setCellWidget(row, 2, currentRadians);
|
||||
|
||||
QDoubleSpinBox *targetDegrees = new QDoubleSpinBox(m_motionTable);
|
||||
targetDegrees->setRange(-360.0, 360.0);
|
||||
targetDegrees->setDecimals(3);
|
||||
targetDegrees->setSingleStep(1.0);
|
||||
targetDegrees->setSuffix(QStringLiteral(" °"));
|
||||
targetDegrees->setKeyboardTracking(false);
|
||||
QDoubleSpinBox *targetRadians = new QDoubleSpinBox(m_motionTable);
|
||||
targetRadians->setRange(-2.0 * M_PI, 2.0 * M_PI);
|
||||
targetRadians->setDecimals(6);
|
||||
targetRadians->setSingleStep(0.01);
|
||||
targetRadians->setSuffix(QStringLiteral(" rad"));
|
||||
targetRadians->setKeyboardTracking(false);
|
||||
m_motionTable->setCellWidget(row, 3, targetDegrees);
|
||||
m_motionTable->setCellWidget(row, 4, targetRadians);
|
||||
connect(targetDegrees, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [targetRadians](double degrees) {
|
||||
const QSignalBlocker blocker(targetRadians);
|
||||
targetRadians->setValue(qDegreesToRadians(degrees));
|
||||
});
|
||||
connect(targetRadians, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [targetDegrees](double radians) {
|
||||
const QSignalBlocker blocker(targetDegrees);
|
||||
targetDegrees->setValue(qRadiansToDegrees(radians));
|
||||
});
|
||||
m_targetSpins.append(targetDegrees);
|
||||
m_targetRadianSpins.append(targetRadians);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_zeroJointCombo) {
|
||||
const QSignalBlocker blocker(m_zeroJointCombo);
|
||||
m_zeroJointCombo->clear();
|
||||
@ -1204,6 +1257,10 @@ void MainWindow::rebuildArmJointTables(const QStringList &jointNames)
|
||||
}
|
||||
if (m_calibrateZeroButton)
|
||||
m_calibrateZeroButton->setEnabled(m_connected && !jointNames.isEmpty());
|
||||
if (m_sendMoveButton)
|
||||
m_sendMoveButton->setEnabled(m_connected && !jointNames.isEmpty());
|
||||
if (m_syncCurrentToTargetButton)
|
||||
m_syncCurrentToTargetButton->setEnabled(m_connected && !jointNames.isEmpty());
|
||||
m_previousJointVelocities.clear();
|
||||
m_lastArmTelemetryMs = 0;
|
||||
rebuildArmJogControls();
|
||||
@ -1413,6 +1470,20 @@ void MainWindow::updateTelemetry(const QString &deviceId, const QVariantList &jo
|
||||
m_jointTable->item(row, 1)->setText(QString::number(position, 'f', 5));
|
||||
m_jointTable->item(row, 2)->setText(QString::number(velocity, 'f', 5));
|
||||
m_jointTable->item(row, 3)->setText(QString::number(acceleration, 'f', 4));
|
||||
if (m_motionTable) {
|
||||
for (int targetRow = 0; targetRow < m_motionTable->rowCount(); ++targetRow) {
|
||||
QTableWidgetItem *targetName = m_motionTable->item(targetRow, 0);
|
||||
if (!targetName || targetName->text() != nameItem->text())
|
||||
continue;
|
||||
if (QLineEdit *degrees = qobject_cast<QLineEdit *>(
|
||||
m_motionTable->cellWidget(targetRow, 1)))
|
||||
degrees->setText(QString::number(qRadiansToDegrees(position), 'f', 3));
|
||||
if (QLineEdit *radians = qobject_cast<QLineEdit *>(
|
||||
m_motionTable->cellWidget(targetRow, 2)))
|
||||
radians->setText(QString::number(position, 'f', 6));
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_previousJointVelocities.insert(nameItem->text(), velocity);
|
||||
if (row < m_jointJogPositionLabels.size())
|
||||
m_jointJogPositionLabels.at(row)->setText(
|
||||
@ -1977,6 +2048,7 @@ void MainWindow::updateAgvInventory(const QStringList &maps, const QVariantList
|
||||
void MainWindow::updateImage(const QImage &image, const QString &detail)
|
||||
{
|
||||
m_lastImage = image;
|
||||
m_lastImageIsDepth = detail.startsWith(QStringLiteral("深度"));
|
||||
if (m_videoRender)
|
||||
m_videoRender->setImage(image);
|
||||
m_imageMetaLabel->setText(detail);
|
||||
@ -2166,11 +2238,19 @@ void MainWindow::appendLog(const QString &level, const QString &message)
|
||||
|
||||
void MainWindow::sendMoveJ()
|
||||
{
|
||||
if (m_armIdEdit->text().trimmed().isEmpty() || m_targetSpins.isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("MoveJ 关节位置控制"),
|
||||
QStringLiteral("请先选择机械臂并等待关节信息加载完成。"));
|
||||
return;
|
||||
}
|
||||
QVariantList positions;
|
||||
for (QDoubleSpinBox *spin : m_targetSpins)
|
||||
positions.append(qDegreesToRadians(spin->value()));
|
||||
for (QDoubleSpinBox *spin : m_targetRadianSpins)
|
||||
positions.append(spin->value());
|
||||
m_client->requestMoveJ(m_armIdEdit->text().trimmed(), positions,
|
||||
m_velocitySpin->value(), m_accelerationSpin->value());
|
||||
m_moveJVelocitySpin ? m_moveJVelocitySpin->value()
|
||||
: m_velocitySpin->value(),
|
||||
m_moveJAccelerationSpin ? m_moveJAccelerationSpin->value()
|
||||
: m_accelerationSpin->value());
|
||||
}
|
||||
|
||||
void MainWindow::refreshRecordedJointPoints()
|
||||
@ -2262,8 +2342,7 @@ void MainWindow::recordCurrentJointPoint()
|
||||
|
||||
m_recordedJointPoints.append(point);
|
||||
refreshRecordedJointPoints();
|
||||
QSettings settings;
|
||||
saveJointPrograms(settings);
|
||||
saveJointPrograms();
|
||||
m_jointPointNameEdit->clear();
|
||||
m_jointPointTable->selectRow(m_recordedJointPoints.size() - 1);
|
||||
appendLog(QStringLiteral("OK"),
|
||||
@ -2291,7 +2370,8 @@ void MainWindow::executeSelectedJointPoint()
|
||||
positions.append(position);
|
||||
m_jointPointMovePending = true;
|
||||
m_client->requestMoveJ(point.deviceId, positions,
|
||||
m_velocitySpin->value(), m_accelerationSpin->value());
|
||||
m_jointFlowVelocitySpin->value(),
|
||||
m_jointFlowAccelerationSpin->value());
|
||||
if (m_jointPointLoopStatus)
|
||||
m_jointPointLoopStatus->setText(QStringLiteral("执行:%1").arg(point.name));
|
||||
}
|
||||
@ -2350,6 +2430,8 @@ void MainWindow::startJointPointLoop()
|
||||
m_recordJointPointButton->setEnabled(false);
|
||||
m_stopJointPointLoopButton->setEnabled(true);
|
||||
m_jointPointTable->setEnabled(false);
|
||||
m_jointFlowVelocitySpin->setEnabled(false);
|
||||
m_jointFlowAccelerationSpin->setEnabled(false);
|
||||
advanceJointPointLoop();
|
||||
}
|
||||
|
||||
@ -2377,7 +2459,8 @@ void MainWindow::advanceJointPointLoop()
|
||||
m_jointPointLoopStatus->setText(QStringLiteral("步骤 %1/%2 · %3")
|
||||
.arg(executionIndex + 1).arg(m_jointPointLoopRows.size()).arg(point.name));
|
||||
m_client->requestMoveJ(point.deviceId, positions,
|
||||
m_velocitySpin->value(), m_accelerationSpin->value());
|
||||
m_jointFlowVelocitySpin->value(),
|
||||
m_jointFlowAccelerationSpin->value());
|
||||
}
|
||||
|
||||
void MainWindow::stopJointPointLoop(const QString &reason)
|
||||
@ -2402,6 +2485,10 @@ void MainWindow::stopJointPointLoop(const QString &reason)
|
||||
m_stopJointPointLoopButton->setEnabled(false);
|
||||
if (m_jointPointTable)
|
||||
m_jointPointTable->setEnabled(true);
|
||||
if (m_jointFlowVelocitySpin)
|
||||
m_jointFlowVelocitySpin->setEnabled(m_connected);
|
||||
if (m_jointFlowAccelerationSpin)
|
||||
m_jointFlowAccelerationSpin->setEnabled(m_connected);
|
||||
if (m_jointPointLoopStatus)
|
||||
m_jointPointLoopStatus->setText(reason.isEmpty() ? QStringLiteral("未运行") : reason);
|
||||
if (wasActive && !reason.isEmpty())
|
||||
@ -2433,9 +2520,13 @@ void MainWindow::saveSnapshot()
|
||||
? m_videoRender->grabFramebuffer() : m_lastImage;
|
||||
if (image.isNull())
|
||||
return;
|
||||
const QString defaultName = QStringLiteral("cmvr_rgb_%1.png")
|
||||
.arg(QDateTime::currentDateTime().toString("yyyyMMdd_HHmmss"));
|
||||
const QString path = QFileDialog::getSaveFileName(this, QStringLiteral("保存 RGB 图像"),
|
||||
const QString defaultName = QStringLiteral("cmvr_%1_%2.png")
|
||||
.arg(m_lastImageIsDepth ? QStringLiteral("depth")
|
||||
: QStringLiteral("rgb"),
|
||||
QDateTime::currentDateTime().toString("yyyyMMdd_HHmmss"));
|
||||
const QString path = QFileDialog::getSaveFileName(
|
||||
this, m_lastImageIsDepth ? QStringLiteral("保存深度图像")
|
||||
: QStringLiteral("保存 RGB 图像"),
|
||||
defaultName, QStringLiteral("PNG 图像 (*.png);;JPEG 图像 (*.jpg)"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
@ -2534,7 +2625,7 @@ void MainWindow::loadSettings()
|
||||
void MainWindow::saveSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
saveJointPrograms(settings);
|
||||
saveJointPrograms();
|
||||
settings.setValue(QStringLiteral("connection/host"), m_hostEdit->text().trimmed());
|
||||
settings.setValue(QStringLiteral("connection/port"), m_portSpin->value());
|
||||
settings.setValue(QStringLiteral("connection/demo"), m_demoCheck->isChecked());
|
||||
@ -2582,89 +2673,217 @@ void MainWindow::saveSettings()
|
||||
: certificatePath);
|
||||
}
|
||||
|
||||
void MainWindow::loadJointPrograms(QSettings &settings)
|
||||
QString MainWindow::jointProgramsFilePath() const
|
||||
{
|
||||
m_recordedJointPoints.clear();
|
||||
const int pointCount = settings.beginReadArray(QStringLiteral("arm/jointPoints"));
|
||||
for (int i = 0; i < pointCount; ++i) {
|
||||
settings.setArrayIndex(i);
|
||||
RecordedJointPoint point;
|
||||
point.name = settings.value(QStringLiteral("name")).toString();
|
||||
point.side = settings.value(QStringLiteral("side")).toString();
|
||||
point.deviceId = settings.value(QStringLiteral("deviceId")).toString();
|
||||
point.jointNames = settings.value(QStringLiteral("jointNames")).toStringList();
|
||||
const QVariantList storedPositions = settings.value(QStringLiteral("positions")).toList();
|
||||
for (const QVariant &value : storedPositions)
|
||||
point.positions.append(value.toDouble());
|
||||
if (!point.name.isEmpty() && point.jointNames.size() == point.positions.size())
|
||||
m_recordedJointPoints.append(point);
|
||||
}
|
||||
settings.endArray();
|
||||
return QDir(QCoreApplication::applicationDirPath())
|
||||
.filePath(QStringLiteral("joint_programs.json"));
|
||||
}
|
||||
|
||||
void MainWindow::storeCurrentJointProgramGroup()
|
||||
{
|
||||
if (m_activeJointProgramGroup < 0
|
||||
|| m_activeJointProgramGroup >= m_jointProgramGroups.size())
|
||||
return;
|
||||
JointProgramGroup &group = m_jointProgramGroups[m_activeJointProgramGroup];
|
||||
group.points = m_recordedJointPoints;
|
||||
group.flow = m_jointFlowEditor ? m_jointFlowEditor->toJson() : QJsonArray();
|
||||
if (m_jointFlowVelocitySpin)
|
||||
group.moveJVelocity = m_jointFlowVelocitySpin->value();
|
||||
if (m_jointFlowAccelerationSpin)
|
||||
group.moveJAcceleration = m_jointFlowAccelerationSpin->value();
|
||||
}
|
||||
|
||||
void MainWindow::activateJointProgramGroup(int index)
|
||||
{
|
||||
if (m_updatingJointProgramGroup || index < 0
|
||||
|| index >= m_jointProgramGroups.size()
|
||||
|| index == m_activeJointProgramGroup)
|
||||
return;
|
||||
if (m_jointPointLoopActive)
|
||||
stopJointPointLoop(QStringLiteral("切换点位组"));
|
||||
storeCurrentJointProgramGroup();
|
||||
m_activeJointProgramGroup = index;
|
||||
const JointProgramGroup &group = m_jointProgramGroups.at(index);
|
||||
m_recordedJointPoints = group.points;
|
||||
if (m_jointFlowEditor) {
|
||||
const QSignalBlocker blocker(m_jointFlowEditor);
|
||||
m_jointFlowEditor->clear();
|
||||
const QByteArray flowJson = settings.value(QStringLiteral("arm/jointFlowGraph")).toByteArray();
|
||||
const QJsonDocument document = QJsonDocument::fromJson(flowJson);
|
||||
if (document.isArray()) {
|
||||
m_jointFlowEditor->fromJson(document.array());
|
||||
} else {
|
||||
struct LegacyStep { QString point; double wait = 1.0; QString group; int count = 1; };
|
||||
QList<LegacyStep> legacy;
|
||||
const int flowCount = settings.beginReadArray(QStringLiteral("arm/jointFlow"));
|
||||
for (int i = 0; i < flowCount; ++i) {
|
||||
settings.setArrayIndex(i);
|
||||
LegacyStep step;
|
||||
step.point = settings.value(QStringLiteral("pointName")).toString();
|
||||
step.wait = settings.value(QStringLiteral("waitSeconds"), 1.0).toDouble();
|
||||
step.group = settings.value(QStringLiteral("loopGroup")).toString();
|
||||
step.count = qMax(1, settings.value(QStringLiteral("loopCount"), 1).toInt());
|
||||
if (!step.point.isEmpty()) legacy.append(step);
|
||||
}
|
||||
settings.endArray();
|
||||
for (int i = 0; i < legacy.size();) {
|
||||
if (legacy.at(i).group.isEmpty()) {
|
||||
m_jointFlowEditor->addSingleNode(legacy.at(i).point,
|
||||
legacy.at(i).point,
|
||||
legacy.at(i).wait);
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
int end = i + 1;
|
||||
while (end < legacy.size() && legacy.at(end).group == legacy.at(i).group) ++end;
|
||||
for (int repeat = 0; repeat < legacy.at(i).count; ++repeat)
|
||||
for (int index = i; index < end; ++index)
|
||||
m_jointFlowEditor->addSingleNode(legacy.at(index).point,
|
||||
legacy.at(index).point,
|
||||
legacy.at(index).wait);
|
||||
i = end;
|
||||
}
|
||||
}
|
||||
m_jointFlowEditor->fromJson(group.flow);
|
||||
}
|
||||
if (m_jointFlowVelocitySpin) {
|
||||
const QSignalBlocker blocker(m_jointFlowVelocitySpin);
|
||||
m_jointFlowVelocitySpin->setValue(group.moveJVelocity);
|
||||
}
|
||||
if (m_jointFlowAccelerationSpin) {
|
||||
const QSignalBlocker blocker(m_jointFlowAccelerationSpin);
|
||||
m_jointFlowAccelerationSpin->setValue(group.moveJAcceleration);
|
||||
}
|
||||
refreshRecordedJointPoints();
|
||||
refreshJointFlowTable();
|
||||
saveJointPrograms();
|
||||
}
|
||||
|
||||
void MainWindow::saveJointPrograms(QSettings &settings) const
|
||||
void MainWindow::loadJointPrograms(QSettings &legacySettings)
|
||||
{
|
||||
settings.remove(QStringLiteral("arm/jointPoints"));
|
||||
settings.beginWriteArray(QStringLiteral("arm/jointPoints"));
|
||||
for (int i = 0; i < m_recordedJointPoints.size(); ++i) {
|
||||
settings.setArrayIndex(i);
|
||||
const RecordedJointPoint &point = m_recordedJointPoints.at(i);
|
||||
QVariantList positions;
|
||||
for (double value : point.positions)
|
||||
positions.append(value);
|
||||
settings.setValue(QStringLiteral("name"), point.name);
|
||||
settings.setValue(QStringLiteral("side"), point.side);
|
||||
settings.setValue(QStringLiteral("deviceId"), point.deviceId);
|
||||
settings.setValue(QStringLiteral("jointNames"), point.jointNames);
|
||||
settings.setValue(QStringLiteral("positions"), positions);
|
||||
m_jointProgramGroups.clear();
|
||||
m_activeJointProgramGroup = -1;
|
||||
const QString filePath = jointProgramsFilePath();
|
||||
const QString legacyJsonPath = QDir(
|
||||
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation))
|
||||
.filePath(QStringLiteral("joint_programs.json"));
|
||||
const QString sourcePath = QFileInfo::exists(filePath)
|
||||
? filePath : legacyJsonPath;
|
||||
QFile file(sourcePath);
|
||||
QString activeGroupName;
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
QJsonParseError parseError;
|
||||
const QJsonDocument document = QJsonDocument::fromJson(file.readAll(), &parseError);
|
||||
const QJsonObject root = document.object();
|
||||
activeGroupName = root.value(QStringLiteral("activeGroup")).toString();
|
||||
const QJsonArray groups = root.value(QStringLiteral("groups")).toArray();
|
||||
for (const QJsonValue &groupValue : groups) {
|
||||
const QJsonObject groupObject = groupValue.toObject();
|
||||
JointProgramGroup group;
|
||||
group.name = groupObject.value(QStringLiteral("name")).toString().trimmed();
|
||||
group.flow = groupObject.value(QStringLiteral("flow")).toArray();
|
||||
group.moveJVelocity = groupObject.value(
|
||||
QStringLiteral("moveJVelocity")).toDouble(0.1);
|
||||
group.moveJAcceleration = groupObject.value(
|
||||
QStringLiteral("moveJAcceleration")).toDouble(0.1);
|
||||
for (const QJsonValue &pointValue : groupObject.value(QStringLiteral("points")).toArray()) {
|
||||
const QJsonObject pointObject = pointValue.toObject();
|
||||
RecordedJointPoint point;
|
||||
point.name = pointObject.value(QStringLiteral("name")).toString();
|
||||
point.side = pointObject.value(QStringLiteral("side")).toString();
|
||||
point.deviceId = pointObject.value(QStringLiteral("deviceId")).toString();
|
||||
for (const QJsonValue &name : pointObject.value(QStringLiteral("jointNames")).toArray())
|
||||
point.jointNames.append(name.toString());
|
||||
for (const QJsonValue &position : pointObject.value(QStringLiteral("positions")).toArray())
|
||||
point.positions.append(position.toDouble());
|
||||
if (!point.name.isEmpty()
|
||||
&& point.jointNames.size() == point.positions.size())
|
||||
group.points.append(point);
|
||||
}
|
||||
if (!group.name.isEmpty())
|
||||
m_jointProgramGroups.append(group);
|
||||
}
|
||||
if (document.isNull())
|
||||
appendLog(QStringLiteral("WARN"),
|
||||
QStringLiteral("点位组 JSON 解析失败:%1").arg(parseError.errorString()));
|
||||
}
|
||||
settings.endArray();
|
||||
|
||||
if (m_jointProgramGroups.isEmpty()) {
|
||||
JointProgramGroup migrated;
|
||||
migrated.name = QStringLiteral("默认组");
|
||||
const int pointCount = legacySettings.beginReadArray(QStringLiteral("arm/jointPoints"));
|
||||
for (int i = 0; i < pointCount; ++i) {
|
||||
legacySettings.setArrayIndex(i);
|
||||
RecordedJointPoint point;
|
||||
point.name = legacySettings.value(QStringLiteral("name")).toString();
|
||||
point.side = legacySettings.value(QStringLiteral("side")).toString();
|
||||
point.deviceId = legacySettings.value(QStringLiteral("deviceId")).toString();
|
||||
point.jointNames = legacySettings.value(QStringLiteral("jointNames")).toStringList();
|
||||
const QVariantList positions =
|
||||
legacySettings.value(QStringLiteral("positions")).toList();
|
||||
for (const QVariant &position : positions)
|
||||
point.positions.append(position.toDouble());
|
||||
if (!point.name.isEmpty()
|
||||
&& point.jointNames.size() == point.positions.size())
|
||||
migrated.points.append(point);
|
||||
}
|
||||
legacySettings.endArray();
|
||||
const QJsonDocument legacyFlow = QJsonDocument::fromJson(
|
||||
legacySettings.value(QStringLiteral("arm/jointFlowGraph")).toByteArray());
|
||||
if (legacyFlow.isArray())
|
||||
migrated.flow = legacyFlow.array();
|
||||
m_jointProgramGroups.append(migrated);
|
||||
activeGroupName = migrated.name;
|
||||
}
|
||||
|
||||
int activeIndex = 0;
|
||||
for (int i = 0; i < m_jointProgramGroups.size(); ++i) {
|
||||
if (m_jointProgramGroups.at(i).name == activeGroupName) {
|
||||
activeIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_activeJointProgramGroup = activeIndex;
|
||||
m_updatingJointProgramGroup = true;
|
||||
if (m_jointProgramGroupCombo) {
|
||||
m_jointProgramGroupCombo->clear();
|
||||
for (const JointProgramGroup &group : m_jointProgramGroups)
|
||||
m_jointProgramGroupCombo->addItem(group.name);
|
||||
m_jointProgramGroupCombo->setCurrentIndex(activeIndex);
|
||||
}
|
||||
m_updatingJointProgramGroup = false;
|
||||
m_recordedJointPoints = m_jointProgramGroups.at(activeIndex).points;
|
||||
if (m_jointFlowEditor) {
|
||||
settings.setValue(QStringLiteral("arm/jointFlowGraph"),
|
||||
QJsonDocument(m_jointFlowEditor->toJson()).toJson(QJsonDocument::Compact));
|
||||
settings.remove(QStringLiteral("arm/jointFlow"));
|
||||
const QSignalBlocker blocker(m_jointFlowEditor);
|
||||
m_jointFlowEditor->clear();
|
||||
m_jointFlowEditor->fromJson(m_jointProgramGroups.at(activeIndex).flow);
|
||||
}
|
||||
if (m_jointFlowVelocitySpin)
|
||||
m_jointFlowVelocitySpin->setValue(
|
||||
m_jointProgramGroups.at(activeIndex).moveJVelocity);
|
||||
if (m_jointFlowAccelerationSpin)
|
||||
m_jointFlowAccelerationSpin->setValue(
|
||||
m_jointProgramGroups.at(activeIndex).moveJAcceleration);
|
||||
refreshRecordedJointPoints();
|
||||
refreshJointFlowTable();
|
||||
if (!QFileInfo::exists(filePath)) {
|
||||
saveJointPrograms();
|
||||
if (QFileInfo::exists(legacyJsonPath))
|
||||
appendLog(QStringLiteral("INFO"),
|
||||
QStringLiteral("点位规划数据已迁移到程序目录:%1")
|
||||
.arg(filePath));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::saveJointPrograms()
|
||||
{
|
||||
storeCurrentJointProgramGroup();
|
||||
if (m_jointProgramGroups.isEmpty())
|
||||
return;
|
||||
QJsonArray groups;
|
||||
for (const JointProgramGroup &group : m_jointProgramGroups) {
|
||||
QJsonObject groupObject;
|
||||
groupObject.insert(QStringLiteral("name"), group.name);
|
||||
QJsonArray points;
|
||||
for (const RecordedJointPoint &point : group.points) {
|
||||
QJsonObject pointObject;
|
||||
pointObject.insert(QStringLiteral("name"), point.name);
|
||||
pointObject.insert(QStringLiteral("side"), point.side);
|
||||
pointObject.insert(QStringLiteral("deviceId"), point.deviceId);
|
||||
QJsonArray names;
|
||||
for (const QString &name : point.jointNames)
|
||||
names.append(name);
|
||||
QJsonArray positions;
|
||||
for (double position : point.positions)
|
||||
positions.append(position);
|
||||
pointObject.insert(QStringLiteral("jointNames"), names);
|
||||
pointObject.insert(QStringLiteral("positions"), positions);
|
||||
points.append(pointObject);
|
||||
}
|
||||
groupObject.insert(QStringLiteral("points"), points);
|
||||
groupObject.insert(QStringLiteral("flow"), group.flow);
|
||||
groupObject.insert(QStringLiteral("moveJVelocity"), group.moveJVelocity);
|
||||
groupObject.insert(QStringLiteral("moveJAcceleration"), group.moveJAcceleration);
|
||||
groups.append(groupObject);
|
||||
}
|
||||
QJsonObject root;
|
||||
root.insert(QStringLiteral("version"), 1);
|
||||
root.insert(QStringLiteral("activeGroup"),
|
||||
m_jointProgramGroups.at(m_activeJointProgramGroup).name);
|
||||
root.insert(QStringLiteral("groups"), groups);
|
||||
|
||||
const QString filePath = jointProgramsFilePath();
|
||||
QDir().mkpath(QFileInfo(filePath).absolutePath());
|
||||
QSaveFile file(filePath);
|
||||
if (!file.open(QIODevice::WriteOnly)
|
||||
|| file.write(QJsonDocument(root).toJson(QJsonDocument::Indented)) < 0
|
||||
|| !file.commit()) {
|
||||
appendLog(QStringLiteral("ERROR"),
|
||||
QStringLiteral("点位组保存失败:%1").arg(filePath));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2684,6 +2903,14 @@ void MainWindow::setControlsEnabled(bool enabled)
|
||||
m_velocitySpin->setEnabled(enabled);
|
||||
if (m_accelerationSpin)
|
||||
m_accelerationSpin->setEnabled(enabled);
|
||||
if (m_moveJVelocitySpin)
|
||||
m_moveJVelocitySpin->setEnabled(enabled);
|
||||
if (m_moveJAccelerationSpin)
|
||||
m_moveJAccelerationSpin->setEnabled(enabled);
|
||||
if (m_jointFlowVelocitySpin)
|
||||
m_jointFlowVelocitySpin->setEnabled(enabled && !m_jointPointLoopActive);
|
||||
if (m_jointFlowAccelerationSpin)
|
||||
m_jointFlowAccelerationSpin->setEnabled(enabled && !m_jointPointLoopActive);
|
||||
if (m_cartesianVelocitySpin)
|
||||
m_cartesianVelocitySpin->setEnabled(enabled);
|
||||
if (m_cartesianAccelerationSpin)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QImage>
|
||||
#include <QJsonArray>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QMainWindow>
|
||||
@ -116,8 +117,11 @@ private:
|
||||
QWidget *createDiagnosticsPage();
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
void loadJointPrograms(QSettings &settings);
|
||||
void saveJointPrograms(QSettings &settings) const;
|
||||
void loadJointPrograms(QSettings &legacySettings);
|
||||
void saveJointPrograms();
|
||||
void storeCurrentJointProgramGroup();
|
||||
void activateJointProgramGroup(int index);
|
||||
QString jointProgramsFilePath() const;
|
||||
void setControlsEnabled(bool enabled);
|
||||
void updateWindowChrome();
|
||||
void ensureArmModelLoaded();
|
||||
@ -195,6 +199,10 @@ private:
|
||||
QTableWidget *m_jointTable = nullptr;
|
||||
QTableWidget *m_motionTable = nullptr;
|
||||
QList<QDoubleSpinBox *> m_targetSpins;
|
||||
QList<QDoubleSpinBox *> m_targetRadianSpins;
|
||||
QPushButton *m_syncCurrentToTargetButton = nullptr;
|
||||
QDoubleSpinBox *m_moveJVelocitySpin = nullptr;
|
||||
QDoubleSpinBox *m_moveJAccelerationSpin = nullptr;
|
||||
QStringList m_activeArmJointNames;
|
||||
QList<QDoubleSpinBox *> m_moveJPoseSpins;
|
||||
QComboBox *m_moveJPoseBaseLinkCombo = nullptr;
|
||||
@ -248,13 +256,26 @@ private:
|
||||
QStringList jointNames;
|
||||
QVector<double> positions;
|
||||
};
|
||||
struct JointProgramGroup {
|
||||
QString name;
|
||||
QList<RecordedJointPoint> points;
|
||||
QJsonArray flow;
|
||||
double moveJVelocity = 0.1;
|
||||
double moveJAcceleration = 0.1;
|
||||
};
|
||||
QList<JointProgramGroup> m_jointProgramGroups;
|
||||
int m_activeJointProgramGroup = -1;
|
||||
bool m_updatingJointProgramGroup = false;
|
||||
QList<RecordedJointPoint> m_recordedJointPoints;
|
||||
QComboBox *m_jointProgramGroupCombo = nullptr;
|
||||
QHash<QString, double> m_latestArmJointPositions;
|
||||
QLineEdit *m_jointPointNameEdit = nullptr;
|
||||
QTableWidget *m_jointPointTable = nullptr;
|
||||
QLabel *m_jointPointDetailLabel = nullptr;
|
||||
QSpinBox *m_jointPointLoopCount = nullptr;
|
||||
QDoubleSpinBox *m_jointPointInterval = nullptr;
|
||||
QDoubleSpinBox *m_jointFlowVelocitySpin = nullptr;
|
||||
QDoubleSpinBox *m_jointFlowAccelerationSpin = nullptr;
|
||||
QSpinBox *m_jointFlowGroupCount = nullptr;
|
||||
JointFlowEditor *m_jointFlowEditor = nullptr;
|
||||
QDialog *m_jointFlowDialog = nullptr;
|
||||
@ -277,6 +298,7 @@ private:
|
||||
VideoRenderWidget *m_videoRender = nullptr;
|
||||
QLabel *m_imageMetaLabel = nullptr;
|
||||
QPushButton *m_snapshotButton = nullptr;
|
||||
QPushButton *m_depthSnapshotButton = nullptr;
|
||||
QPushButton *m_cameraStreamButton = nullptr;
|
||||
QPushButton *m_saveImageButton = nullptr;
|
||||
QComboBox *m_cameraCodecCombo = nullptr;
|
||||
@ -296,6 +318,7 @@ private:
|
||||
QHash<QString, CameraPreviewTile> m_cameraPreviewTiles;
|
||||
QSet<QString> m_runningCameraIds;
|
||||
QImage m_lastImage;
|
||||
bool m_lastImageIsDepth = false;
|
||||
bool m_cameraStreaming = false;
|
||||
bool m_cameraRecording = false;
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ QString requestFlowNodeName(QWidget *parent, const QString &title,
|
||||
closeButton->setObjectName(QStringLiteral("jointFlowDialogCloseButton"));
|
||||
closeButton->setFixedSize(46, 43);
|
||||
closeButton->setIcon(UiIcons::icon(QStringLiteral(":/icons/x.svg"),
|
||||
QColor(QStringLiteral("#4f5964")), QColor(QStringLiteral("#ffffff"))));
|
||||
QColor(QStringLiteral("#4f5964")), QColor(QStringLiteral("#4f5964"))));
|
||||
titleLayout->addWidget(mark);
|
||||
titleLayout->addWidget(titleLabel);
|
||||
titleLayout->addStretch(1);
|
||||
@ -193,7 +193,10 @@ QString requestFlowNodeName(QWidget *parent, const QString &title,
|
||||
QVBoxLayout *contentLayout = new QVBoxLayout(content);
|
||||
contentLayout->setContentsMargins(18, 16, 18, 16);
|
||||
contentLayout->setSpacing(9);
|
||||
QLabel *fieldLabel = new QLabel(QStringLiteral("节点名称"), content);
|
||||
QLabel *fieldLabel = new QLabel(
|
||||
title.contains(QStringLiteral("点位组")) ? QStringLiteral("组名称")
|
||||
: QStringLiteral("节点名称"),
|
||||
content);
|
||||
QLineEdit *nameEdit = new QLineEdit(initialValue, content);
|
||||
QHBoxLayout *actions = new QHBoxLayout;
|
||||
QPushButton *cancelButton = new QPushButton(QStringLiteral("取消"), content);
|
||||
@ -445,6 +448,83 @@ QWidget *MainWindow::createArmPage()
|
||||
moveJLayout->setContentsMargins(16, 14, 16, 16);
|
||||
moveJLayout->setSpacing(12);
|
||||
|
||||
QFrame *groupPanel = new QFrame(moveJPage);
|
||||
groupPanel->setObjectName(QStringLiteral("jointProgramGroupPanel"));
|
||||
QHBoxLayout *groupLayout = new QHBoxLayout(groupPanel);
|
||||
groupLayout->setContentsMargins(12, 8, 12, 8);
|
||||
groupLayout->setSpacing(8);
|
||||
QLabel *groupLabel = new QLabel(QStringLiteral("点位组"), groupPanel);
|
||||
groupLabel->setObjectName(QStringLiteral("jointFlowSectionTitle"));
|
||||
QLabel *groupHint = new QLabel(
|
||||
QStringLiteral("每个组独立保存点位记录和执行流程"), groupPanel);
|
||||
groupHint->setObjectName(QStringLiteral("jointFlowSectionSubtitle"));
|
||||
m_jointProgramGroupCombo = new QComboBox(groupPanel);
|
||||
m_jointProgramGroupCombo->setMinimumWidth(220);
|
||||
m_jointProgramGroupCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
QPushButton *newGroupButton = new QPushButton(QStringLiteral("新建组"), groupPanel);
|
||||
QPushButton *renameGroupButton = new QPushButton(QStringLiteral("重命名"), groupPanel);
|
||||
newGroupButton->setObjectName(QStringLiteral("primaryButton"));
|
||||
renameGroupButton->setObjectName(QStringLiteral("secondaryButton"));
|
||||
groupLayout->addWidget(groupLabel);
|
||||
groupLayout->addWidget(groupHint);
|
||||
groupLayout->addStretch(1);
|
||||
groupLayout->addWidget(m_jointProgramGroupCombo);
|
||||
groupLayout->addWidget(newGroupButton);
|
||||
groupLayout->addWidget(renameGroupButton);
|
||||
moveJLayout->addWidget(groupPanel);
|
||||
|
||||
connect(m_jointProgramGroupCombo,
|
||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index) { activateJointProgramGroup(index); });
|
||||
connect(newGroupButton, &QPushButton::clicked, this, [this]() {
|
||||
bool ok = false;
|
||||
const QString name = requestFlowNodeName(
|
||||
m_jointFlowDialog, QStringLiteral("新建点位组"), QStringLiteral("新建组"), &ok);
|
||||
if (!ok || name.isEmpty())
|
||||
return;
|
||||
for (const JointProgramGroup &group : m_jointProgramGroups) {
|
||||
if (group.name.compare(name, Qt::CaseInsensitive) == 0) {
|
||||
QMessageBox::information(m_jointFlowDialog, QStringLiteral("新建点位组"),
|
||||
QStringLiteral("已存在同名点位组。"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
storeCurrentJointProgramGroup();
|
||||
JointProgramGroup group;
|
||||
group.name = name;
|
||||
m_jointProgramGroups.append(group);
|
||||
const int newIndex = m_jointProgramGroups.size() - 1;
|
||||
m_updatingJointProgramGroup = true;
|
||||
m_jointProgramGroupCombo->addItem(name);
|
||||
m_jointProgramGroupCombo->setCurrentIndex(newIndex);
|
||||
m_updatingJointProgramGroup = false;
|
||||
activateJointProgramGroup(newIndex);
|
||||
});
|
||||
connect(renameGroupButton, &QPushButton::clicked, this, [this]() {
|
||||
if (m_activeJointProgramGroup < 0
|
||||
|| m_activeJointProgramGroup >= m_jointProgramGroups.size())
|
||||
return;
|
||||
const QString oldName = m_jointProgramGroups.at(m_activeJointProgramGroup).name;
|
||||
bool ok = false;
|
||||
const QString name = requestFlowNodeName(
|
||||
m_jointFlowDialog, QStringLiteral("重命名点位组"), oldName, &ok);
|
||||
if (!ok || name.isEmpty() || name == oldName)
|
||||
return;
|
||||
for (int i = 0; i < m_jointProgramGroups.size(); ++i) {
|
||||
if (i != m_activeJointProgramGroup
|
||||
&& m_jointProgramGroups.at(i).name.compare(name, Qt::CaseInsensitive) == 0) {
|
||||
QMessageBox::information(m_jointFlowDialog, QStringLiteral("重命名点位组"),
|
||||
QStringLiteral("已存在同名点位组。"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_jointProgramGroups[m_activeJointProgramGroup].name = name;
|
||||
m_updatingJointProgramGroup = true;
|
||||
m_jointProgramGroupCombo->setItemText(m_activeJointProgramGroup, name);
|
||||
m_updatingJointProgramGroup = false;
|
||||
saveJointPrograms();
|
||||
});
|
||||
|
||||
QFrame *pointPanel = new QFrame(moveJPage);
|
||||
pointPanel->setObjectName(QStringLiteral("jointPointPanel"));
|
||||
QVBoxLayout *pointLayout = new QVBoxLayout(pointPanel);
|
||||
@ -542,8 +622,7 @@ QWidget *MainWindow::createArmPage()
|
||||
m_jointFlowEditor->removePointReferences(removedNames);
|
||||
refreshRecordedJointPoints();
|
||||
refreshJointFlowTable();
|
||||
QSettings settings;
|
||||
saveJointPrograms(settings);
|
||||
saveJointPrograms();
|
||||
});
|
||||
connect(m_jointPointTable, &QTableWidget::cellClicked, this,
|
||||
[this](int row, int) {
|
||||
@ -630,9 +709,30 @@ QWidget *MainWindow::createArmPage()
|
||||
QHBoxLayout *flowActions = new QHBoxLayout;
|
||||
QPushButton *flowDeleteButton = new QPushButton(QStringLiteral("删除选中节点"), flowPanel);
|
||||
flowDeleteButton->setObjectName(QStringLiteral("dangerOutlineButton"));
|
||||
QLabel *flowVelocityLabel = new QLabel(QStringLiteral("MoveJ 速度"), flowPanel);
|
||||
m_jointFlowVelocitySpin = new QDoubleSpinBox(flowPanel);
|
||||
m_jointFlowVelocitySpin->setRange(0.001, 10.0);
|
||||
m_jointFlowVelocitySpin->setDecimals(3);
|
||||
m_jointFlowVelocitySpin->setSingleStep(0.01);
|
||||
m_jointFlowVelocitySpin->setValue(0.1);
|
||||
m_jointFlowVelocitySpin->setSuffix(QStringLiteral(" rad/s"));
|
||||
m_jointFlowVelocitySpin->setMinimumWidth(140);
|
||||
QLabel *flowAccelerationLabel = new QLabel(QStringLiteral("加速度"), flowPanel);
|
||||
m_jointFlowAccelerationSpin = new QDoubleSpinBox(flowPanel);
|
||||
m_jointFlowAccelerationSpin->setRange(0.001, 20.0);
|
||||
m_jointFlowAccelerationSpin->setDecimals(3);
|
||||
m_jointFlowAccelerationSpin->setSingleStep(0.01);
|
||||
m_jointFlowAccelerationSpin->setValue(0.1);
|
||||
m_jointFlowAccelerationSpin->setSuffix(QStringLiteral(" rad/s²"));
|
||||
m_jointFlowAccelerationSpin->setMinimumWidth(140);
|
||||
m_startJointPointLoopButton->setObjectName(QStringLiteral("primaryButton"));
|
||||
m_stopJointPointLoopButton->setObjectName(QStringLiteral("dangerButton"));
|
||||
flowActions->addWidget(flowDeleteButton);
|
||||
flowActions->addSpacing(10);
|
||||
flowActions->addWidget(flowVelocityLabel);
|
||||
flowActions->addWidget(m_jointFlowVelocitySpin);
|
||||
flowActions->addWidget(flowAccelerationLabel);
|
||||
flowActions->addWidget(m_jointFlowAccelerationSpin);
|
||||
flowActions->addStretch(1);
|
||||
flowActions->addWidget(loopCountLabel);
|
||||
loopCountLabel->setVisible(false);
|
||||
@ -691,9 +791,12 @@ QWidget *MainWindow::createArmPage()
|
||||
m_jointFlowEditor->removeSelectedNode();
|
||||
});
|
||||
connect(m_jointFlowEditor, &JointFlowEditor::changed, this, [this]() {
|
||||
QSettings settings;
|
||||
saveJointPrograms(settings);
|
||||
saveJointPrograms();
|
||||
});
|
||||
connect(m_jointFlowVelocitySpin, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](double) { saveJointPrograms(); });
|
||||
connect(m_jointFlowAccelerationSpin, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](double) { saveJointPrograms(); });
|
||||
FramelessToolDialog *jointFlowDialog = new FramelessToolDialog(this);
|
||||
m_jointFlowDialog = jointFlowDialog;
|
||||
m_jointFlowDialog->setObjectName(QStringLiteral("jointFlowDialog"));
|
||||
@ -734,7 +837,7 @@ QWidget *MainWindow::createArmPage()
|
||||
jointFlowClose->setToolTip(QStringLiteral("关闭"));
|
||||
jointFlowClose->setFixedSize(48, 45);
|
||||
jointFlowClose->setIcon(UiIcons::icon(QStringLiteral(":/icons/x.svg"),
|
||||
QColor(QStringLiteral("#4f5964")), QColor(QStringLiteral("#ffffff"))));
|
||||
QColor(QStringLiteral("#4f5964")), QColor(QStringLiteral("#4f5964"))));
|
||||
jointFlowTitleLayout->addWidget(jointFlowMark);
|
||||
jointFlowTitleLayout->addWidget(jointFlowTitle);
|
||||
jointFlowTitleLayout->addWidget(jointFlowSubtitle);
|
||||
@ -797,9 +900,52 @@ QWidget *MainWindow::createArmPage()
|
||||
ui.telemetryLayout->setStretch(0, 1);
|
||||
ui.telemetryLayout->setStretch(1, 1);
|
||||
|
||||
// Replace the old target/teaching workspace with hold-to-jog controls and
|
||||
// a read-only telemetry panel.
|
||||
ui.targetsPanel->hide();
|
||||
// Keep the MoveJ target panel in its own position-control tab. The model
|
||||
// workspace below only replaces the old teaching/telemetry arrangement.
|
||||
ui.targetsPanel->show();
|
||||
m_syncCurrentToTargetButton = new QPushButton(
|
||||
QStringLiteral("当前位置同步到目标"), ui.targetsPanel);
|
||||
m_syncCurrentToTargetButton->setObjectName(QStringLiteral("secondaryButton"));
|
||||
m_syncCurrentToTargetButton->setToolTip(
|
||||
QStringLiteral("按关节名称将最新遥测位置复制到目标角度和目标弧度"));
|
||||
const int zeroButtonIndex = ui.targetsHeader->indexOf(ui.zeroButton);
|
||||
ui.targetsHeader->insertWidget(
|
||||
zeroButtonIndex >= 0 ? zeroButtonIndex : ui.targetsHeader->count(),
|
||||
m_syncCurrentToTargetButton);
|
||||
|
||||
QFrame *moveJParameters = new QFrame(ui.targetsPanel);
|
||||
moveJParameters->setObjectName(QStringLiteral("jointFlowToolbar"));
|
||||
QHBoxLayout *moveJParametersLayout = new QHBoxLayout(moveJParameters);
|
||||
moveJParametersLayout->setContentsMargins(12, 8, 12, 8);
|
||||
moveJParametersLayout->setSpacing(8);
|
||||
QLabel *moveJParametersTitle = new QLabel(
|
||||
QStringLiteral("MoveJ 运动参数"), moveJParameters);
|
||||
moveJParametersTitle->setObjectName(QStringLiteral("eyebrow"));
|
||||
QLabel *moveJVelocityLabel = new QLabel(QStringLiteral("速度"), moveJParameters);
|
||||
m_moveJVelocitySpin = new QDoubleSpinBox(moveJParameters);
|
||||
m_moveJVelocitySpin->setRange(0.001, 10.0);
|
||||
m_moveJVelocitySpin->setDecimals(3);
|
||||
m_moveJVelocitySpin->setSingleStep(0.01);
|
||||
m_moveJVelocitySpin->setValue(0.1);
|
||||
m_moveJVelocitySpin->setSuffix(QStringLiteral(" rad/s"));
|
||||
m_moveJVelocitySpin->setMinimumWidth(150);
|
||||
QLabel *moveJAccelerationLabel = new QLabel(
|
||||
QStringLiteral("加速度"), moveJParameters);
|
||||
m_moveJAccelerationSpin = new QDoubleSpinBox(moveJParameters);
|
||||
m_moveJAccelerationSpin->setRange(0.001, 20.0);
|
||||
m_moveJAccelerationSpin->setDecimals(3);
|
||||
m_moveJAccelerationSpin->setSingleStep(0.01);
|
||||
m_moveJAccelerationSpin->setValue(0.1);
|
||||
m_moveJAccelerationSpin->setSuffix(QStringLiteral(" rad/s²"));
|
||||
m_moveJAccelerationSpin->setMinimumWidth(150);
|
||||
moveJParametersLayout->addWidget(moveJParametersTitle);
|
||||
moveJParametersLayout->addSpacing(12);
|
||||
moveJParametersLayout->addWidget(moveJVelocityLabel);
|
||||
moveJParametersLayout->addWidget(m_moveJVelocitySpin);
|
||||
moveJParametersLayout->addWidget(moveJAccelerationLabel);
|
||||
moveJParametersLayout->addWidget(m_moveJAccelerationSpin);
|
||||
moveJParametersLayout->addStretch(1);
|
||||
ui.targetsLayout->insertWidget(1, moveJParameters);
|
||||
ui.teachPanel->hide();
|
||||
ui.urdfTabLayout->removeWidget(ui.urdfViewer);
|
||||
ui.urdfTabLayout->removeWidget(ui.teachPanel);
|
||||
@ -1112,8 +1258,8 @@ QWidget *MainWindow::createArmPage()
|
||||
|
||||
const int commandTabIndex = ui.armTabs->indexOf(ui.jointControlTab);
|
||||
if (commandTabIndex >= 0)
|
||||
ui.armTabs->removeTab(commandTabIndex);
|
||||
ui.jointControlTab->hide();
|
||||
ui.armTabs->setTabText(commandTabIndex, QStringLiteral("关节位置控制"));
|
||||
ui.jointControlTab->show();
|
||||
ui.armTabs->addTab(new RpcServiceWidget(QStringLiteral("cmvr.api.ArmService"), m_client),
|
||||
QStringLiteral("全部接口"));
|
||||
ui.armTabs->setCurrentWidget(ui.urdfTab);
|
||||
@ -1124,6 +1270,8 @@ QWidget *MainWindow::createArmPage()
|
||||
m_calibrateZeroButton->setIcon(UiIcons::icon(QStringLiteral(":/icons/crosshair.svg")));
|
||||
m_stopButton->setIcon(UiIcons::icon(QStringLiteral(":/icons/square.svg"), Qt::white,
|
||||
Qt::white, QColor(QStringLiteral("#f4dddd"))));
|
||||
m_sendMoveButton->setIcon(UiIcons::icon(QStringLiteral(":/icons/send.svg"), Qt::white,
|
||||
Qt::white, QColor(QStringLiteral("#e8eef5"))));
|
||||
m_jogStopButton->setIcon(UiIcons::icon(QStringLiteral(":/icons/square.svg"),
|
||||
QColor(QStringLiteral("#cc3434"))));
|
||||
connect(m_armIdEdit, &QLineEdit::textChanged, m_armDeviceSummary,
|
||||
@ -1177,6 +1325,33 @@ QWidget *MainWindow::createArmPage()
|
||||
connect(m_stopButton, &QPushButton::clicked, this, [this]() {
|
||||
m_client->requestArmStop(m_armIdEdit->text().trimmed());
|
||||
});
|
||||
connect(ui.zeroButton, &QPushButton::clicked, this, [this]() {
|
||||
for (QDoubleSpinBox *spin : m_targetSpins)
|
||||
spin->setValue(0.0);
|
||||
});
|
||||
connect(m_syncCurrentToTargetButton, &QPushButton::clicked, this, [this]() {
|
||||
QStringList missing;
|
||||
for (int row = 0; row < m_activeArmJointNames.size(); ++row) {
|
||||
const QString &jointName = m_activeArmJointNames.at(row);
|
||||
if (!m_latestArmJointPositions.contains(jointName)
|
||||
|| row >= m_targetRadianSpins.size()) {
|
||||
missing.append(jointName);
|
||||
continue;
|
||||
}
|
||||
m_targetRadianSpins.at(row)->setValue(
|
||||
m_latestArmJointPositions.value(jointName));
|
||||
}
|
||||
if (!missing.isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("同步当前位置"),
|
||||
QStringLiteral("以下关节尚无遥测位置:\n%1\n\n请先启动遥测。")
|
||||
.arg(missing.join(QStringLiteral(", "))));
|
||||
return;
|
||||
}
|
||||
appendLog(QStringLiteral("OK"),
|
||||
QStringLiteral("已将 %1 个关节的遥测位置同步到 MoveJ 目标")
|
||||
.arg(m_activeArmJointNames.size()));
|
||||
});
|
||||
connect(m_sendMoveButton, &QPushButton::clicked, this, &MainWindow::sendMoveJ);
|
||||
connect(m_jogStopButton, &QPushButton::clicked, this, &MainWindow::stopArmJog);
|
||||
connect(m_jogSpeedSlider, &QSlider::valueChanged, this, [this](int value) {
|
||||
m_jogSpeedValue->setText(QStringLiteral("%1%").arg(value));
|
||||
@ -1238,6 +1413,22 @@ QWidget *MainWindow::createArmPage()
|
||||
m_jointTable->verticalHeader()->setDefaultSectionSize(28);
|
||||
m_jointTable->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
m_motionTable->setColumnCount(5);
|
||||
m_motionTable->setHorizontalHeaderLabels({
|
||||
QStringLiteral("关节"), QStringLiteral("当前位置 (°)"),
|
||||
QStringLiteral("当前位置 (rad)"), QStringLiteral("目标角度 (°)"),
|
||||
QStringLiteral("目标弧度 (rad)")});
|
||||
m_motionTable->setAlternatingRowColors(true);
|
||||
m_motionTable->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
m_motionTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
m_motionTable->verticalHeader()->setVisible(false);
|
||||
m_motionTable->verticalHeader()->setDefaultSectionSize(38);
|
||||
m_motionTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
m_motionTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
m_motionTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
|
||||
m_motionTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
|
||||
m_motionTable->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Stretch);
|
||||
|
||||
m_activeArmJointNames.clear();
|
||||
m_jointTable->setRowCount(0);
|
||||
m_zeroJointCombo->clear();
|
||||
@ -1253,7 +1444,14 @@ QWidget *MainWindow::createArmPage()
|
||||
m_client->setArmTelemetry(oldDeviceId, false);
|
||||
m_armIdEdit->setText(newDeviceId);
|
||||
m_activeArmJointNames.clear();
|
||||
m_latestArmJointPositions.clear();
|
||||
m_jointTable->setRowCount(0);
|
||||
m_targetSpins.clear();
|
||||
m_targetRadianSpins.clear();
|
||||
m_motionTable->clearContents();
|
||||
m_motionTable->setRowCount(0);
|
||||
m_sendMoveButton->setEnabled(false);
|
||||
m_syncCurrentToTargetButton->setEnabled(false);
|
||||
rebuildArmJogControls();
|
||||
m_zeroJointCombo->clear();
|
||||
m_armDefaultBaseFrame.clear();
|
||||
@ -1273,7 +1471,8 @@ QWidget *MainWindow::createArmPage()
|
||||
m_serviceButtons << m_armTelemetryButton << m_armGlobalStopButton
|
||||
<< m_torqueOnButton << m_torqueOffButton
|
||||
<< m_clearFaultButton << m_calibrateZeroButton
|
||||
<< m_stopButton << m_jogStopButton;
|
||||
<< m_stopButton << m_jogStopButton << m_sendMoveButton
|
||||
<< m_syncCurrentToTargetButton;
|
||||
return page;
|
||||
}
|
||||
|
||||
@ -1372,6 +1571,8 @@ void MainWindow::refreshCameraStreamControls()
|
||||
m_cameraCodecCombo->setEnabled(false);
|
||||
m_cameraStreamModeCombo->setEnabled(!m_cameraStreaming);
|
||||
m_snapshotButton->setEnabled(m_connected && !m_cameraStreaming);
|
||||
if (m_depthSnapshotButton)
|
||||
m_depthSnapshotButton->setEnabled(m_connected && !m_cameraStreaming);
|
||||
m_cameraStreamStateLabel->setText(m_cameraStreaming
|
||||
? QStringLiteral("%1 路播放中").arg(m_runningCameraIds.size())
|
||||
: QStringLiteral("已停止"));
|
||||
@ -1396,6 +1597,10 @@ QWidget *MainWindow::createCameraPage()
|
||||
ui.viewerLayout->addWidget(m_cameraPreviewContainer, 1);
|
||||
m_cameraDeviceCombo = ui.cameraDeviceCombo;
|
||||
m_snapshotButton = ui.snapshotButton;
|
||||
m_depthSnapshotButton = new QPushButton(QStringLiteral("获取深度图像"), ui.controlsPanel);
|
||||
m_depthSnapshotButton->setObjectName(QStringLiteral("secondaryButton"));
|
||||
const int snapshotIndex = ui.controlsLayout->indexOf(m_snapshotButton);
|
||||
ui.controlsLayout->insertWidget(snapshotIndex + 1, m_depthSnapshotButton);
|
||||
m_cameraStreamButton = ui.cameraStreamButton;
|
||||
m_cameraCodecCombo = ui.codecCombo;
|
||||
m_cameraStreamModeCombo = ui.streamModeCombo;
|
||||
@ -1410,6 +1615,7 @@ QWidget *MainWindow::createCameraPage()
|
||||
m_cameraRecordStateLabel = ui.cameraRecordStateLabel;
|
||||
m_saveImageButton->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
|
||||
m_snapshotButton->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton));
|
||||
m_depthSnapshotButton->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton));
|
||||
m_cameraStreamButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
|
||||
m_cameraRecordButton->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
|
||||
|
||||
@ -1419,6 +1625,11 @@ QWidget *MainWindow::createCameraPage()
|
||||
if (!cameraIds.isEmpty())
|
||||
m_client->requestSnapshot(cameraIds.first());
|
||||
});
|
||||
connect(m_depthSnapshotButton, &QPushButton::clicked, this, [this]() {
|
||||
const QStringList cameraIds = configuredCameraIds();
|
||||
if (!cameraIds.isEmpty())
|
||||
m_client->requestDepthSnapshot(cameraIds.first());
|
||||
});
|
||||
connect(m_cameraCodecCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index) {
|
||||
const QString codec = index == 1 ? QStringLiteral("h265") : QStringLiteral("h264");
|
||||
@ -1488,7 +1699,9 @@ QWidget *MainWindow::createCameraPage()
|
||||
}
|
||||
});
|
||||
rebuildCameraPreviewGrid(configuredCameraIds());
|
||||
m_serviceButtons << m_snapshotButton << m_cameraStreamButton << m_cameraRecordButton;
|
||||
ui.viewerTitle->setText(QStringLiteral("RGB / 深度预览"));
|
||||
m_serviceButtons << m_snapshotButton << m_depthSnapshotButton
|
||||
<< m_cameraStreamButton << m_cameraRecordButton;
|
||||
return withRpcExplorer(page, m_client, QStringLiteral("cmvr.api.CameraService"));
|
||||
}
|
||||
|
||||
|
||||
@ -175,6 +175,46 @@ VideoFrame videoFrameFromImage(const QImage &image)
|
||||
}
|
||||
|
||||
#ifdef CMVR_WITH_GRPC
|
||||
QImage depthImageFromFrame(const cmvr::api::FrameData &frame)
|
||||
{
|
||||
if (frame.width() <= 0 || frame.height() <= 0)
|
||||
return {};
|
||||
const bool uint16Depth = frame.type() == cmvr::api::FrameData::U16C1;
|
||||
const bool floatDepth = frame.type() == cmvr::api::FrameData::F32C1;
|
||||
const int bytesPerPixel = uint16Depth ? 2 : (floatDepth ? 4 : 0);
|
||||
if (bytesPerPixel == 0
|
||||
|| frame.data().size() < frame.width() * frame.height() * bytesPerPixel)
|
||||
return {};
|
||||
|
||||
QImage image(frame.width(), frame.height(), QImage::Format_RGB888);
|
||||
const char *source = frame.data().data();
|
||||
for (int y = 0; y < frame.height(); ++y) {
|
||||
uchar *destination = image.scanLine(y);
|
||||
for (int x = 0; x < frame.width(); ++x) {
|
||||
const int index = y * frame.width() + x;
|
||||
double metres = 0.0;
|
||||
if (uint16Depth) {
|
||||
quint16 millimetres = 0;
|
||||
std::memcpy(&millimetres, source + index * 2, sizeof(millimetres));
|
||||
metres = millimetres / 1000.0;
|
||||
} else {
|
||||
float value = 0.0f;
|
||||
std::memcpy(&value, source + index * 4, sizeof(value));
|
||||
metres = value;
|
||||
}
|
||||
QColor color(Qt::black);
|
||||
if (std::isfinite(metres) && metres > 0.0) {
|
||||
const double normalized = qBound(0.0, metres / 5.0, 1.0);
|
||||
color = QColor::fromHsvF(normalized * 0.66, 0.9, 1.0);
|
||||
}
|
||||
destination[x * 3] = static_cast<uchar>(color.red());
|
||||
destination[x * 3 + 1] = static_cast<uchar>(color.green());
|
||||
destination[x * 3 + 2] = static_cast<uchar>(color.blue());
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
VideoFrame videoFrameFromDepth(const cmvr::api::FrameData &frame)
|
||||
{
|
||||
if (frame.width() <= 0 || frame.height() <= 0 ||
|
||||
@ -1073,6 +1113,56 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void depthSnapshot(const QString &cameraId)
|
||||
{
|
||||
if (!ensureConnected(QStringLiteral("Depth Snapshot"))
|
||||
|| !ensureDeviceId(QStringLiteral("Depth Snapshot"), cameraId))
|
||||
return;
|
||||
if (m_demoMode) {
|
||||
QImage image(640, 480, QImage::Format_RGB888);
|
||||
for (int y = 0; y < image.height(); ++y) {
|
||||
uchar *line = image.scanLine(y);
|
||||
for (int x = 0; x < image.width(); ++x) {
|
||||
const QColor color = QColor::fromHsvF(
|
||||
(static_cast<double>(x) / image.width()) * 0.66, 0.9, 1.0);
|
||||
line[x * 3] = static_cast<uchar>(color.red());
|
||||
line[x * 3 + 1] = static_cast<uchar>(color.green());
|
||||
line[x * 3 + 2] = static_cast<uchar>(color.blue());
|
||||
}
|
||||
}
|
||||
emit imageReceived(image, QStringLiteral("深度 · 640 x 480 · DEMO · 0–5 m"));
|
||||
emit commandFinished(QStringLiteral("Depth Snapshot"), true,
|
||||
QStringLiteral("深度图像获取成功"));
|
||||
return;
|
||||
}
|
||||
#ifdef CMVR_WITH_GRPC
|
||||
cmvr::api::GetDepthImageCommand::Request request;
|
||||
fillHeader(request.mutable_header(), cameraId);
|
||||
cmvr::api::GetDepthImageCommand::Feedback response;
|
||||
grpc::ClientContext context;
|
||||
setDeadline(context, 3000);
|
||||
const grpc::Status status = m_camera->GetDepthImage(&context, request, &response);
|
||||
if (!status.ok() || !response.header().success()) {
|
||||
finish(QStringLiteral("Depth Snapshot"), status, response.header().success(),
|
||||
QString::fromStdString(response.header().error_message()));
|
||||
return;
|
||||
}
|
||||
const auto &frame = response.depth_frame();
|
||||
const QImage image = depthImageFromFrame(frame);
|
||||
if (image.isNull()) {
|
||||
emit commandFinished(QStringLiteral("Depth Snapshot"), false,
|
||||
QStringLiteral("不支持的深度图格式:type=%1, codec=%2")
|
||||
.arg(frame.type()).arg(QString::fromStdString(frame.codec())));
|
||||
return;
|
||||
}
|
||||
emit imageReceived(image, QStringLiteral("深度 · %1 x %2 · %3 · 0–5 m")
|
||||
.arg(frame.width()).arg(frame.height())
|
||||
.arg(QString::fromStdString(frame.codec())));
|
||||
emit commandFinished(QStringLiteral("Depth Snapshot"), true,
|
||||
QStringLiteral("深度图像获取成功"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void startDexHandTactileStream(const QString &deviceId)
|
||||
{
|
||||
if (!ensureConnected(QStringLiteral("DexHand Tactile Stream"))
|
||||
@ -3660,6 +3750,8 @@ RobotClient::RobotClient(QObject *parent)
|
||||
connect(this, &RobotClient::armCalibrateZeroRequested,
|
||||
m_worker, &BackendWorker::armCalibrateZero);
|
||||
connect(this, &RobotClient::snapshotRequested, m_worker, &BackendWorker::snapshot);
|
||||
connect(this, &RobotClient::depthSnapshotRequested,
|
||||
m_worker, &BackendWorker::depthSnapshot);
|
||||
connect(this, &RobotClient::cameraStatusRequested, m_worker, &BackendWorker::getCameraStatus);
|
||||
connect(this, &RobotClient::dexHandStatusRequested,
|
||||
m_worker, &BackendWorker::getDexHandStatus);
|
||||
@ -3794,6 +3886,10 @@ void RobotClient::requestArmCalibrateZero(const QString &deviceId, const QString
|
||||
emit armCalibrateZeroRequested(deviceId, jointName);
|
||||
}
|
||||
void RobotClient::requestSnapshot(const QString &cameraId) { emit snapshotRequested(cameraId); }
|
||||
void RobotClient::requestDepthSnapshot(const QString &cameraId)
|
||||
{
|
||||
emit depthSnapshotRequested(cameraId);
|
||||
}
|
||||
void RobotClient::requestCameraStatus(const QString &cameraId)
|
||||
{
|
||||
emit cameraStatusRequested(cameraId);
|
||||
|
||||
@ -47,6 +47,7 @@ public slots:
|
||||
void requestArmClearFault(const QString &deviceId);
|
||||
void requestArmCalibrateZero(const QString &deviceId, const QString &jointName);
|
||||
void requestSnapshot(const QString &cameraId);
|
||||
void requestDepthSnapshot(const QString &cameraId);
|
||||
void requestCameraStatus(const QString &cameraId);
|
||||
void requestDexHandStatus(const QString &deviceId);
|
||||
void requestDexHandCommand(const QString &deviceId, const QString &command,
|
||||
@ -115,6 +116,7 @@ signals:
|
||||
void armClearFaultRequested(const QString &deviceId);
|
||||
void armCalibrateZeroRequested(const QString &deviceId, const QString &jointName);
|
||||
void snapshotRequested(const QString &cameraId);
|
||||
void depthSnapshotRequested(const QString &cameraId);
|
||||
void cameraStatusRequested(const QString &cameraId);
|
||||
void dexHandStatusRequested(const QString &deviceId);
|
||||
void dexHandCommandRequested(const QString &deviceId, const QString &command,
|
||||
|
||||
@ -1699,13 +1699,14 @@ QPushButton#jointFlowDialogCloseButton {
|
||||
border-top-right-radius: 8px;
|
||||
}
|
||||
QPushButton#jointFlowDialogCloseButton:hover {
|
||||
background: #d83b3b;
|
||||
background: #fde8e8;
|
||||
}
|
||||
QWidget#jointFlowWorkspace {
|
||||
background: #f3f6f9;
|
||||
}
|
||||
QFrame#jointPointPanel,
|
||||
QFrame#jointFlowPanel {
|
||||
QFrame#jointFlowPanel,
|
||||
QFrame#jointProgramGroupPanel {
|
||||
background: #ffffff;
|
||||
border: 1px solid #dce3ea;
|
||||
border-radius: 8px;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user