moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
controller_edit_widget.hpp
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
39#include <QWidget>
40#include <QComboBox>
41#include <QLabel>
42#include <QLineEdit>
43#include <QPushButton>
44
45namespace moveit_setup
46{
47namespace controllers
48{
49class ControllerEditWidget : public QWidget
50{
51 Q_OBJECT
52
53public:
54 // ******************************************************************************************
55 // Public Functions
56 // ******************************************************************************************
57
59 ControllerEditWidget(QWidget* parent, const FieldPointers& additional_fields);
60
62 void setSelected(const std::string& controller_name, const ControllerInfo* info);
63
65 void loadControllersTypesComboBox(const std::vector<std::string>& controller_types);
66
68 void hideDelete();
69
71 void hideSave();
72
75
77 void showDelete();
78
80 void showSave();
81
84
86 void setTitle(const QString& title);
87
89 std::string getControllerName();
90
92 std::string getControllerType();
93
95 std::map<std::string, std::string> getAdditionalParameters();
96
97private Q_SLOTS:
98
99 // ******************************************************************************************
100 // Slot Event Functions
101 // ******************************************************************************************
103 void typeChanged(int index);
104
105Q_SIGNALS:
106
107 // ******************************************************************************************
108 // Emitted Signals
109 // ******************************************************************************************
110
113
116
118 void save();
119
122
125
126private:
127 // ******************************************************************************************
128 // Qt Components
129 // ******************************************************************************************
130
131 QLabel* title_; // specify the title from the parent widget
132 QLineEdit* controller_name_field_;
133 QComboBox* controller_type_field_;
134 QPushButton* btn_delete_; // this button is hidden for new controllers
135 QPushButton* btn_save_; // this button is hidden for new controllers
136 QWidget* new_buttons_widget_; // for showing/hiding the new controllers buttons
137
138 FieldPointers additional_fields_;
139 std::vector<QLineEdit*> additional_fields_inputs_; // one QLineEdit for each additional field
140
141 // ******************************************************************************************
142 // Variables
143 // ******************************************************************************************
144
145 // For loading default types combo box just once
146 bool has_loaded_ = false;
147};
148} // namespace controllers
149} // namespace moveit_setup
void cancelEditing()
Event sent when user presses cancel button.
void save()
Button event for just saving, when in edit mode.
void saveJoints()
Button event for new groups, progressing to adding joints.
std::map< std::string, std::string > getAdditionalParameters()
Get the names and values for any additional parameters.
void deleteController()
Event sent when delete is being requested for controller.
void setSelected(const std::string &controller_name, const ControllerInfo *info)
Set the previous data.
void saveJointsGroups()
Button event for new groups, progressing to adding subgroups.
void loadControllersTypesComboBox(const std::vector< std::string > &controller_types)
Populate the combo dropdown box with controllers types.
void setTitle(const QString &title)
Set widget title.
std::vector< std::shared_ptr< AdditionalControllerField > > FieldPointers
Convenience alias.