37 #include <QFormLayout>
39 #include <QHBoxLayout>
42 #include <QMessageBox>
43 #include <QPushButton>
45 #include <QVBoxLayout>
54 : QWidget(parent), config_data_(config_data)
57 QVBoxLayout* layout =
new QVBoxLayout();
59 QGroupBox* controller_options_group =
new QGroupBox(
"Controller Options");
62 title_ =
new QLabel(
this);
63 QFont group_title_font(QFont().defaultFamily(), 12, QFont::Bold);
64 title_->setFont(group_title_font);
65 layout->addWidget(title_);
67 QFormLayout* form_layout =
new QFormLayout();
68 form_layout->setContentsMargins(0, 15, 0, 15);
71 controller_name_field_ =
new QLineEdit(
this);
72 controller_name_field_->setMaximumWidth(400);
73 form_layout->addRow(
"Controller Name:", controller_name_field_);
76 controller_type_field_ =
new QComboBox(
this);
77 controller_type_field_->setEditable(
false);
78 controller_type_field_->setMaximumWidth(400);
79 form_layout->addRow(
"Controller Type:", controller_type_field_);
81 controller_options_group->setLayout(form_layout);
83 layout->addWidget(controller_options_group);
85 layout->setAlignment(Qt::AlignTop);
88 new_buttons_widget_ =
new QWidget();
89 QVBoxLayout* new_buttons_layout =
new QVBoxLayout();
91 QLabel* save_and_add =
new QLabel(
"Next, Add Components To Controller:",
this);
92 QFont save_and_add_font(QFont().defaultFamily(), 12, QFont::Bold);
93 save_and_add->setFont(save_and_add_font);
94 new_buttons_layout->addWidget(save_and_add);
96 QLabel* add_subtitle =
new QLabel(
"Recommended: ",
this);
97 QFont add_subtitle_font(QFont().defaultFamily(), 10, QFont::Bold);
98 add_subtitle->setFont(add_subtitle_font);
99 new_buttons_layout->addWidget(add_subtitle);
102 QPushButton* btn_save_groups_joints =
new QPushButton(
"Add Planning Group Joints",
this);
103 btn_save_groups_joints->setMaximumWidth(200);
104 connect(btn_save_groups_joints, SIGNAL(clicked()),
this, SIGNAL(saveJointsGroups()));
105 new_buttons_layout->addWidget(btn_save_groups_joints);
107 QLabel* add_subtitle2 =
new QLabel(
"Advanced Options:",
this);
108 add_subtitle2->setFont(add_subtitle_font);
109 new_buttons_layout->addWidget(add_subtitle2);
112 QPushButton* btn_save_joints =
new QPushButton(
"Add Individual Joints",
this);
113 btn_save_joints->setMaximumWidth(200);
114 connect(btn_save_joints, SIGNAL(clicked()),
this, SIGNAL(saveJoints()));
115 new_buttons_layout->addWidget(btn_save_joints);
118 new_buttons_widget_->setLayout(new_buttons_layout);
119 layout->addWidget(new_buttons_widget_);
122 layout->addItem(
new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
125 QHBoxLayout* controls_layout =
new QHBoxLayout();
128 btn_delete_ =
new QPushButton(
"&Delete Controller",
this);
129 btn_delete_->setMaximumWidth(200);
130 connect(btn_delete_, SIGNAL(clicked()),
this, SIGNAL(deleteController()));
131 controls_layout->addWidget(btn_delete_);
132 controls_layout->setAlignment(btn_delete_, Qt::AlignRight);
135 controls_layout->addItem(
new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
138 btn_save_ =
new QPushButton(
"&Save",
this);
140 connect(
btn_save_, SIGNAL(clicked()),
this, SIGNAL(save()));
142 controls_layout->setAlignment(
btn_save_, Qt::AlignRight);
145 QPushButton* btn_cancel =
new QPushButton(
"&Cancel",
this);
146 btn_cancel->setMaximumWidth(200);
147 connect(btn_cancel, SIGNAL(clicked()),
this, SIGNAL(cancelEditing()));
148 controls_layout->addWidget(btn_cancel);
149 controls_layout->setAlignment(btn_cancel, Qt::AlignRight);
152 layout->addLayout(controls_layout);
155 this->setLayout(layout);
165 if (searched_controller !=
nullptr)
167 const std::string controller_type = searched_controller->
type_;
171 if (type_index == -1)
173 QMessageBox::warning(
this,
"Missing Controller Type", QString(
"Setting controller type to the default value"));
197 const std::vector<std::string> default_types = {
"effort_controllers/JointTrajectoryController",
198 "velocity_controllers/JointTrajectoryController",
199 "position_controllers/JointTrajectoryController",
200 "FollowJointTrajectory",
"GripperCommand" };
206 for (
const std::string& type : default_types)