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 #include <std_msgs/String.h> 36 #include <std_msgs/Int32.h> 40 #include <OgreSceneNode.h> 41 #include <OgreFrustum.h> 42 #include <OgreSceneQuery.h> 77 this->
world_ = _parent->GetWorld();
83 this->
node_.reset(
new transport::Node());
85 #if GAZEBO_MAJOR_VERSION >= 8 91 std::string name = std::string(
"~/") + _parent->GetName() +
"/" +
92 _sdf->Get<std::string>(
"projector");
100 if (_sdf->HasElement(
"robotNamespace"))
101 this->robot_namespace_ = _sdf->GetElement(
"robotNamespace")->Get<std::string>() +
"/";
104 if (_sdf->HasElement(
"textureTopicName"))
105 this->texture_topic_name_ = _sdf->GetElement(
"textureTopicName")->Get<std::string>();
108 if (_sdf->HasElement(
"projectorTopicName"))
109 this->projector_topic_name_ = _sdf->GetElement(
"projectorTopicName")->Get<std::string>();
114 ROS_FATAL_STREAM_NAMED(
"projector",
"A ROS node for Gazebo has not been initialized, unable to load plugin. " 115 <<
"Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)");
148 msg.set_name(
"texture_projector");
149 msg.set_texture(imageMsg->data);
158 msg.set_name(
"texture_projector");
159 msg.set_enabled(projectorMsg->data);
168 static const double timeout = 0.01;
virtual ~GazeboRosProjector()
Destructor.
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ROSCPP_DECL bool isInitialized()
virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Load the controller.
ros::CallbackQueue queue_
std::string robot_namespace_
For setting ROS name space.
GazeboRosProjector()
Constructor.
GZ_REGISTER_MODEL_PLUGIN(GazeboRosF3D)
ros::Subscriber projectorSubscriber_
#define ROS_FATAL_STREAM_NAMED(name, args)
std::string projector_topic_name_
ROS projector topic name.
boost::thread callback_queue_thread_
physics::WorldPtr world_
pointer to the world
ros::NodeHandle * rosnode_
A pointer to the ROS node. A node will be instantiated if it does not exist.
ros::Subscriber imageSubscriber_
OgrePassMap::iterator OgrePassMapIterator
void ToggleProjector(const std_msgs::Int32::ConstPtr &projectorMsg)
Callbakc when a projector toggle is published.
transport::PublisherPtr projector_pub_
boost::shared_ptr< void > VoidPtr
std::string texture_topic_name_
ROS texture topic name.
void LoadImage(const std_msgs::String::ConstPtr &imageMsg)
Callback when a texture is published.
std::map< std::string, Ogre::Pass * > OgrePassMap