urg_node_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, Willow Garage, Inc.
3  * Copyright (c) 2017, Clearpath Robotics, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * * Neither the name of the Willow Garage, Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 /*
32  * Author: Mike O'Driscoll
33  */
34 
35 #ifndef URG_NODE_URG_NODE_DRIVER_H
36 #define URG_NODE_URG_NODE_DRIVER_H
37 
38 #include <string>
39 #include <ros/ros.h>
40 #include <dynamic_reconfigure/server.h>
44 #include <urg_node/URGConfig.h>
45 #include <std_srvs/Trigger.h>
46 
47 #include "urg_node/urg_c_wrapper.h"
48 
49 namespace urg_node
50 {
51 class UrgNode
52 {
53 public:
54  UrgNode();
55  UrgNode(ros::NodeHandle nh, ros::NodeHandle private_nh);
56  ~UrgNode();
57 
61  void run();
62 
68  bool updateStatus();
69 
70 private:
71  void initSetup();
72  bool connect();
73  bool reconfigure_callback(urg_node::URGConfig& config, int level);
75  void calibrate_time_offset();
76  void updateDiagnostics();
78  void scanThread();
79 
80  bool statusCallback(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res);
81 
84 
85  boost::thread diagnostics_thread_;
86  boost::thread scan_thread_;
87 
93 
94  boost::mutex lidar_mutex_;
95 
96  /* Non-const device properties. If you poll the driver for these
97  * while scanning is running, then the scan will probably fail.
98  */
99  std::string device_status_;
100  std::string vendor_name_;
101  std::string product_name_;
102  std::string firmware_version_;
103  std::string firmware_date_;
104  std::string protocol_version_;
105  std::string device_id_;
106  uint16_t error_code_;
108 
110  double freq_min_;
113 
114  int ip_port_;
115  std::string ip_address_;
116  std::string serial_port_;
126 
127  volatile bool service_yield_;
128 
132 
134 };
135 
136 } // namespace urg_node
137 
138 #endif // URG_NODE_URG_NODE_DRIVER_H
ros::Publisher status_pub_
std::string product_name_
bool updateStatus()
Trigger an update of the lidar&#39;s status publish the latest known information about the lidar on latch...
std::string protocol_version_
boost::shared_ptr< urg_node::URGCWrapper > urg_
std::string vendor_name_
double diagnostics_window_time_
boost::shared_ptr< diagnostic_updater::HeaderlessTopicDiagnostic > laser_freq_
std::string serial_port_
ros::NodeHandle pnh_
boost::thread diagnostics_thread_
boost::shared_ptr< diagnostic_updater::Updater > diagnostic_updater_
boost::thread scan_thread_
boost::shared_ptr< diagnostic_updater::HeaderlessTopicDiagnostic > echoes_freq_
std::string firmware_version_
boost::mutex lidar_mutex_
std::string device_status_
volatile bool service_yield_
laser_proc::LaserPublisher echoes_pub_
std::string ip_address_
std::string device_id_
ros::NodeHandle nh_
bool statusCallback(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
std::string firmware_date_
boost::shared_ptr< dynamic_reconfigure::Server< urg_node::URGConfig > > srv_
Dynamic reconfigure server.
ros::Publisher laser_pub_
ros::ServiceServer status_service_
void populateDiagnosticsStatus(diagnostic_updater::DiagnosticStatusWrapper &stat)
void run()
Start&#39;s the nodes threads to run the lidar.
bool reconfigure_callback(urg_node::URGConfig &config, int level)


urg_node
Author(s): Chad Rockey , Mike O'Driscoll
autogenerated on Wed Oct 28 2020 03:39:16