gazebo_ros_laser.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2012 Open Source Robotics Foundation
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 
00018 #ifndef GAZEBO_ROS_LASER_HH
00019 #define GAZEBO_ROS_LASER_HH
00020 
00021 #include <string>
00022 
00023 #include <boost/bind.hpp>
00024 #include <boost/thread.hpp>
00025 
00026 #include <ros/ros.h>
00027 #include <ros/advertise_options.h>
00028 #include <sensor_msgs/LaserScan.h>
00029 
00030 #include <sdf/Param.hh>
00031 #include <gazebo/physics/physics.hh>
00032 #include <gazebo/transport/TransportTypes.hh>
00033 #include <gazebo/msgs/MessageTypes.hh>
00034 #include <gazebo/common/Time.hh>
00035 #include <gazebo/common/Plugin.hh>
00036 #include <gazebo/common/Events.hh>
00037 #include <gazebo/sensors/SensorTypes.hh>
00038 #include <gazebo/plugins/RayPlugin.hh>
00039 #include <gazebo_plugins/gazebo_ros_utils.h>
00040 
00041 #include <gazebo_plugins/PubQueue.h>
00042 
00043 namespace gazebo
00044 {
00045   class GazeboRosLaser : public RayPlugin
00046   {
00048     public: GazeboRosLaser();
00049 
00051     public: ~GazeboRosLaser();
00052 
00055     public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
00056 
00058     private: int laser_connect_count_;
00059     private: void LaserConnect();
00060     private: void LaserDisconnect();
00061 
00062     // Pointer to the model
00063     GazeboRosPtr gazebo_ros_;
00064     private: std::string world_name_;
00065     private: physics::WorldPtr world_;
00067     private: sensors::RaySensorPtr parent_ray_sensor_;
00068 
00070     private: ros::NodeHandle* rosnode_;
00071     private: ros::Publisher pub_;
00072     private: PubQueue<sensor_msgs::LaserScan>::Ptr pub_queue_;
00073 
00075     private: std::string topic_name_;
00076 
00078     private: std::string frame_name_;
00079     
00081     private: std::string tf_prefix_;
00082 
00084     private: std::string robot_namespace_;
00085 
00086     // deferred load in case ros is blocking
00087     private: sdf::ElementPtr sdf;
00088     private: void LoadThread();
00089     private: boost::thread deferred_load_thread_;
00090     private: unsigned int seed;
00091 
00092     private: gazebo::transport::NodePtr gazebo_node_;
00093     private: gazebo::transport::SubscriberPtr laser_scan_sub_;
00094     private: void OnScan(ConstLaserScanStampedPtr &_msg);
00095 
00097     private: PubMultiQueue pmq;
00098   };
00099 }
00100 #endif


gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Jun 6 2019 18:41:09