Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(perception_util): refactor moving unnamed namespace from include file to src file #2028

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#ifndef PERCEPTION_UTILS__CONVERSION_HPP_
#define PERCEPTION_UTILS__CONVERSION_HPP_

#include "autoware_auto_perception_msgs/msg/detected_objects.hpp"
#include "autoware_auto_perception_msgs/msg/tracked_objects.hpp"
#include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
#include <autoware_auto_perception_msgs/msg/tracked_objects.hpp>

namespace perception_utils
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "tier4_autoware_utils/geometry/geometry.hpp"

#include "autoware_auto_perception_msgs/msg/predicted_path.hpp"
#include <autoware_auto_perception_msgs/msg/predicted_path.hpp>
#include <geometry_msgs/msg/pose.hpp>

#include <boost/optional.hpp>
Expand Down
20 changes: 11 additions & 9 deletions common/perception_utils/include/perception_utils/transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,26 @@
#ifndef PERCEPTION_UTILS__TRANSFORM_HPP_
#define PERCEPTION_UTILS__TRANSFORM_HPP_

#include "geometry_msgs/msg/transform.hpp"
#include <geometry_msgs/msg/transform.hpp>

#include <boost/optional.hpp>

#include <tf2_ros/buffer.h>
#include <tf2_ros/transform_listener.h>

#ifdef ROS_DISTRO_GALACTIC
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#else
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#endif

#include "boost/optional.hpp"

#include <string>

namespace
// To avoid unnamed namespace function in include file and to write template function in include
// file, avoid unnamed namespace
// "detail" name is used in boost library as same reason.
kenji-miyake marked this conversation as resolved.
Show resolved Hide resolved
namespace detail
{
[[maybe_unused]] boost::optional<geometry_msgs::msg::Transform> getTransform(
[[maybe_unused]] inline boost::optional<geometry_msgs::msg::Transform> getTransform(
const tf2_ros::Buffer & tf_buffer, const std::string & source_frame_id,
const std::string & target_frame_id, const rclcpp::Time & time)
{
Expand All @@ -46,7 +48,7 @@ namespace
return boost::none;
}
}
} // namespace
} // namespace detail

namespace perception_utils
{
Expand All @@ -64,8 +66,8 @@ bool transformObjects(
tf2::Transform tf_target2objects;
tf2::Transform tf_objects_world2objects;
{
const auto ros_target2objects_world =
getTransform(tf_buffer, input_msg.header.frame_id, target_frame_id, input_msg.header.stamp);
const auto ros_target2objects_world = detail::getTransform(
tf_buffer, input_msg.header.frame_id, target_frame_id, input_msg.header.stamp);
if (!ros_target2objects_world) {
return false;
}
Expand Down