39 #include <Eigen/Geometry>
43 QWidget(parent), mouse_x_(-1), mouse_y_(-1), pub_cmd_vel_(pub_cmd_vel)
45 setBackgroundRole(QPalette::Base);
46 setAutoFillBackground(
true);
51 return QSize(300, 300);
56 return QSize(300, 300);
78 QSize widget_size =
size();
83 int radius = std::min(width, height) / 2;
86 QPainter painter(
this);
87 painter.setRenderHint(QPainter::Antialiasing);
89 pen.setColor(QColor(130, 177, 255));
92 painter.drawArc(center_x - radius, center_y - radius,
93 radius * 2, radius * 2, 0, (360 + 1) * 16);
96 inner_pen.setColor(QColor(33, 150, 243));
98 inner_pen.setWidth(inner_size);
99 painter.setPen(inner_pen);
107 painter.drawArc(
mouse_x_ - inner_size / 2,
109 inner_size, inner_size, 0, (360 + 1) * 16);
113 int mouse_x,
int mouse_y,
int cx,
int cy)
115 double diff_x = mouse_x - cx;
116 double diff_y = mouse_y - cy;
117 Eigen::Vector3d ex(0, -1, 0);
118 Eigen::Vector3d vel(diff_x / cx, diff_y / cy, 0);
121 if (ex.cross(vel).dot(Eigen::Vector3d(0, 0, -1)) < 0) {
124 double dot = ex.dot(vel) / ex.norm() / vel.norm();
131 double theta = sign * acos(dot);
132 if (!std::isnan(
theta)) {
133 Eigen::Vector3d vel_refined(-vel[1], -vel[0], 0);
143 geometry_msgs::Twist twist;
146 twist.angular.z =
theta;
152 return "QPushButton {background-color: #FF5252; color: white; font-size: 30pt;}";
157 return "QPushButton {background-color: white; color: #424242; font-size: 30pt;}";
162 return "QRadioButton {font-size: 20pt; color: #424242;}";
167 return "QListWidget {font-size: 20pt; color: #424242;}";
173 pub_start_demo_ = nh.
advertise<jsk_rviz_plugins::StringStamped>(
174 "/Tablet/StartDemo", 1);
175 pub_spot_ = nh.
advertise<jsk_rviz_plugins::StringStamped>(
176 "/Tablet/MoveToSpot", 1);
177 sub_spots_ = nh.
subscribe(
"/spots_marker_array",
179 pub_cmd_vel_ = nh.
advertise<geometry_msgs::Twist>(
180 "/navigation/unsafe_vel", 1);
181 layout_ =
new QVBoxLayout();
182 layout_->addStretch();
183 task_button_ =
new QPushButton(
"Task",
this);
184 task_button_->setMinimumHeight(100);
185 task_button_->setStyleSheet(defaultButtonStyleSheet());
187 connect(task_button_, SIGNAL(released()),
this, SLOT(taskButtonClicked()));
188 layout_->addWidget(task_button_);
189 layout_->addSpacing(10);
190 spot_button_ =
new QPushButton(
"Move to spot",
this);
191 spot_button_->setMinimumHeight(100);
192 spot_button_->setStyleSheet(defaultButtonStyleSheet());
193 connect(spot_button_, SIGNAL(released()),
this, SLOT(spotButtonClicked()));
194 layout_->addWidget(spot_button_);
195 layout_->addSpacing(10);
197 layout_->addWidget(cmd_vel_area_);
201 setBackgroundRole(QPalette::Base);
202 setAutoFillBackground(
true);
224 const visualization_msgs::MarkerArray::ConstPtr&
marker)
228 for (
size_t i = 0; i <
marker->markers.size(); i++) {
245 std::vector<std::string> tasks;
246 tasks.push_back(
"/Tablet/other/GetGeorgia");
247 tasks.push_back(
"/Tablet/chen/GoToElevator");
248 tasks.push_back(
"/Tablet/chen/Greeting1");
249 tasks.push_back(
"/Tablet/chen/Greeting2");
250 tasks.push_back(
"/Tablet/chen/Greeting3");
251 tasks.push_back(
"/Tablet/chen/Greeting4");
252 tasks.push_back(
"/Tablet/chen/Greeting5");
253 tasks.push_back(
"/Tablet/chen/HandOver");
254 for (
size_t i = 0; i < tasks.size(); i++) {
255 QRadioButton* task =
new QRadioButton(QString::fromStdString(tasks[i]),
this);
256 task->setMinimumHeight(50);
258 task->setChecked(
true);
295 if (radio->isChecked()) {
296 std::string task = radio->text().toStdString();
299 jsk_rviz_plugins::StringStamped
command;
319 for (
size_t i = 0; i <
spots_.size(); i++) {
320 QListWidgetItem* item =
new QListWidgetItem(
321 QString::fromStdString(
spots_[i]));
322 item->setSizeHint(QSize(item->sizeHint().width(), 30));
354 QListWidgetItem* item =
spot_list_->currentItem();
356 std::string spot = item->text().toStdString();
357 jsk_rviz_plugins::StringStamped spot_command;
358 spot_command.data = spot;