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
slam_toolbox::SlamToolbox
Definition: slam_toolbox_common.hpp:55
slam_toolbox::SlamToolbox::getLaser
karto::LaserRangeFinder * getLaser(const sensor_msgs::LaserScan::ConstPtr &scan)
Definition: slam_toolbox_common.cpp:289
karto::LaserRangeFinder
Definition: Karto.h:3922
ROS_WARN_THROTTLE
#define ROS_WARN_THROTTLE(period,...)
slam_toolbox::SlamToolbox::deserializePoseGraphCallback
virtual bool deserializePoseGraphCallback(slam_toolbox_msgs::DeserializePoseGraph::Request &req, slam_toolbox_msgs::DeserializePoseGraph::Response &resp)
Definition: slam_toolbox_common.cpp:736
slam_toolbox::AsynchronousSlamToolbox::laserCallback
virtual void laserCallback(const sensor_msgs::LaserScan::ConstPtr &scan) override final
Definition: slam_toolbox_async.cpp:34
slam_toolbox::SlamToolbox::loadPoseGraphByParams
void loadPoseGraphByParams(ros::NodeHandle &nh)
Definition: slam_toolbox_common.cpp:223
slam_toolbox::SlamToolbox::addScan
virtual karto::LocalizedRangeScan * addScan(karto::LaserRangeFinder *laser, const sensor_msgs::LaserScan::ConstPtr &scan, karto::Pose2 &karto_pose)
Definition: slam_toolbox_common.cpp:476
ROS_ERROR
#define ROS_ERROR(...)
slam_toolbox::SlamToolbox::pose_helper_
std::unique_ptr< pose_utils::GetPoseHelper > pose_helper_
Definition: slam_toolbox_common.hpp:129
slam_toolbox::AsynchronousSlamToolbox::deserializePoseGraphCallback
virtual bool deserializePoseGraphCallback(slam_toolbox_msgs::DeserializePoseGraph::Request &req, slam_toolbox_msgs::DeserializePoseGraph::Response &resp) override final
Definition: slam_toolbox_async.cpp:60
slam_toolbox
Definition: slam_toolbox_lifelong.hpp:24
karto::Pose2
Definition: Karto.h:2046
slam_toolbox_async.hpp
ros::NodeHandle
slam_toolbox::AsynchronousSlamToolbox::AsynchronousSlamToolbox
AsynchronousSlamToolbox(ros::NodeHandle &nh)
Definition: slam_toolbox_async.cpp:26


slam_toolbox
Author(s): Steve Macenski
autogenerated on Thu Jan 11 2024 03:37:55