10 setObjectName(
"Pose info");
13 QGridLayout* geometric_pose_layout =
new QGridLayout;
15 geometric_pose_layout->addWidget(
new QLabel(
"X"), 0, 0);
16 geometric_pose_layout->addWidget(
x_, 0, 1);
18 geometric_pose_layout->addWidget(
new QLabel(
"W"), 0, 2);
19 geometric_pose_layout->addWidget(
w_, 0, 3);
21 geometric_pose_layout->addWidget(
new QLabel(
"Y"));
22 geometric_pose_layout->addWidget(
y_);
24 geometric_pose_layout->addWidget(
new QLabel(
"P"));
25 geometric_pose_layout->addWidget(
p_);
27 geometric_pose_layout->addWidget(
new QLabel(
"Z"));
28 geometric_pose_layout->addWidget(
z_);
30 geometric_pose_layout->addWidget(
new QLabel(
"R"));
31 geometric_pose_layout->addWidget(
r_);
33 QGridLayout* info_layout =
new QGridLayout;
35 info_layout->addWidget(
new QLabel(
"Layer level:"), 0, 0);
38 info_layout->addWidget(
new QLabel(
"Layer index:"));
41 info_layout->addWidget(
new QLabel(
"Polygon start:"));
44 info_layout->addWidget(
new QLabel(
"Polygon end:"));
47 info_layout->addWidget(
new QLabel(
"Entry pose:"));
50 info_layout->addWidget(
new QLabel(
"Exit pose:"));
53 QGridLayout* params_layout =
new QGridLayout;
55 params_layout->addWidget(
new QLabel(
"Movement type:"), 0, 0);
58 params_layout->addWidget(
new QLabel(
"Approach type:"));
61 params_layout->addWidget(
new QLabel(
"Blend radius:"));
64 params_layout->addWidget(
new QLabel(
"Speed:"));
65 params_layout->addWidget(
speed_);
67 params_layout->addWidget(
new QLabel(
"Laser power:"));
70 params_layout->addWidget(
new QLabel(
"Feed rate:"));
73 QHBoxLayout* get_pose_layout =
new QHBoxLayout;
76 get_pose_layout->addWidget(
new QLabel(
"Pose index:"));
79 QHBoxLayout* buttons_layout =
new QHBoxLayout;
93 QVBoxLayout *scroll_widget_layout =
new QVBoxLayout();
94 QWidget *scroll_widget =
new QWidget;
95 scroll_widget->setLayout(scroll_widget_layout);
96 QScrollArea *scroll_area =
new QScrollArea;
97 scroll_area->setWidget(scroll_widget);
98 scroll_area->setWidgetResizable(
true);
99 scroll_area->setFrameShape(QFrame::NoFrame);
100 QVBoxLayout* main_layout =
new QVBoxLayout(
this);
101 main_layout->addWidget(scroll_area);
103 scroll_widget_layout->addWidget(
new QLabel(
"<b>Geometric pose</b>"));
104 scroll_widget_layout->addLayout(geometric_pose_layout);
105 scroll_widget_layout->addStretch(1);
106 scroll_widget_layout->addWidget(
new QLabel(
"<b>Information</b>"));
107 scroll_widget_layout->addLayout(info_layout);
108 scroll_widget_layout->addStretch(1);
110 scroll_widget_layout->addWidget(
new QLabel(
"<b>Parameters</b>"));
111 scroll_widget_layout->addLayout(params_layout);
112 scroll_widget_layout->addStretch(2);
113 scroll_widget_layout->addLayout(get_pose_layout);
114 scroll_widget_layout->addLayout(buttons_layout);
127 "ram/pose_selector/get_poses_from_trajectory");
130 Q_EMIT setEnabled(
false);
163 Q_EMIT setEnabled(
false);
167 Q_EMIT setEnabled(
true);
225 if (success && (
pose_params_.response.poses.size() == 1))
240 Eigen::Affine3d current_pose_affine;
246 Eigen::Vector3d euler_angles = current_pose_affine.linear().eulerAngles(0, 1, 2);
248 x_->setText(QString::number(current_pose_affine.translation().x() * 1000.0) +
" mm");
249 y_->setText(QString::number(current_pose_affine.translation().y() * 1000.0) +
" mm");
250 z_->setText(QString::number(current_pose_affine.translation().z() * 1000.0) +
" mm");
252 const double rad_to_deg(57.2957795131);
253 w_->setText(QString::number(euler_angles[0] * rad_to_deg) +
" deg");
254 p_->setText(QString::number(euler_angles[1] * rad_to_deg) +
" deg");
255 r_->setText(QString::number(euler_angles[2] * rad_to_deg) +
" deg");
258 QString movement_type_str;
259 QString speed_unit_str =
"";
260 double speed_conversion_factor;
261 switch (
pose_params_.response.poses[0].params.movement_type)
264 movement_type_str =
"Joint";
265 speed_conversion_factor = 1.0;
268 movement_type_str =
"Linear";
269 speed_unit_str =
" meters/min";
270 speed_conversion_factor = 60.0;
273 movement_type_str =
"";
274 speed_conversion_factor = 0;
279 QString approach_type_str;
280 switch (
pose_params_.response.poses[0].params.approach_type)
283 approach_type_str =
"Stop/go";
286 approach_type_str =
"Blend radius";
289 approach_type_str =
"-";
296 QString::number(
pose_params_.response.poses[0].params.speed * speed_conversion_factor) + speed_unit_str);
299 QString::number(
pose_params_.response.poses[0].params.feed_rate * 60.0) +
" meters/min");
307 if (config.
mapGetInt(
"pose_index_box", &tmp_int))
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
ram_modify_trajectory::GetPosesFromTrajectory pose_params_
ros::Subscriber trajectory_sub_
void forwardButtonHandler()
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void checkForPublishers()
void poseMsgToEigen(const geometry_msgs::Pose &m, Eigen::Affine3d &e)
PoseInfo(QWidget *parent=NULL)
void save(rviz::Config config) const
bool call(MReq &req, MRes &res)
QPushButton * last_pose_button_
std::recursive_mutex pose_params_mutex_
void mapSetValue(const QString &key, QVariant value)
ros::ServiceClient get_poses_from_trajectory_client_
bool waitForExistence(ros::Duration timeout=ros::Duration(-1))
uint32_t getNumPublishers() const
std::string getTopic() const
virtual QString getName() const
void updateGUIparameters()
QPushButton * first_pose_button_
unsigned trajectory_size_
bool mapGetInt(const QString &key, int *value_out) const
void trajectoryCallback(const ram_msgs::AdditiveManufacturingTrajectoryConstPtr &)
void lastPoseButtonHandler()
#define ROS_INFO_STREAM(args)
QPushButton * forward_button_
void load(const rviz::Config &config)
virtual void save(Config config) const
void getPoseInformation()
#define ROS_ERROR_STREAM(args)
virtual void load(const Config &config)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void firstPoseButtonHandler()
QPushButton * back_button_