TouchPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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 #ifndef GAZEBO_PLUGINS_TOUCHPLUGIN_HH_
18 #define GAZEBO_PLUGINS_TOUCHPLUGIN_HH_
19 
20 #include <string>
21 #include <vector>
22 #include <gazebo/common/Events.hh>
23 #include <gazebo/common/Plugin.hh>
25 #include <gazebo/transport/Node.hh>
26 #include <sdf/sdf.hh>
27 
28 namespace gazebo
29 {
61  {
63  public: TouchPlugin();
64 
65  // Documentation inherited
66  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
67 
70  public: void Enable(ConstIntPtr &_msg);
71 
74  private: void OnUpdate(const common::UpdateInfo &_info);
75 
77  private: std::vector<sensors::ContactSensorPtr> contactSensors;
78 
80  private: std::string modelName;
81 
84  private: std::string target;
85 
87  private: std::string ns;
88 
90  private: common::Time targetTime = 5;
91 
93  private: common::Time touchStart;
94 
96  private: transport::NodePtr gzNode;
97 
99  private: transport::PublisherPtr touchedPub;
100 
102  private: transport::SubscriberPtr enableSub;
103 
105  private: event::ConnectionPtr updateConnection;
106  };
107 }
108 
109 #endif
110 
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
Information for use in an update event.
Definition: UpdateInfo.hh:30
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
Plugin which checks if this model has touched some specific target for a given time continuously and ...
Definition: TouchPlugin.hh:60
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
A plugin with access to physics::Model.
Definition: Plugin.hh:260
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44