Skip to content

Commit 93295cd

Browse files
Use shared tf listener (#83)
2 parents 3c51a35 + c8f48d1 commit 93295cd

File tree

4 files changed

+3
-22
lines changed

4 files changed

+3
-22
lines changed

ed_sensor_integration/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ find_package(catkin REQUIRED COMPONENTS
1818
rosconsole_bridge
1919
roscpp
2020
sensor_msgs
21-
tf2_ros
2221
tue_config
2322
tue_filesystem
2423
visualization_msgs

ed_sensor_integration/package.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
<exec_depend>rosconsole_bridge</exec_depend>
3434
<build_depend>sensor_msgs</build_depend>
3535
<exec_depend>sensor_msgs</exec_depend>
36-
<build_depend>tf2_ros</build_depend>
37-
<exec_depend>tf2_ros</exec_depend>
3836
<build_depend>tue_filesystem</build_depend>
3937
<exec_depend>tue_filesystem</exec_depend>
4038

ed_sensor_integration/src/laser/laser_plugin.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <ros/console.h>
2020
#include <ros/node_handle.h>
2121

22-
#include <tf2_ros/transform_listener.h>
23-
2422
#include <iostream>
2523

2624

@@ -47,7 +45,7 @@ void lasermsgToSensorRanges(const sensor_msgs::LaserScan::ConstPtr& scan, std::v
4745
}
4846
}
4947

50-
LaserPlugin::LaserPlugin() : tf_buffer_(), tf_listener_(nullptr)
48+
LaserPlugin::LaserPlugin()
5149
{
5250
}
5351

@@ -71,11 +69,6 @@ void LaserPlugin::initialize(ed::InitData& init)
7169

7270
// Communication
7371
sub_scan_ = nh.subscribe<sensor_msgs::LaserScan>(laser_topic, 3, &LaserPlugin::scanCallback, this);
74-
75-
if (!tf_listener_)
76-
tf_listener_ = std::make_unique<tf2_ros::TransformListener>(tf_buffer_);
77-
78-
//pose_cache.clear();
7972
}
8073

8174
void LaserPlugin::process(const ed::WorldModel& world, ed::UpdateRequest& req)
@@ -92,7 +85,7 @@ void LaserPlugin::process(const ed::WorldModel& world, ed::UpdateRequest& req)
9285
try
9386
{
9487
geometry_msgs::TransformStamped gm_sensor_pose;
95-
gm_sensor_pose = tf_buffer_.lookupTransform("map", scan->header.frame_id, scan->header.stamp);
88+
gm_sensor_pose = tf_buffer_->lookupTransform("map", scan->header.frame_id, scan->header.stamp);
9689
scan_buffer_.pop();
9790
geo::Pose3D sensor_pose;
9891
geo::convert(gm_sensor_pose.transform, sensor_pose);
@@ -107,7 +100,7 @@ void LaserPlugin::process(const ed::WorldModel& world, ed::UpdateRequest& req)
107100
// Now we have to check if the error was an interpolation or extrapolation error
108101
// (i.e., the scan is too old or too new, respectively)
109102
geometry_msgs::TransformStamped latest_transform;
110-
latest_transform = tf_buffer_.lookupTransform("map", scan->header.frame_id, ros::Time(0));
103+
latest_transform = tf_buffer_->lookupTransform("map", scan->header.frame_id, ros::Time(0));
111104

112105
if (scan_buffer_.front()->header.stamp > latest_transform.header.stamp)
113106
{

ed_sensor_integration/src/laser/laser_plugin.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,12 @@
1010

1111
#include <ros/subscriber.h>
1212
#include <ros/callback_queue.h>
13-
#include <tf2_ros/buffer.h>
1413
#include <sensor_msgs/LaserScan.h>
1514

1615
#include <queue>
1716
#include <map>
1817
#include <memory>
1918

20-
namespace tf2_ros
21-
{
22-
class TransformListener;
23-
}
24-
2519
class LaserPlugin : public ed::Plugin
2620
{
2721

@@ -44,9 +38,6 @@ class LaserPlugin : public ed::Plugin
4438

4539
std::queue<sensor_msgs::LaserScan::ConstPtr> scan_buffer_;
4640

47-
tf2_ros::Buffer tf_buffer_;
48-
std::unique_ptr<tf2_ros::TransformListener> tf_listener_;
49-
5041
LaserUpdater updater_;
5142

5243
void scanCallback(const sensor_msgs::LaserScan::ConstPtr& msg);

0 commit comments

Comments
 (0)