Skip to content

Commit 69de883

Browse files
committed
feat(autoware_utils_uuid): split package
Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp>
1 parent 62b5953 commit 69de883

File tree

7 files changed

+84
-14
lines changed

7 files changed

+84
-14
lines changed

autoware_utils/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ The ROS module provides utilities for working with ROS messages and nodes:
5656
- **`published_time_publisher.hpp`**: Tracks and publishes the time when messages are published.
5757
- **`self_pose_listener.hpp`**: Listens to the self-pose of the vehicle.
5858
- **`update_param.hpp`**: Updates parameters from remote nodes.
59-
- **`uuid_helper.hpp`**: Utilities for generating and managing UUIDs.
6059
- **`wait_for_param.hpp`**: Waits for parameters from remote nodes.
6160
- **`debug_traits.hpp`**: Traits for identifying debug message types.
6261

autoware_utils_uuid/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(autoware_utils_uuid)
3+
4+
find_package(autoware_cmake REQUIRED)
5+
autoware_package()
6+
7+
if(BUILD_TESTING)
8+
file(GLOB_RECURSE test_files test/*.cpp)
9+
ament_auto_add_gtest(test_${PROJECT_NAME} ${test_files})
10+
endif()
11+
12+
ament_auto_package()

autoware_utils_uuid/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# autoware_utils_uuid
2+
3+
## Overview
4+
5+
The **autoware_utils** library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications.
6+
This package provides essential utilities for UUID.
7+
It is extensively used in the Autoware project to handle common tasks such as generation and conversion of UUID.
8+
9+
## Design
10+
11+
- **`uuid_helper.hpp`**: Utilities for generating and managing UUIDs.

autoware_utils/include/autoware_utils/ros/uuid_helper.hpp renamed to autoware_utils_uuid/include/autoware_utils_uuid/uuid_helper.hpp

Lines changed: 6 additions & 5 deletions
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 AUTOWARE_UTILS__ROS__UUID_HELPER_HPP_
16-
#define AUTOWARE_UTILS__ROS__UUID_HELPER_HPP_
15+
#ifndef AUTOWARE_UTILS_UUID__UUID_HELPER_HPP_
16+
#define AUTOWARE_UTILS_UUID__UUID_HELPER_HPP_
1717

1818
#include <unique_identifier_msgs/msg/uuid.hpp>
1919

@@ -23,8 +23,9 @@
2323
#include <random>
2424
#include <string>
2525

26-
namespace autoware_utils
26+
namespace autoware_utils_uuid
2727
{
28+
2829
inline unique_identifier_msgs::msg::UUID generate_uuid()
2930
{
3031
// Generate random number
@@ -67,6 +68,6 @@ inline unique_identifier_msgs::msg::UUID to_uuid_msg(const boost::uuids::uuid &
6768
return ros_uuid;
6869
}
6970

70-
} // namespace autoware_utils
71+
} // namespace autoware_utils_uuid
7172

72-
#endif // AUTOWARE_UTILS__ROS__UUID_HELPER_HPP_
73+
#endif // AUTOWARE_UTILS_UUID__UUID_HELPER_HPP_

autoware_utils_uuid/package.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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>autoware_utils_uuid</name>
5+
<version>1.1.0</version>
6+
<description>The autoware_utils_uuid package</description>
7+
<maintainer email="egon.kang@autocore.ai">Jian Kang</maintainer>
8+
<maintainer email="ryohsuke.mitsudome@tier4.jp">Ryohsuke Mitsudome</maintainer>
9+
<maintainer email="esteve.fernandez@tier4.jp">Esteve Fernandez</maintainer>
10+
<maintainer email="yutaka.kondo@tier4.jp">Yutaka Kondo</maintainer>
11+
<maintainer email="isamu.takagi@tier4.jp">Takagi, Isamu</maintainer>
12+
<license>Apache License 2.0</license>
13+
14+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
15+
<buildtool_depend>autoware_cmake</buildtool_depend>
16+
17+
<depend>libboost-system-dev</depend>
18+
<depend>unique_identifier_msgs</depend>
19+
20+
<test_depend>ament_lint_auto</test_depend>
21+
<test_depend>autoware_lint_common</test_depend>
22+
23+
<export>
24+
<build_type>ament_cmake</build_type>
25+
</export>
26+
</package>

autoware_utils/test/src/ros/test_uuid_helper.cpp renamed to autoware_utils_uuid/test/cases/uuid_helper.cpp

Lines changed: 8 additions & 8 deletions
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 "autoware_utils/ros/uuid_helper.hpp"
15+
#include "autoware_utils_uuid/uuid_helper.hpp"
1616

1717
#include <boost/uuid/uuid_generators.hpp>
1818

@@ -24,18 +24,18 @@ TEST(UUIDHelperTest, generate_uuid)
2424
{
2525
// Generate two UUIDs and ensure they are all different
2626

27-
unique_identifier_msgs::msg::UUID uuid1 = autoware_utils::generate_uuid();
28-
unique_identifier_msgs::msg::UUID uuid2 = autoware_utils::generate_uuid();
27+
unique_identifier_msgs::msg::UUID uuid1 = autoware_utils_uuid::generate_uuid();
28+
unique_identifier_msgs::msg::UUID uuid2 = autoware_utils_uuid::generate_uuid();
2929

3030
EXPECT_FALSE(uuid1 == uuid2) << "Duplicate UUID generated: "
31-
<< autoware_utils::to_hex_string(uuid2);
31+
<< autoware_utils_uuid::to_hex_string(uuid2);
3232
}
3333

3434
TEST(UUIDHelperTest, generate_default_uuid)
3535
{
3636
// Generate two UUIDs and ensure they are all different
3737

38-
unique_identifier_msgs::msg::UUID default_uuid = autoware_utils::generate_default_uuid();
38+
unique_identifier_msgs::msg::UUID default_uuid = autoware_utils_uuid::generate_default_uuid();
3939
unique_identifier_msgs::msg::UUID zero_uuid;
4040
std::fill(zero_uuid.uuid.begin(), zero_uuid.uuid.end(), 0x00);
4141

@@ -48,7 +48,7 @@ TEST(UUIDHelperTest, to_hex_string)
4848
// Populate the UUID with some values
4949
std::fill(uuid.uuid.begin(), uuid.uuid.end(), 0x42);
5050

51-
std::string hex_string = autoware_utils::to_hex_string(uuid);
51+
std::string hex_string = autoware_utils_uuid::to_hex_string(uuid);
5252

5353
// Check if the generated hex string is correct
5454
EXPECT_EQ(hex_string, "42424242424242424242424242424242");
@@ -64,14 +64,14 @@ TEST(UUIDHelperTest, to_boost_uuid)
6464
std::fill(boost_uuid.begin(), boost_uuid.end(), 0x42);
6565

6666
// Check if the conversion from ROS UUID to Boost UUID is correct
67-
EXPECT_TRUE(boost_uuid == autoware_utils::to_boost_uuid(uuid));
67+
EXPECT_TRUE(boost_uuid == autoware_utils_uuid::to_boost_uuid(uuid));
6868
}
6969

7070
TEST(UUIDHelperTest, to_uuid_msg)
7171
{
7272
boost::uuids::random_generator generator;
7373
boost::uuids::uuid boost_uuid = generator();
74-
unique_identifier_msgs::msg::UUID ros_uuid = autoware_utils::to_uuid_msg(boost_uuid);
74+
unique_identifier_msgs::msg::UUID ros_uuid = autoware_utils_uuid::to_uuid_msg(boost_uuid);
7575

7676
// Check if the conversion from Boost UUID to ROS UUID is correct
7777
EXPECT_TRUE(std::equal(boost_uuid.begin(), boost_uuid.end(), ros_uuid.uuid.begin()));

autoware_utils_uuid/test/main.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2025 The Autoware Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include <gtest/gtest.h>
16+
17+
int main(int argc, char ** argv)
18+
{
19+
testing::InitGoogleTest(&argc, argv);
20+
return RUN_ALL_TESTS();
21+
}

0 commit comments

Comments
 (0)