OccupiedEventSource.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 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
18#ifndef GAZEBO_PLUGINS_EVENTS_OCCUPIEDEVENTSSOURCE_HH_
19#define GAZEBO_PLUGINS_EVENTS_OCCUPIEDEVENTSSOURCE_HH_
20
21#include <string>
22#include <map>
23
24#include <sdf/sdf.hh>
25
27
29#include <gazebo/util/system.hh>
30
31#include "Region.hh"
32#include "EventSource.hh"
33
34namespace gazebo
35{
38 //
58 class GZ_PLUGIN_VISIBLE OccupiedEventSource : public EventSource
59 {
60 // Documentation inherited
62 physics::WorldPtr _world,
63 const std::map<std::string, RegionPtr> &_regions);
64
66 public: ~OccupiedEventSource() = default;
67
68 // Documentation inherited
69 public: virtual void Load(const sdf::ElementPtr _sdf);
70
72 private: void Update();
73
75 private: sdf::ElementPtr sdf;
76
78 private: std::map<std::string, RegionPtr> regions;
79
81 public: msgs::GzString msg;
82
85
87 private: event::ConnectionPtr updateConnection;
88
90 private: transport::NodePtr node;
91
93 private: std::string regionName;
94 };
95}
96#endif
Forward declarations for transport.
The base class for emitting SimEvents.
Definition EventSource.hh:35
A plugin that transmits a message when an in-region event occurs.
Definition OccupiedEventSource.hh:59
OccupiedEventSource(transport::PublisherPtr _pub, physics::WorldPtr _world, const std::map< std::string, RegionPtr > &_regions)
virtual void Load(const sdf::ElementPtr _sdf)
Load from an sdf element (with possible configuration data)
msgs::GzString msg
String message that is transmitted when an event occurs.
Definition OccupiedEventSource.hh:81
~OccupiedEventSource()=default
Destructor.
transport::PublisherPtr msgPub
Publisher that transmits the message when an event occurs.
Definition OccupiedEventSource.hh:84
boost::shared_ptr< Connection > ConnectionPtr
Definition CommonTypes.hh:134
boost::shared_ptr< World > WorldPtr
Definition PhysicsTypes.hh:89
boost::shared_ptr< Publisher > PublisherPtr
Definition TransportTypes.hh:49
boost::shared_ptr< Node > NodePtr
Definition TransportTypes.hh:57
Forward declarations for the common classes.
Definition Animation.hh:27