MudPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 _MUD_PLUGIN_HH_
18 #define _MUD_PLUGIN_HH_
19 
20 #include <string>
21 #include <vector>
22 
23 #include "gazebo/common/Plugin.hh"
24 #include "gazebo/physics/physics.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
31  {
33  public: MudPlugin();
34 
35  // Documentation Inherited.
36  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
37 
38  // Documentation Inherited.
39  public: virtual void Init();
40 
43  private: void OnContact(ConstContactsPtr &_msg);
44 
46  private: void OnUpdate();
47 
49  private: transport::NodePtr node;
50 
52  private: transport::SubscriberPtr contactSub;
53 
55  private: event::ConnectionPtr updateConnection;
56 
58  private: physics::WorldPtr world;
59 
61  private: physics::PhysicsEnginePtr physics;
62 
64  private: physics::ModelPtr model;
65 
67  private: std::string modelName;
68 
71  private: physics::LinkPtr link;
72 
74  private: std::string contactSensorName;
75 
77  private: mutable boost::mutex mutex;
78 
80  private: msgs::Contacts newestContactsMsg;
81 
83  private: bool newMsg;
84 
86  private: unsigned int newMsgWait;
87 
90  private: double stiffness;
91 
94  private: double damping;
95 
97  private: std::vector<std::string> allowedLinks;
98 
100  private: std::vector<physics::LinkPtr> links;
101 
103  private: std::vector<physics::JointPtr> joints;
104 
106  private: unsigned int contactSurfaceBitmask;
107 
109  private: sdf::ElementPtr sdf;
110  };
111 }
112 #endif // ifndef _MUD_PLUGIN_HH_
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:147
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:84
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
Forward declarations for transport.
Definition: MudPlugin.hh:30
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:108
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:80
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
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:245
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:66
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:92