PressurePlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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  * Desc: Pressure Sensor Plugin
19  * Author: Steve Peters
20  */
21 
22 #ifndef GAZEBO_PLUGINS_PRESSUREPLUGIN_HH_
23 #define GAZEBO_PLUGINS_PRESSUREPLUGIN_HH_
24 
25 #include <map>
26 #include <string>
27 #include <ignition/transport/Node.hh>
28 
29 #include <gazebo/common/Plugin.hh>
30 #include <gazebo/sensors/sensors.hh>
31 #include <gazebo/transport/transport.hh>
32 #include "gazebo/util/system.hh"
33 
34 namespace gazebo
35 {
42  class GZ_PLUGIN_VISIBLE PressurePlugin : public SensorPlugin
43  {
45  public: PressurePlugin();
46 
48  public: virtual ~PressurePlugin();
49 
50  // Documentation inherited.
51  public: virtual void Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf);
52 
53  // Documentation inherited.
54  public: virtual void Init();
55 
57  private: virtual void OnUpdate();
58 
60  private: sensors::ContactSensorPtr parentSensor;
61 
64  private: event::ConnectionPtr updateConnection;
65 
67  private: transport::NodePtr node;
68 
70  private: transport::PublisherPtr tactilePub;
71 
73  private: std::string worldName;
74 
76  private: std::string parentSensorName;
77 
79  private: std::map<std::string, double> collisionNamesToArea;
80 
81  // Place ignition::transport objects at the end of this file to
82  // guarantee they are destructed first.
83 
85  private: ignition::transport::Node nodeIgn;
86 
88  private: ignition::transport::Node::Publisher tactilePubIgn;
89  };
90 }
91 #endif
std::shared_ptr< Sensor > SensorPtr
Definition: SensorTypes.hh:64
Forward declarations for the common classes.
Definition: Animation.hh:26
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
std::shared_ptr< ContactSensor > ContactSensorPtr
Definition: SensorTypes.hh:92
A plugin for a tactile pressure sensor.
Definition: PressurePlugin.hh:42
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
A plugin with access to physics::Sensor.
Definition: Plugin.hh:332