open_manipulator_controller.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 /* Authors: Darby Lim, Hye-Jong KIM, Ryan Shim, Yong-Ho Na */
18 
19 #ifndef OPEN_MANIPULATOR_CONTROLLER_H
20 #define OPEN_MANIPULATOR_CONTROLLER_H
21 
22 #include <ros/ros.h>
23 #include <sensor_msgs/JointState.h>
24 #include <geometry_msgs/PoseStamped.h>
25 #include <std_msgs/Float64.h>
26 #include <std_msgs/String.h>
27 #include <std_msgs/Empty.h>
28 #include <boost/thread.hpp>
29 #include <unistd.h>
30 
34 
38 
39 #include <moveit_msgs/DisplayTrajectory.h>
40 #include <moveit_msgs/ExecuteTrajectoryActionGoal.h>
41 #include <moveit_msgs/MoveGroupActionGoal.h>
42 #include <trajectory_msgs/JointTrajectory.h>
43 #include <trajectory_msgs/JointTrajectoryPoint.h>
44 
45 #include "open_manipulator_msgs/SetJointPosition.h"
46 #include "open_manipulator_msgs/SetKinematicsPose.h"
47 #include "open_manipulator_msgs/SetDrawingTrajectory.h"
48 #include "open_manipulator_msgs/SetActuatorState.h"
49 #include "open_manipulator_msgs/GetJointPosition.h"
50 #include "open_manipulator_msgs/GetKinematicsPose.h"
51 #include "open_manipulator_msgs/OpenManipulatorState.h"
52 
54 
56 {
57 
59 {
60  private:
61  // ROS NodeHandle
64 
65  // ROS Parameters
69 
70  // ROS Publisher
72  std::vector<ros::Publisher> open_manipulator_kinematics_pose_pub_;
74  std::vector<ros::Publisher> gazebo_goal_joint_position_pub_;
76 
77  // ROS Subscribers
82 
83  // ROS Service Server
102 
103  // MoveIt! interface
105  trajectory_msgs::JointTrajectory joint_trajectory_;
108 
109  // Thread parameter
110  pthread_t timer_thread_;
111  pthread_attr_t attr_;
112 
113  // Related robotis_manipulator
115 
116  // flag parameter
120 
121  public:
122 
123  OpenManipulatorController(std::string usb_port, std::string baud_rate);
125 
126  void publishCallback(const ros::TimerEvent&);
127 
128  void initPublisher();
129  void initSubscriber();
130 
131  void initServer();
132 
133  void openManipulatorOptionCallback(const std_msgs::String::ConstPtr &msg);
134  void displayPlannedPathCallback(const moveit_msgs::DisplayTrajectory::ConstPtr &msg);
135  void moveGroupGoalCallback(const moveit_msgs::MoveGroupActionGoal::ConstPtr &msg);
136  void executeTrajGoalCallback(const moveit_msgs::ExecuteTrajectoryActionGoal::ConstPtr &msg);
137 
138  double getControlPeriod(void){return control_period_;}
139 
140  bool goalJointSpacePathCallback(open_manipulator_msgs::SetJointPosition::Request &req,
141  open_manipulator_msgs::SetJointPosition::Response &res);
142 
143  bool goalJointSpacePathToKinematicsPoseCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
144  open_manipulator_msgs::SetKinematicsPose::Response &res);
145 
146  bool goalJointSpacePathToKinematicsPositionCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
147  open_manipulator_msgs::SetKinematicsPose::Response &res);
148 
149  bool goalJointSpacePathToKinematicsOrientationCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
150  open_manipulator_msgs::SetKinematicsPose::Response &res);
151 
152  bool goalTaskSpacePathCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
153  open_manipulator_msgs::SetKinematicsPose::Response &res);
154 
155  bool goalTaskSpacePathPositionOnlyCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
156  open_manipulator_msgs::SetKinematicsPose::Response &res);
157 
158  bool goalTaskSpacePathOrientationOnlyCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
159  open_manipulator_msgs::SetKinematicsPose::Response &res);
160 
161  bool goalJointSpacePathFromPresentCallback(open_manipulator_msgs::SetJointPosition::Request &req,
162  open_manipulator_msgs::SetJointPosition::Response &res);
163 
164  bool goalTaskSpacePathFromPresentCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
165  open_manipulator_msgs::SetKinematicsPose::Response &res);
166 
167  bool goalTaskSpacePathFromPresentPositionOnlyCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
168  open_manipulator_msgs::SetKinematicsPose::Response &res);
169 
170  bool goalTaskSpacePathFromPresentOrientationOnlyCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
171  open_manipulator_msgs::SetKinematicsPose::Response &res);
172 
173  bool goalToolControlCallback(open_manipulator_msgs::SetJointPosition::Request &req,
174  open_manipulator_msgs::SetJointPosition::Response &res);
175 
176  bool setActuatorStateCallback(open_manipulator_msgs::SetActuatorState::Request &req,
177  open_manipulator_msgs::SetActuatorState::Response &res);
178 
179  bool goalDrawingTrajectoryCallback(open_manipulator_msgs::SetDrawingTrajectory::Request &req,
180  open_manipulator_msgs::SetDrawingTrajectory::Response &res);
181 
182  bool setJointPositionMsgCallback(open_manipulator_msgs::SetJointPosition::Request &req,
183  open_manipulator_msgs::SetJointPosition::Response &res);
184 
185  bool setKinematicsPoseMsgCallback(open_manipulator_msgs::SetKinematicsPose::Request &req,
186  open_manipulator_msgs::SetKinematicsPose::Response &res);
187 
188  bool getJointPositionMsgCallback(open_manipulator_msgs::GetJointPosition::Request &req,
189  open_manipulator_msgs::GetJointPosition::Response &res);
190 
191  bool getKinematicsPoseMsgCallback(open_manipulator_msgs::GetKinematicsPose::Request &req,
192  open_manipulator_msgs::GetKinematicsPose::Response &res);
193 
194  void startTimerThread();
195  static void *timerThread(void *param);
196 
197  void moveitTimer(double present_time);
198  void process(double time);
199 
201  void publishKinematicsPose();
202  void publishJointStates();
203  void publishGazeboCommand();
204 
205  bool calcPlannedPath(const std::string planning_group, open_manipulator_msgs::JointPosition msg);
206  bool calcPlannedPath(const std::string planning_group, open_manipulator_msgs::KinematicsPose msg);
207 
208 };
209 }
210 
211 #endif //OPEN_MANIPULATOR_CONTROLLER_H
bool param(const std::string &param_name, T &param_val, const T &default_val)
void executeTrajGoalCallback(const moveit_msgs::ExecuteTrajectoryActionGoal::ConstPtr &msg)
bool goalToolControlCallback(open_manipulator_msgs::SetJointPosition::Request &req, open_manipulator_msgs::SetJointPosition::Response &res)
bool goalTaskSpacePathOrientationOnlyCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
void displayPlannedPathCallback(const moveit_msgs::DisplayTrajectory::ConstPtr &msg)
bool goalTaskSpacePathCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
planning_group
void moveGroupGoalCallback(const moveit_msgs::MoveGroupActionGoal::ConstPtr &msg)
bool goalTaskSpacePathFromPresentOrientationOnlyCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
bool goalTaskSpacePathPositionOnlyCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
bool setActuatorStateCallback(open_manipulator_msgs::SetActuatorState::Request &req, open_manipulator_msgs::SetActuatorState::Response &res)
void openManipulatorOptionCallback(const std_msgs::String::ConstPtr &msg)
bool goalTaskSpacePathFromPresentCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
bool goalJointSpacePathFromPresentCallback(open_manipulator_msgs::SetJointPosition::Request &req, open_manipulator_msgs::SetJointPosition::Response &res)
OpenManipulatorController(std::string usb_port, std::string baud_rate)
bool goalJointSpacePathCallback(open_manipulator_msgs::SetJointPosition::Request &req, open_manipulator_msgs::SetJointPosition::Response &res)
bool goalJointSpacePathToKinematicsPoseCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
bool setKinematicsPoseMsgCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
bool goalTaskSpacePathFromPresentPositionOnlyCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
bool goalDrawingTrajectoryCallback(open_manipulator_msgs::SetDrawingTrajectory::Request &req, open_manipulator_msgs::SetDrawingTrajectory::Response &res)
bool calcPlannedPath(const std::string planning_group, open_manipulator_msgs::JointPosition msg)
bool goalJointSpacePathToKinematicsPositionCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
moveit::planning_interface::MoveGroupInterface * move_group_
bool goalJointSpacePathToKinematicsOrientationCallback(open_manipulator_msgs::SetKinematicsPose::Request &req, open_manipulator_msgs::SetKinematicsPose::Response &res)
bool setJointPositionMsgCallback(open_manipulator_msgs::SetJointPosition::Request &req, open_manipulator_msgs::SetJointPosition::Response &res)
bool getJointPositionMsgCallback(open_manipulator_msgs::GetJointPosition::Request &req, open_manipulator_msgs::GetJointPosition::Response &res)
bool getKinematicsPoseMsgCallback(open_manipulator_msgs::GetKinematicsPose::Request &req, open_manipulator_msgs::GetKinematicsPose::Response &res)


open_manipulator_controller
Author(s): Darby Lim , Hye-Jong KIM , Ryan Shim , Yong-Ho Na
autogenerated on Mon Jun 10 2019 14:12:06