Skip to content

Commit

Permalink
chore(autoware_imu_corrector): refactored the imu corrector into the …
Browse files Browse the repository at this point in the history
…autoware namespace (autowarefoundation#8222)

* chore: refactored the imu corrector into the autoware namespace

Signed-off-by: Kenzo Lobos-Tsunekawa <[email protected]>

* chore: reverted to non-exported includes

Signed-off-by: Kenzo Lobos-Tsunekawa <[email protected]>

---------

Signed-off-by: Kenzo Lobos-Tsunekawa <[email protected]>
Co-authored-by: Yamato Ando <[email protected]>
  • Loading branch information
2 people authored and ktro2828 committed Sep 18, 2024
1 parent e991843 commit 4be4837
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ planning/sampling_based_planner/autoware_frenet_planner/** maxime.clement@tier4.
planning/sampling_based_planner/autoware_path_sampler/** [email protected]
planning/sampling_based_planner/autoware_sampler_common/** [email protected]
sensing/autoware_image_diagnostics/** [email protected] [email protected]
sensing/autoware_imu_corrector/** [email protected] [email protected]
sensing/autoware_image_transport_decompressor/** [email protected] [email protected]
sensing/autoware_pcl_extensions/** [email protected] [email protected] [email protected]
sensing/autoware_pointcloud_preprocessor/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.14)
project(imu_corrector)
project(autoware_imu_corrector)

find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_library(${PROJECT_NAME} SHARED
ament_auto_add_library(imu_corrector SHARED
src/imu_corrector_core.cpp
)

Expand All @@ -13,14 +13,14 @@ ament_auto_add_library(gyro_bias_estimator SHARED
src/gyro_bias_estimation_module.cpp
)

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "imu_corrector::ImuCorrector"
EXECUTABLE ${PROJECT_NAME}_node
rclcpp_components_register_node(imu_corrector
PLUGIN "autoware::imu_corrector::ImuCorrector"
EXECUTABLE imu_corrector_node
EXECUTOR SingleThreadedExecutor
)

rclcpp_components_register_node(gyro_bias_estimator
PLUGIN "imu_corrector::GyroBiasEstimator"
PLUGIN "autoware::imu_corrector::GyroBiasEstimator"
EXECUTABLE gyro_bias_estimator_node
EXECUTOR SingleThreadedExecutor
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# imu_corrector
# autoware_imu_corrector

## imu_corrector

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<arg name="input_imu_raw" default="imu_raw"/>
<arg name="input_odom" default="odom"/>
<arg name="output_gyro_bias" default="gyro_bias"/>
<arg name="gyro_bias_estimator_param_file" default="$(find-pkg-share imu_corrector)/config/gyro_bias_estimator.param.yaml"/>
<arg name="imu_corrector_param_file" default="$(find-pkg-share imu_corrector)/config/imu_corrector.param.yaml"/>
<arg name="gyro_bias_estimator_param_file" default="$(find-pkg-share autoware_imu_corrector)/config/gyro_bias_estimator.param.yaml"/>
<arg name="imu_corrector_param_file" default="$(find-pkg-share autoware_imu_corrector)/config/imu_corrector.param.yaml"/>

<node pkg="imu_corrector" exec="gyro_bias_estimator_node" output="both">
<node pkg="autoware_imu_corrector" exec="gyro_bias_estimator_node" output="both">
<remap from="~/input/imu_raw" to="$(var input_imu_raw)"/>
<remap from="~/input/odom" to="$(var input_odom)"/>
<remap from="~/output/gyro_bias" to="$(var output_gyro_bias)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<launch>
<arg name="input_topic" default="imu_raw"/>
<arg name="output_topic" default="imu_data"/>
<arg name="param_file" default="$(find-pkg-share imu_corrector)/config/imu_corrector.param.yaml"/>
<arg name="param_file" default="$(find-pkg-share autoware_imu_corrector)/config/imu_corrector.param.yaml"/>

<node pkg="imu_corrector" exec="imu_corrector_node" output="both">
<node pkg="autoware_imu_corrector" exec="imu_corrector_node" output="both">
<remap from="input" to="$(var input_topic)"/>
<remap from="output" to="$(var output_topic)"/>
<param from="$(var param_file)"/>
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>imu_corrector</name>
<name>autoware_imu_corrector</name>
<version>1.0.0</version>
<description>The ROS 2 imu_corrector package</description>
<description>The ROS 2 autoware_imu_corrector package</description>
<maintainer email="[email protected]">Yamato Ando</maintainer>
<maintainer email="[email protected]">Taiki Yamada</maintainer>
<license>Apache License 2.0</license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

#include "gyro_bias_estimation_module.hpp"

#include "autoware/universe_utils/geometry/geometry.hpp"

#include <autoware/universe_utils/geometry/geometry.hpp>
#include <rclcpp/rclcpp.hpp>

namespace imu_corrector
namespace autoware::imu_corrector
{

/**
Expand Down Expand Up @@ -116,4 +115,4 @@ geometry_msgs::msg::Vector3 GyroBiasEstimationModule::get_bias_base_link() const
return gyro_bias_base;
}

} // namespace imu_corrector
} // namespace autoware::imu_corrector
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <utility>
#include <vector>

namespace imu_corrector
namespace autoware::imu_corrector
{
class GyroBiasEstimationModule
{
Expand All @@ -36,6 +36,6 @@ class GyroBiasEstimationModule
private:
std::pair<geometry_msgs::msg::Vector3, geometry_msgs::msg::Vector3> gyro_bias_pair_;
};
} // namespace imu_corrector
} // namespace autoware::imu_corrector

#endif // GYRO_BIAS_ESTIMATION_MODULE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

#include "gyro_bias_estimator.hpp"

#include "autoware/universe_utils/geometry/geometry.hpp"
#include <autoware/universe_utils/geometry/geometry.hpp>

#include <geometry_msgs/msg/transform_stamped.hpp>
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>

#include <utility>

namespace imu_corrector
namespace autoware::imu_corrector
{
GyroBiasEstimator::GyroBiasEstimator(const rclcpp::NodeOptions & options)
: rclcpp::Node("gyro_bias_validator", options),
Expand Down Expand Up @@ -243,7 +243,7 @@ void GyroBiasEstimator::update_diagnostics(diagnostic_updater::DiagnosticStatusW
stat.add("gyro_bias_threshold", f(gyro_bias_threshold_));
}

} // namespace imu_corrector
} // namespace autoware::imu_corrector

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(imu_corrector::GyroBiasEstimator)
RCLCPP_COMPONENTS_REGISTER_NODE(autoware::imu_corrector::GyroBiasEstimator)
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#ifndef GYRO_BIAS_ESTIMATOR_HPP_
#define GYRO_BIAS_ESTIMATOR_HPP_

#include "autoware/universe_utils/ros/transform_listener.hpp"
#include "gyro_bias_estimation_module.hpp"

#include <autoware/universe_utils/ros/transform_listener.hpp>
#include <diagnostic_updater/diagnostic_updater.hpp>
#include <rclcpp/rclcpp.hpp>

Expand All @@ -30,7 +30,7 @@
#include <string>
#include <vector>

namespace imu_corrector
namespace autoware::imu_corrector
{
class GyroBiasEstimator : public rclcpp::Node
{
Expand Down Expand Up @@ -97,6 +97,6 @@ class GyroBiasEstimator : public rclcpp::Node

DiagnosticsInfo diagnostics_info_;
};
} // namespace imu_corrector
} // namespace autoware::imu_corrector

#endif // GYRO_BIAS_ESTIMATOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ geometry_msgs::msg::Vector3 transform_vector3(
return vec_stamped_transformed.vector;
}

namespace imu_corrector
namespace autoware::imu_corrector
{
ImuCorrector::ImuCorrector(const rclcpp::NodeOptions & options)
: rclcpp::Node("imu_corrector", options),
Expand Down Expand Up @@ -124,7 +124,7 @@ void ImuCorrector::callback_imu(const sensor_msgs::msg::Imu::ConstSharedPtr imu_
imu_pub_->publish(imu_msg_base_link);
}

} // namespace imu_corrector
} // namespace autoware::imu_corrector

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(imu_corrector::ImuCorrector)
RCLCPP_COMPONENTS_REGISTER_NODE(autoware::imu_corrector::ImuCorrector)
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
#ifndef IMU_CORRECTOR_CORE_HPP_
#define IMU_CORRECTOR_CORE_HPP_

#include "autoware/universe_utils/ros/msg_covariance.hpp"
#include "autoware/universe_utils/ros/transform_listener.hpp"

#include <autoware/universe_utils/ros/msg_covariance.hpp>
#include <autoware/universe_utils/ros/transform_listener.hpp>
#include <rclcpp/rclcpp.hpp>

#include <sensor_msgs/msg/imu.hpp>
Expand All @@ -27,7 +26,7 @@
#include <memory>
#include <string>

namespace imu_corrector
namespace autoware::imu_corrector
{
class ImuCorrector : public rclcpp::Node
{
Expand Down Expand Up @@ -57,6 +56,6 @@ class ImuCorrector : public rclcpp::Node

std::string output_frame_;
};
} // namespace imu_corrector
} // namespace autoware::imu_corrector

#endif // IMU_CORRECTOR_CORE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <gtest/gtest.h>

namespace imu_corrector
namespace autoware::imu_corrector
{
class GyroBiasEstimationModuleTest : public ::testing::Test
{
Expand Down Expand Up @@ -88,4 +88,4 @@ TEST_F(GyroBiasEstimationModuleTest, GetInsufficientDataExceptionWhenVehicleMovi
ASSERT_THROW(module.update_bias(pose_list, gyro_list), std::runtime_error);
}
}
} // namespace imu_corrector
} // namespace autoware::imu_corrector

0 comments on commit 4be4837

Please sign in to comment.