24 #include <QMessageBox> 26 #include "../include/turtlebot3_manipulation_gui/main_window.hpp" 41 : QMainWindow(parent),
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()));
57 ui.txt_j1->setText(QString::number(joint_angle.at(0),
'f', 3));
58 ui.txt_j2->setText(QString::number(joint_angle.at(1),
'f', 3));
59 ui.txt_j3->setText(QString::number(joint_angle.at(2),
'f', 3));
60 ui.txt_j4->setText(QString::number(joint_angle.at(3),
'f', 3));
61 ui.txt_grip->setText(QString::number(joint_angle.at(4),
'f', 3));
65 if(position.size() != 3)
68 ui.txt_x->setText(QString::number(position.at(0),
'f', 3));
69 ui.txt_y->setText(QString::number(position.at(1),
'f', 3));
70 ui.txt_z->setText(QString::number(position.at(2),
'f', 3));
74 if(
ui.tabWidget->currentIndex()==0)
76 if(
ui.tabWidget->currentIndex()==1)
82 ui.plainTextEdit_log->moveCursor (QTextCursor::End);
83 ui.plainTextEdit_log->appendPlainText(str);
88 timer =
new QTimer(
this);
93 ui.btn_timer_start->setEnabled(
false);
94 ui.btn_home_pose->setEnabled(
true);
95 ui.btn_init_pose->setEnabled(
true);
96 ui.btn_read_joint_angle->setEnabled(
true);
97 ui.btn_read_kinematic_pose->setEnabled(
true);
98 ui.btn_send_joint_angle->setEnabled(
true);
99 ui.btn_send_kinematic_pose->setEnabled(
true);
100 ui.btn_gripper_close->setEnabled(
true);
101 ui.btn_gripper_open->setEnabled(
true);
102 ui.btn_set_gripper->setEnabled(
true);
107 std::vector<double> joint_angle;
108 double path_time = 2.0;
109 joint_angle.push_back(0.0);
110 joint_angle.push_back(0.0);
111 joint_angle.push_back(0.0);
112 joint_angle.push_back(0.0);
116 writeLog(
"[ERR!!] Failed to send service");
120 writeLog(
"Send joint angle to initial pose");
125 std::vector<double> joint_angle;
126 double path_time = 2.0;
128 joint_angle.push_back(0.0);
129 joint_angle.push_back(-1.0);
130 joint_angle.push_back(0.3);
131 joint_angle.push_back(0.7);
135 writeLog(
"[ERR!!] Failed to send service");
138 writeLog(
"Send joint angle to home pose");
143 std::vector<double> joint_angle;
144 joint_angle.push_back(0.010);
148 writeLog(
"[ERR!!] Failed to send service");
156 std::vector<double> joint_angle;
157 joint_angle.push_back(-0.010);
160 writeLog(
"[ERR!!] Failed to send service");
169 ui.doubleSpinBox_j1->setValue(joint_angle.at(0));
170 ui.doubleSpinBox_j2->setValue(joint_angle.at(1));
171 ui.doubleSpinBox_j3->setValue(joint_angle.at(2));
172 ui.doubleSpinBox_j4->setValue(joint_angle.at(3));
173 ui.doubleSpinBox_gripper->setValue(joint_angle.at(4));
180 std::vector<double> joint_angle;
181 double path_time =
ui.doubleSpinBox_time_js->value();
183 joint_angle.push_back(
ui.doubleSpinBox_j1->value());
184 joint_angle.push_back(
ui.doubleSpinBox_j2->value());
185 joint_angle.push_back(
ui.doubleSpinBox_j3->value());
186 joint_angle.push_back(
ui.doubleSpinBox_j4->value());
190 writeLog(
"[ERR!!] Failed to send service");
200 ui.doubleSpinBox_x->setValue(position.at(0));
201 ui.doubleSpinBox_y->setValue(position.at(1));
202 ui.doubleSpinBox_z->setValue(position.at(2));
209 std::vector<double> kinematics_pose;
210 Eigen::Quaterniond temp_orientation;
212 double path_time =
ui.doubleSpinBox_time_cs->value();
213 kinematics_pose.push_back(
ui.doubleSpinBox_x->value());
214 kinematics_pose.push_back(
ui.doubleSpinBox_y->value());
215 kinematics_pose.push_back(
ui.doubleSpinBox_z->value());
219 writeLog(
"[ERR!!] Failed to send service");
228 std::vector<double> joint_angle;
229 joint_angle.push_back(
ui.doubleSpinBox_gripper->value());
232 writeLog(
"[ERR!!] Failed to send service");
bool setToolControl(std::vector< double > joint_angle)
void on_btn_send_joint_angle_clicked(void)
void on_btn_set_gripper_clicked(void)
void on_btn_timer_start_clicked(void)
void writeLog(QString str)
void on_btn_read_joint_angle_clicked(void)
std::vector< double > getPresentKinematicsPosition()
void on_btn_send_kinematic_pose_clicked(void)
void on_btn_gripper_close_clicked(void)
void on_btn_gripper_open_clicked(void)
MainWindow(int argc, char **argv, QWidget *parent=0)
std::vector< double > getPresentJointAngle()
void on_btn_home_pose_clicked(void)
void on_btn_read_kinematic_pose_clicked(void)
bool setTaskSpacePath(std::vector< double > kinematics_pose, double path_time)
void on_btn_init_pose_clicked(void)
bool setJointSpacePath(std::vector< double > joint_angle, double path_time)