$search
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: A dynamic controller plugin that performs generic force interface. 00023 * Author: John Hsu 00024 * Date: 24 Sept 2008 00025 * SVN: $Id$ 00026 */ 00027 #ifndef GAZEBO_ROS_FORCE_HH 00028 #define GAZEBO_ROS_FORCE_HH 00029 00030 // Custom Callback Queue 00031 #include <ros/callback_queue.h> 00032 #include <ros/subscribe_options.h> 00033 00034 #include <ros/ros.h> 00035 #include "boost/thread/mutex.hpp" 00036 #include <gazebo/Controller.hh> 00037 #include <gazebo/Param.hh> 00038 #include <gazebo/Body.hh> 00039 #include <gazebo/Model.hh> 00040 #include <geometry_msgs/Wrench.h> 00041 00042 namespace gazebo 00043 { 00044 00047 00076 class GazeboRosForce : public Controller 00077 { 00080 public: GazeboRosForce(Entity *parent); 00081 00083 public: virtual ~GazeboRosForce(); 00084 00087 protected: virtual void LoadChild(XMLConfigNode *node); 00088 00090 protected: virtual void InitChild(); 00091 00093 protected: virtual void UpdateChild(); 00094 00096 protected: virtual void FiniChild(); 00097 00099 private: void UpdateObjectForce(const geometry_msgs::Wrench::ConstPtr& wrenchMsg); 00100 00102 private: Model *myParent; 00103 00105 private: Body *myBody; 00106 00108 private: ros::NodeHandle* rosnode_; 00109 private: ros::Subscriber sub_; 00110 00112 private: boost::mutex lock; 00113 00116 private: ParamT<std::string> *topicNameP,*bodyNameP; 00117 private: std::string topicName,bodyName; 00118 00120 private: ParamT<std::string> *robotNamespaceP; 00121 private: std::string robotNamespace; 00122 00123 // Custom Callback Queue 00124 private: ros::CallbackQueue queue_; 00125 private: void QueueThread(); 00126 private: boost::thread callback_queue_thread_; 00127 private: geometry_msgs::Wrench wrench; 00128 00129 }; 00130 00132 00133 00134 } 00135 #endif 00136