SimEventsPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2016 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.k *
15 */
16 
17 #ifndef _SIMEVENTS_PLUGIN_HH_
18 #define _SIMEVENTS_PLUGIN_HH_
19 
20 #include <iostream>
21 #include <map>
22 #include <set>
23 #include <string>
24 #include <vector>
25 
26 #include "SimEventsException.hh"
27 #include "SimStateEventSource.hh"
28 
29 namespace gazebo
30 {
32  {
34  public: virtual ~SimEventsPlugin();
35 
39  public: void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf);
40 
42  public: void Init();
43 
45  public: void Update();
46 
49  private: void OnModelInfo(ConstModelPtr &_msg);
50 
53  private: void OnRequest(ConstRequestPtr &_msg);
54 
56  private: physics::WorldPtr world;
57 
59  private: sdf::ElementPtr sdf;
60 
62  private: std::map<std::string, RegionPtr> regions;
63 
65  private: std::vector<EventSourcePtr> events;
66 
68  private: transport::NodePtr node;
69 
71  private: transport::PublisherPtr pub;
72 
74  private: transport::SubscriberPtr spawnSub;
75 
77  private: std::set<std::string> models;
78 
80  private: transport::SubscriberPtr requestSub;
81  };
82 }
83 
84 #endif
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
A plugin with access to physics::World.
Definition: Plugin.hh:220
void Init()
Called upon initialization.
void Update()
Called every simulation step.
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:84
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
virtual ~SimEventsPlugin()
Destrutor.
Definition: SimEventsPlugin.hh:31
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf)
Called when the world file is loaded.