thormang3_offset_tuner_server.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  * thormang3_offset_tuner_server.cpp
19  *
20  * Created on: 2016. 2. 15.
21  * Author: Jay Song
22  */
23 
24 #ifndef THORMANG3_OFFSET_TUNER_SERVER_H_
25 #define THORMANG3_OFFSET_TUNER_SERVER_H_
26 
27 #include <map>
28 #include <fstream>
29 #include <ros/ros.h>
30 #include <yaml-cpp/yaml.h>
31 
34 #include "thormang3_offset_tuner_msgs/JointOffsetData.h"
35 #include "thormang3_offset_tuner_msgs/JointTorqueOnOffArray.h"
36 #include "thormang3_offset_tuner_msgs/GetPresentJointOffsetData.h"
37 
38 namespace thormang3
39 {
40 
42 {
43 public:
46  int p_gain_;
47  int i_gain_;
48  int d_gain_;
49 
51  {
52  joint_offset_rad_ = 0;
53  joint_init_pos_rad_ = 0;
54  p_gain_ = 32;
55  i_gain_ = 0;
56  d_gain_ = 0;
57  }
58 
59  JointOffsetData(double joint_offset_rad, double joint_init_pose_rad)
60  {
61  this->joint_offset_rad_ = joint_offset_rad;
62  this->joint_init_pos_rad_ = joint_init_pose_rad;
63  p_gain_ = 32;
64  i_gain_ = 0;
65  d_gain_ = 0;
66  }
67 
69  {
70  }
71 };
72 
73 class OffsetTunerServer: public robotis_framework::Singleton<OffsetTunerServer>
74 {
75 private:
76  //RobotisController* controller_;
77 
79 
80  std::string init_file_;
81  std::string robot_file_;
82  std::string offset_file_;
83 
84  std::map<std::string, bool> robot_torque_enable_data_;
85  std::map<std::string, JointOffsetData*> robot_offset_data_;
86 
92 
93  void setCtrlModule(std::string module);
94 
95 public:
98 
99  bool initialize();
100  void moveToInitPose();
101  void stringMsgsCallBack(const std_msgs::String::ConstPtr& msg);
102  void commandCallback(const std_msgs::String::ConstPtr& msg);
103  void jointOffsetDataCallback(const thormang3_offset_tuner_msgs::JointOffsetData::ConstPtr &msg);
104  void jointTorqueOnOffCallback(const thormang3_offset_tuner_msgs::JointTorqueOnOffArray::ConstPtr& msg);
105  bool getPresentJointOffsetDataServiceCallback(thormang3_offset_tuner_msgs::GetPresentJointOffsetData::Request &req,
106  thormang3_offset_tuner_msgs::GetPresentJointOffsetData::Response &res);
107 
108 };
109 
110 }
111 
112 #endif /* THORMANG3_OFFSET_TUNER_SERVER_H_ */
ROSCONSOLE_DECL void initialize()
JointOffsetData(double joint_offset_rad, double joint_init_pose_rad)
std::map< std::string, bool > robot_torque_enable_data_
robotis_framework::RobotisController * controller_
std::map< std::string, JointOffsetData * > robot_offset_data_


thormang3_offset_tuner_server
Author(s): Kayman , SCH , Jay Song
autogenerated on Mon Jun 10 2019 15:37:48