psm_node.h
Go to the documentation of this file.
1 /*
2 * Polar Scan Matcher
3 * Copyright (C) 2010, CCNY Robotics Lab
4 * Ivan Dryanovski <ivan.dryanovski@gmail.com>
5 * William Morris <morris@ee.ccny.cuny.edu>
6 * http://robotics.ccny.cuny.edu
7 * Modified 2014, Daniel Axtens <daniel@axtens.net>
8 * whilst a student at the Australian National University
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 *
23 * This is a wrapper around Polar Scan Matcher [1], written by
24 * Albert Diosi
25 *
26 * [1] A. Diosi and L. Kleeman, "Laser Scan Matching in Polar Coordinates with
27 * Application to SLAM " Proceedings of 2005 IEEE/RSJ International Conference
28 * on Intelligent Robots and Systems, August, 2005, Edmonton, Canada
29 */
30 
31 #ifndef POLAR_SCAN_MATCHER_PSM_NODE_H
32 #define POLAR_SCAN_MATCHER_PSM_NODE_H
33 
34 #include <sys/time.h>
35 
36 #include <ros/ros.h>
38 #include <tf/transform_listener.h>
39 #include <sensor_msgs/LaserScan.h>
40 #include <sensor_msgs/Imu.h>
41 #include <geometry_msgs/Pose2D.h>
42 
44 
45 const std::string imuTopic_ = "imu";
46 const std::string scanTopic_ = "scan";
47 const std::string poseTopic_ = "pose2D";
48 
49 const double ROS_TO_PM = 100.0; // convert from cm to m
50 
51 class PSMNode
52 {
53  private:
54 
58 
64 
68 
71 
72  boost::mutex imuMutex_;
73  double prevImuAngle_; // the yaw angle when we last perfomred a scan match
74  double currImuAngle_; // the most recent yaw angle we have received
75 
76  // **** parameters
77 
78  bool publishTf_;
82 
85  double maxError_;
88 
89  std::string worldFrame_;
90  std::string baseFrame_;
91  std::string laserFrame_;
92 
93  void getParams();
94  bool initialize(const sensor_msgs::LaserScan& scan);
95 
96  void imuCallback (const sensor_msgs::Imu& imuMsg);
97  void scanCallback (const sensor_msgs::LaserScan& scan);
98 
99  void publishTf(const tf::Transform& transform,
100  const ros::Time& time);
101  void publishPose(const tf::Transform& transform);
102 
103  void rosToPMScan(const sensor_msgs::LaserScan& scan,
104  const tf::Transform& change,
105  PMScan* pmScan);
106  void pose2DToTf(const geometry_msgs::Pose2D& pose, tf::Transform& t);
107  void tfToPose2D(const tf::Transform& t, geometry_msgs::Pose2D& pose);
108  void getCurrentEstimatedPose(tf::Transform& worldToBase,
109  const sensor_msgs::LaserScan& scanMsg);
110 
111  public:
112 
113  PSMNode();
114  virtual ~PSMNode();
115 };
116 
117 #endif // POLAR_SCAN_MATCHER_PSM_NODE_H
ros::Subscriber scanSubscriber_
Definition: psm_node.h:55
boost::mutex imuMutex_
Definition: psm_node.h:72
int scansCount_
Definition: psm_node.h:67
std::string worldFrame_
Definition: psm_node.h:89
tf::Transform baseToLaser_
Definition: psm_node.h:62
double currImuAngle_
Definition: psm_node.h:74
void tfToPose2D(const tf::Transform &t, geometry_msgs::Pose2D &pose)
Definition: psm_node.cpp:365
void rosToPMScan(const sensor_msgs::LaserScan &scan, const tf::Transform &change, PMScan *pmScan)
Definition: psm_node.cpp:304
PSMNode()
Definition: psm_node.cpp:40
const double ROS_TO_PM
Definition: psm_node.h:49
PolarMatcher matcher_
Definition: psm_node.h:69
virtual ~PSMNode()
Definition: psm_node.cpp:59
tf::TransformBroadcaster tfBroadcaster_
Definition: psm_node.h:59
double maxError_
Definition: psm_node.h:85
std::string baseFrame_
Definition: psm_node.h:90
bool useImuOdometry_
Definition: psm_node.h:81
tf::Transform prevWorldToBase_
Definition: psm_node.h:61
void pose2DToTf(const geometry_msgs::Pose2D &pose, tf::Transform &t)
Definition: psm_node.cpp:357
ros::Publisher posePublisher_
Definition: psm_node.h:57
void publishTf(const tf::Transform &transform, const ros::Time &time)
Definition: psm_node.cpp:289
bool publishPose_
Definition: psm_node.h:79
bool publishTf_
Definition: psm_node.h:78
tf::TransformListener tfListener_
Definition: psm_node.h:60
bool useTfOdometry_
Definition: psm_node.h:80
tf::Transform laserToBase_
Definition: psm_node.h:63
bool initialized_
Definition: psm_node.h:65
const std::string scanTopic_
Definition: psm_node.h:46
void scanCallback(const sensor_msgs::LaserScan &scan)
Definition: psm_node.cpp:184
const std::string poseTopic_
Definition: psm_node.h:47
void publishPose(const tf::Transform &transform)
Definition: psm_node.cpp:296
std::string laserFrame_
Definition: psm_node.h:91
int maxIterations_
Definition: psm_node.h:86
void getCurrentEstimatedPose(tf::Transform &worldToBase, const sensor_msgs::LaserScan &scanMsg)
Definition: psm_node.cpp:339
PMScan * prevPMScan_
Definition: psm_node.h:70
double totalDuration_
Definition: psm_node.h:66
void imuCallback(const sensor_msgs::Imu &imuMsg)
Definition: psm_node.cpp:174
double prevImuAngle_
Definition: psm_node.h:73
int minValidPoints_
Definition: psm_node.h:83
double stopCondition_
Definition: psm_node.h:87
int searchWindow_
Definition: psm_node.h:84
void getParams()
Definition: psm_node.cpp:64
bool initialize(const sensor_msgs::LaserScan &scan)
Definition: psm_node.cpp:120
ros::Subscriber imuSubscriber_
Definition: psm_node.h:56
const std::string imuTopic_
Definition: psm_node.h:45


polar_scan_matcher
Author(s): Ivan Dryanovski
autogenerated on Mon Jun 10 2019 15:08:51