gazebo_ros_katana_gripper.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  * 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/common/Plugin.hh>
00034 #include <gazebo/common/Time.hh>
00035 #include <gazebo/common/Events.hh>
00036 #include <gazebo/physics/physics.hh>
00037 
00038 #include <katana_msgs/GripperControllerState.h>
00039 #include <control_toolbox/pid.h>
00040 #include <ros/ros.h>
00041 
00042 #include <boost/thread.hpp>
00043 
00044 namespace gazebo
00045 {
00046 class GazeboRosKatanaGripper : public ModelPlugin
00047 {
00048 public:
00049   GazeboRosKatanaGripper();
00050   virtual ~GazeboRosKatanaGripper();
00051 
00052   virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
00053   virtual void InitChild();
00054   virtual void FiniChild();
00055   virtual void UpdateChild();
00056 
00057 private:
00058   void updateActiveGripperAction();
00059   void updateGains();
00060 
00061   static const size_t NUM_JOINTS = 2;
00062 
00063   ros::NodeHandle *rosnode_;
00064 
00065   //  ros::Publisher joint_state_pub_;
00066   ros::Publisher controller_state_pub_;
00067 
00068   std::string node_namespace_;
00069   std::vector<std::string> joint_names_;
00070 
00072   float torque_;
00073 
00074   physics::WorldPtr my_world_;
00075   physics::ModelPtr my_parent_;
00076 
00077   control_toolbox::Pid pid_controller_;
00078 
00079   physics::JointPtr joints_[NUM_JOINTS];
00080 
00081   // sensor_msgs::JointState js_;
00082 
00083   // Simulation time of the last update
00084   common::Time prev_update_time_;
00085 
00086   // Pointer to the update event connection
00087   event::ConnectionPtr updateConnection;
00088 
00089   katana_gazebo_plugins::IGazeboRosKatanaGripperAction* active_gripper_action_;
00090   std::vector<katana_gazebo_plugins::IGazeboRosKatanaGripperAction*> gripper_action_list_;
00091 
00092   short publish_counter_;
00093 
00094   void spin();
00095   boost::thread *spinner_thread_;
00096 };
00097 }
00098 #endif


katana_gazebo_plugins
Author(s): Martin Günther
autogenerated on Thu Jun 6 2019 21:42:23