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 #include <bondcpp/bond.h>
47 
48 #include "urg_node/urg_c_wrapper.h"
49 
50 namespace urg_node
51 {
52 class UrgNode
53 {
54 public:
55  UrgNode();
56  UrgNode(ros::NodeHandle nh, ros::NodeHandle private_nh);
57  ~UrgNode();
58 
62  void run();
63 
69  bool updateStatus();
70 
71 private:
72  void initSetup();
73  bool connect();
74  bool reconfigure_callback(urg_node::URGConfig& config, int level);
76  void calibrate_time_offset();
77  void addDiagnostics();
78  void updateDiagnostics();
80  void scanThread();
81 
82  bool statusCallback(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res);
83 
86 
87  boost::thread diagnostics_thread_;
88  boost::thread scan_thread_;
89 
96 
97  boost::mutex lidar_mutex_;
98 
99  /* Non-const device properties. If you poll the driver for these
100  * while scanning is running, then the scan will probably fail.
101  */
102  std::string device_status_;
103  std::string vendor_name_;
104  std::string product_name_;
105  std::string firmware_version_;
106  std::string firmware_date_;
107  std::string protocol_version_;
108  std::string device_id_;
109  uint16_t error_code_;
111 
113  double freq_min_;
116 
117  int ip_port_;
118  std::string ip_address_;
119  std::string serial_port_;
129 
130  volatile bool service_yield_;
131 
135 
137 };
138 
139 } // namespace urg_node
140 
141 #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_
boost::shared_ptr< bond::Bond > bond_
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 Fri Oct 14 2022 02:41:16