realsense_node_factory.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2018 Intel Corporation. All Rights Reserved
3 
4 #pragma once
5 
7 #include <nodelet/nodelet.h>
9 #include <ros/ros.h>
10 #include <ros/package.h>
11 #include <std_srvs/SetBool.h>
12 #include <librealsense2/rs.hpp>
13 #include <librealsense2/rsutil.h>
16 #include <cv_bridge/cv_bridge.h>
17 #include <constants.h>
18 #include <realsense2_camera/Extrinsics.h>
19 #include <realsense2_camera/IMUInfo.h>
20 #include <csignal>
21 #include <eigen3/Eigen/Geometry>
22 #include <fstream>
23 #include <thread>
24 #include <std_srvs/Empty.h>
25 
26 namespace realsense2_camera
27 {
40 
41  const std::vector<stream_index_pair> IMAGE_STREAMS = {DEPTH, INFRA0, INFRA1, INFRA2,
42  COLOR,
43  FISHEYE,
45 
46  const std::vector<stream_index_pair> HID_STREAMS = {GYRO, ACCEL, POSE};
47 
49  {
50  public:
51  virtual void publishTopics() = 0;
52  virtual void toggleSensors(bool enabled) = 0;
53  virtual void registerDynamicReconfigCb(ros::NodeHandle& nh) = 0;
54  virtual ~InterfaceRealSenseNode() = default;
55  };
56 
58  {
59  public:
61  virtual ~RealSenseNodeFactory();
62 
63  private:
64  void closeDevice();
65  void StartDevice();
66  void change_device_callback(rs2::event_information& info);
67  void getDevice(rs2::device_list list);
68  virtual void onInit() override;
69  void initialize(const ros::WallTimerEvent &ignored);
70  void tryGetLogSeverity(rs2_log_severity& severity) const;
71  void reset();
72  bool handleReset(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
73  static std::string parse_usb_port(std::string line);
74  bool toggle_sensor_callback(std_srvs::SetBool::Request &req, std_srvs::SetBool::Response &res);
75 
77  std::shared_ptr<InterfaceRealSenseNode> _realSenseNode;
79  std::string _serial_no;
80  std::string _usb_port_id;
81  std::string _device_type;
83  std::thread _query_thread;
84  bool _is_alive;
88 
89  };
90 }//end namespace
const stream_index_pair FISHEYE1
const std::vector< stream_index_pair > IMAGE_STREAMS
GLenum GLuint GLenum severity
virtual void registerDynamicReconfigCb(ros::NodeHandle &nh)=0
def info(args)
GLboolean reset
ROSCONSOLE_DECL void initialize()
RS2_STREAM_FISHEYE
const stream_index_pair INFRA0
RS2_STREAM_POSE
string line
const stream_index_pair INFRA2
RS2_STREAM_GYRO
RS2_STREAM_COLOR
std::pair< rs2_stream, int > stream_index_pair
Definition: constants.h:98
const stream_index_pair CONFIDENCE
const stream_index_pair GYRO
RS2_STREAM_CONFIDENCE
const stream_index_pair DEPTH
GLenum GLenum GLsizei const GLuint GLboolean enabled
std::shared_ptr< InterfaceRealSenseNode > _realSenseNode
const stream_index_pair FISHEYE2
RS2_STREAM_DEPTH
RS2_STREAM_INFRARED
RS2_STREAM_ACCEL
virtual void toggleSensors(bool enabled)=0
const stream_index_pair ACCEL
const stream_index_pair POSE
const std::vector< stream_index_pair > HID_STREAMS
GLuint res
const stream_index_pair FISHEYE
const stream_index_pair COLOR
const stream_index_pair INFRA1
rs2_log_severity


realsense2_camera
Author(s): Sergey Dorodnicov , Doron Hirshberg
autogenerated on Thu May 13 2021 02:33:12