ros_controllers_widget.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018, Mohamad Ayman.
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  * * The name of Mohamad Ayman may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *********************************************************************/
33 
34 /* Author: Mohamad Ayman */
35 
36 #ifndef MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_ROS_CONTROLLERS_WIDGET_H
37 #define MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_ROS_CONTROLLERS_WIDGET_H
38 
39 // Qt
40 #include <QVBoxLayout>
41 #include <QHBoxLayout>
42 #include <QScrollArea>
43 #include <QGroupBox>
44 #include <QTableWidget>
45 #include <QTreeWidget>
46 #include <QStackedLayout>
47 #include <QString>
48 
49 // SA
50 #ifndef Q_MOC_RUN
52 #endif
53 
54 #include "double_list_widget.h" // for joints, links and subgroups pages
55 #include "header_widget.h"
56 #include "setup_screen_widget.h" // a base class for screens in the setup assistant
57 #include "controller_edit_widget.h"
58 
59 namespace moveit_ros_control
60 {
62 {
63  Q_OBJECT
64 
65 public:
66  // ******************************************************************************************
67  // Public Functions
68  // ******************************************************************************************
69 
70  ROSControllersWidget(QWidget* parent, moveit_setup_assistant::MoveItConfigDataPtr config_data);
71 
72  void changeScreen(int index);
73 
75  virtual void focusGiven();
76 
77 private Q_SLOTS:
78 
79  // ******************************************************************************************
80  // Slot Event Functions
81  // ******************************************************************************************
82 
83  // Expand/Collapse Tree
84  void alterTree(const QString& link);
85 
87  void addController();
88 
90  void editController();
91 
93  void deleteController();
94 
95  // Add a Follow Joint Trajectory action Controller for each Planning Group
96  void addDefaultControllers();
97 
100  void saveJointsScreen();
101  bool saveControllerScreen();
104  void saveJointsGroupsScreen();
105  void cancelEditing();
106 
108  void editSelected();
109 
111  void previewSelectedJoints(std::vector<std::string> joints);
112 
114  void previewSelectedGroup(std::vector<std::string> groups);
115 
117  void previewSelected(QTreeWidgetItem* selected_item, int column);
118 
120  void itemSelectionChanged();
121 
122 private:
123  // ******************************************************************************************
124  // Qt Components
125  // ******************************************************************************************
126 
128  QTreeWidget* controllers_tree_;
130 
132  QStackedLayout* stacked_layout_;
134 
135  QPushButton* btn_delete_;
136  QPushButton* btn_add_;
137  QPushButton* btn_edit_;
138  QHBoxLayout* controls_layout_;
141 
144 
147 
149  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
150 
152  QWidget* createContentsWidget();
153 
154  void loadControllersTree();
156  void showMainScreen();
160 };
161 
162 } // namespace moveit_setup_assistant
163 
164 #endif
std::string current_edit_controller_
Remember what controller we are editing when an edit screen is being shown.
QWidget * createContentsWidget()
Builds the main screen list widget.
void editSelected()
Called whenever element is selected in the controllers tree view.
QTreeWidget * controllers_tree_
Main table for holding controllers.
void loadJointsScreen(moveit_setup_assistant::ROSControlConfig *this_controller)
void loadGroupsScreen(moveit_setup_assistant::ROSControlConfig *this_controller)
void previewSelectedGroup(std::vector< std::string > groups)
Called from Double List widget to highlight a group.
void addController()
Create a new controller.
moveit_setup_assistant::DoubleListWidget * joint_groups_widget_
void loadToControllersTree(const moveit_setup_assistant::ROSControlConfig &controller_it)
unsigned int index
void previewSelectedJoints(std::vector< std::string > joints)
Called from Double List widget to highlight a joint.
ROSControllersWidget(QWidget *parent, moveit_setup_assistant::MoveItConfigDataPtr config_data)
void previewSelected(QTreeWidgetItem *selected_item, int column)
Called when an item is seleceted from the controllers tree.
void itemSelectionChanged()
Called sleceted item changed.
moveit_setup_assistant::DoubleListWidget * joints_widget_
void deleteController()
Delete an existing controller.
QStackedLayout * stacked_layout_
For changing between table and different add/edit views.
groups
void loadControllerScreen(moveit_setup_assistant::ROSControlConfig *this_controller)
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
void saveControllerScreenJoints()
Call when screen is done being edited.
virtual void focusGiven()
Received when this widget is chosen from the navigation menu.
bool adding_new_controller_
Remember whethere we&#39;re editing a controller or adding a new one.
void editController()
Edit an existing controller.


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sun Oct 18 2020 13:19:28