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(pose2twist)!: prefix package and namespace with autoware #8347

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.14)
project(pose2twist)
project(autoware_pose2twist)

find_package(autoware_cmake REQUIRED)
autoware_package()
Expand All @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<arg name="input_pose_topic" default="/localization/pose_estimator/pose" description=""/>
<arg name="output_twist_topic" default="/estimate_twist" description=""/>

<node pkg="pose2twist" exec="pose2twist_node" output="both">
<node pkg="autoware_pose2twist" exec="autoware_pose2twist_node" output="both">
<remap from="pose" to="$(var input_pose_topic)"/>
<remap from="twist" to="$(var output_twist_topic)"/>
</node>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>pose2twist</name>
<name>autoware_pose2twist</name>
<version>0.1.0</version>
<description>The pose2twist package</description>
<description>The autoware_pose2twist package</description>
<maintainer email="yamato.ando@tier4.jp">Yamato Ando</maintainer>
<maintainer email="masahiro.sakamoto@tier4.jp">Masahiro Sakamoto</maintainer>
<maintainer email="kento.yabuuchi.2@tier4.jp">Kento Yabuuchi</maintainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cmath>
#include <cstddef>
#include <functional>

namespace autoware::pose2twist
{
Pose2Twist::Pose2Twist(const rclcpp::NodeOptions & options) : rclcpp::Node("pose2twist", options)
{
using std::placeholders::_1;
Expand Down Expand Up @@ -113,6 +115,7 @@ void Pose2Twist::callback_pose(geometry_msgs::msg::PoseStamped::SharedPtr pose_m
angular_z_msg.data = static_cast<float>(twist_msg.twist.angular.z);
angular_z_pub_->publish(angular_z_msg);
}
} // namespace autoware::pose2twist

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(Pose2Twist)
RCLCPP_COMPONENTS_REGISTER_NODE(autoware::pose2twist::Pose2Twist)
Original file line number Diff line number Diff line change
Expand Up @@ -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 <rclcpp/rclcpp.hpp>

Expand All @@ -27,6 +27,8 @@
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#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);
Expand All @@ -45,5 +47,6 @@ class Pose2Twist : public rclcpp::Node
rclcpp::Publisher<tier4_debug_msgs::msg::Float32Stamped>::SharedPtr linear_x_pub_;
rclcpp::Publisher<tier4_debug_msgs::msg::Float32Stamped>::SharedPtr angular_z_pub_;
};
} // namespace autoware::pose2twist

#endif // POSE2TWIST__POSE2TWIST_CORE_HPP_
#endif // POSE2TWIST_CORE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<include file="$(find-pkg-share global_parameter_loader)/launch/global_params.launch.py"/>

<!-- ndt twist publisher -->
<include file="$(find-pkg-share pose2twist)/launch/pose2twist.launch.xml">
<include file="$(find-pkg-share autoware_pose2twist)/launch/pose2twist.launch.xml">
<arg name="input_pose_topic" value="/localization/pose_estimator/pose"/>
<arg name="output_twist_topic" value="/estimate_twist"/>
</include>
Expand Down
2 changes: 1 addition & 1 deletion vehicle/autoware_steer_offset_estimator/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<depend>rclcpp_components</depend>
<depend>std_msgs</depend>
<depend>tier4_debug_msgs</depend>
<exec_depend>autoware_pose2twist</exec_depend>
<exec_depend>global_parameter_loader</exec_depend>
<exec_depend>pose2twist</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
Expand Down
Loading