gazebo_ros_video.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 /*
19  * Desc: Video plugin for displaying ROS image topics on Ogre textures
20  * Author: Piyush Khandelwal
21  * Date: 26 July 2013
22  */
23 
24 #ifndef GAZEBO_ROS_VIDEO_H
25 #define GAZEBO_ROS_VIDEO_H
26 
27 #include <boost/thread/mutex.hpp>
28 #include <cv_bridge/cv_bridge.h>
30 #include <opencv2/opencv.hpp>
31 #include <ros/advertise_options.h>
32 #include <ros/callback_queue.h>
33 #include <ros/ros.h>
34 #include <sensor_msgs/Image.h>
35 
36 #include <gazebo/common/Events.hh>
37 #include <gazebo/common/Plugin.hh>
38 #include <gazebo/common/Time.hh>
39 #include <gazebo/rendering/rendering.hh>
40 #include <gazebo/transport/TransportTypes.hh>
41 
42 namespace gazebo
43 {
44 
45  class VideoVisual : public rendering::Visual
46  {
47  public:
49  const std::string &name, rendering::VisualPtr parent,
50  int height, int width);
51  virtual ~VideoVisual();
52  void render(const cv::Mat& image);
53  private:
54  Ogre::TexturePtr texture_;
55  int height_;
56  int width_;
57  };
58 
59  class GazeboRosVideo : public VisualPlugin
60  {
61  public:
62 
64  virtual ~GazeboRosVideo();
65 
66  void Load(rendering::VisualPtr parent, sdf::ElementPtr sdf);
67  void processImage(const sensor_msgs::ImageConstPtr &msg);
68 
69  protected:
70 
71  virtual void UpdateChild();
72 
73  // Pointer to the model
74  rendering::VisualPtr model_;
75  // Pointer to the update event connection
76  event::ConnectionPtr update_connection_;
77 
79 
81  boost::mutex m_image_;
83 
86 
87  // ROS Stuff
89  std::string robot_namespace_;
90  std::string topic_name_;
91 
93  boost::thread callback_queue_thread_;
94  void QueueThread();
95 
96  };
97 
98 }
99 
100 #endif
msg
ros::NodeHandle * rosnode_
A pointer to the ROS node. A node will be instantiated if it does not exist.
VideoVisual(const std::string &name, rendering::VisualPtr parent, int height, int width)
rendering::VisualPtr model_
ros::CallbackQueue queue_
event::ConnectionPtr update_connection_
void render(const cv::Mat &image)
ros::Subscriber camera_subscriber_
cv_bridge::CvImagePtr image_
boost::thread callback_queue_thread_
Ogre::TexturePtr texture_
boost::shared_ptr< VideoVisual > video_visual_


gazebo_plugins
Author(s): John Hsu
autogenerated on Wed Aug 24 2022 02:47:52