gripper_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 #ifndef THORMANG3_GRIPPER_MODULE_H_
18 #define THORMANG3_GRIPPER_MODULE_H_
19 
20 #include <map>
21 #include <fstream>
22 #include <ros/ros.h>
23 #include <ros/callback_queue.h>
24 #include <ros/package.h>
25 #include <std_msgs/Int16.h>
26 #include <std_msgs/Float64.h>
27 #include <std_msgs/String.h>
28 #include <std_msgs/Bool.h>
29 #include <sensor_msgs/JointState.h>
30 #include <boost/thread.hpp>
31 #include <eigen3/Eigen/Eigen>
32 #include <yaml-cpp/yaml.h>
33 
36 
37 #include "robotis_controller_msgs/JointCtrlModule.h"
38 #include "robotis_controller_msgs/StatusMsg.h"
39 #include "robotis_controller_msgs/SyncWriteItem.h"
40 
41 namespace thormang3
42 {
43 
44 #define NUM_GRIPPER_JOINTS 2
45 
48  public robotis_framework::Singleton<GripperModule>
49 {
50 private:
52  boost::thread queue_thread_;
53  boost::thread* tra_gene_tread_;
54 
55  /* sample subscriber & publisher */
60 
61  std::map<std::string, int> joint_name_to_id_;
62 
63  /* base parameters */
64  bool is_moving_;
65 
66  Eigen::VectorXd present_joint_position_;
67  Eigen::VectorXd present_joint_velocity_;
68  Eigen::VectorXd goal_joint_position_;
69 
70  sensor_msgs::JointState goal_joint_pose_msg_;
71 
72  std_msgs::String movement_done_msg_;
73 
74  /* movement */
75  double mov_time_;
77  int cnt_;
78 
79  Eigen::MatrixXd goal_joint_tra_;
80 
81  void queueThread();
82 
83  void setJointPoseMsgCallback(const sensor_msgs::JointState::ConstPtr& msg);
84  void traGeneProcJointSpace();
85  void setTorqueLimit();
86  void setEndTrajectory();
87 
88 public:
89  GripperModule();
90  virtual ~GripperModule();
91 
92  /* ROS Topic Callback Functions */
93  void setModeMsgCallback(const std_msgs::String::ConstPtr& msg);
94 
95  void initialize(const int control_cycle_msec, robotis_framework::Robot *robot);
96  void process(std::map<std::string, robotis_framework::Dynamixel *> dxls, std::map<std::string, double> sensors);
97 
98  void stop();
99  bool isRunning();
100  void publishStatusMsg(unsigned int type, std::string msg);
101 };
102 
103 }
104 
105 #endif /* THORMANG3_GRIPPER_MODULE_H_ */
Eigen::MatrixXd goal_joint_tra_
ros::Publisher movement_done_pub_
std_msgs::String movement_done_msg_
boost::thread * tra_gene_tread_
Eigen::VectorXd present_joint_position_
sensor_msgs::JointState goal_joint_pose_msg_
Eigen::VectorXd present_joint_velocity_
ros::Publisher status_msg_pub_
void setModeMsgCallback(const std_msgs::String::ConstPtr &msg)
Eigen::VectorXd goal_joint_position_
ros::Publisher goal_torque_limit_pub_
ros::Publisher set_ctrl_module_pub_
void setJointPoseMsgCallback(const sensor_msgs::JointState::ConstPtr &msg)
void initialize(const int control_cycle_msec, robotis_framework::Robot *robot)
void publishStatusMsg(unsigned int type, std::string msg)
void process(std::map< std::string, robotis_framework::Dynamixel * > dxls, std::map< std::string, double > sensors)
std::map< std::string, int > joint_name_to_id_
boost::thread queue_thread_


thormang3_gripper_module
Author(s): SCH
autogenerated on Mon Jun 10 2019 15:37:46