##

InRegionEventSource.hh
Go to the documentation of this file.
/*
* Copyright (C) 2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PLUGINS_INREGIONEVENTSOURCE_HH_
#define GAZEBO_PLUGINS_INREGIONEVENTSOURCE_HH_
#include <map>
#include <string>
#include <vector>
#include "plugins/events/Region.hh"
#include "plugins/events/EventSource.hh"
namespace gazebo
{
class InRegionEventSource: public EventSource
{
public: InRegionEventSource(transport::PublisherPtr _pub,
physics::WorldPtr _world,
const std::map<std::string, RegionPtr> &_regions);
public: virtual void Init();
public: void Update();
public: void Info() const;
public: virtual void Load(const sdf::ElementPtr _sdf);
private: event::ConnectionPtr updateConnection;
private: std::string modelName;
private: physics::ModelPtr model;
private: std::string regionName;
private: RegionPtr region;
private: const std::map<std::string, RegionPtr> &regions;
private: bool isInside;
};
}
#endif
gazebo::InRegionEventSource::Load
virtual void Load(const sdf::ElementPtr _sdf)
Loads the full name of the model and the region from the world file.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::InRegionEventSource::InRegionEventSource
InRegionEventSource(transport::PublisherPtr _pub, physics::WorldPtr _world, const std::map< std::string, RegionPtr > &_regions)
Constructor.
gazebo::InRegionEventSource::Update
void Update()
Called every simulation step.
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
gazebo::InRegionEventSource
The event generator class.
Definition: InRegionEventSource.hh:31
gazebo::transport::PublisherPtr
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
Region.hh
EventSource.hh
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::EventSource
The base class for emitting SimEvents.
Definition: EventSource.hh:34
gazebo::InRegionEventSource::Init
virtual void Init()
Initialize the event.
gazebo::InRegionEventSource::Info
void Info() const
Prints data about the event source to the log (useful for debug)
gazebo::RegionPtr
std::shared_ptr< Region > RegionPtr
Definition: Region.hh:64
gazebo::physics::WorldPtr
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89