OdometryROS.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
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  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef ODOMETRYROS_H_
29 #define ODOMETRYROS_H_
30 
31 #include <ros/ros.h>
32 #include <nodelet/nodelet.h>
33 
35 #include <tf/transform_listener.h>
36 
37 #include <std_srvs/Empty.h>
38 #include <std_msgs/Header.h>
39 
40 #include <rtabmap_ros/ResetPose.h>
43 
44 #include <boost/thread.hpp>
45 
46 namespace rtabmap {
47 class Odometry;
48 }
49 
50 namespace rtabmap_ros {
51 
53 {
54 
55 public:
56  OdometryROS(bool stereoParams, bool visParams, bool icpParams);
57  virtual ~OdometryROS();
58 
59  void processData(const rtabmap::SensorData & data, const ros::Time & stamp);
60 
61  bool reset(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
62  bool resetToPose(rtabmap_ros::ResetPose::Request&, rtabmap_ros::ResetPose::Response&);
63  bool pause(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
64  bool resume(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
65  bool setLogDebug(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
66  bool setLogInfo(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
67  bool setLogWarn(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
68  bool setLogError(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
69 
70  const std::string & frameId() const {return frameId_;}
71  const std::string & odomFrameId() const {return odomFrameId_;}
72  const rtabmap::ParametersMap & parameters() const {return parameters_;}
73  bool isPaused() const {return paused_;}
74  rtabmap::Transform getTransform(const std::string & fromFrameId, const std::string & toFrameId, const ros::Time & stamp) const;
75 
76 protected:
77  void startWarningThread(const std::string & subscribedTopicsMsg, bool approxSync);
78  void callbackCalled() {callbackCalled_ = true;}
79 
80  virtual void flushCallbacks() = 0;
81  tf::TransformListener & tfListener() {return tfListener_;}
82 
83 private:
84  void warningLoop(const std::string & subscribedTopicsMsg, bool approxSync);
85  virtual void onInit();
86  virtual void onOdomInit() = 0;
87  virtual void updateParameters(rtabmap::ParametersMap & parameters) {}
88 
89 private:
91  boost::thread * warningThread_;
93 
94  // parameters
95  std::string frameId_;
96  std::string odomFrameId_;
97  std::string groundTruthFrameId_;
99  std::string guessFrameId_;
107 
123 
124  bool paused_;
131  double guessStamp_;
132 };
133 
134 }
135 
136 #endif
std::string groundTruthBaseFrameId_
Definition: OdometryROS.h:98
const rtabmap::ParametersMap & parameters() const
Definition: OdometryROS.h:72
const std::string & frameId() const
Definition: OdometryROS.h:70
std::string odomFrameId_
Definition: OdometryROS.h:96
tf2_ros::TransformBroadcaster tfBroadcaster_
Definition: OdometryROS.h:121
virtual void updateParameters(rtabmap::ParametersMap &parameters)
Definition: OdometryROS.h:87
boost::thread * warningThread_
Definition: OdometryROS.h:91
ros::Publisher odomLocalScanMap_
Definition: OdometryROS.h:111
ros::ServiceServer setLogInfoSrv_
Definition: OdometryROS.h:118
std::map< std::string, std::string > ParametersMap
std::string groundTruthFrameId_
Definition: OdometryROS.h:97
ros::ServiceServer setLogDebugSrv_
Definition: OdometryROS.h:117
rtabmap::Transform getTransform(const std::string &fromFrameId, const std::string &toFrameId, const ros::Time &stamp, tf::TransformListener &listener, double waitForTransform)
ros::Publisher odomPub_
Definition: OdometryROS.h:108
tf::TransformListener & tfListener()
Definition: OdometryROS.h:81
ros::ServiceServer setLogWarnSrv_
Definition: OdometryROS.h:119
ros::ServiceServer resetToPoseSrv_
Definition: OdometryROS.h:114
rtabmap::ParametersMap parameters_
Definition: OdometryROS.h:106
ros::ServiceServer setLogErrorSrv_
Definition: OdometryROS.h:120
ros::ServiceServer resetSrv_
Definition: OdometryROS.h:113
ros::ServiceServer pauseSrv_
Definition: OdometryROS.h:115
ros::ServiceServer resumeSrv_
Definition: OdometryROS.h:116
ros::Publisher odomLocalMap_
Definition: OdometryROS.h:110
const std::string & odomFrameId() const
Definition: OdometryROS.h:71
rtabmap::Odometry * odometry_
Definition: OdometryROS.h:90
ros::Publisher odomInfoPub_
Definition: OdometryROS.h:109
tf::TransformListener tfListener_
Definition: OdometryROS.h:122
rtabmap::Transform guess_
Definition: OdometryROS.h:130
std::string guessFrameId_
Definition: OdometryROS.h:99
bool isPaused() const
Definition: OdometryROS.h:73
ros::Publisher odomLastFrame_
Definition: OdometryROS.h:112


rtabmap_ros
Author(s): Mathieu Labbe
autogenerated on Fri Jun 7 2019 21:55:04