Fawkes API  Fawkes Development Version
line_info.h
1 
2 /***************************************************************************
3  * line_info.h - line info container
4  *
5  * Created: Tue Mar 17 11:13:24 2015 (re-factoring)
6  * Copyright 2011-2015 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __PLUGINS_LASER_LINES_LINE_INFO_H_
23 #define __PLUGINS_LASER_LINES_LINE_INFO_H_
24 
25 #include <Eigen/Geometry>
26 #include <pcl/point_cloud.h>
27 #include <pcl/point_types.h>
28 #include <boost/circular_buffer.hpp>
29 #include <memory>
30 #include <tf/types.h>
31 #include <tf/transformer.h>
32 #include <logging/logger.h>
33 
34 /** Line information container.
35  * All points and angles are in the sensor reference frame
36  * from which the lines were extracted.
37  */
38 class LineInfo {
39  public:
40  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41 
42  float bearing; ///< bearing to point on line
43  float length; ///< length of the detecte line segment
44 
45  Eigen::Vector3f point_on_line; ///< point on line vector
46  Eigen::Vector3f line_direction; ///< line direction vector
47 
48  Eigen::Vector3f base_point; ///< optimized closest point on line
49 
50  Eigen::Vector3f end_point_1; ///< line segment end point
51  Eigen::Vector3f end_point_2; ///< line segment end point
52 
53  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud; ///< point cloud consisting only of
54  ///< points account to this line
55 };
56 
57 
59 public:
60  LineInfo raw; ///< the latest geometry of this line, i.e. unfiltered
61  LineInfo smooth; ///< moving-average geometry of this line (cf. length of history buffer)
62  fawkes::tf::Stamped<fawkes::tf::Point> base_point_odom; ///< last reference point (in odom frame) for line tracking
63  fawkes::tf::Transformer *transformer; ///< Transformer used to transform from input_frame_id_to odom
64  std::string input_frame_id; ///< Input frame ID of raw line infos (base_laser usually)
65  std::string tracking_frame_id; ///< Track lines relative to this frame (e.g. odom helps compensate movement)
66  float cfg_switch_tolerance; ///< Configured line jitter threshold
67  boost::circular_buffer<LineInfo> history; ///< history of raw line geometries for computing moving average
68  float bearing_center; ///< Bearing towards line center, used to select lines "in front of us" when there
69  fawkes::Logger *logger; ///< Logger pointer of the calling class
70  std::string plugin_name; ///< Plugin name of the calling class
71 
74  const std::string &input_frame_id,
75  const std::string &tracking_frame_id,
76  float cfg_switch_tolerance,
77  unsigned int cfg_moving_avg_len,
78  fawkes::Logger *logger,
79  std::string plugin_name);
80 
81  btScalar distance(const LineInfo &linfo) const;
82  void update(LineInfo &new_linfo);
83 };
84 
85 #endif
Line information container.
Definition: line_info.h:38
EIGEN_MAKE_ALIGNED_OPERATOR_NEW float bearing
bearing to point on line
Definition: line_info.h:42
std::string input_frame_id
Input frame ID of raw line infos (base_laser usually)
Definition: line_info.h:64
Eigen::Vector3f end_point_1
line segment end point
Definition: line_info.h:50
std::string tracking_frame_id
Track lines relative to this frame (e.g. odom helps compensate movement)
Definition: line_info.h:65
Eigen::Vector3f end_point_2
line segment end point
Definition: line_info.h:51
fawkes::tf::Transformer * transformer
Transformer used to transform from input_frame_id_to odom.
Definition: line_info.h:63
Eigen::Vector3f base_point
optimized closest point on line
Definition: line_info.h:48
LineInfo smooth
moving-average geometry of this line (cf. length of history buffer)
Definition: line_info.h:61
fawkes::Logger * logger
Logger pointer of the calling class.
Definition: line_info.h:69
std::string plugin_name
Plugin name of the calling class.
Definition: line_info.h:70
Eigen::Vector3f line_direction
line direction vector
Definition: line_info.h:46
float length
length of the detecte line segment
Definition: line_info.h:43
Eigen::Vector3f point_on_line
point on line vector
Definition: line_info.h:45
boost::circular_buffer< LineInfo > history
history of raw line geometries for computing moving average
Definition: line_info.h:67
fawkes::tf::Stamped< fawkes::tf::Point > base_point_odom
last reference point (in odom frame) for line tracking
Definition: line_info.h:62
float cfg_switch_tolerance
Configured line jitter threshold.
Definition: line_info.h:66
Container for a line with tracking and smoothing info.
Definition: line_info.h:58
LineInfo raw
the latest geometry of this line, i.e. unfiltered
Definition: line_info.h:60
Coordinate transforms between any two frames in a system.
Definition: transformer.h:68
float bearing_center
Bearing towards line center, used to select lines "in front of us" when there.
Definition: line_info.h:68
pcl::PointCloud< pcl::PointXYZ >::Ptr cloud
point cloud consisting only of points account to this line
Definition: line_info.h:53
Interface for logging.
Definition: logger.h:34