reem_bumper_gazebo.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: Bumper Controller
00023  * Author: Nate Koenig mod by John Hsu
00024  * Date: 24 Sept 2008
00025  */
00026 #include <ros/ros.h>
00027 #include <ros/callback_queue.h>
00028 #include <ros/advertise_options.h>
00029 
00030 #include <sys/time.h>
00031 
00032 #include <gazebo.hh>
00033 #include <gazebo/common/Plugin.hh>
00034 #include <gazebo/sensors/ContactSensor.hh>
00035 #include <gazebo/plugins/ContactPlugin.hh>
00036 
00037 #include <boost/thread.hpp>
00038 #include <boost/thread/mutex.hpp>
00039 
00040 #include <std_msgs/String.h>
00041 
00042 #include <gazebo_msgs/ContactState.h>
00043 #include <gazebo_msgs/ContactsState.h>
00044 #include <reem_msgs/Bumper.h>
00045 
00046 namespace gazebo
00047 {
00049   class ReemGazeboBumper : public gazebo::SensorPlugin
00050   {
00052     public: ReemGazeboBumper();
00053 
00055     public: ~ReemGazeboBumper();
00056 
00059     public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
00060 
00062     protected: virtual void Update();
00063 
00064   private:
00065 
00067       ros::NodeHandle* rosnode_;
00068       ros::Publisher contact_pub_;
00069 
00071       std::string bumper_topic_name_;
00072       std::string frame_name_;
00073 
00074       gazebo::sensors::ContactSensorPtr sensor_;
00075       gazebo::physics::WorldPtr parent_;
00076 
00078       gazebo_msgs::ContactsState contact_state_msg_;
00079 
00081       std::string robot_namespace_;
00082 
00084       int contact_connect_count_;
00085       void ContactConnect();
00086       void ContactDisconnect();
00087       ros::CallbackQueue contact_queue_;
00088       void ContactQueueThread();
00089       boost::thread callback_queue_thread_;
00090 
00091       // Pointer to the update event connection
00092       event::ConnectionPtr update_connection_;
00093 
00094   };
00095 
00096 }


bumper_gazebo_plugin
Author(s): Jose Rafael Capriles
autogenerated on Thu Jan 2 2014 11:37:02