gazebo_ros_gpu_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 <gazebo/physics/physics.hh>
31 #include <gazebo/transport/TransportTypes.hh>
32 #include <gazebo/msgs/MessageTypes.hh>
33 #include <gazebo/common/Time.hh>
34 #include <gazebo/common/Plugin.hh>
35 #include <gazebo/common/Events.hh>
36 #include <gazebo/sensors/SensorTypes.hh>
37 #include <gazebo/plugins/GpuRayPlugin.hh>
38 
39 #include <sdf/sdf.hh>
40 
42 
43 namespace gazebo
44 {
45  class GazeboRosLaser : public GpuRayPlugin
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
63  private: std::string world_name_;
64  private: physics::WorldPtr world_;
66  private: sensors::GpuRaySensorPtr parent_ray_sensor_;
67 
70  private: ros::Publisher pub_;
72 
74  private: std::string topic_name_;
75 
77  private: std::string frame_name_;
78 
80  private: std::string tf_prefix_;
81 
83  private: std::string robot_namespace_;
84 
85  // deferred load in case ros is blocking
86  private: sdf::ElementPtr sdf;
87  private: void LoadThread();
88  private: boost::thread deferred_load_thread_;
89 
90  private: gazebo::transport::NodePtr gazebo_node_;
91  private: gazebo::transport::SubscriberPtr laser_scan_sub_;
92  private: void OnScan(ConstLaserScanStampedPtr &_msg);
93 
95  private: PubMultiQueue pmq;
96  };
97 }
98 #endif
gazebo::GazeboRosLaser::LoadThread
void LoadThread()
Definition: gazebo_ros_gpu_laser.cpp:127
ros::Publisher
gazebo
ros.h
gazebo::GazeboRosLaser::LaserDisconnect
void LaserDisconnect()
Definition: gazebo_ros_gpu_laser.cpp:176
gazebo::GazeboRosLaser
Definition: gazebo_ros_gpu_laser.h:45
gazebo::GazeboRosLaser::topic_name_
std::string topic_name_
topic name
Definition: gazebo_ros_gpu_laser.h:74
gazebo::GazeboRosLaser::frame_name_
std::string frame_name_
frame transform name, should match link name
Definition: gazebo_ros_gpu_laser.h:77
gazebo::GazeboRosLaser::~GazeboRosLaser
~GazeboRosLaser()
Destructor.
Definition: gazebo_ros_gpu_laser.cpp:62
gazebo::GazeboRosLaser::gazebo_node_
gazebo::transport::NodePtr gazebo_node_
Definition: gazebo_ros_gpu_laser.h:90
gazebo::GazeboRosLaser::pmq
PubMultiQueue pmq
prevents blocking
Definition: gazebo_ros_gpu_laser.h:95
gazebo::GazeboRosLaser::pub_queue_
PubQueue< sensor_msgs::LaserScan >::Ptr pub_queue_
Definition: gazebo_ros_gpu_laser.h:71
gazebo::GazeboRosLaser::GazeboRosLaser
GazeboRosLaser()
Constructor.
Definition: gazebo_ros_gpu_laser.cpp:56
gazebo::GazeboRosLaser::Load
void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
Load the plugin.
Definition: gazebo_ros_gpu_laser.cpp:72
gazebo::GazeboRosLaser::world_
physics::WorldPtr world_
Definition: gazebo_ros_gpu_laser.h:64
gazebo::GazeboRosLaser::parent_ray_sensor_
sensors::GpuRaySensorPtr parent_ray_sensor_
The parent sensor.
Definition: gazebo_ros_gpu_laser.h:66
advertise_options.h
gazebo::GazeboRosLaser::laser_scan_sub_
gazebo::transport::SubscriberPtr laser_scan_sub_
Definition: gazebo_ros_gpu_laser.h:91
PubMultiQueue
A collection of PubQueue objects, potentially of different types. This class is the programmer's inte...
Definition: PubQueue.h:96
PubQueue.h
gazebo::GazeboRosLaser::rosnode_
ros::NodeHandle * rosnode_
pointer to ros node
Definition: gazebo_ros_gpu_laser.h:69
gazebo::GazeboRosLaser::robot_namespace_
std::string robot_namespace_
for setting ROS name space
Definition: gazebo_ros_gpu_laser.h:83
gazebo::GazeboRosLaser::LaserConnect
void LaserConnect()
Definition: gazebo_ros_gpu_laser.cpp:165
gazebo::GazeboRosLaser::sdf
sdf::ElementPtr sdf
Definition: gazebo_ros_gpu_laser.h:86
gazebo::GazeboRosLaser::world_name_
std::string world_name_
Definition: gazebo_ros_gpu_laser.h:63
gazebo::GazeboRosLaser::tf_prefix_
std::string tf_prefix_
tf prefix
Definition: gazebo_ros_gpu_laser.h:80
PubQueue
A queue of outgoing messages. Instead of calling publish() directly, you can push() messages here to ...
Definition: PubQueue.h:48
gazebo::GazeboRosLaser::OnScan
void OnScan(ConstLaserScanStampedPtr &_msg)
Definition: gazebo_ros_gpu_laser.cpp:185
gazebo::GazeboRosLaser::deferred_load_thread_
boost::thread deferred_load_thread_
Definition: gazebo_ros_gpu_laser.h:88
gazebo::GazeboRosLaser::pub_
ros::Publisher pub_
Definition: gazebo_ros_gpu_laser.h:70
ros::NodeHandle
gazebo::GazeboRosLaser::laser_connect_count_
int laser_connect_count_
Keep track of number of connctions.
Definition: gazebo_ros_gpu_laser.h:58


gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Sep 5 2024 02:49:55