Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _GAZEBO_OPTICAL_FLOW_PLUGIN_HH_
00018 #define _GAZEBO_OPTICAL_FLOW_PLUGIN_HH_
00019
00020 #include <string>
00021
00022 #include "gazebo/common/Plugin.hh"
00023 #include "gazebo/sensors/CameraSensor.hh"
00024 #include "gazebo/gazebo.hh"
00025 #include "gazebo/common/common.hh"
00026 #include "gazebo/rendering/Camera.hh"
00027 #include "gazebo/util/system.hh"
00028 #include "gazebo/transport/transport.hh"
00029 #include "gazebo/msgs/msgs.hh"
00030
00031 #include "OpticalFlow.pb.h"
00032
00033 #include <opencv2/opencv.hpp>
00034 #include <iostream>
00035 #include <boost/timer/timer.hpp>
00036
00037 #include "flow_opencv.hpp"
00038 #include "flow_px4.hpp"
00039
00040 using namespace cv;
00041 using namespace std;
00042
00043 namespace gazebo
00044 {
00045 class GAZEBO_VISIBLE OpticalFlowPlugin : public SensorPlugin
00046 {
00047 public:
00048 OpticalFlowPlugin();
00049 virtual ~OpticalFlowPlugin();
00050 virtual void Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf);
00051 virtual void OnNewFrame(const unsigned char *_image,
00052 unsigned int _width, unsigned int _height,
00053 unsigned int _depth, const std::string &_format);
00054
00055 protected:
00056 unsigned int width, height, depth;
00057 std::string format;
00058 sensors::CameraSensorPtr parentSensor;
00059 rendering::CameraPtr camera;
00060
00061 private:
00062 event::ConnectionPtr newFrameConnection;
00063 Mat old_gray;
00064 Mat frame_gray;
00065 transport::PublisherPtr opticalFlow_pub_;
00066 transport::NodePtr node_handle_;
00067 opticalFlow_msgs::msgs::opticalFlow opticalFlow_message;
00068 std::string namespace_;
00069 boost::timer::cpu_timer timer_;
00070 OpticalFlowOpenCV *_optical_flow;
00071
00072
00073 float hfov;
00074 float rate;
00075 int dt_us;
00076 float focal_length;
00077 double first_frame_time;
00078 double frame_time;
00079 double old_frame_time;
00080 uint32_t frame_time_us;
00081 };
00082 }
00083 #endif
rotors_gazebo_plugins
Author(s): Fadri Furrer, Michael Burri, Mina Kamel, Janosch Nikolic, Markus Achtelik
autogenerated on Thu Apr 18 2019 02:43:43