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 #pragma once
37 
38 // Qt
39 class QHBoxLayout;
40 class QPushButton;
41 class QStackedWidget;
42 class QTreeWidget;
43 class QTreeWidgetItem;
44 
45 // SA
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 namespace moveit_setup_assistant
53 {
54 class DoubleListWidget;
55 class ControllerEditWidget;
56 
58 {
59  Q_OBJECT
60 
61 public:
62  // ******************************************************************************************
63  // Public Functions
64  // ******************************************************************************************
65 
66  ControllersWidget(QWidget* parent, const MoveItConfigDataPtr& config_data);
67 
68  void changeScreen(int index);
69 
71  void focusGiven() override;
72 
73 private Q_SLOTS:
74 
75  // ******************************************************************************************
76  // Slot Event Functions
77  // ******************************************************************************************
78 
79  // Expand/Collapse Tree
80  void alterTree(const QString& link);
81 
83  void addController();
84 
86  void editController();
87 
89  void deleteController();
90 
91  // Add a Follow Joint Trajectory action Controller for each Planning Group
92  void addDefaultControllers();
93 
96  void saveJointsScreen();
97  bool saveControllerScreen();
100  void saveJointsGroupsScreen();
101  void cancelEditing();
102 
104  void editSelected();
105 
107  void previewSelectedJoints(const std::vector<std::string>& joints);
108 
110  void previewSelectedGroup(const std::vector<std::string>& groups);
111 
113  void previewSelected(QTreeWidgetItem* selected_item, int column);
114 
116  void itemSelectionChanged();
117 
118 private:
119  // ******************************************************************************************
120  // Qt Components
121  // ******************************************************************************************
122 
124  QTreeWidget* controllers_tree_;
126 
128  QStackedWidget* stacked_widget_;
130 
131  QPushButton* btn_delete_;
132  QPushButton* btn_add_;
133  QPushButton* btn_edit_;
134  QHBoxLayout* controls_layout_;
137 
140 
143 
145  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
146 
148  QWidget* createContentsWidget();
149 
150  void loadControllersTree();
152  void showMainScreen();
156 };
157 
158 } // namespace moveit_setup_assistant
moveit_setup_assistant::ControllersWidget::createContentsWidget
QWidget * createContentsWidget()
Builds the main screen list widget.
Definition: controllers_widget.cpp:157
moveit_setup_assistant::ControllersWidget::config_data_
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
Definition: controllers_widget.h:145
moveit_setup_assistant::ControllersWidget::controllers_tree_widget_
QWidget * controllers_tree_widget_
Definition: controllers_widget.h:125
moveit_setup_assistant::ControllersWidget::btn_add_
QPushButton * btn_add_
Definition: controllers_widget.h:132
moveit_setup_assistant::ControllersWidget::stacked_widget_
QStackedWidget * stacked_widget_
For changing between table and different add/edit views.
Definition: controllers_widget.h:128
moveit_setup_assistant::ControllersWidget::saveControllerScreenGroups
void saveControllerScreenGroups()
Definition: controllers_widget.cpp:590
moveit_setup_assistant::DoubleListWidget
Definition: double_list_widget.h:51
moveit_setup_assistant::ControllersWidget::loadControllersTree
void loadControllersTree()
Definition: controllers_widget.cpp:240
moveit_setup_assistant::ControllersWidget::loadJointsScreen
void loadJointsScreen(moveit_setup_assistant::ControllerConfig *this_controller)
Definition: controllers_widget.cpp:320
moveit_setup_assistant::ControllersWidget::previewSelectedGroup
void previewSelectedGroup(const std::vector< std::string > &groups)
Called from Double List widget to highlight a group.
Definition: controllers_widget.cpp:536
moveit_setup_assistant::ControllersWidget::editController
void editController()
Edit an existing controller.
Definition: controllers_widget.cpp:818
moveit_setup_assistant::ControllersWidget::showMainScreen
void showMainScreen()
Definition: controllers_widget.cpp:837
moveit_setup_assistant::ControllersWidget::ControllersWidget
ControllersWidget(QWidget *parent, const MoveItConfigDataPtr &config_data)
Definition: controllers_widget.cpp:99
moveit_setup_assistant::ControllersWidget::itemSelectionChanged
void itemSelectionChanged()
Called sleceted item changed.
Definition: controllers_widget.cpp:867
moveit_setup_assistant::ControllersWidget::cancelEditing
void cancelEditing()
Definition: controllers_widget.cpp:479
moveit_setup_assistant::ControllersWidget::loadToControllersTree
void loadToControllersTree(const moveit_setup_assistant::ControllerConfig &controller_it)
Definition: controllers_widget.cpp:263
moveit_setup_assistant::ControllersWidget::saveControllerScreenJoints
void saveControllerScreenJoints()
Call when screen is done being edited.
Definition: controllers_widget.cpp:571
moveit_setup_assistant::ControllerEditWidget
Definition: controller_edit_widget.h:50
moveit_setup_assistant::ControllersWidget::addController
void addController()
Create a new controller.
Definition: controllers_widget.cpp:427
moveit_config_data.h
moveit_setup_assistant::ControllersWidget::addDefaultControllers
void addDefaultControllers()
Definition: controllers_widget.cpp:440
moveit_setup_assistant::ControllersWidget
Definition: controllers_widget.h:57
moveit_setup_assistant::ControllersWidget::controls_layout_
QHBoxLayout * controls_layout_
Definition: controllers_widget.h:134
moveit_setup_assistant::ControllersWidget::saveJointsScreen
void saveJointsScreen()
Definition: controllers_widget.cpp:609
moveit_setup_assistant::ControllersWidget::adding_new_controller_
bool adding_new_controller_
Remember whethere we're editing a controller or adding a new one.
Definition: controllers_widget.h:142
moveit_setup_assistant::ControllersWidget::btn_delete_
QPushButton * btn_delete_
Definition: controllers_widget.h:131
moveit_setup_assistant::ControllersWidget::joint_groups_widget_
moveit_setup_assistant::DoubleListWidget * joint_groups_widget_
Definition: controllers_widget.h:136
moveit_setup_assistant::ControllersWidget::saveJointsGroupsScreen
void saveJointsGroupsScreen()
Definition: controllers_widget.cpp:634
SetupScreenWidget
Definition: setup_screen_widget.h:44
moveit_setup_assistant::ControllersWidget::controllers_tree_
QTreeWidget * controllers_tree_
Main table for holding controllers.
Definition: controllers_widget.h:124
moveit_setup_assistant::ControllersWidget::joints_widget_
moveit_setup_assistant::DoubleListWidget * joints_widget_
Definition: controllers_widget.h:135
moveit_setup_assistant::ControllersWidget::saveControllerScreen
bool saveControllerScreen()
Definition: controllers_widget.cpp:683
moveit_setup_assistant::ControllersWidget::controller_edit_widget_
ControllerEditWidget * controller_edit_widget_
Definition: controllers_widget.h:129
moveit_setup_assistant::ControllersWidget::previewSelectedJoints
void previewSelectedJoints(const std::vector< std::string > &joints)
Called from Double List widget to highlight a joint.
Definition: controllers_widget.cpp:505
moveit_setup_assistant::ControllersWidget::loadGroupsScreen
void loadGroupsScreen(moveit_setup_assistant::ControllerConfig *this_controller)
Definition: controllers_widget.cpp:351
moveit_setup_assistant
Definition: compute_default_collisions.h:46
moveit_setup_assistant::ControllersWidget::deleteController
void deleteController()
Delete an existing controller.
Definition: controllers_widget.cpp:380
moveit_setup_assistant::ControllersWidget::editSelected
void editSelected()
Called whenever element is selected in the controllers tree view.
Definition: controllers_widget.cpp:757
moveit_setup_assistant::ControllersWidget::current_edit_controller_
std::string current_edit_controller_
Remember what controller we are editing when an edit screen is being shown.
Definition: controllers_widget.h:139
moveit_setup_assistant::ControllersWidget::previewSelected
void previewSelected(QTreeWidgetItem *selected_item, int column)
Called when an item is seleceted from the controllers tree.
Definition: controllers_widget.cpp:551
moveit_setup_assistant::ControllersWidget::loadControllerScreen
void loadControllerScreen(moveit_setup_assistant::ControllerConfig *this_controller)
Definition: controllers_widget.cpp:450
setup_screen_widget.h
moveit_setup_assistant::ControllersWidget::alterTree
void alterTree(const QString &link)
Definition: controllers_widget.cpp:859
moveit_setup_assistant::ControllersWidget::saveControllerScreenEdit
void saveControllerScreenEdit()
Definition: controllers_widget.cpp:670
index
unsigned int index
moveit_setup_assistant::ControllersWidget::btn_edit_
QPushButton * btn_edit_
Definition: controllers_widget.h:133
moveit_setup_assistant::ControllerConfig
Definition: moveit_config_data.h:115
moveit_setup_assistant::ControllersWidget::changeScreen
void changeScreen(int index)
Definition: controllers_widget.cpp:848
moveit_setup_assistant::ControllersWidget::focusGiven
void focusGiven() override
Received when this widget is chosen from the navigation menu.
Definition: controllers_widget.cpp:309


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