38 #include <QApplication> 
   39 #include <QFileDialog> 
   41 #include <QHBoxLayout> 
   44 #include <QMessageBox> 
   45 #include <QProgressBar> 
   46 #include <QPushButton> 
   50 #include <QVBoxLayout> 
   68   QVBoxLayout* layout = 
new QVBoxLayout(
this);
 
   71   QHBoxLayout* hlayout = 
new QHBoxLayout();
 
   73   QVBoxLayout* left_layout = 
new QVBoxLayout();
 
   75   QVBoxLayout* right_layout = 
new QVBoxLayout();
 
   80   auto image_path = 
getSharePath(
"moveit_setup_assistant") / 
"resources/MoveIt_Setup_Assistant2.png";
 
   89     RCLCPP_ERROR_STREAM(setup_step_.
getLogger(), 
"FAILED TO LOAD " << image_path);
 
   97       "MoveIt Setup Assistant",
 
   98       "These tools will assist you in creating a Semantic Robot Description Format (SRDF) file, various yaml " 
   99       "configuration and many roslaunch files for utilizing all aspects of MoveIt functionality.",
 
  101   layout->addWidget(header);
 
  113                                        "Specify the package name or path of an existing MoveIt configuration package " 
  114                                        "to be edited for your robot. Example package name: <i>panda_moveit_config</i>",
 
  115                                        "optional xacro arguments:", 
this, 
true);  
 
  119   connect(
stack_path_, SIGNAL(pathChanged(QString)), 
this, SLOT(onPackagePathChanged(QString)));
 
  124       "Load a URDF or COLLADA Robot Model",
 
  125       "Specify the location of an existing Universal Robot Description Format or COLLADA file for your robot",
 
  126       "optional xacro arguments:", 
this, 
false, 
true);  
 
  130   connect(
urdf_file_, SIGNAL(pathChanged(QString)), 
this, SLOT(onUrdfPathChanged(QString)));
 
  134   QHBoxLayout* load_files_layout = 
new QHBoxLayout();
 
  142   btn_load_ = 
