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/or 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 
88  class TabletControllerPanel: public rviz::Panel
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_;
118  QHBoxLayout* task_dialog_button_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_;
126  QHBoxLayout* spot_dialog_button_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
150  private:
151 
152  };
153 }
154 
155 #endif
jsk_rviz_plugins::TabletControllerPanel::listStyleSheet
virtual QString listStyleSheet()
Definition: tablet_controller_panel.cpp:197
panel.h
jsk_rviz_plugins::TabletControllerPanel::spot_dialog_
QDialog * spot_dialog_
Definition: tablet_controller_panel.h:156
jsk_rviz_plugins::TabletControllerPanel::task_execute_button_
QPushButton * task_execute_button_
Definition: tablet_controller_panel.h:151
ros::Publisher
jsk_rviz_plugins::TabletCmdVelArea::minimumSizeHint
virtual QSize minimumSizeHint() const
Definition: tablet_controller_panel.cpp:81
rviz::Panel
jsk_rviz_plugins::TabletCmdVelArea::sizeHint
virtual QSize sizeHint() const
Definition: tablet_controller_panel.cpp:86
jsk_rviz_plugins::TabletControllerPanel::TabletControllerPanel
TabletControllerPanel(QWidget *parent=0)
Definition: tablet_controller_panel.cpp:202
jsk_rviz_plugins::TabletControllerPanel::save
virtual void save(rviz::Config config) const
Definition: tablet_controller_panel.cpp:247
ros.h
jsk_rviz_plugins::TabletControllerPanel::spotButtonClicked
void spotButtonClicked()
Definition: tablet_controller_panel.cpp:340
jsk_rviz_plugins::TabletControllerPanel::taskExecuteClicked
void taskExecuteClicked()
Definition: tablet_controller_panel.cpp:323
jsk_rviz_plugins::TabletControllerPanel::taskButtonClicked
void taskButtonClicked()
Definition: tablet_controller_panel.cpp:270
overlay_sample.theta
int theta
Definition: overlay_sample.py:22
jsk_rviz_plugins::TabletControllerPanel::sub_spots_
ros::Subscriber sub_spots_
Definition: tablet_controller_panel.h:168
jsk_rviz_plugins::TabletControllerPanel::~TabletControllerPanel
virtual ~TabletControllerPanel()
Definition: tablet_controller_panel.cpp:237
jsk_rviz_plugins::TabletControllerPanel::task_dialog_layout_
QVBoxLayout * task_dialog_layout_
Definition: tablet_controller_panel.h:149
jsk_rviz_plugins::TabletControllerPanel::layout_
QVBoxLayout * layout_
Definition: tablet_controller_panel.h:143
jsk_rviz_plugins::TabletControllerPanel::pub_start_demo_
ros::Publisher pub_start_demo_
Definition: tablet_controller_panel.h:167
jsk_rviz_plugins::TabletControllerPanel::pub_cmd_vel_
ros::Publisher pub_cmd_vel_
Definition: tablet_controller_panel.h:165
jsk_rviz_plugins::TabletControllerPanel::spot_cancel_button_
QPushButton * spot_cancel_button_
Definition: tablet_controller_panel.h:160
jsk_rviz_plugins::TabletControllerPanel::spotGoClicked
void spotGoClicked()
Definition: tablet_controller_panel.cpp:384
jsk_rviz_plugins::TabletControllerPanel::task_dialog_button_layout_
QHBoxLayout * task_dialog_button_layout_
Definition: tablet_controller_panel.h:150
jsk_rviz_plugins::TabletControllerPanel::cmd_vel_area_
TabletCmdVelArea * cmd_vel_area_
Definition: tablet_controller_panel.h:146
jsk_rviz_plugins::TabletControllerPanel::spot_go_button_
QPushButton * spot_go_button_
Definition: tablet_controller_panel.h:159
jsk_rviz_plugins::TabletCmdVelArea::mouse_y_
int mouse_y_
Definition: tablet_controller_panel.h:148
jsk_rviz_plugins::TabletControllerPanel::spots_
std::vector< std::string > spots_
Definition: tablet_controller_panel.h:155
jsk_rviz_plugins::TabletControllerPanel::mutex_
boost::mutex mutex_
Definition: tablet_controller_panel.h:169
jsk_rviz_plugins::TabletCmdVelArea::pub_cmd_vel_
ros::Publisher pub_cmd_vel_
Definition: tablet_controller_panel.h:149
jsk_rviz_plugins::TabletControllerPanel::taskCancelClicked
void taskCancelClicked()
Definition: tablet_controller_panel.cpp:318
jsk_rviz_plugins::TabletControllerPanel::executeButtonStyleSheet
virtual QString executeButtonStyleSheet()
Definition: tablet_controller_panel.cpp:187
jsk_rviz_plugins::TabletControllerPanel::task_button_
QPushButton * task_button_
Definition: tablet_controller_panel.h:144
jsk_rviz_plugins::TabletControllerPanel::task_dialog_
QDialog * task_dialog_
Definition: tablet_controller_panel.h:148
jsk_rviz_plugins::TabletCmdVelArea::publishVelocity
virtual void publishVelocity(int mouse_x, int mouse_y, int cx, int cy)
Definition: tablet_controller_panel.cpp:144
bounding_box_sample.x
x
Definition: bounding_box_sample.py:26
jsk_rviz_plugins::TabletCmdVelArea::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *event)
Definition: tablet_controller_panel.cpp:101
jsk_rviz_plugins::TabletCmdVelArea::TabletCmdVelArea
TabletCmdVelArea(QWidget *parent, ros::Publisher &pub_cmd_vel)
Definition: tablet_controller_panel.cpp:74
jsk_rviz_plugins::TabletCmdVelArea::paintEvent
virtual void paintEvent(QPaintEvent *event)
Definition: tablet_controller_panel.cpp:108
jsk_rviz_plugins::TabletCmdVelArea::publishCmdVel
virtual void publishCmdVel(double x, double y, double theta)
Definition: tablet_controller_panel.cpp:171
jsk_rviz_plugins::TabletControllerPanel::spotCallback
virtual void spotCallback(const visualization_msgs::MarkerArray::ConstPtr &marker)
Definition: tablet_controller_panel.cpp:255
bounding_box_sample.y
y
Definition: bounding_box_sample.py:27
jsk_rviz_plugins::TabletControllerPanel::spot_list_
QListWidget * spot_list_
Definition: tablet_controller_panel.h:161
jsk_rviz_plugins::TabletCmdVelArea::mouse_x_
int mouse_x_
Definition: tablet_controller_panel.h:147
jsk_rviz_plugins::TabletCmdVelArea
Definition: tablet_controller_panel.h:101
jsk_rviz_plugins::TabletControllerPanel::radioButtonStyleSheet
virtual QString radioButtonStyleSheet()
Definition: tablet_controller_panel.cpp:192
jsk_rviz_plugins::TabletControllerPanel::spot_dialog_button_layout_
QHBoxLayout * spot_dialog_button_layout_
Definition: tablet_controller_panel.h:158
jsk_rviz_plugins::TabletControllerPanel::spot_button_
QPushButton * spot_button_
Definition: tablet_controller_panel.h:145
jsk_rviz_plugins::TabletControllerPanel::load
virtual void load(const rviz::Config &config)
Definition: tablet_controller_panel.cpp:242
jsk_rviz_plugins::TabletControllerPanel::defaultButtonStyleSheet
virtual QString defaultButtonStyleSheet()
Definition: tablet_controller_panel.cpp:182
jsk_rviz_plugins::TabletControllerPanel::spot_dialog_layout_
QVBoxLayout * spot_dialog_layout_
Definition: tablet_controller_panel.h:157
jsk_rviz_plugins::TabletControllerPanel::pub_spot_
ros::Publisher pub_spot_
Definition: tablet_controller_panel.h:166
jsk_rviz_plugins::TabletCmdVelArea::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event)
Definition: tablet_controller_panel.cpp:96
jsk_rviz_plugins::TabletCmdVelArea::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *event)
Definition: tablet_controller_panel.cpp:91
jsk_rviz_plugins
Definition: __init__.py:1
rviz::Config
ros::Subscriber
jsk_rviz_plugins::TabletControllerPanel::spotCancelClicked
void spotCancelClicked()
Definition: tablet_controller_panel.cpp:379
jsk_rviz_plugins::TabletControllerPanel::task_cancel_button_
QPushButton * task_cancel_button_
Definition: tablet_controller_panel.h:152
jsk_rviz_plugins::TabletControllerPanel::task_radio_buttons_
std::vector< QRadioButton * > task_radio_buttons_
Definition: tablet_controller_panel.h:153


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Tue Dec 10 2024 03:48:25