camera_nodelet.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /*
3  * Copyright (C) 2018 ifm electronic, gmbh
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distribted on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __IFM3D_ROS_CAMERA_NODELET_H__
19 #define __IFM3D_ROS_CAMERA_NODELET_H__
20 
21 #include <cstdint>
22 #include <memory>
23 #include <mutex>
24 #include <string>
25 
27 #include <nodelet/nodelet.h>
28 #include <ros/ros.h>
29 
30 #include <ifm3d/camera.h>
31 #include <ifm3d/fg.h>
32 #include <ifm3d/image.h>
33 #include <ifm3d/Config.h>
34 #include <ifm3d/Dump.h>
35 #include <ifm3d/Extrinsics.h>
36 #include <ifm3d/SoftOff.h>
37 #include <ifm3d/SoftOn.h>
38 #include <ifm3d/SyncClocks.h>
39 #include <ifm3d/Trigger.h>
40 
41 namespace ifm3d_ros
42 {
50  {
51  private:
52  //
53  // Nodelet lifecycle functions
54  //
55  virtual void onInit() override;
56 
57  //
58  // ROS services
59  //
60  bool Dump(ifm3d::Dump::Request& req, ifm3d::Dump::Response& res);
61  bool Config(ifm3d::Config::Request& req, ifm3d::Config::Response& res);
62  bool Trigger(ifm3d::Trigger::Request& req, ifm3d::Trigger::Response& res);
63  bool SoftOff(ifm3d::SoftOff::Request& req, ifm3d::SoftOff::Response& res);
64  bool SoftOn(ifm3d::SoftOn::Request& req, ifm3d::SoftOn::Response& res);
65  bool SyncClocks(ifm3d::SyncClocks::Request& req,
66  ifm3d::SyncClocks::Response& res);
67 
68  //
69  // This is our main publishing loop and its helper functions
70  //
71  void Run();
72  bool InitStructures(std::uint16_t mask);
73  bool AcquireFrame();
74 
75  //
76  // state
77  //
78  std::string camera_ip_;
79  std::uint16_t xmlrpc_port_;
80  std::string password_;
81  std::uint16_t schema_mask_;
91 
92  std::string frame_id_;
93  std::string optical_frame_id_;
94 
95  ifm3d::Camera::Ptr cam_;
96  ifm3d::FrameGrabber::Ptr fg_;
97  ifm3d::ImageBuffer::Ptr im_;
98  std::mutex mutex_;
99 
101  std::unique_ptr<image_transport::ImageTransport> it_;
102 
103  //
104  // Topics we publish
105  //
115 
116  //
117  // Services we advertise
118  //
125 
126  //
127  // We use a ROS one-shot timer to kick off our publishing loop.
128  //
130 
131  }; // end: class CameraNodelet
132 
133 } // end: namespace ifm3d_ros
134 
135 #endif // __IFM3D_ROS_CAMERA_NODELET_H__
bool Config(ifm3d::Config::Request &req, ifm3d::Config::Response &res)
ros::ServiceServer soft_off_srv_
image_transport::Publisher conf_pub_
std::uint16_t schema_mask_
ifm3d::Camera::Ptr cam_
ifm3d::ImageBuffer::Ptr im_
ros::ServiceServer dump_srv_
image_transport::Publisher good_bad_pub_
image_transport::Publisher raw_amplitude_pub_
ros::ServiceServer sync_clocks_srv_
image_transport::Publisher amplitude_pub_
ifm3d::FrameGrabber::Ptr fg_
bool InitStructures(std::uint16_t mask)
ros::Publisher extrinsics_pub_
image_transport::Publisher xyz_image_pub_
image_transport::Publisher distance_pub_
ros::ServiceServer trigger_srv_
bool Trigger(ifm3d::Trigger::Request &req, ifm3d::Trigger::Response &res)
ros::ServiceServer soft_on_srv_
bool Dump(ifm3d::Dump::Request &req, ifm3d::Dump::Response &res)
bool SoftOff(ifm3d::SoftOff::Request &req, ifm3d::SoftOff::Response &res)
std::uint16_t xmlrpc_port_
virtual void onInit() override
bool SoftOn(ifm3d::SoftOn::Request &req, ifm3d::SoftOn::Response &res)
bool SyncClocks(ifm3d::SyncClocks::Request &req, ifm3d::SyncClocks::Response &res)
ros::ServiceServer config_srv_
std::unique_ptr< image_transport::ImageTransport > it_


ifm3d
Author(s): Tom Panzarella
autogenerated on Thu Feb 4 2021 03:23:54