24 #include <QMessageBox> 26 #include "../include/open_manipulator_p_control_gui/main_window.hpp" 45 QObject::connect(
ui.actionAbout_Qt, SIGNAL(triggered(
bool)), qApp, SLOT(aboutQt()));
46 connect(
ui.tabWidget, SIGNAL(currentChanged(
int)),
this, SLOT(
tabSelected()));
47 QObject::connect(&
qnode, SIGNAL(rosShutdown()),
this, SLOT(close()));
61 if(joint_angle.size() != joint_size)
64 ui.txt_j1->setText(QString::number(joint_angle.at(0),
'f', 3));
65 ui.txt_j2->setText(QString::number(joint_angle.at(1),
'f', 3));
66 ui.txt_j3->setText(QString::number(joint_angle.at(2),
'f', 3));
67 ui.txt_j4->setText(QString::number(joint_angle.at(3),
'f', 3));
68 ui.txt_j5->setText(QString::number(joint_angle.at(4),
'f', 3));
69 ui.txt_j6->setText(QString::number(joint_angle.at(5),
'f', 3));
75 if(position.size() != 3 || orientation_rpy.size() != 3)
78 ui.txt_x->setText(QString::number(position.at(0),
'f', 3));
79 ui.txt_y->setText(QString::number(position.at(1),
'f', 3));
80 ui.txt_z->setText(QString::number(position.at(2),
'f', 3));
82 ui.txt_roll->setText(QString::number(orientation_rpy.coeffRef(0,0),
'f', 3));
83 ui.txt_pitch->setText(QString::number(orientation_rpy.coeffRef(1,0),
'f', 3));
84 ui.txt_yaw->setText(QString::number(orientation_rpy.coeffRef(2,0),
'f', 3));
87 ui.txt_actuactor_state->setText(
"Actuator enabled");
89 ui.txt_actuactor_state->setText(
"Actuator disabled");
91 ui.txt_moving_state->setText(
"Robot is moving");
93 ui.txt_moving_state->setText(
"Robot is stopped");
98 if(
ui.tabWidget->currentIndex()==0)
100 if(
ui.tabWidget->currentIndex()==1)
106 ui.plainTextEdit_log->moveCursor (QTextCursor::End);
107 ui.plainTextEdit_log->appendPlainText(str);
112 timer =
new QTimer(
this);
117 ui.btn_timer_start->setEnabled(
false);
118 ui.btn_actuator_disable->setEnabled(
true);
119 ui.btn_actuator_enable->setEnabled(
true);
120 ui.btn_home_pose->setEnabled(
true);
121 ui.btn_init_pose->setEnabled(
true);
122 ui.btn_read_joint_angle->setEnabled(
true);
123 ui.btn_read_kinematic_pose->setEnabled(
true);
124 ui.btn_send_joint_angle->setEnabled(
true);
125 ui.btn_send_kinematic_pose->setEnabled(
true);
126 ui.btn_send_drawing_trajectory->setEnabled(
true);
130 ui.btn_gripper_close->setEnabled(
true);
131 ui.btn_gripper_open->setEnabled(
true);
132 ui.btn_set_gripper->setEnabled(
true);
140 writeLog(
"[ERR!!] Failed to send service");
144 writeLog(
"Send actuator state to enable");
151 writeLog(
"[ERR!!] Failed to send service");
155 writeLog(
"Send actuator state to disable");
160 std::vector<std::string> joint_name;
161 std::vector<double> joint_angle;
162 double path_time = 2.0;
163 joint_name.push_back(
"joint1"); joint_angle.push_back(0.0);
164 joint_name.push_back(
"joint2"); joint_angle.push_back(0.0);
165 joint_name.push_back(
"joint3"); joint_angle.push_back(0.0);
166 joint_name.push_back(
"joint4"); joint_angle.push_back(0.0);
167 joint_name.push_back(
"joint5"); joint_angle.push_back(0.0);
168 joint_name.push_back(
"joint6"); joint_angle.push_back(0.0);
172 writeLog(
"[ERR!!] Failed to send service");
176 writeLog(
"Send joint angle to initial pose");
181 std::vector<std::string> joint_name;
182 std::vector<double> joint_angle;
183 double path_time = 2.0;
185 joint_name.push_back(
"joint1"); joint_angle.push_back(0.0);
186 joint_name.push_back(
"joint2"); joint_angle.push_back(-
PI/4);
187 joint_name.push_back(
"joint3"); joint_angle.push_back(
PI/8);
188 joint_name.push_back(
"joint4"); joint_angle.push_back(0.0);
189 joint_name.push_back(
"joint5"); joint_angle.push_back(
PI/8);
190 joint_name.push_back(
"joint6"); joint_angle.push_back(0.0);
194 writeLog(
"[ERR!!] Failed to send service");
197 writeLog(
"Send joint angle to home pose");
202 std::vector<double> joint_angle;
203 joint_angle.push_back(0.0);
206 writeLog(
"[ERR!!] Failed to send service");
215 std::vector<double> joint_angle;
216 joint_angle.push_back(1.1);
219 writeLog(
"[ERR!!] Failed to send service");
230 ui.doubleSpinBox_j1->setValue(joint_angle.at(0));
231 ui.doubleSpinBox_j2->setValue(joint_angle.at(1));
232 ui.doubleSpinBox_j3->setValue(joint_angle.at(2));
233 ui.doubleSpinBox_j4->setValue(joint_angle.at(3));
234 ui.doubleSpinBox_j5->setValue(joint_angle.at(4));
235 ui.doubleSpinBox_j6->setValue(joint_angle.at(5));
242 std::vector<std::string> joint_name;
243 std::vector<double> joint_angle;
244 double path_time =
ui.doubleSpinBox_time_js->value();
246 joint_name.push_back(
"joint1"); joint_angle.push_back(
ui.doubleSpinBox_j1->value());
247 joint_name.push_back(
"joint2"); joint_angle.push_back(
ui.doubleSpinBox_j2->value());
248 joint_name.push_back(
"joint3"); joint_angle.push_back(
ui.doubleSpinBox_j3->value());
249 joint_name.push_back(
"joint4"); joint_angle.push_back(
ui.doubleSpinBox_j4->value());
250 joint_name.push_back(
"joint5"); joint_angle.push_back(
ui.doubleSpinBox_j5->value());
251 joint_name.push_back(
"joint6"); joint_angle.push_back(
ui.doubleSpinBox_j6->value());
255 writeLog(
"[ERR!!] Failed to send service");
266 ui.doubleSpinBox_x->setValue(position.at(0));
267 ui.doubleSpinBox_y->setValue(position.at(1));
268 ui.doubleSpinBox_z->setValue(position.at(2));
269 ui.doubleSpinBox_roll->setValue(orientation_rpy.coeffRef(0,0));
270 ui.doubleSpinBox_pitch->setValue(orientation_rpy.coeffRef(1,0));
271 ui.doubleSpinBox_yaw->setValue(orientation_rpy.coeffRef(2,0));
277 std::vector<double> kinematics_pose;
278 Eigen::Quaterniond temp_orientation;
281 double path_time =
ui.doubleSpinBox_time_cs->value();
283 kinematics_pose.push_back(
ui.doubleSpinBox_x->value());
284 kinematics_pose.push_back(
ui.doubleSpinBox_y->value());
285 kinematics_pose.push_back(
ui.doubleSpinBox_z->value());
286 kinematics_pose.push_back(temp_orientation.w());
287 kinematics_pose.push_back(temp_orientation.x());
288 kinematics_pose.push_back(temp_orientation.y());
289 kinematics_pose.push_back(temp_orientation.z());
293 writeLog(
"[ERR!!] Failed to send service");
301 std::vector<double> joint_angle;
302 joint_angle.push_back(
ui.doubleSpinBox_gripper->value());
305 writeLog(
"[ERR!!] Failed to send service");
314 writeLog(
"Check the terminal of open_manipulator_controller package");
320 ui.txt_drawing_arg_1->setText(
"Transpose X");
321 ui.txt_drawing_arg_2->setText(
"Transpose Y");
322 ui.txt_drawing_arg_3->setText(
"Transpose Z");
323 ui.txt_drawing_arg_unit_1->setText(
"m");
324 ui.txt_drawing_arg_unit_2->setText(
"m");
325 ui.txt_drawing_arg_unit_3->setText(
"m");
326 ui.doubleSpinBox_drawing_arg_1->setValue(0.0);
327 ui.doubleSpinBox_drawing_arg_2->setValue(0.0);
328 ui.doubleSpinBox_drawing_arg_3->setValue(0.0);
332 ui.txt_drawing_arg_1->setText(
"Radius");
333 ui.txt_drawing_arg_2->setText(
"Revolution");
334 ui.txt_drawing_arg_3->setText(
"Start angle");
335 ui.txt_drawing_arg_unit_1->setText(
"m");
336 ui.txt_drawing_arg_unit_2->setText(
"rev");
337 ui.txt_drawing_arg_unit_3->setText(
"rad");
338 ui.doubleSpinBox_drawing_arg_1->setValue(0.0);
339 ui.doubleSpinBox_drawing_arg_2->setValue(0.0);
340 ui.doubleSpinBox_drawing_arg_3->setValue(0.0);
344 ui.txt_drawing_arg_1->setText(
"Radius");
345 ui.txt_drawing_arg_2->setText(
"Revolution");
346 ui.txt_drawing_arg_3->setText(
"Start angle");
347 ui.txt_drawing_arg_unit_1->setText(
"m");
348 ui.txt_drawing_arg_unit_2->setText(
"rev");
349 ui.txt_drawing_arg_unit_3->setText(
"rad");
350 ui.doubleSpinBox_drawing_arg_1->setValue(0.0);
351 ui.doubleSpinBox_drawing_arg_2->setValue(0.0);
352 ui.doubleSpinBox_drawing_arg_3->setValue(0.0);
356 ui.txt_drawing_arg_1->setText(
"Radius");
357 ui.txt_drawing_arg_2->setText(
"Revolution");
358 ui.txt_drawing_arg_3->setText(
"Start angle");
359 ui.txt_drawing_arg_unit_1->setText(
"m");
360 ui.txt_drawing_arg_unit_2->setText(
"rev");
361 ui.txt_drawing_arg_unit_3->setText(
"rad");
362 ui.doubleSpinBox_drawing_arg_1->setValue(0.0);
363 ui.doubleSpinBox_drawing_arg_2->setValue(0.0);
364 ui.doubleSpinBox_drawing_arg_3->setValue(0.0);
369 if(
ui.radio_drawing_line->isChecked()) name =
"line";
370 else if(
ui.radio_drawing_circle->isChecked()) name =
"circle";
371 else if(
ui.radio_drawing_rhombus->isChecked()) name =
"rhombus";
372 else if(
ui.radio_drawing_heart->isChecked()) name =
"heart";
374 std::vector<double> arg;
375 arg.push_back(
ui.doubleSpinBox_drawing_arg_1->value());
376 arg.push_back(
ui.doubleSpinBox_drawing_arg_2->value());
377 arg.push_back(
ui.doubleSpinBox_drawing_arg_3->value());
379 double path_time =
ui.doubleSpinBox_time_drawing->value();
383 writeLog(
"[ERR!!] Failed to send service");
386 writeLog(
"Send drawing trajectory");
std::vector< double > getPresentJointAngle()
bool getOpenManipulatorMovingState()
bool setActuatorState(bool actuator_state)
void on_btn_get_manipulator_setting_clicked(void)
void writeLog(QString str)
void on_radio_drawing_circle_clicked(void)
void setOption(std::string opt)
void on_radio_drawing_rhombus_clicked(void)
void on_btn_actuator_enable_clicked(void)
void on_radio_drawing_line_clicked(void)
void on_btn_home_pose_clicked(void)
void on_btn_read_kinematic_pose_clicked(void)
MainWindow(int argc, char **argv, QWidget *parent=0)
void on_btn_send_joint_angle_clicked(void)
void on_btn_gripper_open_clicked(void)
void on_btn_init_pose_clicked(void)
bool getWithGripperState()
void on_btn_gripper_close_clicked(void)
std::vector< double > getPresentKinematicsPosition()
bool setJointSpacePath(std::vector< std::string > joint_name, std::vector< double > joint_angle, double path_time)
bool getOpenManipulatorActuatorState()
void on_btn_timer_start_clicked(void)
void on_btn_send_drawing_trajectory_clicked(void)
Eigen::Quaterniond convertRPYToQuaternion(double roll, double pitch, double yaw)
void on_btn_set_gripper_clicked(void)
void on_btn_actuator_disable_clicked(void)
void on_btn_send_kinematic_pose_clicked(void)
void on_radio_drawing_heart_clicked(void)
void on_btn_read_joint_angle_clicked(void)
bool setDrawingTrajectory(std::string name, std::vector< double > arg, double path_time)
bool setTaskSpacePath(std::vector< double > kinematics_pose, double path_time)
Eigen::Vector3d getPresentKinematicsOrientationRPY()
bool setToolControl(std::vector< double > joint_angle)