gazebo_ros_laser.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GAZEBO_ROS_LASER_HH
19 #define GAZEBO_ROS_LASER_HH
20 
21 #include <string>
22 
23 #include <boost/bind.hpp>
24 #include <boost/thread.hpp>
25 
26 #include <ros/ros.h>
27 #include <ros/advertise_options.h>
28 #include <sensor_msgs/LaserScan.h>
29 
30 #include <sdf/Param.hh>
31 #include <gazebo/physics/physics.hh>
32 #include <gazebo/transport/TransportTypes.hh>
33 #include <gazebo/msgs/MessageTypes.hh>
34 #include <gazebo/common/Time.hh>
35 #include <gazebo/common/Plugin.hh>
36 #include <gazebo/common/Events.hh>
37 #include <gazebo/sensors/SensorTypes.hh>
38 #include <gazebo/plugins/RayPlugin.hh>
40 
42 
43 namespace gazebo
44 {
45  class GazeboRosLaser : public RayPlugin
46  {
48  public: GazeboRosLaser();
49 
51  public: ~GazeboRosLaser();
52 
55  public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
56 
58  private: int laser_connect_count_;
59  private: void LaserConnect();
60  private: void LaserDisconnect();
61 
62  // Pointer to the model
64  private: std::string world_name_;
65  private: physics::WorldPtr world_;
67  private: sensors::RaySensorPtr parent_ray_sensor_;
68 
70  private: ros::NodeHandle* rosnode_;
71  private: ros::Publisher pub_;
73 
75  private: std::string topic_name_;
76 
78  private: std::string frame_name_;
79 
81  private: std::string tf_prefix_;
82 
84  private: std::string robot_namespace_;
85 
86  // deferred load in case ros is blocking
87  private: sdf::ElementPtr sdf;
88  private: void LoadThread();
89  private: boost::thread deferred_load_thread_;
90  private: unsigned int seed;
91 
92  private: gazebo::transport::NodePtr gazebo_node_;
93  private: gazebo::transport::SubscriberPtr laser_scan_sub_;
94  private: void OnScan(ConstLaserScanStampedPtr &_msg);
95 
97  private: PubMultiQueue pmq;
98  };
99 }
100 #endif
ros::NodeHandle * rosnode_
pointer to ros node
sensors::RaySensorPtr parent_ray_sensor_
The parent sensor.
A collection of PubQueue objects, potentially of different types. This class is the programmer&#39;s inte...
Definition: PubQueue.h:96
std::string tf_prefix_
tf prefix
gazebo::transport::SubscriberPtr laser_scan_sub_
void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
Load the plugin.
boost::thread deferred_load_thread_
A queue of outgoing messages. Instead of calling publish() directly, you can push() messages here to ...
Definition: PubQueue.h:48
PubQueue< sensor_msgs::LaserScan >::Ptr pub_queue_
std::string frame_name_
frame transform name, should match link name
std::string robot_namespace_
for setting ROS name space
gazebo::transport::NodePtr gazebo_node_
PubMultiQueue pmq
prevents blocking
void OnScan(ConstLaserScanStampedPtr &_msg)
std::string topic_name_
topic name
int laser_connect_count_
Keep track of number of connctions.


gazebo_plugins
Author(s): John Hsu
autogenerated on Tue Apr 6 2021 02:19:39