qnode.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2020 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 
17 /* Authors: Ryan Shim */
18 
19 /*****************************************************************************
20 ** Ifdefs
21 *****************************************************************************/
22 
23 #ifndef TURTLEBOT3_MANIPULATION_GUI_QNODE_HPP_
24 #define TURTLEBOT3_MANIPULATION_GUI_QNODE_HPP_
25 
26 /*****************************************************************************
27 ** Includes
28 *****************************************************************************/
29 
30 // To workaround boost/qt4 problems that won't be bugfixed. Refer to
31 // https://bugreports.qt.io/browse/QTBUG-22829
32 #ifndef Q_MOC_RUN
33 #include <ros/ros.h>
34 #endif
35 #include <string>
36 #include <QThread>
37 #include <QStringListModel>
38 #include <eigen3/Eigen/Eigen>
39 
40 #include <geometry_msgs/Pose.h>
41 #include <sensor_msgs/JointState.h>
42 #include <std_msgs/String.h>
43 
47 
51 
52 #include <moveit_msgs/DisplayTrajectory.h>
53 #include <moveit_msgs/ExecuteTrajectoryActionGoal.h>
54 #include <moveit_msgs/MoveGroupActionGoal.h>
55 
56 
57 /*****************************************************************************
58 ** Namespaces
59 *****************************************************************************/
60 
62 
63 /*****************************************************************************
64 ** Class
65 *****************************************************************************/
66 
67 class QNode : public QThread {
68  Q_OBJECT
69 public:
70  QNode(int argc, char** argv );
71  virtual ~QNode();
72  bool init();
73  void run();
74 
75  /*********************
76  ** Logging
77  **********************/
78  enum LogLevel {
84  };
85 
86  QStringListModel* loggingModel() { return &logging_model; }
87  void log( const LogLevel &level, const std::string &msg);
88 
89  void updateRobotState();
90 
91  std::vector<double> getPresentJointAngle();
92  std::vector<double> getPresentKinematicsPosition();
93 
94  bool setJointSpacePath(std::vector<double> joint_angle, double path_time);
95  bool setTaskSpacePath(std::vector<double> kinematics_pose, double path_time);
96  bool setToolControl(std::vector<double> joint_angle);
97 
98 Q_SIGNALS:
99  void rosShutdown();
100 
101 private:
103  char** init_argv;
104  QStringListModel logging_model;
105 
106  std::vector<double> present_joint_angle_;
107  std::vector<double> present_kinematics_position_;
108 
109  // MoveIt! interface
112 };
113 
114 } // namespace turtlebot3_manipulation_gui
115 
116 #endif /* TURTLEBOT3_MANIPULATION_GUI_QNODE_HPP_ */
QStringListModel logging_model
Definition: qnode.hpp:104
bool setToolControl(std::vector< double > joint_angle)
Definition: qnode.cpp:200
moveit::planning_interface::MoveGroupInterface * move_group2_
Definition: qnode.hpp:111
void log(const LogLevel &level, const std::string &msg)
std::vector< double > present_kinematics_position_
Definition: qnode.hpp:107
std::vector< double > getPresentKinematicsPosition()
Definition: qnode.cpp:122
std::vector< double > present_joint_angle_
Definition: qnode.hpp:106
moveit::planning_interface::MoveGroupInterface * move_group_
Definition: qnode.hpp:110
std::vector< double > getPresentJointAngle()
Definition: qnode.cpp:117
bool setTaskSpacePath(std::vector< double > kinematics_pose, double path_time)
Definition: qnode.cpp:159
bool setJointSpacePath(std::vector< double > joint_angle, double path_time)
Definition: qnode.cpp:127
QStringListModel * loggingModel()
Definition: qnode.hpp:86
QNode(int argc, char **argv)
Definition: qnode.cpp:40


turtlebot3_manipulation_gui
Author(s): Darby Lim , Ryan Shim
autogenerated on Sun May 10 2020 03:49:19