Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
senceryazici committed Dec 20, 2024
1 parent 0a42323 commit b5e8a50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions auv_navigation/auv_mapping/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(catkin REQUIRED
roscpp
tf
tf2
tf2_ros
geometry_msgs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ObjectMapTFServerROS {
public:
ObjectMapTFServerROS(const ros::NodeHandle &nh)
: nh_{nh},
tf_listener_{std::make_shared<tf::TransformListener>()},
tf_listener_{nh_},
rate_{10.0},
static_frame_{""},
transforms_{},
Expand Down Expand Up @@ -125,24 +125,20 @@ class ObjectMapTFServerROS {
std::optional<tf::StampedTransform> get_transform(
const std::string &target_frame, const std::string &source_frame,
const ros::Duration timeout) {
if (!tf_listener) {
return std::nullopt;
}

try {
tf_listener_->waitForTransform(target_frame, source_frame, ros::Time(0),
timeout);
tf_listener_.waitForTransform(target_frame, source_frame, ros::Time(0),
timeout);
tf::StampedTransform tf_transform;
tf_listener_->lookupTransform(target_frame, source_frame, ros::Time(0),
tf_transform);
tf_listener_.lookupTransform(target_frame, source_frame, ros::Time(0),
tf_transform);
return tf_transform;
} catch (tf::TransformException &ex) {
return std::nullopt;
}
}

ros::NodeHandle nh_;
std::shared_ptr<tf::TransformListener> tf_listener_;
tf::TransformListener tf_listener_;
double rate_;
std::string static_frame_;
TransformMap transforms_;
Expand All @@ -152,4 +148,4 @@ class ObjectMapTFServerROS {
ros::ServiceServer service_;
};

} // namespace auv_mapping
} // namespace auv_mapping

0 comments on commit b5e8a50

Please sign in to comment.