slam_toolbox_async.cpp
Go to the documentation of this file.
1 /*
2  * slam_toolbox
3  * Copyright Work Modifications (c) 2018, Simbe Robotics, Inc.
4  * Copyright Work Modifications (c) 2019, Steve Macenski
5  *
6  * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
7  * COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
8  * COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
9  * AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
10  *
11  * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO
12  * BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS
13  * CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
14  * CONDITIONS.
15  *
16  */
17 
18 /* Author: Steven Macenski */
19 
21 
22 namespace slam_toolbox
23 {
24 
25 /*****************************************************************************/
27 : SlamToolbox(nh)
28 /*****************************************************************************/
29 {
31 }
32 
33 /*****************************************************************************/
35  const sensor_msgs::LaserScan::ConstPtr& scan)
36 /*****************************************************************************/
37 {
38  // no odom info
39  karto::Pose2 pose;
40  if(!pose_helper_->getOdomPose(pose, scan->header.stamp))
41  {
42  return;
43  }
44 
45  // ensure the laser can be used
46  karto::LaserRangeFinder* laser = getLaser(scan);
47 
48  if(!laser)
49  {
50  ROS_WARN_THROTTLE(5., "Failed to create laser device for"
51  " %s; discarding scan", scan->header.frame_id.c_str());
52  return;
53  }
54 
55  addScan(laser, scan, pose);
56  return;
57 }
58 
59 /*****************************************************************************/
61  slam_toolbox_msgs::DeserializePoseGraph::Request& req,
62  slam_toolbox_msgs::DeserializePoseGraph::Response& resp)
63 /*****************************************************************************/
64 {
65  if (req.match_type == procType::LOCALIZE_AT_POSE)
66  {
67  ROS_ERROR("Requested a localization deserialization "
68  "in non-localization mode.");
69  return false;
70  }
71 
73 }
74 
75 } // end namespace
karto::LaserRangeFinder * getLaser(const sensor_msgs::LaserScan::ConstPtr &scan)
virtual bool deserializePoseGraphCallback(slam_toolbox_msgs::DeserializePoseGraph::Request &req, slam_toolbox_msgs::DeserializePoseGraph::Response &resp) override final
virtual bool deserializePoseGraphCallback(slam_toolbox_msgs::DeserializePoseGraph::Request &req, slam_toolbox_msgs::DeserializePoseGraph::Response &resp)
#define ROS_WARN_THROTTLE(period,...)
virtual karto::LocalizedRangeScan * addScan(karto::LaserRangeFinder *laser, const sensor_msgs::LaserScan::ConstPtr &scan, karto::Pose2 &karto_pose)
void loadPoseGraphByParams(ros::NodeHandle &nh)
virtual void laserCallback(const sensor_msgs::LaserScan::ConstPtr &scan) override final
std::unique_ptr< pose_utils::GetPoseHelper > pose_helper_
#define ROS_ERROR(...)


slam_toolbox
Author(s): Steve Macenski
autogenerated on Wed Mar 3 2021 03:49:20