00001 /* 00002 * Gazebo - Outdoor Multi-Robot Simulator 00003 * Copyright (C) 2003 00004 * Nate Koenig & Andrew Howard 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 /* 00022 * Desc: 3D Applied Force Feedback Interface 00023 * Author: John Hsu 00024 * Date: 24 Sept 2008 00025 * SVN: $Id$ 00026 */ 00027 #ifndef GAZEBO_ROS_F3D_HH 00028 #define GAZEBO_ROS_F3D_HH 00029 00030 // Custom Callback Queue 00031 #include <ros/callback_queue.h> 00032 #include <ros/advertise_options.h> 00033 00034 #include "physics/physics.hh" 00035 #include "transport/TransportTypes.hh" 00036 #include "common/Plugin.hh" 00037 #include "common/Events.hh" 00038 00039 #include <ros/ros.h> 00040 #include <boost/thread.hpp> 00041 #include <boost/thread/mutex.hpp> 00042 #include <geometry_msgs/WrenchStamped.h> 00043 00044 namespace gazebo 00045 { 00046 00049 class GazeboRosF3D : public ModelPlugin 00050 { 00053 public: GazeboRosF3D(); 00054 00056 public: virtual ~GazeboRosF3D(); 00057 00059 public: void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf ); 00060 00062 protected: virtual void UpdateChild(); 00063 00064 private: physics::WorldPtr world_; 00065 00067 private: physics::LinkPtr link_; 00068 00069 00071 private: ros::NodeHandle* rosnode_; 00072 private: ros::Publisher pub_; 00073 00075 private: geometry_msgs::WrenchStamped wrench_msg_; 00076 00078 private: std::string link_name_; 00079 00081 private: std::string topic_name_; 00082 00085 private: std::string frame_name_; 00086 00088 private: std::string robot_namespace_; 00089 00091 private: boost::mutex lock_; 00092 00094 private: int f3d_connect_count_; 00095 private: void F3DConnect(); 00096 private: void F3DDisconnect(); 00097 00098 // Custom Callback Queue 00099 private: ros::CallbackQueue queue_; 00100 private: void QueueThread(); 00101 private: boost::thread callback_queue_thread_; 00102 00103 // Pointer to the update event connection 00104 private: event::ConnectionPtr update_connection_; 00105 00106 }; 00107 00109 00110 00111 00112 } 00113 00114 #endif 00115