##

ArrangePlugin.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_ARRANGEPLUGIN_HH_
#define GAZEBO_PLUGINS_ARRANGEPLUGIN_HH_
#include <map>
#include <memory>
#include <string>
#include <sdf/sdf.hh>
#include <ignition/math/Pose3.hh>
#include <ignition/transport/Node.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/transport/transport.hh>
#include <gazebo/physics/PhysicsTypes.hh>
#include <gazebo/util/system.hh>
#include <gazebo/msgs/msgs.hh>
namespace gazebo
{
class GAZEBO_VISIBLE ArrangePlugin : public WorldPlugin
{
public: ArrangePlugin();
public: ~ArrangePlugin();
public: virtual void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf);
public: virtual void Init();
public: virtual void Reset();
public: bool SetArrangement(const std::string &_arrangement);
public: void ArrangementCallback(ConstGzStringPtr &_msg);
protected: physics::WorldPtr world;
protected: sdf::ElementPtr sdf;
protected: class Object
{
public: physics::ModelPtr model;
public: ignition::math::Pose3d pose;
};
typedef std::shared_ptr<Object> ObjectPtr;
typedef std::map<std::string, ObjectPtr> Object_M;
protected: Object_M objects;
typedef std::map<std::string, ignition::math::Pose3d> Pose_M;
typedef std::map<std::string, Pose_M> Arrangement_M;
protected: Arrangement_M arrangements;
protected: std::string initialArrangementName;
protected: std::string currentArrangementName;
protected: std::string eventTopicName;
protected: transport::NodePtr node;
protected: transport::SubscriberPtr sub;
// Place ignition::transport objects at the end of this file to
// guarantee they are destructed first.
protected: ignition::transport::Node nodeIgn;
};
}
#endif
gazebo::ArrangePlugin::arrangements
Arrangement_M arrangements
Information about arrangements.
Definition: ArrangePlugin.hh:94
gazebo::ArrangePlugin::eventTopicName
std::string eventTopicName
Topic to listen on for changing arrangments.
Definition: ArrangePlugin.hh:103
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
gazebo::ArrangePlugin::Object_M
std::map< std::string, ObjectPtr > Object_M
Map of strings to model pointers.
Definition: ArrangePlugin.hh:82
system.hh
msgs.hh
gazebo::WorldPlugin
A plugin with access to physics::World. See reference.
Definition: Plugin.hh:278
gazebo::transport::SubscriberPtr
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
PhysicsTypes.hh
default namespace for gazebo
gazebo::transport::NodePtr
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
gazebo::ArrangePlugin::sub
transport::SubscriberPtr sub
Subscriber for listening to changing arrangements.
Definition: ArrangePlugin.hh:109
gazebo::ArrangePlugin::node
transport::NodePtr node
Node for Gazebo transport.
Definition: ArrangePlugin.hh:106
gazebo::ArrangePlugin::nodeIgn
ignition::transport::Node nodeIgn
Ignition node for Gazebo transport.
Definition: ArrangePlugin.hh:115
gazebo::ArrangePlugin::Arrangement_M
std::map< std::string, Pose_M > Arrangement_M
Map of strings to Pose_M (arrangement map).
Definition: ArrangePlugin.hh:91
gazebo::ArrangePlugin::Object::pose
ignition::math::Pose3d pose
Initial object pose.
Definition: ArrangePlugin.hh:77
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::ArrangePlugin
Definition: ArrangePlugin.hh:37
gazebo::ArrangePlugin::objects
Object_M objects
Collection of models.
Definition: ArrangePlugin.hh:85
gazebo::ArrangePlugin::Pose_M
std::map< std::string, ignition::math::Pose3d > Pose_M
Map of strings to model poses.
Definition: ArrangePlugin.hh:88
gazebo::ArrangePlugin::Object
Class to store info about each object.
Definition: ArrangePlugin.hh:71
gazebo::ArrangePlugin::Object::model
physics::ModelPtr model
Model pointer.
Definition: ArrangePlugin.hh:74
gazebo::physics::WorldPtr
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
gazebo::ArrangePlugin::world
physics::WorldPtr world
World pointer.
Definition: ArrangePlugin.hh:65
Plugin.hh
gazebo::ArrangePlugin::currentArrangementName
std::string currentArrangementName
Current arrangement name.
Definition: ArrangePlugin.hh:100
gazebo::ArrangePlugin::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: ArrangePlugin.hh:79
gazebo::ArrangePlugin::sdf
sdf::ElementPtr sdf
SDF pointer.
Definition: ArrangePlugin.hh:68
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59
gazebo::ArrangePlugin::initialArrangementName
std::string initialArrangementName
Initial arrangement name.
Definition: ArrangePlugin.hh:97