28 #ifndef COREWRAPPER_H_ 29 #define COREWRAPPER_H_ 35 #include <std_srvs/Empty.h> 40 #include <std_msgs/Empty.h> 41 #include <std_msgs/Int32.h> 42 #include <sensor_msgs/NavSatFix.h> 43 #include <nav_msgs/GetMap.h> 44 #include <nav_msgs/GetPlan.h> 45 #include <geometry_msgs/PoseWithCovarianceStamped.h> 46 #include <sensor_msgs/Imu.h> 52 #include "rtabmap_ros/GetNodeData.h" 53 #include "rtabmap_ros/GetMap.h" 54 #include "rtabmap_ros/GetMap2.h" 55 #include "rtabmap_ros/ListLabels.h" 56 #include "rtabmap_ros/PublishMap.h" 57 #include "rtabmap_ros/SetGoal.h" 58 #include "rtabmap_ros/SetLabel.h" 59 #include "rtabmap_ros/Goal.h" 60 #include "rtabmap_ros/GetPlan.h" 62 #include "rtabmap_ros/OdomInfo.h" 63 #include "rtabmap_ros/AddLink.h" 64 #include "rtabmap_ros/GetNodesInRadius.h" 68 #ifdef WITH_OCTOMAP_MSGS 69 #include <octomap_msgs/GetOctomap.h> 72 #ifdef WITH_APRILTAG_ROS 73 #include <apriltag_ros/AprilTagDetectionArray.h> 77 #include <move_base_msgs/MoveBaseAction.h> 78 #include <move_base_msgs/MoveBaseActionGoal.h> 79 #include <move_base_msgs/MoveBaseActionResult.h> 80 #include <move_base_msgs/MoveBaseActionFeedback.h> 81 #include <actionlib_msgs/GoalStatusArray.h> 98 virtual void onInit();
100 bool odomUpdate(
const nav_msgs::OdometryConstPtr & odomMsg,
ros::Time stamp);
101 bool odomTFUpdate(
const ros::Time & stamp);
103 virtual void commonDepthCallback(
104 const nav_msgs::OdometryConstPtr & odomMsg,
105 const rtabmap_ros::UserDataConstPtr & userDataMsg,
106 const std::vector<cv_bridge::CvImageConstPtr> & imageMsgs,
107 const std::vector<cv_bridge::CvImageConstPtr> & depthMsgs,
108 const std::vector<sensor_msgs::CameraInfo> & cameraInfoMsgs,
109 const sensor_msgs::LaserScan& scanMsg,
110 const sensor_msgs::PointCloud2& scan3dMsg,
111 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg,
112 const std::vector<rtabmap_ros::GlobalDescriptor> & globalDescriptorMsgs = std::vector<rtabmap_ros::GlobalDescriptor>(),
113 const std::vector<std::vector<rtabmap_ros::KeyPoint> > & localKeyPoints = std::vector<std::vector<rtabmap_ros::KeyPoint> >(),
114 const std::vector<std::vector<rtabmap_ros::Point3f> > & localPoints3d = std::vector<std::vector<rtabmap_ros::Point3f> >(),
115 const std::vector<cv::Mat> & localDescriptors = std::vector<cv::Mat>());
116 void commonDepthCallbackImpl(
117 const std::string & odomFrameId,
118 const rtabmap_ros::UserDataConstPtr & userDataMsg,
119 const std::vector<cv_bridge::CvImageConstPtr> & imageMsgs,
120 const std::vector<cv_bridge::CvImageConstPtr> & depthMsgs,
121 const std::vector<sensor_msgs::CameraInfo> & cameraInfoMsgs,
122 const sensor_msgs::LaserScan& scan2dMsg,
123 const sensor_msgs::PointCloud2& scan3dMsg,
124 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg,
125 const std::vector<rtabmap_ros::GlobalDescriptor> & globalDescriptorMsgs,
126 const std::vector<std::vector<rtabmap_ros::KeyPoint> > & localKeyPoints,
127 const std::vector<std::vector<rtabmap_ros::Point3f> > & localPoints3d,
128 const std::vector<cv::Mat> & localDescriptors);
129 virtual void commonStereoCallback(
130 const nav_msgs::OdometryConstPtr & odomMsg,
131 const rtabmap_ros::UserDataConstPtr & userDataMsg,
134 const sensor_msgs::CameraInfo& leftCamInfoMsg,
135 const sensor_msgs::CameraInfo& rightCamInfoMsg,
136 const sensor_msgs::LaserScan& scanMsg,
137 const sensor_msgs::PointCloud2& scan3dMsg,
138 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg,
139 const std::vector<rtabmap_ros::GlobalDescriptor> & globalDescriptorMsgs = std::vector<rtabmap_ros::GlobalDescriptor>(),
140 const std::vector<rtabmap_ros::KeyPoint> & localKeyPoints = std::vector<rtabmap_ros::KeyPoint>(),
141 const std::vector<rtabmap_ros::Point3f> & localPoints3d = std::vector<rtabmap_ros::Point3f>(),
142 const cv::Mat & localDescriptors = cv::Mat());
143 virtual void commonLaserScanCallback(
144 const nav_msgs::OdometryConstPtr & odomMsg,
145 const rtabmap_ros::UserDataConstPtr & userDataMsg,
146 const sensor_msgs::LaserScan& scanMsg,
147 const sensor_msgs::PointCloud2& scan3dMsg,
148 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg,
149 const rtabmap_ros::GlobalDescriptor & globalDescriptor = rtabmap_ros::GlobalDescriptor());
150 virtual void commonOdomCallback(
151 const nav_msgs::OdometryConstPtr & odomMsg,
152 const rtabmap_ros::UserDataConstPtr & userDataMsg,
153 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg);
155 void defaultCallback(
const sensor_msgs::ImageConstPtr & imageMsg);
157 void userDataAsyncCallback(
const rtabmap_ros::UserDataConstPtr & dataMsg);
158 void globalPoseAsyncCallback(
const geometry_msgs::PoseWithCovarianceStampedConstPtr & globalPoseMsg);
159 void gpsFixAsyncCallback(
const sensor_msgs::NavSatFixConstPtr & gpsFixMsg);
160 #ifdef WITH_APRILTAG_ROS 161 void tagDetectionsAsyncCallback(
const apriltag_ros::AprilTagDetectionArray & tagDetections);
163 void imuAsyncCallback(
const sensor_msgs::ImuConstPtr & tagDetections);
164 void interOdomCallback(
const nav_msgs::OdometryConstPtr & msg);
165 void interOdomInfoCallback(
const nav_msgs::OdometryConstPtr & msg1,
const rtabmap_ros::OdomInfoConstPtr & msg2);
167 void initialPoseCallback(
const geometry_msgs::PoseWithCovarianceStampedConstPtr & msg);
169 void goalCommonCallback(
int id,
170 const std::string & label,
174 double * planningTime = 0);
175 void goalCallback(
const geometry_msgs::PoseStampedConstPtr & msg);
176 void goalNodeCallback(
const rtabmap_ros::GoalConstPtr & msg);
177 void updateGoal(
const ros::Time & stamp);
183 const std::string & odomFrameId =
"",
184 const cv::Mat & odomCovariance = cv::Mat::eye(6,6,CV_64FC1),
187 bool updateRtabmapCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
188 bool resetRtabmapCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
189 bool pauseRtabmapCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
190 bool resumeRtabmapCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
191 bool triggerNewMapCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
192 bool backupDatabaseCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
193 bool setModeLocalizationCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
194 bool setModeMappingCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
195 bool setLogDebug(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
196 bool setLogInfo(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
197 bool setLogWarn(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
198 bool setLogError(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
199 bool getNodeDataCallback(rtabmap_ros::GetNodeData::Request& req, rtabmap_ros::GetNodeData::Response& res);
200 bool getMapDataCallback(rtabmap_ros::GetMap::Request& req, rtabmap_ros::GetMap::Response& res);
201 bool getMapData2Callback(rtabmap_ros::GetMap2::Request& req, rtabmap_ros::GetMap2::Response& res);
202 bool getMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
203 bool getProbMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
204 bool getProjMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
205 bool getGridMapCallback(nav_msgs::GetMap::Request &req, nav_msgs::GetMap::Response &res);
206 bool publishMapCallback(rtabmap_ros::PublishMap::Request&, rtabmap_ros::PublishMap::Response&);
207 bool getPlanCallback(nav_msgs::GetPlan::Request &req, nav_msgs::GetPlan::Response &res);
208 bool getPlanNodesCallback(rtabmap_ros::GetPlan::Request &req, rtabmap_ros::GetPlan::Response &res);
209 bool setGoalCallback(rtabmap_ros::SetGoal::Request& req, rtabmap_ros::SetGoal::Response& res);
210 bool cancelGoalCallback(std_srvs::Empty::Request& req, std_srvs::Empty::Response& res);
211 bool setLabelCallback(rtabmap_ros::SetLabel::Request& req, rtabmap_ros::SetLabel::Response& res);
212 bool listLabelsCallback(rtabmap_ros::ListLabels::Request& req, rtabmap_ros::ListLabels::Response& res);
213 bool addLinkCallback(rtabmap_ros::AddLink::Request&, rtabmap_ros::AddLink::Response&);
214 bool getNodesInRadiusCallback(rtabmap_ros::GetNodesInRadius::Request&, rtabmap_ros::GetNodesInRadius::Response&);
215 #ifdef WITH_OCTOMAP_MSGS 216 bool octomapBinaryCallback(octomap_msgs::GetOctomap::Request &req, octomap_msgs::GetOctomap::Response &res);
217 bool octomapFullCallback(octomap_msgs::GetOctomap::Request &req, octomap_msgs::GetOctomap::Response &res);
221 void saveParameters(
const std::string & configFile);
223 void publishLoop(
double tfDelay,
double tfTolerance);
225 void publishStats(
const ros::Time & stamp);
226 void publishCurrentGoal(
const ros::Time & stamp);
229 void goalFeedbackCb(
const move_base_msgs::MoveBaseFeedbackConstPtr& feedback);
230 void publishLocalPath(
const ros::Time & stamp);
231 void publishGlobalPath(
const ros::Time & stamp);
330 #ifdef WITH_OCTOMAP_MSGS 352 std::map<int, geometry_msgs::PoseWithCovarianceStamped>
tags_;
354 std::map<double, rtabmap::Transform>
imus_;
358 std::list<std::pair<nav_msgs::Odometry, rtabmap_ros::OdomInfo> >
interOdoms_;
geometry_msgs::PoseWithCovarianceStamped globalPose_
ros::ServiceServer setLogErrorSrv_
ros::ServiceServer getMapDataSrv_
ros::Subscriber gpsFixAsyncSub_
std::map< int, geometry_msgs::PoseWithCovarianceStamped > tags_
ros::ServiceServer getNodesInRadiusSrv_
ros::ServiceServer getProjMapSrv_
int genDepthFillIterations_
double genDepthFillHolesError_
ros::ServiceServer pauseSrv_
ros::Publisher localPathNodesPub_
ros::ServiceServer setLogDebugSrv_
rtabmap::Transform lastPose_
ros::Publisher globalPathNodesPub_
ros::ServiceServer publishMapDataSrv_
double odomDefaultLinVariance_
ros::ServiceServer setLogWarnSrv_
image_transport::Subscriber defaultSub_
ros::ServiceServer resetSrv_
rtabmap::ParametersMap parameters_
bool createIntermediateNodes_
ros::ServiceServer addLinkSrv_
ros::Subscriber tagDetectionsSub_
ros::Publisher localGridEmpty_
ros::ServiceServer getNodeDataSrv_
ros::ServiceServer getMapSrv_
ros::ServiceServer getGridMapSrv_
rtabmap::Rtabmap rtabmap_
ros::Publisher localizationPosePub_
rtabmap::Transform lastPublishedMetricGoal_
message_filters::Synchronizer< MyExactInterOdomSyncPolicy > * interOdomSync_
std::map< std::string, std::string > ParametersMap
message_filters::sync_policies::ExactTime< nav_msgs::Odometry, rtabmap_ros::OdomInfo > MyExactInterOdomSyncPolicy
ros::ServiceServer getProbMapSrv_
double landmarkDefaultAngVariance_
ros::Publisher landmarksPub_
bool lastPoseIntermediate_
message_filters::Subscriber< rtabmap_ros::OdomInfo > interOdomInfoSyncSub_
int genDepthFillHolesSize_
std::string databasePath_
ros::ServiceServer getMapData2Srv_
ros::Publisher nextMetricGoalPub_
ros::Subscriber initialPoseSub_
ros::Publisher mapDataPub_
bool alreadyRectifiedImages_
ros::Subscriber globalPoseAsyncSub_
ros::ServiceServer setModeMappingSrv_
ros::Subscriber userDataAsyncSub_
double odomDefaultAngVariance_
ros::ServiceServer updateSrv_
bool latestNodeWasReached_
ros::ServiceServer backupDatabase_
ros::ServiceServer setLogInfoSrv_
std::map< std::string, float > rtabmapROSStats_
ros::Subscriber interOdomSub_
ros::ServiceServer setLabelSrv_
tf2_ros::TransformBroadcaster tfBroadcaster_
ros::Publisher localGridObstacle_
message_filters::Subscriber< nav_msgs::Odometry > interOdomSyncSub_
MoveBaseClient * mbClient_
boost::mutex mapToOdomMutex_
ros::ServiceServer cancelGoalSrv_
tf::TransformListener tfListener_
RecoveryProgressState state
double landmarkDefaultLinVariance_
rtabmap::Transform mapToOdom_
actionlib::SimpleActionClient< move_base_msgs::MoveBaseAction > MoveBaseClient
boost::thread * transformThread_
rtabmap::Transform currentMetricGoal_
ros::Subscriber goalNodeSub_
ros::ServiceServer listLabelsSrv_
ros::Publisher labelsPub_
ros::Publisher mapPathPub_
ros::ServiceServer getPlanNodesSrv_
ros::Publisher localPathPub_
double waitForTransformDuration_
std::string groundTruthFrameId_
std::map< double, rtabmap::Transform > imus_
ros::ServiceServer getPlanSrv_
std::list< std::pair< nav_msgs::Odometry, rtabmap_ros::OdomInfo > > interOdoms_
ros::ServiceServer setGoalSrv_
ros::Publisher globalPathPub_
std::string groundTruthBaseFrameId_
ros::ServiceServer setModeLocalizationSrv_
ros::Publisher goalReachedPub_
ros::ServiceServer triggerNewMapSrv_
ros::Publisher mapGraphPub_
ros::Publisher localGridGround_
ros::ServiceServer resumeSrv_