laser_scan_matcher_node.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, Ivan Dryanovski, William Morris
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the CCNY Robotics Lab nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /* This package uses Canonical Scan Matcher [1], written by
31  * Andrea Censi
32  *
33  * [1] A. Censi, "An ICP variant using a point-to-line metric"
34  * Proceedings of the IEEE International Conference
35  * on Robotics and Automation (ICRA), 2008
36  */
37 
38 /* This package contains modifications that are copyright by Nokia
39  *
40  * Licensed under the BSD 3-Clause "New" or "Revised" License
41  * SPDX-License-Identifier: BSD-3-Clause
42  */
43 
45 
46 // Workaround for a bug in CSM library. CSM does not properly
47 // handle all cases of singular matrix so an error trickles
48 // down in to the GSL library and causes the error handler
49 // to kick in. Our handler catches that error and
50 // and throws an exception. The exception is then caught
51 // in the caller and handled as failed matching. Only
52 // the GSL_EDOM errors are handled, other errors (potentially
53 // due to our bugs are still going to crash us so that we
54 // can fix them the right way.
55 void csm_gsl_error_handler(const char* reason, const char *file, int line, int gsl_errno)
56 {
57 
58  ROS_ERROR("intercepted GSL error in %s/%d: %s (%d)",
59  file, line, reason, gsl_errno);
60  if (gsl_errno == GSL_EDOM)
61  throw gsl_errno;
62  else
63  exit(-1);
64 }
65 
66 int main(int argc, char** argv)
67 {
68  gsl_set_error_handler(csm_gsl_error_handler);
69  ros::init(argc, argv, "LaserScanMatcher");
70  ros::NodeHandle nh;
71  ros::NodeHandle nh_private("~");
72  scan_tools::LaserScanMatcher laser_scan_matcher(nh, nh_private);
73  ros::spin();
74  return 0;
75 }
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
laser_scan_matcher.h
scan_tools::LaserScanMatcher
Definition: laser_scan_matcher.h:75
ROS_ERROR
#define ROS_ERROR(...)
ros::spin
ROSCPP_DECL void spin()
csm_gsl_error_handler
void csm_gsl_error_handler(const char *reason, const char *file, int line, int gsl_errno)
Definition: laser_scan_matcher_node.cpp:55
ros::NodeHandle
main
int main(int argc, char **argv)
Definition: laser_scan_matcher_node.cpp:66


lsm_localization
Author(s): Ivan Dryanovski , Ilija Hadzic
autogenerated on Fri Dec 23 2022 03:09:11