planning_groups_widget.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2012, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *********************************************************************/
00034 
00035 /* Author: Dave Coleman */
00036 
00037 #ifndef MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_PLANNING_GROUPS_WIDGET_
00038 #define MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_PLANNING_GROUPS_WIDGET_
00039 
00040 // Qt
00041 #include <QWidget>
00042 #include <QTreeWidget>
00043 #include <QSplitter>
00044 #include <QStackedLayout>
00045 
00046 // Setup Asst
00047 #ifndef Q_MOC_RUN
00048 #include <moveit/setup_assistant/tools/moveit_config_data.h>
00049 #endif
00050 
00051 #include "double_list_widget.h"      // for joints, links and subgroups pages
00052 #include "kinematic_chain_widget.h"  // for kinematic chain page
00053 #include "group_edit_widget.h"       // for group rename page
00054 #include "setup_screen_widget.h"     // a base class for screens in the setup assistant
00055 
00056 // Forward Declaration (outside of namespace for Qt)
00057 class PlanGroupType;
00058 
00059 namespace moveit_setup_assistant
00060 {
00061 // Custom Type
00062 enum GroupType
00063 {
00064   JOINT,
00065   LINK,
00066   CHAIN,
00067   SUBGROUP,
00068   GROUP
00069 };
00070 
00071 // ******************************************************************************************
00072 // ******************************************************************************************
00073 // CLASS
00074 // ******************************************************************************************
00075 // ******************************************************************************************
00076 class PlanningGroupsWidget : public SetupScreenWidget
00077 {
00078   Q_OBJECT
00079 
00080 public:
00081   // ******************************************************************************************
00082   // Public Functions
00083   // ******************************************************************************************
00084 
00085   PlanningGroupsWidget(QWidget* parent, moveit_setup_assistant::MoveItConfigDataPtr config_data);
00086 
00087   void changeScreen(int index);
00088 
00090   virtual void focusGiven();
00091 
00092 private Q_SLOTS:
00093 
00094   // ******************************************************************************************
00095   // Slot Event Functions
00096   // ******************************************************************************************
00097 
00099   void loadGroupsTree();
00100 
00102   void previewSelected();
00103 
00105   void editSelected();
00106 
00108   void addGroup();
00109 
00111   void saveJointsScreen();
00112   void saveLinksScreen();
00113   void saveChainScreen();
00114   void saveSubgroupsScreen();
00115   void saveGroupScreenEdit();
00116   void saveGroupScreenJoints();
00117   void saveGroupScreenLinks();
00118   void saveGroupScreenChain();
00119   void saveGroupScreenSubgroups();
00120 
00121   // Delete a group
00122   void deleteGroup();
00123 
00125   void cancelEditing();
00126 
00128   void alterTree(const QString& link);
00129 
00131   void previewSelectedLink(std::vector<std::string> links);
00132 
00134   // void previewClickedJoint( std::string name );
00135   void previewSelectedJoints(std::vector<std::string> joints);
00136 
00138   void previewSelectedSubgroup(std::vector<std::string> groups);
00139 
00140 private:
00141   // ******************************************************************************************
00142   // Qt Components
00143   // ******************************************************************************************
00144 
00146   QTreeWidget* groups_tree_;
00147 
00149   QStackedLayout* stacked_layout_;
00150 
00152   QPushButton* btn_edit_;
00153 
00154   QPushButton* btn_delete_;
00155 
00156   // Stacked Layout SUBPAGES -------------------------------------------
00157 
00158   QWidget* groups_tree_widget_;
00159   DoubleListWidget* joints_widget_;
00160   DoubleListWidget* links_widget_;
00161   DoubleListWidget* subgroups_widget_;
00162   KinematicChainWidget* chain_widget_;
00163   GroupEditWidget* group_edit_widget_;
00164 
00165   // ******************************************************************************************
00166   // Variables
00167   // ******************************************************************************************
00168 
00170   moveit_setup_assistant::MoveItConfigDataPtr config_data_;
00171 
00173   std::string current_edit_group_;
00174 
00176   GroupType current_edit_element_;
00177 
00179   bool adding_new_group_;
00180 
00181   // ******************************************************************************************
00182   // Private Functions
00183   // ******************************************************************************************
00184 
00186   QWidget* createContentsWidget();
00187 
00189   void loadGroupsTreeRecursive(srdf::Model::Group& group_it, QTreeWidgetItem* parent);
00190 
00191   // Convenience function for getting a group pointer
00192   srdf::Model::Group* findGroupByName(const std::string& name);
00193 
00194   // Load edit screen
00195   void loadJointsScreen(srdf::Model::Group* this_group);
00196   void loadLinksScreen(srdf::Model::Group* this_group);
00197   void loadChainScreen(srdf::Model::Group* this_group);
00198   void loadSubgroupsScreen(srdf::Model::Group* this_group);
00199   void loadGroupScreen(srdf::Model::Group* this_group);
00200 
00201   // Save group screen
00202   bool saveGroupScreen();
00203 
00205   void showMainScreen();
00206 };
00207 }
00208 
00209 // ******************************************************************************************
00210 // ******************************************************************************************
00211 // Metatype Class For Holding Points to Group Parts
00212 // ******************************************************************************************
00213 // ******************************************************************************************
00214 
00215 class PlanGroupType
00216 {
00217 public:
00218   //  explicit PlanGroupType();
00219   PlanGroupType()
00220   {
00221   }
00222   PlanGroupType(srdf::Model::Group* group, const moveit_setup_assistant::GroupType type);
00223   virtual ~PlanGroupType()
00224   {
00225     ;
00226   }
00227 
00228   srdf::Model::Group* group_;
00229 
00230   moveit_setup_assistant::GroupType type_;
00231 };
00232 
00233 Q_DECLARE_METATYPE(PlanGroupType);
00234 
00235 #endif


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Mon Jul 24 2017 02:22:29