$search
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 * gazebo_ros_katana_gripper.cpp 00020 * 00021 * Created on: 29.08.2011 00022 * Author: Martin Günther <mguenthe@uos.de> 00023 */ 00024 #ifndef GAZEBO_ROS_KATANA_H 00025 #define GAZEBO_ROS_KATANA_H 00026 00027 #include <vector> 00028 00029 #include <katana_gazebo_plugins/gazebo_ros_katana_gripper_action_interface.h> 00030 #include <katana_gazebo_plugins/katana_gripper_grasp_controller.h> 00031 #include <katana_gazebo_plugins/katana_gripper_joint_trajectory_controller.h> 00032 00033 #include <gazebo/Controller.hh> 00034 #include <gazebo/Model.hh> 00035 00036 // #include <sensor_msgs/JointState.h> 00037 #include <katana_msgs/GripperControllerState.h> 00038 #include <control_toolbox/pid.h> 00039 #include <ros/ros.h> 00040 00041 00042 00043 namespace gazebo 00044 { 00045 class GazeboRosKatanaGripper : public Controller 00046 { 00047 public: 00048 GazeboRosKatanaGripper(gazebo::Entity *parent); 00049 virtual ~GazeboRosKatanaGripper(); 00050 00051 virtual void LoadChild(XMLConfigNode *node); 00052 virtual void InitChild(); 00053 virtual void FiniChild(); 00054 virtual void UpdateChild(); 00055 00056 private: 00057 void updateActiveGripperAction(); 00058 00059 private: 00060 static const size_t NUM_JOINTS = 2; 00061 00062 ros::NodeHandle *rosnode_; 00063 00064 // ros::Publisher joint_state_pub_; 00065 ros::Publisher controller_state_pub_; 00066 00067 ParamT<std::string> *node_namespaceP_; 00068 std::vector<ParamT<std::string> *> joint_nameP_; 00069 00071 ParamT<float> *torqueP_; 00072 00073 Model *my_parent_; 00074 00075 control_toolbox::Pid pid_controller_; 00076 00077 Joint *joints_[NUM_JOINTS]; 00078 00079 // sensor_msgs::JointState js_; 00080 00081 // Simulation time of the last update 00082 Time prev_update_time_; 00083 00084 katana_gazebo_plugins::IGazeboRosKatanaGripperAction* active_gripper_action_; 00085 std::vector<katana_gazebo_plugins::IGazeboRosKatanaGripperAction*> gripper_action_list_; 00086 00087 short publish_counter_; 00088 }; 00089 } 00090 #endif