29 #include <gazebo/rendering/RenderingIface.hh>
30 #include <gazebo/rendering/Scene.hh>
31 #include <gazebo/rendering/Visual.hh>
32 #include <gazebo/rendering/RTShaderSystem.hh>
35 #ifdef ENABLE_PROFILER
36 #include <ignition/common/Profiler.hh>
39 #include <std_msgs/String.h>
40 #include <std_msgs/Int32.h>
44 #include <OgreSceneNode.h>
45 #include <OgreFrustum.h>
46 #include <OgreSceneQuery.h>
81 this->
world_ = _parent->GetWorld();
84 this->
node_.reset(
new transport::Node());
86 #if GAZEBO_MAJOR_VERSION >= 8
92 std::string name = std::string(
"~/") + _parent->GetName() +
"/" +
93 _sdf->Get<std::string>(
"projector");
101 if (_sdf->HasElement(
"robotNamespace"))
102 this->robot_namespace_ = _sdf->GetElement(
"robotNamespace")->Get<std::string>() +
"/";
105 if (_sdf->HasElement(
"textureTopicName"))
106 this->texture_topic_name_ = _sdf->GetElement(
"textureTopicName")->Get<std::string>();
109 if (_sdf->HasElement(
"projectorTopicName"))
110 this->projector_topic_name_ = _sdf->GetElement(
"projectorTopicName")->Get<std::string>();
115 ROS_FATAL_STREAM_NAMED(
"projector",
"A ROS node for Gazebo has not been initialized, unable to load plugin. "
116 <<
"Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)");
126 this->projector_topic_name_,1,
132 this->texture_topic_name_,1,
148 #ifdef ENABLE_PROFILER
149 IGN_PROFILE(
"GazeboRosProjector::LoadImage");
150 IGN_PROFILE_BEGIN(
"publish");
153 msg.set_name(
"texture_projector");
154 msg.set_texture(imageMsg->data);
156 #ifdef ENABLE_PROFILER
165 #ifdef ENABLE_PROFILER
166 IGN_PROFILE(
"GazeboRosProjector::ToggleProjector");
167 IGN_PROFILE_BEGIN(
"publish");
170 msg.set_name(
"texture_projector");
171 msg.set_enabled(projectorMsg->data);
173 #ifdef ENABLE_PROFILER
183 static const double timeout = 0.01;