gazebo_ros_imu.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: 3D position interface.
00023  * Author: Sachin Chitta and John Hsu
00024  * Date: 10 June 2008
00025  * SVN: $Id$
00026  */
00027 #ifndef GAZEBO_ROS_IMU_HH
00028 #define GAZEBO_ROS_IMU_HH
00029 
00030 #include <ros/callback_queue.h>
00031 #include <ros/advertise_options.h>
00032 
00033 #include "physics/physics.h"
00034 #include "transport/TransportTypes.hh"
00035 #include "msgs/MessageTypes.hh"
00036 #include "common/Time.hh"
00037 #include "common/Plugin.hh"
00038 #include "common/Events.hh"
00039 
00040 #include <ros/ros.h>
00041 #include <boost/thread.hpp>
00042 #include <boost/thread/mutex.hpp>
00043 #include <boost/bind.hpp>
00044 #include <sensor_msgs/Imu.h>
00045 #include <std_srvs/Empty.h>
00046 
00047 
00048 namespace gazebo
00049 {
00050    class GazeboRosIMU : public ModelPlugin
00051    {
00053       public: GazeboRosIMU();
00054 
00056       public: virtual ~GazeboRosIMU();
00057 
00060       public: void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
00061 
00063       protected: virtual void UpdateChild();
00064 
00066       private: physics::WorldPtr world_;
00067 
00069       private: physics::LinkPtr link;
00070 
00072       private: ros::NodeHandle* rosnode_;
00073       private: ros::Publisher pub_;
00074       private: ros::Publisher deprecated_pub_;
00075 
00077       private: sensor_msgs::Imu imu_msg_;
00078 
00080       private: std::string link_name_;
00081 
00083       private: std::string topic_name_;
00084 
00086       private: math::Pose offset_;
00087 
00089       private: boost::mutex lock_;
00090 
00092       private: common::Time last_time_;
00093       private: math::Vector3 last_vpos_;
00094       private: math::Vector3 last_veul_;
00095       private: math::Vector3 apos_;
00096       private: math::Vector3 aeul_;
00097 
00099       private: math::Pose initial_pose_;
00100 
00102       private: double gaussian_noise_;
00103 
00105       private: double GaussianKernel(double mu,double sigma);
00106 
00108       private: std::string robot_namespace_;
00109 
00111       private: int imu_connect_count_;
00112       private: void IMUConnect();
00113       private: void IMUDisconnect();
00114 
00116       private: bool ServiceCallback(std_srvs::Empty::Request &req,
00117                                     std_srvs::Empty::Response &res);
00118       private: ros::ServiceServer srv_;
00119       private: std::string service_name_;
00120 
00121       private: ros::CallbackQueue imu_queue_;
00122       private: void IMUQueueThread();
00123       private: boost::thread callback_queue_thread_;
00124 
00125       // Pointer to the update event connection
00126       private: event::ConnectionPtr update_connection_;
00127    };
00128 
00130 
00131 
00132 
00133 }
00134 
00135 #endif
00136 


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