gazebo_ros_force.h
Go to the documentation of this file.
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.hpp>
00036 #include <boost/thread/mutex.hpp>
00037 
00038 #include "physics/physics.h"
00039 #include "transport/TransportTypes.hh"
00040 #include "common/Plugin.hh"
00041 #include "common/Events.hh"
00042 
00043 #include <geometry_msgs/Wrench.h>
00044 
00045 namespace gazebo
00046 {
00047 
00050 
00078 class GazeboRosForce : public ModelPlugin
00079 {
00082   public: GazeboRosForce();
00083 
00085   public: virtual ~GazeboRosForce();
00086 
00089   protected: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
00090 
00092   protected: virtual void UpdateChild();
00093 
00095   private: void UpdateObjectForce(const geometry_msgs::Wrench::ConstPtr& _msg);
00096 
00097   private: physics::WorldPtr world_;
00098 
00100   private: physics::LinkPtr link_;
00101 
00103   private: ros::NodeHandle* rosnode_;
00104   private: ros::Subscriber sub_;
00105 
00107   private: boost::mutex lock_;
00108 
00111   private: std::string topic_name_;
00112   private: std::string link_name_;
00113 
00115   private: std::string robot_namespace_;
00116 
00117   // Custom Callback Queue
00118   private: ros::CallbackQueue queue_;
00119   private: void QueueThread();
00120   private: boost::thread callback_queue_thread_;
00121   private: geometry_msgs::Wrench wrench_msg_;
00122 
00123   // Pointer to the update event connection
00124   private: event::ConnectionPtr update_connection_;
00125 };
00126 
00128 
00129 
00130 }
00131 #endif
00132 


gazebo_plugins
Author(s): Sachin Chitta, Stu Glaser, John Hsu
autogenerated on Sun Jan 5 2014 11:34:58