$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: ROS laser controller. 00023 * Author: John Hsu 00024 * Date: 24 Sept 2007 00025 * SVN: $Id$ 00026 */ 00027 00028 #ifndef GAZEBO_ROS_LASER_HH 00029 #define GAZEBO_ROS_LASER_HH 00030 00031 #define USE_CBQ 00032 #ifdef USE_CBQ 00033 #include <ros/callback_queue.h> 00034 #include <ros/advertise_options.h> 00035 #endif 00036 00037 #include <gazebo/Controller.hh> 00038 #include <gazebo/Param.hh> 00039 00040 #include <ros/ros.h> 00041 #include <boost/thread/mutex.hpp> 00042 #include <sensor_msgs/LaserScan.h> 00043 00044 namespace gazebo 00045 { 00046 class RaySensor; 00047 00050 00122 class GazeboRosLaser : public Controller 00123 { 00126 public: GazeboRosLaser(Entity *parent); 00127 00129 public: virtual ~GazeboRosLaser(); 00130 00133 protected: virtual void LoadChild(XMLConfigNode *node); 00134 00136 protected: virtual void InitChild(); 00137 00139 protected: virtual void UpdateChild(); 00140 00142 protected: virtual void FiniChild(); 00143 00145 private: void PutLaserData(); 00146 00148 private: int laserConnectCount; 00149 private: void LaserConnect(); 00150 private: void LaserDisconnect(); 00151 private: int deprecatedLaserConnectCount; 00152 private: void DeprecatedLaserConnect(); 00153 private: void DeprecatedLaserDisconnect(); 00154 00156 private: RaySensor *myParent; 00157 00159 private: ros::NodeHandle* rosnode_; 00160 private: ros::Publisher pub_; 00161 private: ros::Publisher deprecated_pub_; 00162 00164 private: sensor_msgs::LaserScan laserMsg; 00165 00167 private: ParamT<std::string> *topicNameP; 00168 private: std::string topicName; 00169 private: ParamT<std::string> *deprecatedTopicNameP; 00170 private: std::string deprecatedTopicName; 00171 00173 private: ParamT<std::string> *frameNameP; 00174 private: std::string frameName; 00175 00177 private: ParamT<double> *gaussianNoiseP; 00178 private: double gaussianNoise; 00179 00181 private: double GaussianKernel(double mu,double sigma); 00182 00184 private: boost::mutex lock; 00185 00187 private: ParamT<double> *hokuyoMinIntensityP; 00188 private: double hokuyoMinIntensity; 00189 00191 private: ParamT<std::string> *robotNamespaceP; 00192 private: std::string robotNamespace; 00193 00194 #ifdef USE_CBQ 00195 private: ros::CallbackQueue laser_queue_; 00196 private: void LaserQueueThread(); 00197 private: boost::thread callback_queue_thread_; 00198 #endif 00199 00200 }; 00201 00203 00204 00205 } 00206 00207 #endif 00208