Skip to content

Commit 97b9d56

Browse files
miurshpre-commit-ci[bot]wep21
authored
chore: separate traffic_light_utils from perception_utils (autowarefoundation#4207)
* separate traffic_light_utils from perception_utils Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * style(pre-commit): autofix * fix namespace bug Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * remove unnecessary dependency Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * rename rest of perception_utils to object_recognition_utils Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * fix bug Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * rename for added radar_object_clustering Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * delete redundant namespace Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Update common/perception_utils/include/perception_utils/prime_synchronizer.hpp Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> * Correct the failure in the previous merge. Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> --------- Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>
1 parent 0ef26b8 commit 97b9d56

File tree

64 files changed

+277
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+277
-221
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(object_recognition_utils)
3+
4+
find_package(autoware_cmake REQUIRED)
5+
autoware_package()
6+
7+
find_package(Boost REQUIRED)
8+
9+
ament_auto_add_library(object_recognition_utils SHARED
10+
src/predicted_path_utils.cpp
11+
src/conversion.cpp
12+
)
13+
14+
if(BUILD_TESTING)
15+
find_package(ament_cmake_ros REQUIRED)
16+
17+
file(GLOB_RECURSE test_files test/**/*.cpp)
18+
19+
ament_add_ros_isolated_gtest(test_object_recognition_utils ${test_files})
20+
21+
target_link_libraries(test_object_recognition_utils
22+
object_recognition_utils
23+
)
24+
endif()
25+
26+
ament_auto_package()

common/perception_utils/include/perception_utils/conversion.hpp common/object_recognition_utils/include/object_recognition_utils/conversion.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PERCEPTION_UTILS__CONVERSION_HPP_
16-
#define PERCEPTION_UTILS__CONVERSION_HPP_
15+
#ifndef OBJECT_RECOGNITION_UTILS__CONVERSION_HPP_
16+
#define OBJECT_RECOGNITION_UTILS__CONVERSION_HPP_
1717

1818
#include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
1919
#include <autoware_auto_perception_msgs/msg/tracked_objects.hpp>
2020

21-
namespace perception_utils
21+
namespace object_recognition_utils
2222
{
2323
using autoware_auto_perception_msgs::msg::DetectedObject;
2424
using autoware_auto_perception_msgs::msg::DetectedObjects;
@@ -29,6 +29,6 @@ DetectedObject toDetectedObject(const TrackedObject & tracked_object);
2929
DetectedObjects toDetectedObjects(const TrackedObjects & tracked_objects);
3030
TrackedObject toTrackedObject(const DetectedObject & detected_object);
3131
TrackedObjects toTrackedObjects(const DetectedObjects & detected_objects);
32-
} // namespace perception_utils
32+
} // namespace object_recognition_utils
3333

34-
#endif // PERCEPTION_UTILS__CONVERSION_HPP_
34+
#endif // OBJECT_RECOGNITION_UTILS__CONVERSION_HPP_

common/perception_utils/include/perception_utils/geometry.hpp common/object_recognition_utils/include/object_recognition_utils/geometry.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PERCEPTION_UTILS__GEOMETRY_HPP_
16-
#define PERCEPTION_UTILS__GEOMETRY_HPP_
15+
#ifndef OBJECT_RECOGNITION_UTILS__GEOMETRY_HPP_
16+
#define OBJECT_RECOGNITION_UTILS__GEOMETRY_HPP_
1717

1818
#include <autoware_auto_perception_msgs/msg/detected_object.hpp>
1919
#include <autoware_auto_perception_msgs/msg/predicted_object.hpp>
2020
#include <autoware_auto_perception_msgs/msg/tracked_object.hpp>
2121
#include <geometry_msgs/msg/pose.hpp>
2222

23-
namespace perception_utils
23+
namespace object_recognition_utils
2424
{
2525
template <class T>
2626
geometry_msgs::msg::Pose getPose([[maybe_unused]] const T & p)
@@ -55,6 +55,6 @@ inline geometry_msgs::msg::Pose getPose(
5555
{
5656
return obj.kinematics.initial_pose_with_covariance.pose;
5757
}
58-
} // namespace perception_utils
58+
} // namespace object_recognition_utils
5959

60-
#endif // PERCEPTION_UTILS__GEOMETRY_HPP_
60+
#endif // OBJECT_RECOGNITION_UTILS__GEOMETRY_HPP_

common/perception_utils/include/perception_utils/matching.hpp common/object_recognition_utils/include/object_recognition_utils/matching.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PERCEPTION_UTILS__MATCHING_HPP_
16-
#define PERCEPTION_UTILS__MATCHING_HPP_
15+
#ifndef OBJECT_RECOGNITION_UTILS__MATCHING_HPP_
16+
#define OBJECT_RECOGNITION_UTILS__MATCHING_HPP_
1717

