HydraDemoPlugin.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2014 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_PLUGINS_HYDRADEMOPLUGIN_HH_
19#define GAZEBO_PLUGINS_HYDRADEMOPLUGIN_HH_
20
21#include <mutex>
22#include <ignition/transport/Node.hh>
23#include "gazebo/physics/physics.hh"
24#include "gazebo/msgs/msgs.hh"
28
29namespace gazebo
30{
31 class GZ_PLUGIN_VISIBLE HydraDemoPlugin : public ModelPlugin
32 {
34 public: HydraDemoPlugin();
35
37 public: virtual ~HydraDemoPlugin();
38
39 // Documentation Inherited.
40 public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
41
43 private: void Update();
44
47 private: void OnHydra(ConstHydraPtr &_msg);
48
50 private: physics::WorldPtr world;
51
53 private: physics::ModelPtr model;
54
56 private: transport::NodePtr node;
57
59 private: transport::SubscriberPtr hydraSub;
60
62 private: event::ConnectionPtr updateConnection;
63
65 private: std::mutex msgMutex;
66
68 private: boost::shared_ptr<const gazebo::msgs::Hydra> hydraMsgPtr;
69
70 // Place ignition::transport objects at the end of this file to
71 // guarantee they are destructed first.
72
74 private: ignition::transport::Node nodeIgn;
75 };
76}
77#endif
Forward declarations for transport.
Definition HydraDemoPlugin.hh:32
HydraDemoPlugin()
Constructor.
virtual ~HydraDemoPlugin()
Destructor.
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Load function.
A plugin with access to physics::Model.
Definition Plugin.hh:304
boost::shared_ptr< Connection > ConnectionPtr
Definition CommonTypes.hh:134
boost::shared_ptr< World > WorldPtr
Definition PhysicsTypes.hh:89
boost::shared_ptr< Model > ModelPtr
Definition PhysicsTypes.hh:93
boost::shared_ptr< Subscriber > SubscriberPtr
Definition TransportTypes.hh:53
boost::shared_ptr< Node > NodePtr
Definition TransportTypes.hh:57
Forward declarations for the common classes.
Definition Animation.hh:27