new QPushButton(
"&Load Files", 
this);
 
  147   load_files_layout->setAlignment(
btn_load_, Qt::AlignRight);
 
  148   connect(
btn_load_, SIGNAL(clicked()), 
this, SLOT(loadFilesClick()));
 
  152   QFont next_label_font(QFont().defaultFamily(), 11, QFont::Bold);
 
  154   next_label_->setText(
"Success! Use the left navigation pane to continue.");
 
  159   layout->setAlignment(Qt::AlignTop);
 
  160   hlayout->setAlignment(Qt::AlignTop);
 
  161   left_layout->setAlignment(Qt::AlignTop);
 
  162   right_layout->setAlignment(Qt::AlignTop);
 
  165   left_layout->setSpacing(10);
 
  168   hlayout->addLayout(left_layout);
 
  169   hlayout->addLayout(right_layout);
 
  170   layout->addLayout(hlayout);
 
  173   layout->addItem(
new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
 
  178   layout->addLayout(load_files_layout);
 
  180   setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
 
  181   this->setLayout(layout);
 
  188     QTimer* update_timer = 
new QTimer(
this);
 
  189     update_timer->setSingleShot(
true);  
 
  190     connect(update_timer, SIGNAL(timeout()), 
btn_load_, SLOT(click()));
 
  191     update_timer->start(100);
 
  206   if (!pkg_path.empty())
 
  213   std::filesystem::path urdf_path = setup_step_.
getURDFPath();
 
  214   if (!urdf_path.empty())
 
  224 void StartScreenWidget::showNewOptions()
 
  235   create_new_package_ = 
true;
 
  241 void StartScreenWidget::showExistingOptions()
 
  252   create_new_package_ = 
false;
 
  258 void StartScreenWidget::loadFilesClick()
 
  271   if (create_new_package_)
 
  273     result = loadNewFiles();
 
  277     result = loadExistingFiles();
 
  298 void StartScreenWidget::onPackagePathChanged(
const QString& )
 
  300   if (!loadPackageSettings(
false))
 
  306 void StartScreenWidget::onUrdfPathChanged(
const QString& path)
 
  312 bool StartScreenWidget::loadPackageSettings(
bool show_warnings)
 
  322   catch (
const std::runtime_error& e)
 
  325       QMessageBox::warning(
this, 
"Error Loading Files", e.what());
 
  333 bool StartScreenWidget::loadExistingFiles()
 
  339     QApplication::processEvents();
 
  341     if (!loadPackageSettings(
true))
 
  344   catch (
const std::runtime_error& e)
 
  346     QMessageBox::warning(
this, 
"Error Loading SRDF", QString(e.what()));
 
  347     RCLCPP_ERROR(setup_step_.
getLogger(), 
"%s", e.what());
 
  353   QApplication::processEvents();
 
  358   RCLCPP_INFO(setup_step_.
getLogger(), 
"Loading Setup Assistant Complete");
 
  367 bool StartScreenWidget::loadNewFiles()
 
  373   if (urdf_path.empty())
 
  375     QMessageBox::warning(
this, 
"Error Loading Files", 
"No robot model file specified");
 
  380   if (!std::filesystem::is_regular_file(urdf_path))
 
  382     QMessageBox::warning(
this, 
"Error Loading Files",
 
  383                          QString(
"Unable to locate the URDF file: ").
append(urdf_path.c_str()));
 
  389   QApplication::processEvents();
 
  397   catch (
const std::runtime_error& e)
 
  399     QMessageBox::warning(
this, 
"Error Loading URDF", QString(e.what()));
 
  405   QApplication::processEvents();
 
  414   QApplication::processEvents();
 
  418   QApplication::processEvents();
 
  422   RCLCPP_INFO(setup_step_.
getLogger(), 
"Loading Setup Assistant Complete");
 
  438   setFrameShape(QFrame::StyledPanel);
 
  439   setFrameShadow(QFrame::Raised);
 
  444   QVBoxLayout* layout = 
new QVBoxLayout(
this);
 
  447   QHBoxLayout* hlayout = 
new QHBoxLayout();
 
  450   QLabel* widget_title = 
new QLabel(
this);
 
  451   widget_title->setText(
"Create new or edit existing?");
 
  452   QFont widget_title_font(QFont().defaultFamily(), 12, QFont::Bold);
 
  453   widget_title->setFont(widget_title_font);
 
  454   layout->addWidget(widget_title);
 
  455   layout->setAlignment(widget_title, Qt::AlignTop);
 
  463       "All settings for MoveIt are stored in the MoveIt configuration package. Here you have the option to create a " 
  464       "new configuration package or load an existing one. Note: changes to a MoveIt configuration package outside this " 
  465       "Setup Assistant are likely to be overwritten by this tool.");
 
  472   btn_new_->setText(
"Create &New MoveIt\nConfiguration Package");
 
  477   btn_exist_->setText(
"&Edit Existing MoveIt\nConfiguration Package");
 
  482   layout->addLayout(hlayout);
 
  490 #include <pluginlib/class_list_macros.hpp>   
PLUGINLIB_EXPORT_CLASS(cached_ik_kinematics_plugin::CachedIKKinematicsPlugin< kdl_kinematics_plugin::KDLKinematicsPlugin >, kinematics::KinematicsBase)
 
const rclcpp::Logger & getLogger() const
Makes a namespaced logger for this step available to the widget.
 
std::filesystem::path getURDFPath()
 
void loadURDFFile(const std::filesystem::path &urdf_file_path, const std::string &xacro_args)
 
std::filesystem::path getPackagePath()
 
std::string getXacroArgs()
 
void loadExisting(const std::filesystem::path &package_path)
 
std::filesystem::path getSharePath(const std::string &package_name)
Return a path for the given package's share folder.
 
std::string append(const std::string &left, const std::string &right)