From 8c73f43bddc5ab265f6935558c69643d3af275bd Mon Sep 17 00:00:00 2001 From: a-maumau Date: Mon, 5 Aug 2024 10:33:45 +0900 Subject: [PATCH 1/2] add autoware_ prefix Signed-off-by: a-maumau --- .github/CODEOWNERS | 2 +- .../{pose2twist => autoware_pose2twist}/CMakeLists.txt | 8 ++++++-- .../{pose2twist => autoware_pose2twist}/README.md | 4 ++-- .../launch/pose2twist.launch.xml | 2 +- .../{pose2twist => autoware_pose2twist}/package.xml | 4 ++-- .../src/pose2twist_core.cpp | 7 +++++-- .../src}/pose2twist_core.hpp | 9 ++++++--- .../test/test_angular_velocity.cpp | 4 ++-- .../launch/steer_offset_estimator.launch.xml | 2 +- vehicle/autoware_steer_offset_estimator/package.xml | 2 +- 10 files changed, 27 insertions(+), 17 deletions(-) rename localization/{pose2twist => autoware_pose2twist}/CMakeLists.txt (82%) rename localization/{pose2twist => autoware_pose2twist}/README.md (82%) rename localization/{pose2twist => autoware_pose2twist}/launch/pose2twist.launch.xml (79%) rename localization/{pose2twist => autoware_pose2twist}/package.xml (92%) rename localization/{pose2twist => autoware_pose2twist}/src/pose2twist_core.cpp (96%) rename localization/{pose2twist/include/pose2twist => autoware_pose2twist/src}/pose2twist_core.hpp (91%) rename localization/{pose2twist => autoware_pose2twist}/test/test_angular_velocity.cpp (97%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9f530e0dea9e3..1763f4e5fc079 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -89,7 +89,7 @@ localization/gyro_odometer/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp ma localization/localization_error_monitor/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp localization/localization_util/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp localization/ndt_scan_matcher/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp -localization/pose2twist/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp +localization/autoware_pose2twist/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp localization/pose_estimator_arbiter/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp localization/pose_initializer/** anh.nguyen.2@tier4.jp isamu.takagi@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp localization/pose_instability_detector/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp diff --git a/localization/pose2twist/CMakeLists.txt b/localization/autoware_pose2twist/CMakeLists.txt similarity index 82% rename from localization/pose2twist/CMakeLists.txt rename to localization/autoware_pose2twist/CMakeLists.txt index ee63d9f43559a..d3f5142e4e467 100644 --- a/localization/pose2twist/CMakeLists.txt +++ b/localization/autoware_pose2twist/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(pose2twist) +project(autoware_pose2twist) find_package(autoware_cmake REQUIRED) autoware_package() @@ -8,8 +8,12 @@ ament_auto_add_library(${PROJECT_NAME} SHARED src/pose2twist_core.cpp ) +include_directories( + src +) + rclcpp_components_register_node(${PROJECT_NAME} - PLUGIN "Pose2Twist" + PLUGIN "autoware::pose2twist::Pose2Twist" EXECUTABLE ${PROJECT_NAME}_node EXECUTOR SingleThreadedExecutor ) diff --git a/localization/pose2twist/README.md b/localization/autoware_pose2twist/README.md similarity index 82% rename from localization/pose2twist/README.md rename to localization/autoware_pose2twist/README.md index f1f7d6408fafb..55ca4667c423d 100644 --- a/localization/pose2twist/README.md +++ b/localization/autoware_pose2twist/README.md @@ -1,8 +1,8 @@ -# pose2twist +# autoware_pose2twist ## Purpose -This `pose2twist` calculates the velocity from the input pose history. In addition to the computed twist, this node outputs the linear-x and angular-z components as a float message to simplify debugging. +This `autoware_pose2twist` calculates the velocity from the input pose history. In addition to the computed twist, this node outputs the linear-x and angular-z components as a float message to simplify debugging. The `twist.linear.x` is calculated as `sqrt(dx * dx + dy * dy + dz * dz) / dt`, and the values in the `y` and `z` fields are zero. The `twist.angular` is calculated as `relative_rotation_vector / dt` for each field. diff --git a/localization/pose2twist/launch/pose2twist.launch.xml b/localization/autoware_pose2twist/launch/pose2twist.launch.xml similarity index 79% rename from localization/pose2twist/launch/pose2twist.launch.xml rename to localization/autoware_pose2twist/launch/pose2twist.launch.xml index 57a41dbfcf017..8ac802a5d0ce3 100644 --- a/localization/pose2twist/launch/pose2twist.launch.xml +++ b/localization/autoware_pose2twist/launch/pose2twist.launch.xml @@ -2,7 +2,7 @@ - + diff --git a/localization/pose2twist/package.xml b/localization/autoware_pose2twist/package.xml similarity index 92% rename from localization/pose2twist/package.xml rename to localization/autoware_pose2twist/package.xml index 07e445c72978c..dc499f8eda5a4 100644 --- a/localization/pose2twist/package.xml +++ b/localization/autoware_pose2twist/package.xml @@ -1,9 +1,9 @@ - pose2twist + autoware_pose2twist 0.1.0 - The pose2twist package + The autoware_pose2twist package Yamato Ando Masahiro Sakamoto Kento Yabuuchi diff --git a/localization/pose2twist/src/pose2twist_core.cpp b/localization/autoware_pose2twist/src/pose2twist_core.cpp similarity index 96% rename from localization/pose2twist/src/pose2twist_core.cpp rename to localization/autoware_pose2twist/src/pose2twist_core.cpp index cdde78ed7e357..4dc7b5fb04209 100644 --- a/localization/pose2twist/src/pose2twist_core.cpp +++ b/localization/autoware_pose2twist/src/pose2twist_core.cpp @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pose2twist/pose2twist_core.hpp" +#include "pose2twist_core.hpp" #include #include #include +namespace autoware::pose2twist +{ Pose2Twist::Pose2Twist(const rclcpp::NodeOptions & options) : rclcpp::Node("pose2twist", options) { using std::placeholders::_1; @@ -113,6 +115,7 @@ void Pose2Twist::callback_pose(geometry_msgs::msg::PoseStamped::SharedPtr pose_m angular_z_msg.data = static_cast(twist_msg.twist.angular.z); angular_z_pub_->publish(angular_z_msg); } +} // namespace autoware::pose2twist #include -RCLCPP_COMPONENTS_REGISTER_NODE(Pose2Twist) +RCLCPP_COMPONENTS_REGISTER_NODE(autoware::pose2twist::Pose2Twist) diff --git a/localization/pose2twist/include/pose2twist/pose2twist_core.hpp b/localization/autoware_pose2twist/src/pose2twist_core.hpp similarity index 91% rename from localization/pose2twist/include/pose2twist/pose2twist_core.hpp rename to localization/autoware_pose2twist/src/pose2twist_core.hpp index d1ff6ee5ff8b6..ed3e542beb857 100644 --- a/localization/pose2twist/include/pose2twist/pose2twist_core.hpp +++ b/localization/autoware_pose2twist/src/pose2twist_core.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef POSE2TWIST__POSE2TWIST_CORE_HPP_ -#define POSE2TWIST__POSE2TWIST_CORE_HPP_ +#ifndef POSE2TWIST_CORE_HPP_ +#define POSE2TWIST_CORE_HPP_ #include @@ -27,6 +27,8 @@ #include #endif +namespace autoware::pose2twist +{ // Compute the relative rotation of q2 from q1 as a rotation vector geometry_msgs::msg::Vector3 compute_relative_rotation_vector( const tf2::Quaternion & q1, const tf2::Quaternion & q2); @@ -45,5 +47,6 @@ class Pose2Twist : public rclcpp::Node rclcpp::Publisher::SharedPtr linear_x_pub_; rclcpp::Publisher::SharedPtr angular_z_pub_; }; +} // namespace autoware::pose2twist -#endif // POSE2TWIST__POSE2TWIST_CORE_HPP_ +#endif // POSE2TWIST_CORE_HPP_ diff --git a/localization/pose2twist/test/test_angular_velocity.cpp b/localization/autoware_pose2twist/test/test_angular_velocity.cpp similarity index 97% rename from localization/pose2twist/test/test_angular_velocity.cpp rename to localization/autoware_pose2twist/test/test_angular_velocity.cpp index bf2ca0a3ba5c2..38eba6f329565 100644 --- a/localization/pose2twist/test/test_angular_velocity.cpp +++ b/localization/autoware_pose2twist/test/test_angular_velocity.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pose2twist/pose2twist_core.hpp" +#include "pose2twist_core.hpp" #include @@ -102,7 +102,7 @@ TEST(AngularVelocityFromQuaternion, CheckNumericalValidity) // Calculate the relative rotation between the initial and final quaternion const geometry_msgs::msg::Vector3 rotation_vector = - compute_relative_rotation_vector(initial_q, final_q); + autoware::pose2twist::compute_relative_rotation_vector(initial_q, final_q); EXPECT_NEAR(rotation_vector.x, expected_axis.x() * expected_angle, acceptable_error); EXPECT_NEAR(rotation_vector.y, expected_axis.y() * expected_angle, acceptable_error); diff --git a/vehicle/autoware_steer_offset_estimator/launch/steer_offset_estimator.launch.xml b/vehicle/autoware_steer_offset_estimator/launch/steer_offset_estimator.launch.xml index 9ee05189a35d8..919858950e69c 100644 --- a/vehicle/autoware_steer_offset_estimator/launch/steer_offset_estimator.launch.xml +++ b/vehicle/autoware_steer_offset_estimator/launch/steer_offset_estimator.launch.xml @@ -6,7 +6,7 @@ - + diff --git a/vehicle/autoware_steer_offset_estimator/package.xml b/vehicle/autoware_steer_offset_estimator/package.xml index 5e4638f605713..ea35883334e35 100644 --- a/vehicle/autoware_steer_offset_estimator/package.xml +++ b/vehicle/autoware_steer_offset_estimator/package.xml @@ -18,8 +18,8 @@ rclcpp_components std_msgs tier4_debug_msgs + autoware_pose2twist global_parameter_loader - pose2twist ament_lint_auto autoware_lint_common From 6e8b53fcafb8b4b5334a51a8abbdade2c1953889 Mon Sep 17 00:00:00 2001 From: a-maumau Date: Tue, 6 Aug 2024 11:54:49 +0900 Subject: [PATCH 2/2] use target_include_directories instead Signed-off-by: a-maumau --- localization/autoware_pose2twist/CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/localization/autoware_pose2twist/CMakeLists.txt b/localization/autoware_pose2twist/CMakeLists.txt index d3f5142e4e467..2783e1a69047a 100644 --- a/localization/autoware_pose2twist/CMakeLists.txt +++ b/localization/autoware_pose2twist/CMakeLists.txt @@ -8,10 +8,6 @@ ament_auto_add_library(${PROJECT_NAME} SHARED src/pose2twist_core.cpp ) -include_directories( - src -) - rclcpp_components_register_node(${PROJECT_NAME} PLUGIN "autoware::pose2twist::Pose2Twist" EXECUTABLE ${PROJECT_NAME}_node @@ -23,6 +19,9 @@ if(BUILD_TESTING) ament_auto_add_gtest(test_angular_velocity test/test_angular_velocity.cpp ) + target_include_directories(test_angular_velocity PRIVATE + src + ) endif() ament_auto_package(