kinematic_chain_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 #ifndef MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_KINEMATIC_CHAIN_WIDGET_
38 #define MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_KINEMATIC_CHAIN_WIDGET_
39 
40 #include <QWidget>
41 #include <QLabel>
42 #include <QTreeWidget>
43 
44 #ifndef Q_MOC_RUN
46 #include <ros/ros.h>
47 #endif
48 
49 namespace moveit_setup_assistant
50 {
51 class KinematicChainWidget : public QWidget
52 {
53  Q_OBJECT
54 
55  // ******************************************************************************************
56  // Reusable double list widget for selecting and deselecting a subset from a set
57  // ******************************************************************************************
58 public:
59  // ******************************************************************************************
60  // Public Functions
61  // ******************************************************************************************
62 
64  KinematicChainWidget(QWidget* parent, moveit_setup_assistant::MoveItConfigDataPtr config_data);
65 
67  void setAvailable();
68 
70  void setSelected(const std::string& base_link, const std::string& tip_link);
71 
72  void addLinktoTreeRecursive(const robot_model::LinkModel* link, const robot_model::LinkModel* parent);
73 
74  bool addLinkChildRecursive(QTreeWidgetItem* parent, const robot_model::LinkModel* link,
75  const std::string& parent_name);
76 
77  // ******************************************************************************************
78  // Qt Components
79  // ******************************************************************************************
80 
81  QLabel* title_; // specify the title from the parent widget
82  QTreeWidget* link_tree_;
83  QLineEdit* base_link_field_;
84  QLineEdit* tip_link_field_;
85 
86 private Q_SLOTS:
87 
88  // ******************************************************************************************
89  // Slot Event Functions
90  // ******************************************************************************************
91 
93  void baseLinkTreeClick();
94 
96  void tipLinkTreeClick();
97 
99  void alterTree(const QString& link);
100 
102  void itemSelected();
103 
104 Q_SIGNALS:
105 
106  // ******************************************************************************************
107  // Emitted Signals
108  // ******************************************************************************************
109 
111  void doneEditing();
112 
114  void cancelEditing();
115 
117  void highlightLink(const std::string& name, const QColor&);
118 
120  void unhighlightAll();
121 
122 private:
123  // ******************************************************************************************
124  // Variables
125  // ******************************************************************************************
126 
128  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
129 
132 
133  // ******************************************************************************************
134  // Private Functions
135  // ******************************************************************************************
136 };
137 }
138 
139 #endif
void setAvailable()
Loads the availble data list.
void setSelected(const std::string &base_link, const std::string &tip_link)
Set the link field with previous value.
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
void highlightLink(const std::string &name, const QColor &)
Event for telling rviz to highlight a link of the robot.
void addLinktoTreeRecursive(const robot_model::LinkModel *link, const robot_model::LinkModel *parent)
void alterTree(const QString &link)
Expand/Collapse Tree.
KinematicChainWidget(QWidget *parent, moveit_setup_assistant::MoveItConfigDataPtr config_data)
Constructor.
bool kinematic_chain_loaded_
Remember if the chain tree has been loaded.
bool addLinkChildRecursive(QTreeWidgetItem *parent, const robot_model::LinkModel *link, const std::string &parent_name)
void itemSelected()
Highlight the selected link in the kinematic chain.
void cancelEditing()
Event sent when user presses cancel button.
void unhighlightAll()
Event for telling rviz to unhighlight all links of the robot.
void doneEditing()
Event sent when this widget is done making data changes and parent widget can save.


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