qnode.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2018 ROBOTIS CO., LTD.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 
24 /*****************************************************************************
25  ** Ifdefs
26  *****************************************************************************/
27 
28 #ifndef manipulator_h_gui_QNODE_HPP_
29 #define manipulator_h_gui_QNODE_HPP_
30 
31 /*****************************************************************************
32  ** Includes
33  *****************************************************************************/
34 
35 #ifndef Q_MOC_RUN
36 
37 #include <ros/ros.h>
38 #include <string>
39 #include <QThread>
40 #include <QStringListModel>
41 
42 #include <eigen3/Eigen/Eigen>
43 
44 #include <std_msgs/String.h>
45 
46 #include "robotis_controller_msgs/JointCtrlModule.h"
47 #include "robotis_controller_msgs/StatusMsg.h"
48 
49 #include <manipulator_h_base_module_msgs/JointPose.h>
50 #include <manipulator_h_base_module_msgs/KinematicsPose.h>
51 
52 #include <manipulator_h_base_module_msgs/GetJointPose.h>
53 #include <manipulator_h_base_module_msgs/GetKinematicsPose.h>
54 
55 #endif
56 
57 #define DEGREE2RADIAN (M_PI / 180.0)
58 #define RADIAN2DEGREE (180.0 / M_PI)
59 
60 #define PRINT_MAT(X) std::cout << #X << ":\n" << X << std::endl << std::endl
61 
62 /*****************************************************************************
63  ** Namespaces
64  *****************************************************************************/
65 
66 namespace manipulator_h_gui
67 {
68 
69 /*****************************************************************************
70  ** Class
71  *****************************************************************************/
72 
73 class QNode: public QThread
74 {
75  Q_OBJECT
76 public:
77  QNode(int argc, char** argv);
78  virtual ~QNode();
79  bool init();
80  void run();
81 
82  /*********************
83  ** Logging
84  **********************/
85  enum LogLevel
86  {
88  };
89 
90  QStringListModel* loggingModel()
91  {
92  return &logging_model_;
93  }
94  void log(const LogLevel &level, const std::string &msg, std::string sender = "GUI");
95  void statusMsgCallback(const robotis_controller_msgs::StatusMsg::ConstPtr &msg);
96 
97  void sendIniPoseMsg(std_msgs::String msg);
98  void sendSetModeMsg(std_msgs::String msg);
99 
100  void sendJointPoseMsg(manipulator_h_base_module_msgs::JointPose msg);
101  void sendKinematicsPoseMsg(manipulator_h_base_module_msgs::KinematicsPose msg);
102 
103 public Q_SLOTS:
104  void getJointPose( std::vector<std::string> joint_name );
105  void getKinematicsPose(std::string group_name);
106 
107 Q_SIGNALS:
108  void loggingUpdated();
109  void rosShutdown();
110 
111  void updateCurrentJointPose(manipulator_h_base_module_msgs::JointPose);
112  void updateCurrentKinematicsPose(manipulator_h_base_module_msgs::KinematicsPose);
113 
114 private:
116  char** init_argv_;
117 
119  QStringListModel logging_model_;
120 
123 
126 
129 
131 
132 };
133 
134 } // namespace manipulator_h_gui
135 
136 #endif /* manipulator_h_gui_QNODE_HPP_ */
void sendSetModeMsg(std_msgs::String msg)
Definition: qnode.cpp:161
void sendJointPoseMsg(manipulator_h_base_module_msgs::JointPose msg)
Definition: qnode.cpp:140
ros::Publisher set_mode_msg_pub_
Definition: qnode.hpp:122
void getKinematicsPose(std::string group_name)
Definition: qnode.cpp:195
void getJointPose(std::vector< std::string > joint_name)
Definition: qnode.cpp:168
QStringListModel logging_model_
Definition: qnode.hpp:119
void sendKinematicsPoseMsg(manipulator_h_base_module_msgs::KinematicsPose msg)
Definition: qnode.cpp:147
ros::Publisher chatter_publisher_
Definition: qnode.hpp:118
ros::Subscriber status_msg_sub_
Definition: qnode.hpp:130
ros::Publisher ini_pose_msg_pub_
Definition: qnode.hpp:121
QStringListModel * loggingModel()
Definition: qnode.hpp:90
QNode(int argc, char **argv)
Definition: qnode.cpp:45
void statusMsgCallback(const robotis_controller_msgs::StatusMsg::ConstPtr &msg)
Definition: qnode.cpp:95
void updateCurrentKinematicsPose(manipulator_h_base_module_msgs::KinematicsPose)
ros::Publisher kinematics_pose_msg_pub_
Definition: qnode.hpp:125
ros::Publisher joint_pose_msg_pub_
Definition: qnode.hpp:124
ros::ServiceClient get_kinematics_pose_client_
Definition: qnode.hpp:128
void log(const LogLevel &level, const std::string &msg, std::string sender="GUI")
Definition: qnode.cpp:100
ros::ServiceClient get_joint_pose_client_
Definition: qnode.hpp:127
void sendIniPoseMsg(std_msgs::String msg)
Definition: qnode.cpp:154
void updateCurrentJointPose(manipulator_h_base_module_msgs::JointPose)


manipulator_h_gui
Author(s): SCH
autogenerated on Mon Jun 10 2019 14:02:56