katana_gripper_grasp_controller.h
Go to the documentation of this file.
00001 /*
00002  * UOS-ROS packages - Robot Operating System code by the University of Osnabrück
00003  * Copyright (C) 2011  University of Osnabrück
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  *
00019  * katana_gripper_grasp_controller.h
00020  *
00021  *  Created on: 29.01.2011
00022  *      Author: Martin Günther <mguenthe@uos.de>
00023  *
00024  * based on pr2_gripper_grasp_controller
00025  */
00026 
00027 #ifndef KATANA_GRIPPER_GRASP_CONTROLLER_H_
00028 #define KATANA_GRIPPER_GRASP_CONTROLLER_H_
00029 
00030 #include <ros/ros.h>
00031 
00032 #include <actionlib/server/simple_action_server.h>
00033 
00034 #include <control_msgs/GripperCommandAction.h>
00035 #include <control_msgs/QueryTrajectoryState.h>
00036 
00037 #include <katana_gazebo_plugins/gazebo_ros_katana_gripper_action_interface.h>
00038 
00039 namespace katana_gazebo_plugins
00040 {
00041 
00042 class KatanaGripperGraspController : public IGazeboRosKatanaGripperAction
00043 {
00044 public:
00045   KatanaGripperGraspController(ros::NodeHandle private_nodehandle);
00046   virtual ~KatanaGripperGraspController();
00047 
00048   GRKAPoint getNextDesiredPoint(ros::Time time)
00049   {
00050     // reset the flag has_new_desired_angle_ because we only emit one angle
00051     if (has_new_desired_angle_)
00052       has_new_desired_angle_ = false;
00053 
00054     GRKAPoint point = {desired_angle_, 0.0};
00055     return point;
00056   }
00057 
00058   void setCurrentPoint(GRKAPoint point)
00059   {
00060     this->current_angle_ = point.position;
00061   }
00062 
00063   bool hasActiveGoal() const
00064   {
00065     return has_new_desired_angle_;
00066   }
00067 
00068   void getGains(double &p, double &i, double &d, double &i_max, double &i_min);
00069 
00070   void cancelGoal()
00071   {
00072     has_new_desired_angle_ = false;
00073   }
00074 
00075 private:
00077   actionlib::SimpleActionServer<control_msgs::GripperCommandAction> *action_server_;
00078 
00080   ros::ServiceServer query_srv_;
00081 
00083   double gripper_object_presence_threshold_;
00084 
00085   void executeCB(const control_msgs::GripperCommandGoalConstPtr &goal);
00086 
00087   bool serviceCallback(control_msgs::QueryTrajectoryState::Request &request,
00088                        control_msgs::QueryTrajectoryState::Response &response);
00089 
00090   void setDesiredAngle(double desired_angle)
00091   {
00092     desired_angle_ = desired_angle;
00093     has_new_desired_angle_ = true;
00094   }
00095 
00096   double goal_threshold_;
00097   double desired_angle_;
00098   double current_angle_;
00099   bool has_new_desired_angle_;
00100 };
00101 
00102 }
00103 
00104 #endif /* KATANA_GRIPPER_GRASP_CONTROLLER_H_ */


katana_gazebo_plugins
Author(s): Martin Günther
autogenerated on Mon Aug 14 2017 02:44:02