18-
#include "perception_utils/geometry.hpp"
18+
#include "object_recognition_utils/geometry.hpp"
1919
#include "tier4_autoware_utils/geometry/boost_geometry.hpp"
2020
#include "tier4_autoware_utils/geometry/boost_polygon_utils.hpp"
2121

@@ -26,7 +26,7 @@
2626
#include <utility>
2727
#include <vector>
2828

29-
namespace perception_utils
29+
namespace object_recognition_utils
3030
{
3131
using tier4_autoware_utils::Polygon2d;
3232

@@ -116,6 +116,6 @@ double get2dRecall(const T1 source_object, const T2 target_object)
116116

117117
return std::min(1.0, intersection_area / target_area);
118118
}
119-
} // namespace perception_utils
119+
} // namespace object_recognition_utils
120120

121-
#endif // PERCEPTION_UTILS__MATCHING_HPP_
121+
#endif // OBJECT_RECOGNITION_UTILS__MATCHING_HPP_

common/perception_utils/include/perception_utils/object_classification.hpp common/object_recognition_utils/include/object_recognition_utils/object_classification.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PERCEPTION_UTILS__OBJECT_CLASSIFICATION_HPP_
16-
#define PERCEPTION_UTILS__OBJECT_CLASSIFICATION_HPP_
15+
#ifndef OBJECT_RECOGNITION_UTILS__OBJECT_CLASSIFICATION_HPP_
16+
#define OBJECT_RECOGNITION_UTILS__OBJECT_CLASSIFICATION_HPP_
1717

1818
#include "autoware_auto_perception_msgs/msg/object_classification.hpp"
1919

2020
#include <string>
2121
#include <vector>
2222

23-
namespace perception_utils
23+
namespace object_recognition_utils
2424
{
2525
using autoware_auto_perception_msgs::msg::ObjectClassification;
2626

@@ -169,6 +169,6 @@ inline std::string convertLabelToString(
169169
return convertLabelToString(highest_prob_label);
170170
}
171171

172-
} // namespace perception_utils
172+
} // namespace object_recognition_utils
173173

174-
#endif // PERCEPTION_UTILS__OBJECT_CLASSIFICATION_HPP_
174+
#endif // OBJECT_RECOGNITION_UTILS__OBJECT_CLASSIFICATION_HPP_

common/perception_utils/include/perception_utils/perception_utils.hpp common/object_recognition_utils/include/object_recognition_utils/object_recognition_utils.hpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PERCEPTION_UTILS__PERCEPTION_UTILS_HPP_
16-
#define PERCEPTION_UTILS__PERCEPTION_UTILS_HPP_
15+
#ifndef OBJECT_RECOGNITION_UTILS__OBJECT_RECOGNITION_UTILS_HPP_
16+
#define OBJECT_RECOGNITION_UTILS__OBJECT_RECOGNITION_UTILS_HPP_
1717

18-
#include "perception_utils/conversion.hpp"
19-
#include "perception_utils/geometry.hpp"
20-
#include "perception_utils/matching.hpp"
21-
#include "perception_utils/object_classification.hpp"
22-
#include "perception_utils/predicted_path_utils.hpp"
23-
#include "perception_utils/transform.hpp"
18+
#include "object_recognition_utils/conversion.hpp"
19+
#include "object_recognition_utils/geometry.hpp"
20+
#include "object_recognition_utils/matching.hpp"
21+
#include "object_recognition_utils/object_classification.hpp"
22+
#include "object_recognition_utils/predicted_path_utils.hpp"
23+
#include "object_recognition_utils/transform.hpp"
2424

25-
#endif // PERCEPTION_UTILS__PERCEPTION_UTILS_HPP_
25+
#endif // OBJECT_RECOGNITION_UTILS__OBJECT_RECOGNITION_UTILS_HPP_

common/perception_utils/include/perception_utils/predicted_path_utils.hpp common/object_recognition_utils/include/object_recognition_utils/predicted_path_utils.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PERCEPTION_UTILS__PREDICTED_PATH_UTILS_HPP_
16-
#define PERCEPTION_UTILS__PREDICTED_PATH_UTILS_HPP_
15+
#ifndef OBJECT_RECOGNITION_UTILS__PREDICTED_PATH_UTILS_HPP_
16+
#define OBJECT_RECOGNITION_UTILS__PREDICTED_PATH_UTILS_HPP_
1717

1818
#include "tier4_autoware_utils/geometry/geometry.hpp"
1919

@@ -24,7 +24,7 @@
2424

2525
#include <vector>
2626

