108 lines
3.4 KiB
C++
108 lines
3.4 KiB
C++
#pragma once
|
|||
|
|
|
||
|
|
#include <QImage>
|
||
|
|
#include <QRect>
|
||
|
|
#include <QWidget>
|
||
|
|
|
||
|
|
#include "ObstaclePlanner.h"
|
||
|
|
|
||
|
|
class CameraManager;
|
||
|
|
class CoordTransformPanel;
|
||
|
|
class OpcUaCommManager;
|
||
|
|
class YoloDetector;
|
||
|
|
|
||
|
|
class QCheckBox;
|
||
|
|
class QComboBox;
|
||
|
|
class QDoubleSpinBox;
|
||
|
|
class QLabel;
|
||
|
|
class QPushButton;
|
||
|
|
class QTableWidget;
|
||
|
|
class QTabWidget;
|
||
|
|
|
||
|
|
class ObstaclePlannerPanel : public QWidget
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
public:
|
||
|
|
explicit ObstaclePlannerPanel(CameraManager* cameraManager,
|
||
|
|
YoloDetector* yoloDetector,
|
||
|
|
CoordTransformPanel* coordPanel,
|
||
|
|
OpcUaCommManager* opcua,
|
||
|
|
QWidget* parent = nullptr);
|
||
|
|
|
||
|
|
signals:
|
||
|
|
void logMessage(const QString& message);
|
||
|
|
|
||
|
|
private slots:
|
||
|
|
void onGenerateDemo();
|
||
|
|
void onLoadImage();
|
||
|
|
void onCaptureImage();
|
||
|
|
void onDetectAndPlan();
|
||
|
|
void onReadRobotPose();
|
||
|
|
void onReadVisualTarget();
|
||
|
|
void onSelfTest();
|
||
|
|
void onExport();
|
||
|
|
|
||
|
|
private:
|
||
|
|
void buildUi();
|
||
|
|
QDoubleSpinBox* makeSpin(double minimum, double maximum,
|
||
|
|
double value, int decimals = 1);
|
||
|
|
SafetyPoint3D startPoint() const;
|
||
|
|
SafetyPoint3D goalPoint() const;
|
||
|
|
SafetyAabb manualObstacle() const;
|
||
|
|
void setStartPoint(const SafetyPoint3D& point);
|
||
|
|
void setGoalPoint(const SafetyPoint3D& point);
|
||
|
|
void showSourceImage(const QImage& image);
|
||
|
|
void showResult(const SafetyPathResult& result,
|
||
|
|
const QRect& detectedPixelBox,
|
||
|
|
const QString& detectorDescription);
|
||
|
|
QImage makeAnnotatedImage(const QRect& detectedPixelBox,
|
||
|
|
const QString& detectorDescription) const;
|
||
|
|
QImage makePlanImage(const SafetyPathResult& result) const;
|
||
|
|
void fillWaypointTable(const SafetyPathResult& result);
|
||
|
|
bool exportResultFiles(const QString& directory, QString* error = nullptr) const;
|
||
|
|
|
||
|
|
CameraManager* m_cameraManager = nullptr;
|
||
|
|
YoloDetector* m_yoloDetector = nullptr;
|
||
|
|
CoordTransformPanel* m_coordPanel = nullptr;
|
||
|
|
OpcUaCommManager* m_opcua = nullptr;
|
||
|
|
|
||
|
|
QComboBox* m_comboDetectionMode = nullptr;
|
||
|
|
QComboBox* m_comboDemoScenario = nullptr;
|
||
|
|
QCheckBox* m_checkObstaclePresent = nullptr;
|
||
|
|
QPushButton* m_buttonPlan = nullptr;
|
||
|
|
QPushButton* m_buttonExport = nullptr;
|
||
|
|
QLabel* m_labelSource = nullptr;
|
||
|
|
QLabel* m_labelPlan = nullptr;
|
||
|
|
QLabel* m_labelStatus = nullptr;
|
||
|
|
QTableWidget* m_tableWaypoints = nullptr;
|
||
|
|
QTabWidget* m_resultTabs = nullptr;
|
||
|
|
|
||
|
|
QDoubleSpinBox* m_startX = nullptr;
|
||
|
|
QDoubleSpinBox* m_startY = nullptr;
|
||
|
|
QDoubleSpinBox* m_startZ = nullptr;
|
||
|
|
QDoubleSpinBox* m_goalX = nullptr;
|
||
|
|
QDoubleSpinBox* m_goalY = nullptr;
|
||
|
|
QDoubleSpinBox* m_goalZ = nullptr;
|
||
|
|
QDoubleSpinBox* m_obstacleX = nullptr;
|
||
|
|
QDoubleSpinBox* m_obstacleY = nullptr;
|
||
|
|
QDoubleSpinBox* m_tableZ = nullptr;
|
||
|
|
QDoubleSpinBox* m_sizeX = nullptr;
|
||
|
|
QDoubleSpinBox* m_sizeY = nullptr;
|
||
|
|
QDoubleSpinBox* m_sizeZ = nullptr;
|
||
|
|
QDoubleSpinBox* m_workspaceXMin = nullptr;
|
||
|
|
QDoubleSpinBox* m_workspaceXMax = nullptr;
|
||
|
|
QDoubleSpinBox* m_workspaceYMin = nullptr;
|
||
|
|
QDoubleSpinBox* m_workspaceYMax = nullptr;
|
||
|
|
QDoubleSpinBox* m_clearance = nullptr;
|
||
|
|
QDoubleSpinBox* m_overhead = nullptr;
|
||
|
|
QDoubleSpinBox* m_maxZ = nullptr;
|
||
|
|
|
||
|
|
QImage m_sourceImage;
|
||
|
|
QImage m_annotatedImage;
|
||
|
|
QImage m_planImage;
|
||
|
|
QRect m_lastPixelBox;
|
||
|
|
SafetyPathResult m_lastResult;
|
||
|
|
QString m_lastDetectorDescription;
|
||
|
|
bool m_hasResult = false;
|
||
|
|
};
|