HLR  0.0.1
ObjectsPlugin.hpp
1 #ifndef OBJECTSPLUGIN_HPP
2 #define OBJECTSPLUGIN_HPP
3 
4 #include <ros/ros.h>
5 #include <HLR/World.h>
6 #include <gazebo/common/common.hh>
7 #include <gazebo/gazebo.hh>
8 #include <gazebo/physics/physics.hh>
9 
10 namespace gazebo // NOLINT
11 {
17 struct Object
18 {
24  uint32_t id;
25 
30  std::string name;
31 };
32 
38 class ObjectPlugin : public WorldPlugin
39 {
40 public:
45  ObjectPlugin();
46 
51  virtual ~ObjectPlugin();
52 
58  ObjectPlugin(const ObjectPlugin& object_plugin) = delete;
59 
66  ObjectPlugin& operator=(const ObjectPlugin& object_plugin) = delete;
67 
73  ObjectPlugin(ObjectPlugin&& object_plugin) = delete;
74 
81  ObjectPlugin& operator=(ObjectPlugin&& object_plugin) = delete;
82 
89  void Load(physics::WorldPtr _parent, sdf::ElementPtr _sdf); // NOLINT
90 
91 private:
99  void update_mesh(const std::string& name,
100  common::Mesh* mesh,
101  const uint32_t& identifier);
102 
108  void world_update_callback(const HLR::World::ConstPtr& msg);
109 
116  void parse_off(common::Mesh* mesh, std::istream& off_stream) const;
117 
122  ros::NodeHandle ros_node;
123 
128  ros::Subscriber world_updates_subscriber;
129 
134  physics::WorldPtr world;
135 
140  std::vector<Object> objects;
141 };
142 
143 // Register the world plugin
144 GZ_REGISTER_WORLD_PLUGIN(ObjectPlugin) // NOLINT
145 } // namespace gazebo
146 #endif
Object existing in the world This struct is used to map the objects we recieve from the worldupdate a...
Definition: ObjectsPlugin.hpp:17
uint32_t id
Id of the object Id of the object, this maps with the id&#39;s recieved from the worldupdates interface...
Definition: ObjectsPlugin.hpp:24
Definition: ObjectsPlugin.hpp:10
Plugin for loading objects in gazebo using worldupdates This function is not unit tested because it o...
Definition: ObjectsPlugin.hpp:38
std::string name
Name of the object This name is the same as in the gazebo world.
Definition: ObjectsPlugin.hpp:30