30 #include <QMessageBox> 51 QObject::connect(
ui.actionAbout_Qt, SIGNAL(triggered(
bool)), qApp, SLOT(aboutQt()));
53 setWindowIcon(QIcon(
":/images/icon.png"));
54 ui.tab_manager->setCurrentIndex(0);
55 QObject::connect(&
qnode, SIGNAL(rosShutdown()),
this, SLOT(close()));
81 qRegisterMetaType<manipulator_h_base_module_msgs::JointPose>(
"manipulator_h_base_module_msgs::JointPose");
82 QObject::connect(&
qnode, SIGNAL(updateCurrentJointPose(manipulator_h_base_module_msgs::JointPose)),
this, SLOT(
updateCurrJointPoseSpinbox(manipulator_h_base_module_msgs::JointPose)));
84 qRegisterMetaType<manipulator_h_base_module_msgs::KinematicsPose>(
"manipulator_h_base_module_msgs::KinematicsPose");
85 QObject::connect(&
qnode, SIGNAL(updateCurrentKinematicsPose(manipulator_h_base_module_msgs::KinematicsPose)),
this, SLOT(
updateCurrKinematicsPoseSpinbox(manipulator_h_base_module_msgs::KinematicsPose)));
106 manipulator_h_base_module_msgs::JointPose msg;
111 msg.value.push_back( ((QDoubleSpinBox *)
joint_spinbox[ _id ])->value() * M_PI / 180.0 );
119 std::string group_name =
"arm";
126 manipulator_h_base_module_msgs::KinematicsPose msg;
130 msg.pose.position.x =
ui.pos_x_spinbox->value();
131 msg.pose.position.y =
ui.pos_y_spinbox->value();
132 msg.pose.position.z =
ui.pos_z_spinbox->value();
134 double roll =
ui.ori_roll_spinbox->value() * M_PI / 180.0;
135 double pitch =
ui.ori_pitch_spinbox->value() * M_PI / 180.0;
136 double yaw =
ui.ori_yaw_spinbox->value() * M_PI / 180.0;
140 msg.pose.orientation.x = QR.x();
141 msg.pose.orientation.y = QR.y();
142 msg.pose.orientation.z = QR.z();
143 msg.pose.orientation.w = QR.w();
150 std_msgs::String msg;
152 msg.data =
"ini_pose";
159 std_msgs::String msg;
161 msg.data =
"set_mode";
168 for (
int _name_index = 0; _name_index < msg.name.size(); _name_index++ )
170 for (
int _id = 0; _id <
joint_name.size(); _id++ )
172 if ( msg.name[ _id ] ==
joint_name[ _name_index ] )
174 ((QDoubleSpinBox *)
joint_spinbox[ _name_index ])->setValue( msg.value[ _id ] * 180.0 / M_PI );
183 ui.pos_x_spinbox->setValue( msg.pose.position.x );
184 ui.pos_y_spinbox->setValue( msg.pose.position.y );
185 ui.pos_z_spinbox->setValue( msg.pose.position.z );
187 Eigen::Quaterniond QR( msg.pose.orientation.w , msg.pose.orientation.x , msg.pose.orientation.y , msg.pose.orientation.z );
191 double roll = rpy.coeff( 0 , 0 ) * 180.0 / M_PI;
192 double pitch = rpy.coeff( 1 , 0 ) * 180.0 / M_PI;
193 double yaw = rpy.coeff( 2, 0 ) * 180.0 /M_PI;
195 ui.ori_roll_spinbox->setValue( roll );
196 ui.ori_pitch_spinbox->setValue( pitch );
197 ui.ori_yaw_spinbox->setValue( yaw );
202 Eigen::MatrixXd _rotation( 3 , 3 );
204 _rotation << 1.0, 0.0, 0.0,
205 0.0,
cos( angle ), -
sin( angle ),
206 0.0,
sin( angle ),
cos( angle );
213 Eigen::MatrixXd _rotation( 3 , 3 );
215 _rotation <<
cos( angle ), 0.0,
sin( angle ),
217 -
sin( angle ), 0.0,
cos( angle );
224 Eigen::MatrixXd _rotation(3,3);
226 _rotation <<
cos( angle ), -
sin( angle ), 0.0,
227 sin( angle ),
cos( angle ), 0.0,
235 Eigen::MatrixXd _rpy = Eigen::MatrixXd::Zero( 3 , 1 );
237 _rpy.coeffRef( 0 , 0 ) =
atan2( rotation.coeff( 2 , 1 ), rotation.coeff( 2 , 2 ) );
238 _rpy.coeffRef( 1 , 0 ) =
atan2( -rotation.coeff( 2 , 0 ),
sqrt(
pow( rotation.coeff( 2 , 1 ) , 2 ) +
pow( rotation.coeff( 2 , 2 ) , 2 ) ) );
239 _rpy.coeffRef( 2 , 0 ) =
atan2 ( rotation.coeff( 1 , 0 ) , rotation.coeff( 0 , 0 ) );
253 Eigen::MatrixXd _rotation =
rpy2rotation( roll, pitch, yaw );
255 Eigen::Matrix3d _rotation3d;
256 _rotation3d = _rotation.block( 0 , 0 , 3 , 3 );
258 Eigen::Quaterniond _quaternion;
260 _quaternion = _rotation3d;
267 Eigen::Matrix3d _rotation3d;
269 _rotation3d = rotation.block( 0 , 0 , 3 , 3 );
271 Eigen::Quaterniond _quaternion;
272 _quaternion = _rotation3d;
279 Eigen::MatrixXd _rpy =
rotation2rpy( quaternion.toRotationMatrix() );
286 Eigen::MatrixXd _rotation = quaternion.toRotationMatrix();
301 ui.view_logging->scrollToBottom();
309 QMessageBox::about(
this, tr(
"About ..."),tr(
"<h2>PACKAGE_NAME Test Program 0.10</h2><p>Copyright Robotis</p><p>This package needs an about description.</p>"));
318 QMainWindow::closeEvent(event);
QList< QAbstractSpinBox * > joint_spinbox
Eigen::Quaterniond rotation2quaternion(Eigen::MatrixXd rotation)
void on_curr_pos_button_clicked(bool check)
Eigen::MatrixXd rotation2rpy(Eigen::MatrixXd rotation)
void sendSetModeMsg(std_msgs::String msg)
void sendJointPoseMsg(manipulator_h_base_module_msgs::JointPose msg)
Eigen::MatrixXd quaternion2rpy(Eigen::Quaterniond quaternion)
void closeEvent(QCloseEvent *event)
MainWindow(int argc, char **argv, QWidget *parent=0)
void on_actionAbout_triggered()
void getKinematicsPose(std::string group_name)
void on_des_pos_button_clicked(bool check)
void on_curr_joint_button_clicked(bool check)
Eigen::MatrixXd rotationX(double angle)
void getJointPose(std::vector< std::string > joint_name)
Eigen::Quaterniond rpy2quaternion(double roll, double pitch, double yaw)
std::vector< std::string > joint_name
void sendKinematicsPoseMsg(manipulator_h_base_module_msgs::KinematicsPose msg)
Eigen::MatrixXd rotationZ(double angle)
void on_set_mode_button_clicked(bool check)
void updateCurrJointPoseSpinbox(manipulator_h_base_module_msgs::JointPose msg)
Qt based gui for manipulator_h_gui.
QStringListModel * loggingModel()
Eigen::MatrixXd quaternion2rotation(Eigen::Quaterniond quaternion)
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
void on_ini_pose_button_clicked(bool check)
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
void updateCurrKinematicsPoseSpinbox(manipulator_h_base_module_msgs::KinematicsPose msg)
void on_des_joint_button_clicked(bool check)
INLINE Rall1d< T, V, S > atan2(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
Eigen::MatrixXd rpy2rotation(double roll, double pitch, double yaw)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
void sendIniPoseMsg(std_msgs::String msg)
Eigen::MatrixXd rotationY(double angle)