gazebo_ros_block_laser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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  * Desc: ros laser controller.
19  * Author: Nathan Koenig
20  * Date: 01 Feb 2007
21  */
22 
23 #ifndef GAZEBO_ROS_BLOCK_LASER_HH
24 #define GAZEBO_ROS_BLOCK_LASER_HH
25 
26 // Custom Callback Queue
27 #include <ros/ros.h>
28 #include <ros/callback_queue.h>
29 #include <ros/advertise_options.h>
30 
31 #include <sdf/Param.hh>
32 #include <gazebo/physics/physics.hh>
33 #include <gazebo/transport/TransportTypes.hh>
34 #include <gazebo/msgs/MessageTypes.hh>
35 #include <gazebo/common/Time.hh>
36 #include <gazebo/common/Plugin.hh>
37 #include <gazebo/sensors/SensorTypes.hh>
38 #include <gazebo/plugins/RayPlugin.hh>
39 
40 #include <boost/bind.hpp>
41 #include <boost/thread.hpp>
42 #include <boost/thread/mutex.hpp>
43 
44 #include <sensor_msgs/PointCloud.h>
45 
46 namespace gazebo
47 {
48 
49  class GazeboRosBlockLaser : public RayPlugin
50  {
53  public: GazeboRosBlockLaser();
54 
56  public: ~GazeboRosBlockLaser();
57 
60  public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
61 
63  protected: virtual void OnNewLaserScans();
64 
66  private: void PutLaserData(common::Time &_updateTime);
67 
68  private: common::Time last_update_time_;
69 
71  private: int laser_connect_count_;
72  private: void LaserConnect();
73  private: void LaserDisconnect();
74 
75  // Pointer to the model
76  private: physics::WorldPtr world_;
78  private: sensors::SensorPtr parent_sensor_;
79  private: sensors::RaySensorPtr parent_ray_sensor_;
80 
83  private: ros::Publisher pub_;
84 
86  private: sensor_msgs::PointCloud cloud_msg_;
87 
89  private: std::string topic_name_;
90 
92  private: std::string frame_name_;
93 
95  private: double gaussian_noise_;
96 
98  private: double GaussianKernel(double mu,double sigma);
99 
101  private: boost::mutex lock;
102 
104  //private: ParamT<double> *hokuyoMinIntensityP;
105  private: double hokuyo_min_intensity_;
106 
108  private: double update_rate_;
109 
111  private: std::string robot_namespace_;
112 
113  // Custom Callback Queue
115  private: void LaserQueueThread();
116  private: boost::thread callback_laser_queue_thread_;
117 
118  // subscribe to world stats
119  private: transport::NodePtr node_;
120  private: common::Time sim_time_;
121  public: void OnStats( const boost::shared_ptr<msgs::WorldStatistics const> &_msg);
122 
123  };
124 
125 }
126 
127 #endif
128 
int laser_connect_count_
Keep track of number of connctions.
void PutLaserData(common::Time &_updateTime)
Put laser data to the ROS topic.
double hokuyo_min_intensity_
hack to mimic hokuyo intensity cutoff of 100
ros::NodeHandle * rosnode_
pointer to ros node
boost::mutex lock
A mutex to lock access to fields that are used in message callbacks.
std::string robot_namespace_
for setting ROS name space
std::string frame_name_
frame transform name, should match link name
std::string topic_name_
topic name
double GaussianKernel(double mu, double sigma)
Gaussian noise generator.
sensors::SensorPtr parent_sensor_
The parent sensor.
double gaussian_noise_
Gaussian noise.
sensors::RaySensorPtr parent_ray_sensor_
virtual void OnNewLaserScans()
Update the controller.
void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
Load the plugin.
double update_rate_
update rate of this sensor
void OnStats(const boost::shared_ptr< msgs::WorldStatistics const > &_msg)
sensor_msgs::PointCloud cloud_msg_
ros message


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