tablet_controller_panel.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/o2r other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 
37 #ifndef JSK_RVIZ_PLUGINS_TABLET_CONTROLLER_PANEL_H_
38 #define JSK_RVIZ_PLUGINS_TABLET_CONTROLLER_PANEL_H_
39 
40 #ifndef Q_MOC_RUN
41 #include <ros/ros.h>
42 #include <rviz/panel.h>
43 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
44 # include <QtWidgets>
45 #else
46 # include <QtGui>
47 #endif
48 #include <QPainter>
49 #include <QLineEdit>
50 #include <QPushButton>
51 #include <QVBoxLayout>
52 #include <QHBoxLayout>
53 #include <QDialog>
54 #include <QListWidget>
55 #include <QListWidgetItem>
56 #include <QLabel>
57 #include <QTimer>
58 #include <QRadioButton>
59 #include <QPaintEvent>
60 #include <QMouseEvent>
61 #include <geometry_msgs/Twist.h>
62 #include <jsk_rviz_plugins/StringStamped.h>
63 #include <visualization_msgs/MarkerArray.h>
64 #include <boost/thread.hpp>
65 #endif
66 
67 namespace jsk_rviz_plugins
68 {
69  class TabletCmdVelArea: public QWidget
70  {
71  Q_OBJECT
72  public:
73  TabletCmdVelArea(QWidget* parent, ros::Publisher& pub_cmd_vel);
74  virtual QSize minimumSizeHint() const;
75  virtual QSize sizeHint() const;
76  protected:
77  virtual void paintEvent(QPaintEvent* event);
78  virtual void mouseMoveEvent(QMouseEvent* event);
79  virtual void mousePressEvent(QMouseEvent* event);
80  virtual void mouseReleaseEvent(QMouseEvent* event);
81  virtual void publishVelocity(int mouse_x, int mouse_y, int cx, int cy);
82  virtual void publishCmdVel(double x, double y, double theta);
83  int mouse_x_;
84  int mouse_y_;
86  };
87 
89  {
90  Q_OBJECT
91  public:
92  TabletControllerPanel(QWidget* parent = 0);
93  virtual ~TabletControllerPanel();
94  virtual void load(const rviz::Config& config);
95  virtual void save(rviz::Config config) const;
96 
97  protected:
99  // methods
101  virtual void spotCallback(
102  const visualization_msgs::MarkerArray::ConstPtr& marker);
103  virtual QString defaultButtonStyleSheet();
104  virtual QString executeButtonStyleSheet();
105  virtual QString radioButtonStyleSheet();
106  virtual QString listStyleSheet();
108  // GUI variables
110 
111  QVBoxLayout* layout_;
112  QPushButton* task_button_;
113  QPushButton* spot_button_;
115 
116  QDialog* task_dialog_;
117  QVBoxLayout* task_dialog_layout_;
119  QPushButton* task_execute_button_;
120  QPushButton* task_cancel_button_;
121  std::vector<QRadioButton*> task_radio_buttons_;
122 
123  std::vector<std::string> spots_;
124  QDialog* spot_dialog_;
125  QVBoxLayout* spot_dialog_layout_;
127  QPushButton* spot_go_button_;
128  QPushButton* spot_cancel_button_;
129  QListWidget* spot_list_;
131  // ROS variables
137  boost::mutex mutex_;
138 
139 
140  protected Q_SLOTS:
142  // callbacks
144  void taskButtonClicked();
145  void taskCancelClicked();
146  void taskExecuteClicked();
147  void spotButtonClicked();
148  void spotGoClicked();
149  void spotCancelClicked();
150  private:
151 
152  };
153 }
154 
155 #endif
config
std::vector< QRadioButton * > task_radio_buttons_
virtual void publishCmdVel(double x, double y, double theta)
virtual void mousePressEvent(QMouseEvent *event)
virtual void mouseMoveEvent(QMouseEvent *event)
virtual void paintEvent(QPaintEvent *event)
TabletCmdVelArea(QWidget *parent, ros::Publisher &pub_cmd_vel)
virtual void publishVelocity(int mouse_x, int mouse_y, int cx, int cy)
virtual void mouseReleaseEvent(QMouseEvent *event)


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Sat Mar 20 2021 03:03:18