src
widgets
robot_poses_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
QComboBox;
41
class
QLabel;
42
class
QLineEdit;
43
class
QPushButton;
44
class
QScrollArea;
45
class
QSlider;
46
class
QStackedWidget;
47
class
QTableWidget;
48
class
QVBoxLayout;
49
50
// SA
51
#ifndef Q_MOC_RUN
52
#include <
moveit/setup_assistant/tools/moveit_config_data.h
>
53
#endif
54
55
#include "
setup_screen_widget.h
"
// a base class for screens in the setup assistant
56
57
namespace
moveit_setup_assistant
58
{
59
class
RobotPosesWidget
:
public
SetupScreenWidget
60
{
61
Q_OBJECT
62
63
public
:
64
// ******************************************************************************************
65
// Public Functions
66
// ******************************************************************************************
67
68
RobotPosesWidget
(QWidget* parent,
const
MoveItConfigDataPtr& config_data);
69
71
void
focusGiven
()
override
;
72
73
// ******************************************************************************************
74
// Qt Components
75
// ******************************************************************************************
76
QTableWidget*
data_table_
;
77
QPushButton*
btn_edit_
;
78
QPushButton*
btn_delete_
;
79
QPushButton*
btn_save_
;
80
QPushButton*
btn_cancel_
;
81
QStackedWidget*
stacked_widget_
;
82
QScrollArea*
scroll_area_
;
83
QVBoxLayout*
column2_
;
84
QLineEdit*
pose_name_field_
;
85
QComboBox*
group_name_field_
;
86
QWidget*
joint_list_widget_
;
87
QVBoxLayout*
joint_list_layout_
;
88
QWidget*
pose_list_widget_
;
89
QWidget*
pose_edit_widget_
;
90
QLabel*
collision_warning_
;
91
92
private
Q_SLOTS:
93
94
// ******************************************************************************************
95
// Slot Event Functions
96
// ******************************************************************************************
97
99
void
showNewScreen
();
100
102
void
editSelected
();
103
105
void
editDoubleClicked
(
int
row,
int
column);
106
108
void
previewClicked
(
int
row,
int
column,
int
previous_row,
int
previous_column);
109
111
void
deleteSelected
();
112
114
void
doneEditing
();
115
117
void
cancelEditing
();
118
120
void
loadJointSliders
(
const
QString& selected);
121
123
void
showDefaultPose
();
124
126
void
playPoses
();
127
134
void
updateRobotModel
(
const
std::string& name,
double
value);
135
137
void
publishJoints
();
138
139
private
:
140
// ******************************************************************************************
141
// Variables
142
// ******************************************************************************************
143
145
moveit_setup_assistant::MoveItConfigDataPtr
config_data_
;
146
148
srdf::Model::GroupState
*
current_edit_pose_
;
149
151
ros::Publisher
pub_robot_state_
;
152
153
// ******************************************************************************************
154
// Collision Variables
155
// ******************************************************************************************
156
collision_detection::CollisionRequest
request
;
157
158
// ******************************************************************************************
159
// Private Functions
160
// ******************************************************************************************
161
168
srdf::Model::GroupState
*
findPoseByName
(
const
std::string& name,
const
std::string& group);
169
175
QWidget*
createContentsWidget
();
176
182
QWidget*
createEditWidget
();
183
188
void
loadDataTable
();
189
194
void
loadGroupsComboBox
();
195
201
void
edit
(
int
row);
202
206
void
showPose
(
srdf::Model::GroupState
* pose);
207
};
208
209
// ******************************************************************************************
210
// ******************************************************************************************
211
// Slider Widget
212
// ******************************************************************************************
213
// ******************************************************************************************
214
class
SliderWidget
:
public
QWidget
215
{
216
Q_OBJECT
217
218
public
:
219
// ******************************************************************************************
220
// Public Functions
221
// ******************************************************************************************
222
229
SliderWidget
(QWidget* parent,
const
moveit::core::JointModel
* joint_model,
double
init_value);
230
234
~SliderWidget
()
override
;
235
236
// ******************************************************************************************
237
// Qt Components
238
// ******************************************************************************************
239
240
QLabel*
joint_label_
;
241
QSlider*
joint_slider_
;
242
QLineEdit*
joint_value_
;
243
244
private
Q_SLOTS:
245
246
// ******************************************************************************************
247
// Slot Event Functions
248
// ******************************************************************************************
249
251
void
changeJointValue
(
int
value);
252
254
void
changeJointSlider
();
255
256
Q_SIGNALS:
257
258
// ******************************************************************************************
259
// Emitted Signal Functions
260
// ******************************************************************************************
261
263
void
jointValueChanged
(
const
std::string& name,
double
value);
264
265
private
:
266
// ******************************************************************************************
267
// Variables
268
// ******************************************************************************************
269
270
// Ptr to the joint's data
271
const
moveit::core::JointModel
*
joint_model_
;
272
273
// Max & min position
274
double
max_position_
;
275
double
min_position_
;
276
277
// ******************************************************************************************
278
// Private Functions
279
// ******************************************************************************************
280
};
281
282
}
// namespace moveit_setup_assistant
moveit_setup_assistant::RobotPosesWidget::editDoubleClicked
void editDoubleClicked(int row, int column)
Edit the double clicked element.
Definition:
robot_poses_widget.cpp:347
moveit_setup_assistant::RobotPosesWidget::column2_
QVBoxLayout * column2_
Definition:
robot_poses_widget.h:83
moveit_setup_assistant::SliderWidget::changeJointSlider
void changeJointSlider()
Called when the joint value box is changed.
Definition:
robot_poses_widget.cpp:914
moveit_setup_assistant::RobotPosesWidget::pose_list_widget_
QWidget * pose_list_widget_
Definition:
robot_poses_widget.h:88
moveit_setup_assistant::SliderWidget::joint_label_
QLabel * joint_label_
Definition:
robot_poses_widget.h:240
moveit_setup_assistant::RobotPosesWidget::playPoses
void playPoses()
Play through the poses.
Definition:
robot_poses_widget.cpp:412
moveit_setup_assistant::RobotPosesWidget::loadDataTable
void loadDataTable()
Definition:
robot_poses_widget.cpp:726
moveit_setup_assistant::RobotPosesWidget::joint_list_layout_
QVBoxLayout * joint_list_layout_
Definition:
robot_poses_widget.h:87
ros::Publisher
moveit_setup_assistant::RobotPosesWidget::collision_warning_
QLabel * collision_warning_
Definition:
robot_poses_widget.h:90
moveit_setup_assistant::RobotPosesWidget::findPoseByName
srdf::Model::GroupState * findPoseByName(const std::string &name, const std::string &group)
Definition:
robot_poses_widget.cpp:557
moveit_setup_assistant::RobotPosesWidget::showNewScreen
void showNewScreen()
Show edit screen.
Definition:
robot_poses_widget.cpp:325
moveit_setup_assistant::RobotPosesWidget::btn_edit_
QPushButton * btn_edit_
Definition:
robot_poses_widget.h:77
moveit_setup_assistant::SliderWidget::joint_value_
QLineEdit * joint_value_
Definition:
robot_poses_widget.h:242
moveit_setup_assistant::RobotPosesWidget::scroll_area_
QScrollArea * scroll_area_
Definition:
robot_poses_widget.h:82
moveit_setup_assistant::RobotPosesWidget::request
collision_detection::CollisionRequest request
Definition:
robot_poses_widget.h:156
moveit_setup_assistant::RobotPosesWidget::pose_name_field_
QLineEdit * pose_name_field_
Definition:
robot_poses_widget.h:84
moveit_setup_assistant::RobotPosesWidget::showDefaultPose
void showDefaultPose()
Show the robot in its default joint positions.
Definition:
robot_poses_widget.cpp:397
moveit_setup_assistant::RobotPosesWidget::pub_robot_state_
ros::Publisher pub_robot_state_
Remember the publisher for quick publishing later.
Definition:
robot_poses_widget.h:151
moveit_setup_assistant::SliderWidget::SliderWidget
SliderWidget(QWidget *parent, const moveit::core::JointModel *joint_model, double init_value)
Definition:
robot_poses_widget.cpp:825
collision_detection::CollisionRequest
moveit_setup_assistant::RobotPosesWidget::btn_cancel_
QPushButton * btn_cancel_
Definition:
robot_poses_widget.h:80
moveit_setup_assistant::RobotPosesWidget::createEditWidget
QWidget * createEditWidget()
Definition:
robot_poses_widget.cpp:232
moveit_config_data.h
moveit_setup_assistant::RobotPosesWidget::pose_edit_widget_
QWidget * pose_edit_widget_
Definition:
robot_poses_widget.h:89
moveit_setup_assistant::SliderWidget::min_position_
double min_position_
Definition:
robot_poses_widget.h:275
moveit_setup_assistant::SliderWidget::joint_slider_
QSlider * joint_slider_
Definition:
robot_poses_widget.h:241
moveit_setup_assistant::RobotPosesWidget::group_name_field_
QComboBox * group_name_field_
Definition:
robot_poses_widget.h:85
moveit_setup_assistant::RobotPosesWidget::edit
void edit(int row)
Definition:
robot_poses_widget.cpp:440
moveit_setup_assistant::SliderWidget::max_position_
double max_position_
Definition:
robot_poses_widget.h:274
moveit_setup_assistant::SliderWidget::jointValueChanged
void jointValueChanged(const std::string &name, double value)
Indicate joint name and value when slider widget changed.
moveit_setup_assistant::RobotPosesWidget::deleteSelected
void deleteSelected()
Delete currently editing ite.
Definition:
robot_poses_widget.cpp:577
moveit_setup_assistant::RobotPosesWidget::btn_delete_
QPushButton * btn_delete_
Definition:
robot_poses_widget.h:78
SetupScreenWidget
Definition:
setup_screen_widget.h:44
moveit_setup_assistant::RobotPosesWidget
Definition:
robot_poses_widget.h:59
moveit_setup_assistant::RobotPosesWidget::updateRobotModel
void updateRobotModel(const std::string &name, double value)
Definition:
robot_poses_widget.cpp:785
moveit_setup_assistant::RobotPosesWidget::publishJoints
void publishJoints()
Publishes a joint state message based on all the slider locations in a planning group,...
Definition:
robot_poses_widget.cpp:797
moveit_setup_assistant::RobotPosesWidget::btn_save_
QPushButton * btn_save_
Definition:
robot_poses_widget.h:79
moveit_setup_assistant
Definition:
compute_default_collisions.h:46
srdf::Model::GroupState
moveit_setup_assistant::RobotPosesWidget::editSelected
void editSelected()
Edit whatever element is selected.
Definition:
robot_poses_widget.cpp:429
moveit_setup_assistant::SliderWidget::changeJointValue
void changeJointValue(int value)
Called when the joint value slider is changed.
Definition:
robot_poses_widget.cpp:899
moveit_setup_assistant::RobotPosesWidget::focusGiven
void focusGiven() override
Received when this widget is chosen from the navigation menu.
Definition:
robot_poses_widget.cpp:770
moveit_setup_assistant::SliderWidget
Definition:
robot_poses_widget.h:214
moveit_setup_assistant::RobotPosesWidget::cancelEditing
void cancelEditing()
Cancel changes.
Definition:
robot_poses_widget.cpp:714
moveit_setup_assistant::RobotPosesWidget::joint_list_widget_
QWidget * joint_list_widget_
Definition:
robot_poses_widget.h:86
moveit_setup_assistant::RobotPosesWidget::loadGroupsComboBox
void loadGroupsComboBox()
Definition:
robot_poses_widget.cpp:476
setup_screen_widget.h
moveit_setup_assistant::RobotPosesWidget::showPose
void showPose(srdf::Model::GroupState *pose)
Definition:
robot_poses_widget.cpp:374
moveit_setup_assistant::SliderWidget::~SliderWidget
~SliderWidget() override
moveit_setup_assistant::SliderWidget::joint_model_
const moveit::core::JointModel * joint_model_
Definition:
robot_poses_widget.h:271
moveit_setup_assistant::RobotPosesWidget::previewClicked
void previewClicked(int row, int column, int previous_row, int previous_column)
Preview whatever element is selected.
Definition:
robot_poses_widget.cpp:356
moveit_setup_assistant::RobotPosesWidget::data_table_
QTableWidget * data_table_
Definition:
robot_poses_widget.h:76
moveit_setup_assistant::RobotPosesWidget::current_edit_pose_
srdf::Model::GroupState * current_edit_pose_
Pointer to currently edited group state.
Definition:
robot_poses_widget.h:148
moveit_setup_assistant::RobotPosesWidget::config_data_
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
Definition:
robot_poses_widget.h:145
moveit_setup_assistant::RobotPosesWidget::doneEditing
void doneEditing()
Save editing changes.
Definition:
robot_poses_widget.cpp:615
moveit_setup_assistant::RobotPosesWidget::loadJointSliders
void loadJointSliders(const QString &selected)
Run this whenever the group is changed.
Definition:
robot_poses_widget.cpp:491
moveit_setup_assistant::RobotPosesWidget::createContentsWidget
QWidget * createContentsWidget()
Definition:
robot_poses_widget.cpp:150
moveit_setup_assistant::RobotPosesWidget::RobotPosesWidget
RobotPosesWidget(QWidget *parent, const MoveItConfigDataPtr &config_data)
Definition:
robot_poses_widget.cpp:97
moveit::core::JointModel
moveit_setup_assistant::RobotPosesWidget::stacked_widget_
QStackedWidget * stacked_widget_
Definition:
robot_poses_widget.h:81
moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sat May 3 2025 02:28:04