base_module.h
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  * ThorManipulation.h
19  *
20  * Created on: 2016. 1. 18.
21  * Author: Zerom
22  */
23 
24 #ifndef THORMANG3_BASE_MODULE_BASE_MODULE_H_
25 #define THORMANG3_BASE_MODULE_BASE_MODULE_H_
26 
27 #include <map>
28 #include <fstream>
29 #include <ros/ros.h>
30 #include <ros/callback_queue.h>
31 #include <ros/package.h>
32 #include <std_msgs/Int16.h>
33 #include <std_msgs/Float64.h>
34 #include <std_msgs/String.h>
35 #include <geometry_msgs/Pose.h>
36 #include <boost/thread.hpp>
37 #include <eigen3/Eigen/Eigen>
38 #include <yaml-cpp/yaml.h>
39 
40 #include "robotis_controller_msgs/StatusMsg.h"
41 
45 
46 #include "base_module_state.h"
47 
48 namespace thormang3
49 {
50 
52 {
53 public:
54  double position_;
55  double velocity_;
56  double effort_;
57 
58  int p_gain_;
59  int i_gain_;
60  int d_gain_;
61 };
62 
64 {
65 public:
66  BaseJointData curr_joint_state_[MAX_JOINT_ID + 1];
67  BaseJointData goal_joint_state_[MAX_JOINT_ID + 1];
68  BaseJointData fake_joint_state_[MAX_JOINT_ID + 1];
69 };
70 
72 {
73 public:
74  BaseModule();
75  virtual ~BaseModule();
76 
77  /* ROS Framework Functions */
78  void initialize(const int control_cycle_msec, robotis_framework::Robot *robot);
79  void process(std::map<std::string, robotis_framework::Dynamixel *> dxls, std::map<std::string, double> sensors);
80 
81  void stop();
82  bool isRunning();
83 
84  /* ROS Topic Callback Functions */
85  void initPoseMsgCallback(const std_msgs::String::ConstPtr& msg);
86 
87  /* ROS Calculation Functions */
88  void initPoseTrajGenerateProc();
89 
90  void poseGenerateProc(Eigen::MatrixXd joint_angle_pose);
91  void poseGenerateProc(std::map<std::string, double>& joint_angle_pose);
92 
93  /* Parameter */
96 
97 private:
98  void queueThread();
99 
100  void setCtrlModule(std::string module);
101  void parseIniPoseData(const std::string &path);
102  void publishStatusMsg(unsigned int type, std::string msg);
103  void publishDoneMsg(const std::string done_msg);
104 
106 
107  boost::thread queue_thread_;
108  boost::thread tra_gene_tread_;
109 
110  // ros::Publisher send_tra_pub_;
114 
115  std::map<std::string, int> joint_name_to_id_;
116 
119 };
120 
121 }
122 
123 #endif /* THORMANG3_BASE_MODULE_BASE_MODULE_H_ */
ros::Publisher movement_done_pub_
Definition: base_module.h:113
ROSCONSOLE_DECL void initialize()
boost::thread tra_gene_tread_
Definition: base_module.h:108
BaseJointState * joint_state_
Definition: base_module.h:95
ros::Publisher set_ctrl_module_pub_
Definition: base_module.h:112
boost::thread queue_thread_
Definition: base_module.h:107
ros::Publisher status_msg_pub_
Definition: base_module.h:111
#define MAX_JOINT_ID
BaseModuleState * base_module_state_
Definition: base_module.h:94
std::map< std::string, int > joint_name_to_id_
Definition: base_module.h:115


thormang3_base_module
Author(s): SCH
autogenerated on Mon Jun 10 2019 15:37:51