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 
17 /*****************************************************************************
18 ** Ifdefs
19 *****************************************************************************/
20 
21 #ifndef rh_p12_rn_gui_QNODE_HPP_
22 #define rh_p12_rn_gui_QNODE_HPP_
23 
24 /*****************************************************************************
25 ** Includes
26 *****************************************************************************/
27 
28 #ifndef Q_MOC_RUN
29 
30 #include <ros/ros.h>
31 #include <string>
32 #include <QThread>
33 #include <QStringListModel>
34 
35 #include "rh_p12_rn_base_module_msgs/GetItemValue.h"
36 #include "robotis_controller_msgs/SyncWriteItem.h"
37 #include "robotis_controller_msgs/JointCtrlModule.h"
38 
39 #endif
40 
41 /*****************************************************************************
42 ** Namespaces
43 *****************************************************************************/
44 
45 namespace rh_p12_rn_gui {
46 
47 /*****************************************************************************
48 ** Class
49 *****************************************************************************/
50 
51 class QNode : public QThread {
52  Q_OBJECT
53 public:
54  QNode(int argc, char** argv );
55  virtual ~QNode();
56  bool init();
57  void run();
58 
59  /*********************
60  ** Logging
61  **********************/
62  enum LogLevel {
68  };
69 
70  QStringListModel* loggingModel() { return &logging_model; }
71  void log( const LogLevel &level, const std::string &msg);
72 
73  void setCtrlItem(const robotis_controller_msgs::SyncWriteItem &msg);
74  void setPosition(const robotis_controller_msgs::SyncWriteItem &msg);
75 
76  uint32_t getItemValue(std::string item_name);
77 
78 Q_SIGNALS:
79  void loggingUpdated();
80  void rosShutdown();
81  void refreshValue(int pos, int curr);
82 
83 private:
84  int init_argc;
85  char** init_argv;
86  QStringListModel logging_model;
87 
90 
92 };
93 
94 } // namespace rh_p12_rn_gui
95 
96 #endif /* rh_p12_rn_gui_QNODE_HPP_ */
void refreshValue(int pos, int curr)
void setPosition(const robotis_controller_msgs::SyncWriteItem &msg)
Definition: qnode.cpp:90
void log(const LogLevel &level, const std::string &msg)
Definition: qnode.cpp:107
ros::ServiceClient get_item_value_client_
Definition: qnode.hpp:91
QNode(int argc, char **argv)
Definition: qnode.cpp:38
QStringListModel logging_model
Definition: qnode.hpp:86
ros::Publisher sync_write_position_pub_
Definition: qnode.hpp:89
ros::Publisher sync_write_item_pub_
Definition: qnode.hpp:88
uint32_t getItemValue(std::string item_name)
Definition: qnode.cpp:95
char ** init_argv
Definition: qnode.hpp:85
virtual ~QNode()
Definition: qnode.cpp:43
void setCtrlItem(const robotis_controller_msgs::SyncWriteItem &msg)
Definition: qnode.cpp:85
QStringListModel * loggingModel()
Definition: qnode.hpp:70


rh_p12_rn_gui
Author(s): Zerom
autogenerated on Mon Jun 10 2019 14:42:12