object_fit_operator.cpp
Go to the documentation of this file.
1 #include <QLineEdit>
2 #include <QToolButton>
3 #include <QVBoxLayout>
4 #include <QHBoxLayout>
5 #include <QTabWidget>
6 #include <QCheckBox>
7 #include <QLabel>
8 #include <ros/package.h>
9 
10 #include "object_fit_operator.h"
11 
12 using namespace rviz;
13 namespace jsk_rviz_plugins
14 {
15  ObjectFitOperatorAction::ObjectFitOperatorAction( QWidget* parent )
16  : rviz::Panel( parent )
17  {
18  layout = new QVBoxLayout;
19 
20  horizontal_layout1_ = new QHBoxLayout();
21  horizontal_layout2_ = new QHBoxLayout();
22 
23  //Button to send cancel topic
24  std::string fit_button_name, reverse_fit_button_name, near_button_name, other_button_name;
25  nh_.param<std::string>("/object_fit_icon", fit_button_name, ros::package::getPath("jsk_rviz_plugins")+std::string("/icons/fit.jpg"));
26  nh_.param<std::string>("/object_near_icon", near_button_name, ros::package::getPath("jsk_rviz_plugins")+std::string("/icons/near.jpg"));
27  nh_.param<std::string>("/object_other_icon", other_button_name, ros::package::getPath("jsk_rviz_plugins")+std::string("/icons/other.jpg"));
28 
29  QSize iconSize(150, 150);
30  fit_button_ = new QToolButton();
31  fit_button_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
32  fit_button_->setIcon(QIcon(QPixmap(QString(fit_button_name.c_str()))));
33  fit_button_->setText("Onto");
34  fit_button_->setIconSize(iconSize);
35  horizontal_layout1_->addWidget( fit_button_ );
36 
37  check_box_ = new QCheckBox(QString("Reverse"));
38  horizontal_layout1_->addWidget(check_box_);
39 
40  near_button_ = new QToolButton();
41  near_button_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
42  near_button_->setIcon(QIcon(QPixmap(QString(near_button_name.c_str()))));
43  near_button_->setIconSize(iconSize);
44  near_button_->setText("Parallel");
45  horizontal_layout2_->addWidget( near_button_ );
46 
47  other_button_ = new QToolButton();
48  other_button_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
49  other_button_->setIcon(QIcon(QPixmap(QString(other_button_name.c_str()))));
50  other_button_->setText("Perpendicular");
51  other_button_->setIconSize(iconSize);
52  horizontal_layout2_->addWidget( other_button_ );
53 
54  layout->addLayout(horizontal_layout1_);
55  layout->addLayout(horizontal_layout2_);
56  setLayout( layout );
57 
58  connect( fit_button_, SIGNAL( clicked() ), this, SLOT( commandFit()));
59  connect( check_box_, SIGNAL(clicked(bool)), this, SLOT(checkBoxChanged(bool)));
60  connect( near_button_, SIGNAL( clicked() ), this, SLOT( commandNear()));
61  connect( other_button_, SIGNAL( clicked() ), this, SLOT( commandOther()));
62 
63  pub_ = nh_.advertise<jsk_rviz_plugins::ObjectFitCommand>( "/object_fit_command", 1 );
64  }
65 
67  reverse_ = state;
68  }
69 
71  if(reverse_)
72  publishObjectFitOder(jsk_rviz_plugins::ObjectFitCommand::REVERSE_FIT);
73  else
74  publishObjectFitOder(jsk_rviz_plugins::ObjectFitCommand::FIT);
75  }
76 
78  if(reverse_)
79  publishObjectFitOder(jsk_rviz_plugins::ObjectFitCommand::REVERSE_NEAR);
80  else
81  publishObjectFitOder(jsk_rviz_plugins::ObjectFitCommand::NEAR);
82  }
83 
85  if(reverse_)
86  publishObjectFitOder(jsk_rviz_plugins::ObjectFitCommand::REVERSE_OTHER);
87  else
88  publishObjectFitOder(jsk_rviz_plugins::ObjectFitCommand::OTHER);
89  }
90 
92  jsk_rviz_plugins::ObjectFitCommand msg;
93  msg.command = type;
94  pub_.publish(msg);
95  }
96 
98  {
99  rviz::Panel::save( config );
100  }
101 
103  {
104  rviz::Panel::load( config );
105  }
106 }
107 
msg
void publish(const boost::shared_ptr< M > &message) const
PLUGINLIB_EXPORT_CLASS(jsk_rviz_plugins::PictogramArrayDisplay, rviz::Display)
virtual void save(rviz::Config config) const
bool param(const std::string &param_name, T &param_val, const T &default_val) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ROSLIB_DECL std::string getPath(const std::string &package_name)
virtual void load(const rviz::Config &config)
virtual void save(Config config) const
virtual void load(const Config &config)


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