camera_nodelet.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 // SPDX-License-Identifier: Apache-2.0
4 // Copyright (C) 2021 ifm electronic, gmbh
5 
6 #ifndef __IFM3D_ROS_CAMERA_NODELET_H__
7 #define __IFM3D_ROS_CAMERA_NODELET_H__
8 
9 #include <cstdint>
10 #include <memory>
11 #include <mutex>
12 #include <string>
13 
15 #include <nodelet/nodelet.h>
16 #include <ros/ros.h>
17 
18 #include <ifm3d/camera/camera_base.h>
19 #include <ifm3d/fg.h>
20 #include <ifm3d/stlimage.h>
21 #include <ifm3d_ros_msgs/Config.h>
22 #include <ifm3d_ros_msgs/Dump.h>
23 #include <ifm3d_ros_msgs/Extrinsics.h>
24 #include <ifm3d_ros_msgs/SoftOff.h>
25 #include <ifm3d_ros_msgs/SoftOn.h>
26 #include <ifm3d_ros_msgs/Trigger.h>
27 
28 namespace ifm3d_ros
29 {
37 {
38 private:
39  //
40  // Nodelet lifecycle functions
41  //
42  void onInit() override;
43 
44  //
45  // ROS services
46  //
47  bool Dump(ifm3d_ros_msgs::Dump::Request& req, ifm3d_ros_msgs::Dump::Response& res);
48  bool Config(ifm3d_ros_msgs::Config::Request& req, ifm3d_ros_msgs::Config::Response& res);
49  bool Trigger(ifm3d_ros_msgs::Trigger::Request& req, ifm3d_ros_msgs::Trigger::Response& res);
50  bool SoftOff(ifm3d_ros_msgs::SoftOff::Request& req, ifm3d_ros_msgs::SoftOff::Response& res);
51  bool SoftOn(ifm3d_ros_msgs::SoftOn::Request& req, ifm3d_ros_msgs::SoftOn::Response& res);
52 
53  //
54  // This is our main publishing loop and its helper functions
55  //
56  void Run();
57  bool InitStructures(std::uint16_t mask, std::uint16_t pcic_port);
58  bool AcquireFrame();
59 
60  //
61  // state
62  //
63  std::string camera_ip_;
64  std::uint16_t xmlrpc_port_;
65  std::uint16_t pcic_port_;
66  std::string password_;
67  std::uint16_t schema_mask_;
76 
77  std::string frame_id_;
78  std::string optical_frame_id_;
79 
80  ifm3d::CameraBase::Ptr cam_;
81  ifm3d::FrameGrabber::Ptr fg_;
82  ifm3d::StlImageBuffer::Ptr im_;
83  std::mutex mutex_;
84 
86  std::unique_ptr<image_transport::ImageTransport> it_;
87 
88  //
89  // Topics we publish
90  //
101 
102  //
103  // Services we advertise
104  //
110 
111  //
112  // We use a ROS one-shot timer to kick off our publishing loop.
113  //
115 
116 }; // end: class CameraNodelet
117 
118 } // namespace ifm3d_ros
119 
120 #endif // __IFM3D_ROS_CAMERA_NODELET_H__
ros::Publisher cloud_pub_
ros::ServiceServer soft_off_srv_
image_transport::Publisher conf_pub_
bool Dump(ifm3d_ros_msgs::Dump::Request &req, ifm3d_ros_msgs::Dump::Response &res)
std::uint16_t schema_mask_
ros::ServiceServer dump_srv_
bool Trigger(ifm3d_ros_msgs::Trigger::Request &req, ifm3d_ros_msgs::Trigger::Response &res)
image_transport::Publisher raw_amplitude_pub_
image_transport::Publisher distance_noise_pub_
image_transport::Publisher gray_image_pub_
image_transport::Publisher amplitude_pub_
ifm3d::FrameGrabber::Ptr fg_
bool SoftOff(ifm3d_ros_msgs::SoftOff::Request &req, ifm3d_ros_msgs::SoftOff::Response &res)
ros::Publisher extrinsics_pub_
ifm3d::StlImageBuffer::Ptr im_
image_transport::Publisher distance_pub_
bool InitStructures(std::uint16_t mask, std::uint16_t pcic_port)
ros::ServiceServer trigger_srv_
bool SoftOn(ifm3d_ros_msgs::SoftOn::Request &req, ifm3d_ros_msgs::SoftOn::Response &res)
ros::ServiceServer soft_on_srv_
ros::Publisher uvec_pub_
std::uint16_t xmlrpc_port_
ifm3d::CameraBase::Ptr cam_
ros::ServiceServer config_srv_
ros::Publisher rgb_image_pub_
std::unique_ptr< image_transport::ImageTransport > it_
bool Config(ifm3d_ros_msgs::Config::Request &req, ifm3d_ros_msgs::Config::Response &res)


ifm3d_ros_driver
Author(s): CSR ifm sytron
autogenerated on Tue Feb 21 2023 03:13:25