27-
namespace perception_utils
27+
namespace object_recognition_utils
2828
{
2929
/**
3030
* @brief Calculate Interpolated Pose from predicted path by time
@@ -61,6 +61,6 @@ autoware_auto_perception_msgs::msg::PredictedPath resamplePredictedPath(
6161
const autoware_auto_perception_msgs::msg::PredictedPath & path,
6262
const double sampling_time_interval, const double sampling_horizon,
6363
const bool use_spline_for_xy = true, const bool use_spline_for_z = false);
64-
} // namespace perception_utils
64+
} // namespace object_recognition_utils
6565

66-
#endif // PERCEPTION_UTILS__PREDICTED_PATH_UTILS_HPP_
66+
#endif // OBJECT_RECOGNITION_UTILS__PREDICTED_PATH_UTILS_HPP_

common/perception_utils/include/perception_utils/transform.hpp common/object_recognition_utils/include/object_recognition_utils/transform.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PERCEPTION_UTILS__TRANSFORM_HPP_
16-
#define PERCEPTION_UTILS__TRANSFORM_HPP_
15+
#ifndef OBJECT_RECOGNITION_UTILS__TRANSFORM_HPP_
16+
#define OBJECT_RECOGNITION_UTILS__TRANSFORM_HPP_
1717

1818
#include <geometry_msgs/msg/transform.hpp>
1919

@@ -41,13 +41,13 @@ namespace detail
4141
target_frame_id, source_frame_id, time, rclcpp::Duration::from_seconds(0.5));
4242
return self_transform_stamped.transform;
4343
} catch (tf2::TransformException & ex) {
44-
RCLCPP_WARN_STREAM(rclcpp::get_logger("perception_utils"), ex.what());
44+
RCLCPP_WARN_STREAM(rclcpp::get_logger("object_recognition_utils"), ex.what());
4545
return boost::none;
4646
}
4747
}
4848
} // namespace detail
4949

50-
namespace perception_utils
50+
namespace object_recognition_utils
5151
{
5252
template <class T>
5353
bool transformObjects(
@@ -79,6 +79,6 @@ bool transformObjects(
7979
}
8080
return true;
8181
}
82-
} // namespace perception_utils
82+
} // namespace object_recognition_utils
8383

84-
#endif // PERCEPTION_UTILS__TRANSFORM_HPP_
84+
#endif // OBJECT_RECOGNITION_UTILS__TRANSFORM_HPP_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>object_recognition_utils</name>
5+
<version>0.1.0</version>
6+
<description>The object_recognition_utils package</description>
7+
<maintainer email="takayuki.murooka@tier4.jp">Takayuki Murooka</maintainer>
8+
<maintainer email="satoshi.tanaka@tier4.jp">Satoshi Tanaka</maintainer>
9+
<maintainer email="yusuke.muramatsu@tier4.jp">Yusuke Muramatsu</maintainer>
10+
<maintainer email="shunsuke.miura@tier4.jp">Shunsuke Miura</maintainer>
11+
<license>Apache License 2.0</license>
12+
13+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
14+
<buildtool_depend>autoware_cmake</buildtool_depend>
15+
16+
<depend>autoware_auto_perception_msgs</depend>
17+
<depend>geometry_msgs</depend>
18+
<depend>interpolation</depend>
19+
<depend>libboost-dev</depend>
20+
<depend>rclcpp</depend>
21+
<depend>tier4_autoware_utils</depend>
22+
23+
<test_depend>ament_cmake_ros</test_depend>
24+
<test_depend>ament_lint_auto</test_depend>
25+
<test_depend>autoware_lint_common</test_depend>
26+
27+
<export>
28+
<build_type>ament_cmake</build_type>
29+
</export>
30+
</package>

common/perception_utils/src/conversion.cpp common/object_recognition_utils/src/conversion.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "perception_utils/conversion.hpp"
15+
#include "object_recognition_utils/conversion.hpp"
1616

17-
namespace perception_utils
17+
namespace object_recognition_utils
1818
{
1919
using autoware_auto_perception_msgs::msg::DetectedObject;
2020
using autoware_auto_perception_msgs::msg::DetectedObjects;
@@ -79,4 +79,4 @@ TrackedObjects toTrackedObjects(const DetectedObjects & detected_objects)
7979
}
8080
return tracked_objects;
8181
}
82-
} // namespace perception_utils
82+
} // namespace object_recognition_utils

common/perception_utils/src/predicted_path_utils.cpp common/object_recognition_utils/src/predicted_path_utils.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "perception_utils/predicted_path_utils.hpp"
15+
#include "object_recognition_utils/predicted_path_utils.hpp"
1616

1717
#include "interpolation/linear_interpolation.hpp"
1818
#include "interpolation/spherical_linear_interpolation.hpp"
1919
#include "interpolation/spline_interpolation.hpp"
2020

2121
#include <algorithm>
2222

23-
namespace perception_utils
23+
namespace object_recognition_utils
2424
{
2525
boost::optional<geometry_msgs::msg::Pose> calcInterpolatedPose(
2626
const autoware_auto_perception_msgs::msg::PredictedPath & path, const double relative_time)
@@ -130,4 +130,4 @@ autoware_auto_perception_msgs::msg::PredictedPath resamplePredictedPath(
130130
resampled_path.time_step = rclcpp::Duration::from_seconds(sampling_time_interval);
131131
return resampled_path;
132132
}
133-
} // namespace perception_utils
133+
} // namespace object_recognition_utils

common/perception_utils/test/src/test_conversion.cpp common/object_recognition_utils/test/src/test_conversion.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "perception_utils/conversion.hpp"
15+
#include "object_recognition_utils/conversion.hpp"
1616
#include "tier4_autoware_utils/geometry/geometry.hpp"
1717

1818
#include <gtest/gtest.h>
@@ -43,7 +43,7 @@ autoware_auto_perception_msgs::msg::ObjectClassification createObjectClassificat
4343
TEST(conversion, test_toDetectedObject)
4444
{
4545
using autoware_auto_perception_msgs::msg::ObjectClassification;
46-
using perception_utils::toDetectedObject;
46+
using object_recognition_utils::toDetectedObject;
4747

4848
autoware_auto_perception_msgs::msg::TrackedObject tracked_obj;
4949
// existence probability
@@ -161,7 +161,7 @@ TEST(conversion, test_toDetectedObject)
161161
TEST(conversion, test_toTrackedObject)
162162
{
163163
using autoware_auto_perception_msgs::msg::ObjectClassification;
164-
using perception_utils::toTrackedObject;
164+
using object_recognition_utils::toTrackedObject;
165165

166166
autoware_auto_perception_msgs::msg::DetectedObject detected_obj;
167167
// existence probability

common/perception_utils/test/src/test_geometry.cpp common/object_recognition_utils/test/src/test_geometry.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "perception_utils/geometry.hpp"
15+
#include "object_recognition_utils/geometry.hpp"
1616

1717
#include <gtest/gtest.h>
1818

1919
#include <string>
2020

2121
TEST(geometry, getPose)
2222
{
23-
using perception_utils::getPose;
23+
using object_recognition_utils::getPose;
2424

2525
const double x_ans = 1.0;
2626
const double y_ans = 2.0;

common/perception_utils/test/src/test_matching.cpp common/object_recognition_utils/test/src/test_matching.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "perception_utils/matching.hpp"
15+
#include "object_recognition_utils/matching.hpp"
1616
#include "tier4_autoware_utils/geometry/geometry.hpp"
1717

1818
#include <autoware_auto_perception_msgs/msg/detected_object.hpp>
@@ -38,7 +38,7 @@ geometry_msgs::msg::Pose createPose(const double x, const double y, const double
3838
TEST(matching, test_get2dIoU)
3939
{
4040
using autoware_auto_perception_msgs::msg::DetectedObject;
41-
using perception_utils::get2dIoU;
41+
using object_recognition_utils::get2dIoU;
4242

4343
const double quart_circle = 0.16237976320958225;
4444

@@ -91,9 +91,9 @@ TEST(matching, test_get2dIoU)
9191
}
9292
}
9393

94-
TEST(perception_utils, test_get2dGeneralizedIoU)
94+
TEST(object_recognition_utils, test_get2dGeneralizedIoU)
9595
{
96-
using perception_utils::get2dGeneralizedIoU;
96+
using object_recognition_utils::get2dGeneralizedIoU;
9797
// TODO(Shin-kyoto):
9898
// get2dGeneralizedIoU uses outer points of each polygon.
9999
// But these points contain an sampling error of outer line,
@@ -154,7 +154,7 @@ TEST(perception_utils, test_get2dGeneralizedIoU)
154154
TEST(matching, test_get2dPrecision)
155155
{
156156
using autoware_auto_perception_msgs::msg::DetectedObject;
157-
using perception_utils::get2dPrecision;
157+
using object_recognition_utils::get2dPrecision;
158158
const double quart_circle = 0.16237976320958225;
159159

160160
{ // non overlapped
@@ -221,7 +221,7 @@ TEST(matching, test_get2dPrecision)
221221
TEST(matching, test_get2dRecall)
222222
{
223223
using autoware_auto_perception_msgs::msg::DetectedObject;
224-
using perception_utils::get2dRecall;
224+
using object_recognition_utils::get2dRecall;
225225
const double quart_circle = 0.16237976320958225;
226226

227227
{ // non overlapped

0 commit comments

Comments
 (0)