MudPlugin.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 #ifndef GAZEBO_PLUGINS_MUDPLUGIN_HH_
18 #define GAZEBO_PLUGINS_MUDPLUGIN_HH_
19 
20 #include <mutex>
21 #include <string>
22 #include <vector>
23 #include <ignition/transport/Node.hh>
24 
25 #include "gazebo/common/Plugin.hh"
26 #include "gazebo/physics/physics.hh"
28 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
33  {
35  public: MudPlugin();
36 
37  // Documentation Inherited.
38  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
39 
40  // Documentation Inherited.
41  public: virtual void Init();
42 
45  private: void OnContact(ConstContactsPtr &_msg);
46 
48  private: void OnUpdate();
49 
51  private: transport::NodePtr node;
52 
54  private: transport::SubscriberPtr contactSub;
55 
57  private: event::ConnectionPtr updateConnection;
58 
60  private: physics::WorldPtr world;
61 
63  private: physics::PhysicsEnginePtr physics;
64 
66  private: physics::ModelPtr model;
67 
69  private: std::string modelName;
70 
73  private: physics::LinkPtr link;
74 
76  private: std::string contactSensorName;
77 
79  private: mutable std::mutex mutex;
80 
82  private: msgs::Contacts newestContactsMsg;
83 
85  private: bool newMsg;
86 
88  private: unsigned int newMsgWait;
89 
92  private: double stiffness;
93 
96  private: double damping;
97 
99  private: std::vector<std::string> allowedLinks;
100 
102  private: std::vector<physics::LinkPtr> links;
103 
105  private: std::vector<physics::JointPtr> joints;
106 
108  private: unsigned int contactSurfaceBitmask;
109 
111  private: sdf::ElementPtr sdf;
112 
113  // Place ignition::transport objects at the end of this file to
114  // guarantee they are destructed first.
115 
118  private: ignition::transport::Node nodeIgn;
119  };
120 }
121 #endif // ifndef _MUD_PLUGIN_HH_
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
Forward declarations for the common classes.
Definition: Animation.hh:33
Forward declarations for transport.
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
Definition: MudPlugin.hh:32
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
A plugin with access to physics::Model.
Definition: Plugin.hh:260
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:58