gazebo_ros_bumper.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_BUMPER_HH
19 #define GAZEBO_ROS_BUMPER_HH
20 
21 #include <string>
22 
23 #include <ros/ros.h>
24 #include <ros/callback_queue.h>
25 #include <ros/advertise_options.h>
26 
27 #ifndef _WIN32
28 #include <sys/time.h>
29 #endif
30 
31 #include <boost/thread.hpp>
32 #include <boost/thread/mutex.hpp>
33 
34 #include <std_msgs/String.h>
35 
36 #include <gazebo_msgs/ContactState.h>
37 #include <gazebo_msgs/ContactsState.h>
38 
39 #include <gazebo/sensors/sensors.hh>
40 #include <gazebo/msgs/msgs.hh>
41 #include <gazebo/physics/physics.hh>
42 #include <sdf/sdf.hh>
43 #include <gazebo/transport/TransportTypes.hh>
44 #include <gazebo/msgs/MessageTypes.hh>
45 #include <gazebo/common/Time.hh>
46 #include <gazebo/sensors/SensorTypes.hh>
47 #include <gazebo/sensors/ContactSensor.hh>
48 #include <gazebo/common/Plugin.hh>
49 
50 namespace gazebo
51 {
53  class GazeboRosBumper : public SensorPlugin
54  {
56  public: GazeboRosBumper();
57 
59  public: ~GazeboRosBumper();
60 
63  public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
64 
66  private: void OnContact();
67 
71 
72  private: sensors::ContactSensorPtr parentSensor;
73 
75  private: std::string bumper_topic_name_;
76 
77  private: std::string frame_name_;
78 
80  private: gazebo_msgs::ContactsState contact_state_msg_;
81 
83  private: std::string robot_namespace_;
84 
86  private: void ContactQueueThread();
87  private: boost::thread callback_queue_thread_;
88 
89  // Pointer to the update event connection
90  private: event::ConnectionPtr update_connection_;
91  };
92 }
93 
94 #endif
95 
gazebo::GazeboRosBumper::GazeboRosBumper
GazeboRosBumper()
Constructor.
Definition: gazebo_ros_bumper.cpp:55
ros::Publisher
gazebo::GazeboRosBumper::frame_name_
std::string frame_name_
Definition: gazebo_ros_bumper.h:77
gazebo::GazeboRosBumper
A Bumper controller.
Definition: gazebo_ros_bumper.h:53
gazebo::GazeboRosBumper::~GazeboRosBumper
~GazeboRosBumper()
Destructor.
Definition: gazebo_ros_bumper.cpp:61
gazebo
ros.h
gazebo::GazeboRosBumper::bumper_topic_name_
std::string bumper_topic_name_
set topic name of broadcast
Definition: gazebo_ros_bumper.h:75
gazebo::GazeboRosBumper::contact_pub_
ros::Publisher contact_pub_
Definition: gazebo_ros_bumper.h:70
gazebo::GazeboRosBumper::robot_namespace_
std::string robot_namespace_
for setting ROS name space
Definition: gazebo_ros_bumper.h:83
ros::CallbackQueue
gazebo::GazeboRosBumper::update_connection_
event::ConnectionPtr update_connection_
Definition: gazebo_ros_bumper.h:90
gazebo::GazeboRosBumper::rosnode_
ros::NodeHandle * rosnode_
pointer to ros node
Definition: gazebo_ros_bumper.h:69
gazebo::GazeboRosBumper::ContactQueueThread
void ContactQueueThread()
Definition: gazebo_ros_bumper.cpp:337
callback_queue.h
gazebo::GazeboRosBumper::contact_state_msg_
gazebo_msgs::ContactsState contact_state_msg_
broadcast some string for now.
Definition: gazebo_ros_bumper.h:80
advertise_options.h
gazebo::GazeboRosBumper::contact_queue_
ros::CallbackQueue contact_queue_
Definition: gazebo_ros_bumper.h:85
gazebo::GazeboRosBumper::parentSensor
sensors::ContactSensorPtr parentSensor
Definition: gazebo_ros_bumper.h:72
gazebo::GazeboRosBumper::OnContact
void OnContact()
Update the controller.
Definition: gazebo_ros_bumper.cpp:137
gazebo::GazeboRosBumper::Load
void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
Load the plugin.
Definition: gazebo_ros_bumper.cpp:71
ros::NodeHandle
gazebo::GazeboRosBumper::callback_queue_thread_
boost::thread callback_queue_thread_
Definition: gazebo_ros_bumper.h:87


gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Nov 23 2023 03:50:28