6 #include <QDoubleSpinBox> 11 #include <QtConcurrent/QtConcurrentRun> 17 package_name_(
"fanuc_grinding_scanning")
19 setObjectName(
"ScanningWidget_");
20 QLabel* cad_meshname_label =
new QLabel(
"CAD mesh file:");
25 QHBoxLayout* cad_meshname_layout =
new QHBoxLayout;
29 QLabel* cad_marker_name_label =
new QLabel(
"CAD marker name:");
31 QHBoxLayout* cad_marker_name_layout =
new QHBoxLayout;
32 cad_marker_name_layout->addWidget(cad_marker_name_label);
49 QLabel* trajectory_yaml_label =
new QLabel(
"Scan trajectory YAML file:");
54 QHBoxLayout* traj_yaml_layout =
new QHBoxLayout;
58 QLabel* sls_2_server_name_label =
new QLabel(
"SLS-2 server name:");
60 QHBoxLayout* sls_2_server_name_layout =
new QHBoxLayout;
61 sls_2_server_name_layout->addWidget(sls_2_server_name_label);
63 QLabel* sls_2_ip_address_label =
new QLabel(
"SLS-2 IP address:");
66 QHBoxLayout* sls_2_ip_address_layout =
new QHBoxLayout;
67 sls_2_ip_address_layout->addWidget(sls_2_ip_address_label);
70 QLabel* calibration_yaml_label =
new QLabel(
"SLS-2 calibration YAML file:");
75 QHBoxLayout* calibration_yaml_layout =
new QHBoxLayout;
79 QVBoxLayout* scan_yaml_widget_layout =
new QVBoxLayout(
start_scan_tab_);
80 scan_yaml_widget_layout->addWidget(trajectory_yaml_label);
81 scan_yaml_widget_layout->addLayout(traj_yaml_layout);
82 scan_yaml_widget_layout->addStretch(1);
83 scan_yaml_widget_layout->addWidget(calibration_yaml_label);
84 scan_yaml_widget_layout->addLayout(calibration_yaml_layout);
85 scan_yaml_widget_layout->addStretch(1);
86 scan_yaml_widget_layout->addLayout(sls_2_server_name_layout);
87 scan_yaml_widget_layout->addLayout(sls_2_ip_address_layout);
89 QLabel* down_sampling_label =
new QLabel(
"Point cloud down-sampling leaf size:");
95 scan_yaml_widget_layout->addWidget(down_sampling_label);
102 QLabel* scan_mesh_label =
new QLabel(
"Import a scan file:");
107 QHBoxLayout* scan_file_label_layout =
new QHBoxLayout;
108 scan_file_label_layout->addWidget(
scan_file_);
110 import_scan_ =
new QPushButton(
"Import scan mesh or point cloud");
111 QVBoxLayout* import_scan_widget_layout =
new QVBoxLayout (
import_scan_tab_);
112 import_scan_widget_layout->addWidget(scan_mesh_label);
113 import_scan_widget_layout->addLayout(scan_file_label_layout);
114 import_scan_widget_layout->addStretch(1);
117 QLabel* scan_marker_name_label =
new QLabel(
"Scan marker name:");
119 QVBoxLayout* scan_marker_name_layout =
new QVBoxLayout;
120 scan_choice_layout->addLayout(scan_marker_name_layout);
121 scan_marker_name_layout->addWidget(scan_marker_name_label);
124 QVBoxLayout* scanning_layout =
new QVBoxLayout(
this);
125 scanning_layout->addWidget(cad_meshname_label);
126 scanning_layout->addLayout(cad_meshname_layout);
127 scanning_layout->addLayout(cad_marker_name_layout);
129 scanning_layout->addStretch(2);
131 scanning_layout->addStretch(1);
164 Q_EMIT
sendStatus(QString::fromStdString(msg->data));
170 srv_scanning_.request.SLS2ServerName = params.SLS2ServerName;
172 srv_scanning_.request.YamlCalibrationFileName = params.YamlCalibrationFileName;
224 QFileDialog cad_mesh_browser;
226 QString file_path = cad_mesh_browser.getOpenFileName(0, tr(
"Import File Dialog"), QString::fromStdString(meshes_path), tr(
"Meshfiles (*.ply *.stl *.obj)"));
235 QFileDialog yaml_browser;
237 QString file_path = yaml_browser.getOpenFileName(0, tr(
"Import File Dialog"), QString::fromStdString(yaml_path), tr(
"Yaml files (*.yaml)"));
246 QFileDialog yaml_browser;
248 QString file_path = yaml_browser.getOpenFileName(0, tr(
"Import File Dialog"), QString::fromStdString(yaml_path), tr(
"Yaml files (*.yaml)"));
257 QFileDialog scan_file_browser;
258 QString file_path = scan_file_browser.getOpenFileName(0, tr(
"Import File Dialog"),
"/home/dell/catkin_ws/src/fanuc_grinding/meshes");
276 "The specified file does not exist",
284 Q_EMIT
sendMsgBox(
"Error publishing CAD marker",
285 "The marker name cannot be empty",
"");
316 "The specified file does not exist",
318 Q_EMIT
sendStatus(
"Scan file does not exist");
323 Q_EMIT
sendMsgBox(
"Error publishing scan marker",
324 "The marker name cannot be empty",
"");
367 Q_EMIT
sendMsgBox(
"Error importing mesh/point cloud file",
393 Q_EMIT
sendMsgBox(
"Error importing mesh/point cloud file",
405 if (!traj_yaml_file.exists())
408 "The specified trajectory YAML file does not exist",
"");
409 Q_EMIT
sendStatus(
"Trajectory YAML file does not exist");
414 if (!calibration_yaml_file.exists())
417 "The specified calibration YAML file does not exist",
"");
423 Q_EMIT
sendMsgBox(
"Error starting scanning",
"Please specify the scan marker name",
"");
424 Q_EMIT
sendStatus(
"Scan marker name is empty");
431 "Please specify the SLS-2 server name",
"");
432 Q_EMIT
sendStatus(
"SLS-2 server name is empty");
458 QString::fromStdString(
srv_scanning_.response.ReturnMessage),
505 ROS_INFO_STREAM(objectName().toStdString() +
" service connections have been made");
538 if (config.
mapGetString(objectName() +
"cad_file", &tmp))
543 cad_meshname_->setText(QString::fromStdString(meshes_path+
"DAC_580813.stl"));
546 if (config.
mapGetString(objectName() +
"cad_marker_name", &tmp))
551 if (config.
mapGetString(objectName() +
"traj_yaml_file", &tmp))
556 traj_yaml_file_->setText(QString::fromStdString(meshes_path+
"trajectory_DaC.yaml"));
559 if (config.
mapGetString(objectName() +
"sls_2_server_name", &tmp))
564 if (config.
mapGetString(objectName() +
"sls_2_ip_address", &tmp))
569 if (config.
mapGetString(objectName() +
"calibration_yaml_file", &tmp))
577 if (config.
mapGetString(objectName() +
"scan_file", &tmp))
582 scan_file_->setText(QString::fromStdString(yaml_path+
"DAC_580813_scan.ply"));
585 if (config.
mapGetString(objectName() +
"scan_marker_name", &tmp))
591 if (config.
mapGetFloat(objectName() +
"down_sampling_leaf_size", &tmp_float))
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool call(MReq &req, MRes &res)
bool mapGetFloat(const QString &key, float *value_out) const
bool mapGetString(const QString &key, QString *value_out) const
void mapSetValue(const QString &key, QVariant value)
bool waitForExistence(ros::Duration timeout=ros::Duration(-1))
#define ROS_WARN_STREAM(args)
ROSLIB_DECL std::string getPath(const std::string &package_name)
#define ROS_INFO_STREAM(args)