planning_groups_widget.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Dave Coleman */
36 
37 #pragma once
38 
39 // Qt
40 class QPushButton;
41 class QStackedWidget;
42 class QTreeWidget;
43 class QTreeWidgetItem;
44 
45 // Setup Asst
46 #ifndef Q_MOC_RUN
48 #endif
49 
50 #include "setup_screen_widget.h" // a base class for screens in the setup assistant
51 
52 // Forward Declaration (outside of namespace for Qt)
53 class PlanGroupType;
54 
55 namespace moveit_setup_assistant
56 {
57 class DoubleListWidget;
58 class KinematicChainWidget;
59 class GroupEditWidget;
60 
61 // Custom Type
63 {
64  JOINT = 1,
65  LINK = 2,
66  CHAIN = 3,
67  SUBGROUP = 4,
68  GROUP = 5
69 };
70 
71 // ******************************************************************************************
72 // ******************************************************************************************
73 // CLASS
74 // ******************************************************************************************
75 // ******************************************************************************************
77 {
78  Q_OBJECT
79 
80 public:
81  // ******************************************************************************************
82  // Public Functions
83  // ******************************************************************************************
84 
85  PlanningGroupsWidget(QWidget* parent, const MoveItConfigDataPtr& config_data);
86 
87  void changeScreen(int index);
88 
90  void focusGiven() override;
91 
92 private Q_SLOTS:
93 
94  // ******************************************************************************************
95  // Slot Event Functions
96  // ******************************************************************************************
97 
99  void loadGroupsTree();
100 
102  void previewSelected();
103 
105  void editSelected();
106 
108  void addGroup();
109 
111  void saveJointsScreen();
112  void saveLinksScreen();
113  void saveChainScreen();
114  void saveSubgroupsScreen();
115  void saveGroupScreenEdit();
116  void saveGroupScreenJoints();
117  void saveGroupScreenLinks();
118  void saveGroupScreenChain();
120 
121  // Delete a group
122  void deleteGroup();
123 
125  void cancelEditing();
126 
128  void alterTree(const QString& link);
129 
131  void previewSelectedLink(const std::vector<std::string>& links);
132 
134  // void previewClickedJoint( std::string name );
135  void previewSelectedJoints(const std::vector<std::string>& joints);
136 
138  void previewSelectedSubgroup(const std::vector<std::string>& groups);
139 
140 private:
141  // ******************************************************************************************
142  // Qt Components
143  // ******************************************************************************************
144 
146  QTreeWidget* groups_tree_;
147 
149  QStackedWidget* stacked_widget_;
150 
152  QPushButton* btn_edit_;
153 
154  QPushButton* btn_delete_;
155 
156  // Stacked Layout SUBPAGES -------------------------------------------
157 
164 
165  // ******************************************************************************************
166  // Variables
167  // ******************************************************************************************
168 
170  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
171 
173  std::string current_edit_group_;
174 
177 
180 
181  // ******************************************************************************************
182  // Private Functions
183  // ******************************************************************************************
184 
186  QWidget* createContentsWidget();
187 
189  void loadGroupsTreeRecursive(srdf::Model::Group& group_it, QTreeWidgetItem* parent);
190 
191  // Convenience function for getting a group pointer
192  srdf::Model::Group* findGroupByName(const std::string& name);
193 
194  // Load edit screen
195  void loadJointsScreen(srdf::Model::Group* this_group);
196  void loadLinksScreen(srdf::Model::Group* this_group);
197  void loadChainScreen(srdf::Model::Group* this_group);
198  void loadSubgroupsScreen(srdf::Model::Group* this_group);
199  void loadGroupScreen(srdf::Model::Group* this_group);
200 
201  // Save group screen
202  bool saveGroupScreen();
203 
205  void showMainScreen();
206 };
207 } // namespace moveit_setup_assistant
208 
209 // ******************************************************************************************
210 // ******************************************************************************************
211 // Metatype Class For Holding Points to Group Parts
212 // ******************************************************************************************
213 // ******************************************************************************************
214 
216 {
217 public:
218  // explicit PlanGroupType();
220  {
221  }
223  virtual ~PlanGroupType()
224  {
225  ;
226  }
227 
229 
231 };
232 
moveit_setup_assistant::PlanningGroupsWidget::loadChainScreen
void loadChainScreen(srdf::Model::Group *this_group)
Definition: planning_groups_widget.cpp:591
moveit_setup_assistant::PlanningGroupsWidget::saveLinksScreen
void saveLinksScreen()
Definition: planning_groups_widget.cpp:883
PlanGroupType
Definition: planning_groups_widget.h:215
moveit_setup_assistant::GroupType
GroupType
Definition: planning_groups_widget.h:62
moveit_setup_assistant::PlanningGroupsWidget::addGroup
void addGroup()
Create a new, empty group.
Definition: planning_groups_widget.cpp:841
moveit_setup_assistant::PlanningGroupsWidget::deleteGroup
void deleteGroup()
Definition: planning_groups_widget.cpp:685
PlanGroupType::~PlanGroupType
virtual ~PlanGroupType()
Definition: planning_groups_widget.h:223
moveit_setup_assistant::SUBGROUP
@ SUBGROUP
Definition: planning_groups_widget.h:67
moveit_setup_assistant::PlanningGroupsWidget::previewSelectedLink
void previewSelectedLink(const std::vector< std::string > &links)
Called from Double List widget to highlight a link.
Definition: planning_groups_widget.cpp:1441
moveit_setup_assistant::PlanningGroupsWidget::previewSelected
void previewSelected()
Highlight the group of whatever element is selected in the tree view.
Definition: planning_groups_widget.cpp:467
moveit_setup_assistant::DoubleListWidget
Definition: double_list_widget.h:51
moveit_setup_assistant::PlanningGroupsWidget::saveChainScreen
void saveChainScreen()
Definition: planning_groups_widget.cpp:912
moveit_setup_assistant::PlanningGroupsWidget::saveGroupScreenJoints
void saveGroupScreenJoints()
Definition: planning_groups_widget.cpp:1293
moveit_setup_assistant::CHAIN
@ CHAIN
Definition: planning_groups_widget.h:66
moveit_setup_assistant::PlanningGroupsWidget::links_widget_
DoubleListWidget * links_widget_
Definition: planning_groups_widget.h:160
moveit_setup_assistant::PlanningGroupsWidget::loadGroupScreen
void loadGroupScreen(srdf::Model::Group *this_group)
Definition: planning_groups_widget.cpp:655
moveit_setup_assistant::GROUP
@ GROUP
Definition: planning_groups_widget.h:68
moveit_setup_assistant::PlanningGroupsWidget::editSelected
void editSelected()
Edit whatever element is selected in the tree view.
Definition: planning_groups_widget.cpp:488
moveit_setup_assistant::JOINT
@ JOINT
Definition: planning_groups_widget.h:64
moveit_setup_assistant::LINK
@ LINK
Definition: planning_groups_widget.h:65
moveit_setup_assistant::GroupEditWidget
Definition: group_edit_widget.h:52
moveit_config_data.h
moveit_setup_assistant::PlanningGroupsWidget
Definition: planning_groups_widget.h:76
moveit_setup_assistant::PlanningGroupsWidget::findGroupByName
srdf::Model::Group * findGroupByName(const std::string &name)
moveit_setup_assistant::PlanningGroupsWidget::btn_edit_
QPushButton * btn_edit_
Show and hide edit button.
Definition: planning_groups_widget.h:152
moveit_setup_assistant::PlanningGroupsWidget::joints_widget_
DoubleListWidget * joints_widget_
Definition: planning_groups_widget.h:159
moveit_setup_assistant::PlanningGroupsWidget::current_edit_group_
std::string current_edit_group_
Remember what group we are editing when an edit screen is being shown.
Definition: planning_groups_widget.h:173
PlanGroupType::type_
moveit_setup_assistant::GroupType type_
Definition: planning_groups_widget.h:230
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(PlanGroupType)
moveit_setup_assistant::PlanningGroupsWidget::saveGroupScreenLinks
void saveGroupScreenLinks()
Definition: planning_groups_widget.cpp:1310
moveit_setup_assistant::PlanningGroupsWidget::chain_widget_
KinematicChainWidget * chain_widget_
Definition: planning_groups_widget.h:162
moveit_setup_assistant::PlanningGroupsWidget::return_screen_
int return_screen_
Remember to which editing screen we should return on Cancel.
Definition: planning_groups_widget.h:176
moveit_setup_assistant::PlanningGroupsWidget::loadGroupsTreeRecursive
void loadGroupsTreeRecursive(srdf::Model::Group &group_it, QTreeWidgetItem *parent)
Recursively build the SRDF tree.
Definition: planning_groups_widget.cpp:316
moveit_setup_assistant::PlanningGroupsWidget::saveGroupScreenEdit
void saveGroupScreenEdit()
Definition: planning_groups_widget.cpp:1280
moveit_setup_assistant::PlanningGroupsWidget::previewSelectedSubgroup
void previewSelectedSubgroup(const std::vector< std::string > &groups)
Called from Double List widget to highlight a subgroup.
Definition: planning_groups_widget.cpp:1492
SetupScreenWidget
Definition: setup_screen_widget.h:44
moveit_setup_assistant::PlanningGroupsWidget::saveGroupScreenChain
void saveGroupScreenChain()
Definition: planning_groups_widget.cpp:1327
moveit_setup_assistant::PlanningGroupsWidget::group_edit_widget_
GroupEditWidget * group_edit_widget_
Definition: planning_groups_widget.h:163
moveit_setup_assistant::PlanningGroupsWidget::saveJointsScreen
void saveJointsScreen()
Call when screen is done being edited.
Definition: planning_groups_widget.cpp:855
moveit_setup_assistant::PlanningGroupsWidget::groups_tree_widget_
QWidget * groups_tree_widget_
Definition: planning_groups_widget.h:158
moveit_setup_assistant
Definition: compute_default_collisions.h:46
moveit_setup_assistant::PlanningGroupsWidget::showMainScreen
void showMainScreen()
Switch to current groups view.
Definition: planning_groups_widget.cpp:1419
moveit_setup_assistant::PlanningGroupsWidget::previewSelectedJoints
void previewSelectedJoints(const std::vector< std::string > &joints)
Called from Double List widget to highlight a joint.
Definition: planning_groups_widget.cpp:1461
moveit_setup_assistant::PlanningGroupsWidget::saveGroupScreen
bool saveGroupScreen()
Definition: planning_groups_widget.cpp:1083
moveit_setup_assistant::PlanningGroupsWidget::focusGiven
void focusGiven() override
Received when this widget is chosen from the navigation menu.
Definition: planning_groups_widget.cpp:1396
moveit_setup_assistant::PlanningGroupsWidget::stacked_widget_
QStackedWidget * stacked_widget_
For changing between table and different add/edit views.
Definition: planning_groups_widget.h:149
setup_screen_widget.h
moveit_setup_assistant::PlanningGroupsWidget::subgroups_widget_
DoubleListWidget * subgroups_widget_
Definition: planning_groups_widget.h:161
index
unsigned int index
moveit_setup_assistant::PlanningGroupsWidget::saveSubgroupsScreen
void saveSubgroupsScreen()
Definition: planning_groups_widget.cpp:988
moveit_setup_assistant::PlanningGroupsWidget::groups_tree_
QTreeWidget * groups_tree_
Main table for holding groups.
Definition: planning_groups_widget.h:146
moveit_setup_assistant::PlanningGroupsWidget::loadGroupsTree
void loadGroupsTree()
Displays data in the link_pairs_ data structure into a QtTableWidget.
Definition: planning_groups_widget.cpp:281
moveit_setup_assistant::PlanningGroupsWidget::cancelEditing
void cancelEditing()
Call when edit screen is canceled.
Definition: planning_groups_widget.cpp:1361
moveit_setup_assistant::PlanningGroupsWidget::alterTree
void alterTree(const QString &link)
Called when user clicks link part of bottom left label.
Definition: planning_groups_widget.cpp:1408
moveit_setup_assistant::PlanningGroupsWidget::config_data_
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
Definition: planning_groups_widget.h:170
moveit_setup_assistant::PlanningGroupsWidget::changeScreen
void changeScreen(int index)
Definition: planning_groups_widget.cpp:1430
moveit_setup_assistant::PlanningGroupsWidget::loadLinksScreen
void loadLinksScreen(srdf::Model::Group *this_group)
Definition: planning_groups_widget.cpp:560
srdf::Model::Group
moveit_setup_assistant::PlanningGroupsWidget::btn_delete_
QPushButton * btn_delete_
Definition: planning_groups_widget.h:154
moveit_setup_assistant::PlanningGroupsWidget::createContentsWidget
QWidget * createContentsWidget()
Builds the main screen list widget.
Definition: planning_groups_widget.cpp:215
moveit_setup_assistant::PlanningGroupsWidget::adding_new_group_
bool adding_new_group_
Remember whethere we're editing a group or adding a new one.
Definition: planning_groups_widget.h:179
moveit_setup_assistant::KinematicChainWidget
Definition: kinematic_chain_widget.h:51
PlanGroupType::group_
srdf::Model::Group * group_
Definition: planning_groups_widget.h:228
moveit_setup_assistant::PlanningGroupsWidget::loadSubgroupsScreen
void loadSubgroupsScreen(srdf::Model::Group *this_group)
Definition: planning_groups_widget.cpp:623
moveit_setup_assistant::PlanningGroupsWidget::loadJointsScreen
void loadJointsScreen(srdf::Model::Group *this_group)
Definition: planning_groups_widget.cpp:529
moveit_setup_assistant::PlanningGroupsWidget::saveGroupScreenSubgroups
void saveGroupScreenSubgroups()
Definition: planning_groups_widget.cpp:1344
PlanGroupType::PlanGroupType
PlanGroupType()
Definition: planning_groups_widget.h:219
moveit_setup_assistant::PlanningGroupsWidget::PlanningGroupsWidget
PlanningGroupsWidget(QWidget *parent, const MoveItConfigDataPtr &config_data)
Definition: planning_groups_widget.cpp:131


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sat May 3 2025 02:28:04