manipulation_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  * manipulation_module.h
19  *
20  * Created on: June 7, 2016
21  * Author: SCH
22  */
23 
24 #ifndef THORMANG3_MANIPULATION_MODULE_MANIPULATION_MODULE_H_
25 #define THORMANG3_MANIPULATION_MODULE_MANIPULATION_MODULE_H_
26 
27 #include <map>
28 #include <ros/ros.h>
29 #include <ros/callback_queue.h>
30 #include <ros/package.h>
31 #include <std_msgs/Int16.h>
32 #include <std_msgs/Float64.h>
33 #include <std_msgs/String.h>
34 #include <geometry_msgs/Pose.h>
35 #include <boost/thread.hpp>
36 #include <eigen3/Eigen/Eigen>
37 #include <yaml-cpp/yaml.h>
38 
39 #include "robotis_controller_msgs/JointCtrlModule.h"
40 #include "robotis_controller_msgs/StatusMsg.h"
41 
42 #include "thormang3_manipulation_module_msgs/JointPose.h"
43 #include "thormang3_manipulation_module_msgs/KinematicsPose.h"
44 #include "thormang3_manipulation_module_msgs/GetJointPose.h"
45 #include "thormang3_manipulation_module_msgs/GetKinematicsPose.h"
46 
49 
51 
52 
53 namespace thormang3
54 {
55 
57  public robotis_framework::Singleton<ManipulationModule>
58 {
59 public:
61  virtual ~ManipulationModule();
62 
63  /* ROS Topic Callback Functions */
64  void initPoseMsgCallback(const std_msgs::String::ConstPtr& msg);
65  void jointPoseMsgCallback(const thormang3_manipulation_module_msgs::JointPose::ConstPtr& msg);
66  void kinematicsPoseMsgCallback(const thormang3_manipulation_module_msgs::KinematicsPose::ConstPtr& msg);
67 
68  bool getJointPoseCallback(thormang3_manipulation_module_msgs::GetJointPose::Request &req,
69  thormang3_manipulation_module_msgs::GetJointPose::Response &res);
70  bool getKinematicsPoseCallback(thormang3_manipulation_module_msgs::GetKinematicsPose::Request &req,
71  thormang3_manipulation_module_msgs::GetKinematicsPose::Response &res);
72 
73  /* ROS Calculation Functions */
75  void jointTrajGenerateProc();
76  void taskTrajGenerateProc();
77 
78  /* ROS Framework Functions */
79  void initialize(const int control_cycle_msec, robotis_framework::Robot *robot);
80  void process(std::map<std::string, robotis_framework::Dynamixel *> dxls, std::map<std::string, double> sensors);
81  void stop();
82  bool isRunning();
83 
84  void publishStatusMsg(unsigned int type, std::string msg);
85 
86  /* Parameter */
88 
89 private:
90  void queueThread();
91 
92  void parseData(const std::string &path);
93  void parseIniPoseData(const std::string &path);
94 
96 
98  boost::thread queue_thread_;
99  boost::thread *traj_generate_tread_;
100 
101  std_msgs::String movement_done_msg_;
102 
105 
106  /* joint state */
107  Eigen::VectorXd present_joint_position_;
108  Eigen::VectorXd goal_joint_position_;
109  Eigen::VectorXd init_joint_position_;
110 
111  /* trajectory */
113  double mov_time_;
114  int cnt_;
116 
117  Eigen::MatrixXd goal_joint_tra_;
118  Eigen::MatrixXd goal_task_tra_;
119 
120  /* msgs */
121  thormang3_manipulation_module_msgs::JointPose goal_joint_pose_msg_;
122  thormang3_manipulation_module_msgs::KinematicsPose goal_kinematics_pose_msg_;
123 
124  /* inverse kinematics */
128 
129  Eigen::MatrixXd ik_target_position_;
130  Eigen::MatrixXd ik_start_rotation_;
131  Eigen::MatrixXd ik_target_rotation_;
132  Eigen::MatrixXd ik_weight_;
133 
134  void setInverseKinematics(int cnt, Eigen::MatrixXd start_rotation);
135 
136  std::map<std::string, int> joint_name_to_id_;
137 };
138 
139 }
140 
141 #endif /* THORMANG3_MANIPULATION_MODULE_MANIPULATION_MODULE_H_ */
void kinematicsPoseMsgCallback(const thormang3_manipulation_module_msgs::KinematicsPose::ConstPtr &msg)
void initialize(const int control_cycle_msec, robotis_framework::Robot *robot)
void jointPoseMsgCallback(const thormang3_manipulation_module_msgs::JointPose::ConstPtr &msg)
thormang3_manipulation_module_msgs::KinematicsPose goal_kinematics_pose_msg_
bool getJointPoseCallback(thormang3_manipulation_module_msgs::GetJointPose::Request &req, thormang3_manipulation_module_msgs::GetJointPose::Response &res)
void parseIniPoseData(const std::string &path)
thormang3_manipulation_module_msgs::JointPose goal_joint_pose_msg_
void setInverseKinematics(int cnt, Eigen::MatrixXd start_rotation)
void parseData(const std::string &path)
std::map< std::string, int > joint_name_to_id_
void initPoseMsgCallback(const std_msgs::String::ConstPtr &msg)
bool getKinematicsPoseCallback(thormang3_manipulation_module_msgs::GetKinematicsPose::Request &req, thormang3_manipulation_module_msgs::GetKinematicsPose::Response &res)
void publishStatusMsg(unsigned int type, std::string msg)
void process(std::map< std::string, robotis_framework::Dynamixel * > dxls, std::map< std::string, double > sensors)


thormang3_manipulation_module
Author(s): SCH
autogenerated on Mon Jun 10 2019 15:37:54