38 #include <QFileDialog>
39 #include <QFormLayout>
41 #include <QHBoxLayout>
44 #include <QMessageBox>
45 #include <QPushButton>
47 #include <QVBoxLayout>
61 QVBoxLayout* layout =
new QVBoxLayout();
63 QGroupBox* group1 =
new QGroupBox(
"Kinematics");
64 QGroupBox* group2 =
new QGroupBox(
"OMPL Planning");
68 QFont group_title_font(QFont().defaultFamily(), 12, QFont::Bold);
69 title_->setFont(group_title_font);
73 QFormLayout* form_layout =
new QFormLayout();
74 form_layout->setContentsMargins(0, 12, 0, 12);
100 QPushButton* kinematics_parameters_file_button =
new QPushButton(
"...",
this);
101 kinematics_parameters_file_button->setMaximumWidth(50);
102 connect(kinematics_parameters_file_button, SIGNAL(clicked()),
this, SLOT(selectKinematicsFile()));
103 QBoxLayout* kinematics_parameters_file_layout =
new QHBoxLayout(
this);
105 kinematics_parameters_file_layout->addWidget(kinematics_parameters_file_button);
106 kinematics_parameters_file_layout->setContentsMargins(0, 0, 0, 0);
107 QWidget* container =
new QWidget(
this);
108 container->setLayout(kinematics_parameters_file_layout);
109 form_layout->addRow(
"Kin. parameters file:", container);
111 group1->setLayout(form_layout);
115 QFormLayout* form_layout2 =
new QFormLayout();
116 form_layout2->setContentsMargins(0, 12, 0, 12);
124 group2->setLayout(form_layout2);
126 layout->addWidget(group1);
127 layout->addWidget(group2);
129 layout->setAlignment(Qt::AlignTop);
134 QVBoxLayout* new_buttons_layout_container =
new QVBoxLayout();
135 QHBoxLayout* label_layout =
new QHBoxLayout();
136 QHBoxLayout* recommended_options =
new QHBoxLayout();
137 QHBoxLayout* advanced_options =
new QHBoxLayout();
139 QLabel* save_and_add =
new QLabel(
"Next, Add Components To Group:",
this);
140 QFont save_and_add_font(QFont().defaultFamily(), 12, QFont::Bold);
141 save_and_add->setFont(save_and_add_font);
142 label_layout->addWidget(save_and_add);
145 QLabel* add_subtitle =
new QLabel(
"Recommended: ",
this);
146 QFont add_subtitle_font(QFont().defaultFamily(), 10, QFont::Bold);
147 add_subtitle->setFont(add_subtitle_font);
148 recommended_options->addWidget(add_subtitle, 0, Qt::AlignLeft);
151 QPushButton* btn_save_chain =
new QPushButton(
"Add Kin. Chain",
this);
152 btn_save_chain->setMaximumWidth(200);
153 connect(btn_save_chain, SIGNAL(clicked()),
this, SIGNAL(
saveChain()));
154 recommended_options->addWidget(btn_save_chain);
157 QPushButton* btn_save_joints =
new QPushButton(
"Add Joints",
this);
158 btn_save_joints->setMaximumWidth(200);
159 connect(btn_save_joints, SIGNAL(clicked()),
this, SIGNAL(
saveJoints()));
160 recommended_options->addWidget(btn_save_joints);
163 QLabel* add_subtitle2 =
new QLabel(
"Advanced Options:",
this);
164 add_subtitle2->setFont(add_subtitle_font);
165 advanced_options->addWidget(add_subtitle2, 0, Qt::AlignLeft);
168 QPushButton* btn_save_subgroups =
new QPushButton(
"Add Subgroups",
this);
169 btn_save_subgroups->setMaximumWidth(200);
170 connect(btn_save_subgroups, SIGNAL(clicked()),
this, SIGNAL(
saveSubgroups()));
171 advanced_options->addWidget(btn_save_subgroups);
174 QPushButton* btn_save_links =
new QPushButton(
"Add Links",
this);
175 btn_save_links->setMaximumWidth(200);
176 connect(btn_save_links, SIGNAL(clicked()),
this, SIGNAL(
saveLinks()));
177 advanced_options->addWidget(btn_save_links);
180 new_buttons_layout_container->addLayout(label_layout);
181 new_buttons_layout_container->addLayout(recommended_options);
182 new_buttons_layout_container->addLayout(advanced_options);
189 layout->addItem(
new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
192 QHBoxLayout* controls_layout =
new QHBoxLayout();
195 btn_delete_ =
new QPushButton(
"&Delete Group",
this);
199 controls_layout->setAlignment(
btn_delete_, Qt::AlignRight);
202 controls_layout->addItem(
new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
205 btn_save_ =
new QPushButton(
"&Save",
this);
209 controls_layout->setAlignment(
btn_save_, Qt::AlignRight);
212 QPushButton* btn_cancel =
new QPushButton(
"&Cancel",
this);
213 btn_cancel->setMaximumWidth(200);
214 connect(btn_cancel, SIGNAL(clicked()),
this, SIGNAL(
cancelEditing()));
215 controls_layout->addWidget(btn_cancel);
216 controls_layout->setAlignment(btn_cancel, Qt::AlignRight);
219 layout->addLayout(controls_layout);
222 this->setLayout(layout);
244 if (kin_solver.empty())
253 QMessageBox::warning(
this,
"Missing Kinematic Solvers",
254 QString(
"Unable to find the kinematic solver '")
255 .
append(kin_solver.c_str())
256 .append(
"'. Trying running rosmake for this package. Until fixed, this setting will be "
257 "lost the next time the MoveIt configuration files are generated"));
271 if (default_planner.empty())
273 default_planner =
"None";
279 QMessageBox::warning(
this,
"Missing Default Planner",
280 QString(
"Unable to find the default planner '%1'").arg(default_planner.c_str()));
294 static bool has_loaded =
false;
307 std::vector<std::string> classes;
312 catch (
const std::runtime_error& ex)
314 QMessageBox::warning(
this,
"Missing Kinematic Solvers", QString(ex.what()));
315 RCLCPP_ERROR_STREAM(setup_step_.
getLogger(), ex.what());
320 for (
const std::string& kinematics_plugin_name : classes)
331 void GroupEditWidget::selectKinematicsFile()
333 QString filename = QFileDialog::getOpenFileName(
this,
"Select a parameter file",
"",
"YAML files (*.yaml)");
335 if (filename.isEmpty())
341 std::filesystem::path relative_filename;
344 QString lookup_path = filename;
347 lookup_path = QString(
"$(find %1)/%2").arg(
package_name.c_str()).arg(relative_filename.c_str());
const rclcpp::Logger & getLogger() const
Makes a namespaced logger for this step available to the widget.
std::vector< std::string > getKinematicPlanners() const
std::vector< std::string > getOMPLPlanners() const
bool extractPackageNameFromPath(const std::filesystem::path &path, std::string &package_name, std::filesystem::path &relative_filepath)
std::string append(const std::string &left, const std::string &right)