Skip to content

Commit 9971a53

Browse files
authored
Merge branch 'main' into multi-object-tracker-branch
2 parents b967eae + 50a110a commit 9971a53

File tree

56 files changed

+308
-323
lines changed

Some content is hidden

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

56 files changed

+308
-323
lines changed

.cppcheck_suppressions

-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
*:*/test/*
22

33
checkersReport
4-
constParameterReference
5-
funcArgNamesDifferent
64
functionConst
75
functionStatic
86
missingInclude
97
missingIncludeSystem
108
noConstructor
11-
passedByValue
129
// cspell: ignore uninit
1310
uninitMemberVar
1411
unknownMacro

.github/CODEOWNERS

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ localization/autoware_landmark_based_localizer/autoware_ar_tag_based_localizer/*
8383
localization/autoware_landmark_based_localizer/autoware_landmark_manager/** 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
8484
localization/autoware_pose_covariance_modifier/** melike@leodrive.ai
8585
localization/autoware_stop_filter/** 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
86+
localization/autoware_twist2accel/** 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
8687
localization/ekf_localizer/** 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 takamasa.horibe@tier4.jp takeshi.ishita@tier4.jp yamato.ando@tier4.jp
8788
localization/geo_pose_projector/** 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
8889
localization/gyro_odometer/** 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
8990
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
9091
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
9192
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
92-
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
93+
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
9394
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
9495
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
9596
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
96-
localization/autoware_twist2accel/** 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
9797
localization/yabloc/yabloc_common/** 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
9898
localization/yabloc/yabloc_image_processing/** 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
9999
localization/yabloc/yabloc_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
@@ -131,7 +131,7 @@ perception/autoware_radar_object_clustering/** satoshi.tanaka@tier4.jp shunsuke.
131131
perception/autoware_radar_object_tracker/** taekjin.lee@tier4.jp yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
132132
perception/autoware_radar_tracks_msgs_converter/** satoshi.tanaka@tier4.jp shunsuke.miura@tier4.jp taekjin.lee@tier4.jp yoshi.ri@tier4.jp
133133
perception/autoware_raindrop_cluster_filter/** dai.nguyen@tier4.jp yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
134-
perception/autoware_shape_estimation/** yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
134+
perception/autoware_shape_estimation/** kcolak@leodrive.ai yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
135135
perception/autoware_simple_object_merger/** satoshi.tanaka@tier4.jp shunsuke.miura@tier4.jp yoshi.ri@tier4.jp
136136
perception/autoware_tensorrt_classifier/** kotaro.uetake@tier4.jp shunsuke.miura@tier4.jp
137137
perception/autoware_tensorrt_yolox/** dan.umeda@tier4.jp manato.hirabayashi@tier4.jp

common/autoware_universe_utils/src/geometry/random_convex_polygon.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ struct VectorsWithMin
3131
};
3232

3333
VectorsWithMin prepare_coordinate_vectors(
34-
const size_t nb_vertices, std::uniform_real_distribution<double> & random_double,
35-
std::uniform_int_distribution<int> & random_bool, std::default_random_engine & random_engine)
34+
const size_t nb_vertices,
35+
std::uniform_real_distribution<double> &
36+
random_double, // cppcheck-suppress constParameterReference
37+
std::uniform_int_distribution<int> & random_bool, // cppcheck-suppress constParameterReference
38+
std::default_random_engine & random_engine)
3639
{
3740
std::vector<double> v;
3841
for (auto i = 0UL; i < nb_vertices; ++i) {

common/tensorrt_common/src/tensorrt_common.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ void TrtCommon::setup()
137137
is_initialized_ = false;
138138
return;
139139
}
140+
// cppcheck-suppress unreadVariable
140141
std::string engine_path = model_file_path_;
141142
if (model_file_path_.extension() == ".engine") {
142143
std::cout << "Load ... " << model_file_path_ << std::endl;
@@ -193,6 +194,7 @@ void TrtCommon::setup()
193194
logger_.stop_throttle(log_thread);
194195
logger_.log(nvinfer1::ILogger::Severity::kINFO, "End build engine");
195196
}
197+
// cppcheck-suppress unreadVariable
196198
engine_path = cache_engine_path;
197199
} else {
198200
is_initialized_ = false;

control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/src/proxima_calc.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@ class transform_model_to_eigen
178178
Eigen::VectorXd bias_linear_finalize_;
179179
Eigen::MatrixXd A_linear_reg_;
180180
Eigen::VectorXd b_linear_reg_;
181-
int deg_;
182-
int acc_delay_step_;
183-
int steer_delay_step_;
184-
int acc_ctrl_queue_size_;
185-
int steer_ctrl_queue_size_;
186-
int steer_ctrl_queue_size_core_;
187-
double vel_normalize_;
188-
double acc_normalize_;
189-
double steer_normalize_;
181+
int deg_{};
182+
int acc_delay_step_{};
183+
int steer_delay_step_{};
184+
int acc_ctrl_queue_size_{};
185+
int steer_ctrl_queue_size_{};
186+
int steer_ctrl_queue_size_core_{};
187+
double vel_normalize_{};
188+
double acc_normalize_{};
189+
double steer_normalize_{};
190190
static constexpr double max_acc_error_ = 20.0;
191191
static constexpr double max_steer_error_ = 20.0;
192192

@@ -611,15 +611,15 @@ class transform_model_with_memory_to_eigen
611611
Eigen::VectorXd bias_linear_finalize_;
612612
Eigen::MatrixXd A_linear_reg_;
613613
Eigen::VectorXd b_linear_reg_;
614-
int deg_;
615-
int acc_delay_step_;
616-
int steer_delay_step_;
617-
int acc_ctrl_queue_size_;
618-
int steer_ctrl_queue_size_;
619-
int steer_ctrl_queue_size_core_;
620-
double vel_normalize_;
621-
double acc_normalize_;
622-
double steer_normalize_;
614+
int deg_{};
615+
int acc_delay_step_{};
616+
int steer_delay_step_{};
617+
int acc_ctrl_queue_size_{};
618+
int steer_ctrl_queue_size_{};
619+
int steer_ctrl_queue_size_core_{};
620+
double vel_normalize_{};
621+
double acc_normalize_{};
622+
double steer_normalize_{};
623623

624624
static constexpr double max_acc_error_ = 20.0;
625625
static constexpr double max_steer_error_ = 20.0;

control/autoware_vehicle_cmd_gate/src/adapi_pause_interface.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ AdapiPauseInterface::AdapiPauseInterface(rclcpp::Node * node) : node_(node)
2929
publish();
3030
}
3131

32-
bool AdapiPauseInterface::is_paused()
32+
bool AdapiPauseInterface::is_paused() const
3333
{
3434
return is_paused_;
3535
}

control/autoware_vehicle_cmd_gate/src/adapi_pause_interface.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AdapiPauseInterface
3535

3636
public:
3737
explicit AdapiPauseInterface(rclcpp::Node * node);
38-
bool is_paused();
38+
bool is_paused() const;
3939
void publish();
4040
void update(const Control & control);
4141

control/autoware_vehicle_cmd_gate/src/vehicle_cmd_filter.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ double VehicleCmdFilter::calcLatAcc(const Control & cmd, const double v) const
252252
return v * v * std::tan(cmd.lateral.steering_tire_angle) / param_.wheel_base;
253253
}
254254

255-
double VehicleCmdFilter::limitDiff(
256-
const double curr, const double prev, const double diff_lim) const
255+
double VehicleCmdFilter::limitDiff(const double curr, const double prev, const double diff_lim)
257256
{
258257
double diff = std::max(std::min(curr - prev, diff_lim), -diff_lim);
259258
return prev + diff;

control/autoware_vehicle_cmd_gate/src/vehicle_cmd_filter.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class VehicleCmdFilter
7575
static IsFilterActivated checkIsActivated(
7676
const Control & c1, const Control & c2, const double tol = 1.0e-3);
7777

78-
Control getPrevCmd() { return prev_cmd_; }
78+
Control getPrevCmd() const { return prev_cmd_; }
7979

8080
private:
8181
VehicleCmdFilterParam param_;
@@ -87,7 +87,7 @@ class VehicleCmdFilter
8787
double calcLatAcc(const Control & cmd) const;
8888
double calcLatAcc(const Control & cmd, const double v) const;
8989
double calcSteerFromLatacc(const double v, const double latacc) const;
90-
double limitDiff(const double curr, const double prev, const double diff_lim) const;
90+
static double limitDiff(const double curr, const double prev, const double diff_lim);
9191

9292
double interpolateFromSpeed(const LimitArray & limits) const;
9393
double getLonAccLim() const;

evaluator/autoware_planning_evaluator/src/metrics/metrics_utils.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ size_t getIndexAfterDistance(const Trajectory & traj, const size_t curr_id, cons
3030
const TrajectoryPoint & curr_p = traj.points.at(curr_id);
3131

3232
size_t target_id = curr_id;
33-
double current_distance = 0.0;
3433
for (size_t traj_id = curr_id + 1; traj_id < traj.points.size(); ++traj_id) {
35-
current_distance = calcDistance2d(traj.points.at(traj_id), curr_p);
34+
double current_distance = calcDistance2d(traj.points.at(traj_id), curr_p);
3635
if (current_distance >= distance) {
3736
target_id = traj_id;
3837
break;

localization/pose2twist/CMakeLists.txt localization/autoware_pose2twist/CMakeLists.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.14)
2-
project(pose2twist)
2+
project(autoware_pose2twist)
33

44
find_package(autoware_cmake REQUIRED)
55
autoware_package()
@@ -9,7 +9,7 @@ ament_auto_add_library(${PROJECT_NAME} SHARED
99
)
1010

1111
rclcpp_components_register_node(${PROJECT_NAME}
12-
PLUGIN "Pose2Twist"
12+
PLUGIN "autoware::pose2twist::Pose2Twist"
1313
EXECUTABLE ${PROJECT_NAME}_node
1414
EXECUTOR SingleThreadedExecutor
1515
)
@@ -19,6 +19,9 @@ if(BUILD_TESTING)
1919
ament_auto_add_gtest(test_angular_velocity
2020
test/test_angular_velocity.cpp
2121
)
22+
target_include_directories(test_angular_velocity PRIVATE
23+
src
24+
)
2225
endif()
2326

2427
ament_auto_package(

localization/pose2twist/README.md localization/autoware_pose2twist/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# pose2twist
1+
# autoware_pose2twist
22

33
## Purpose
44

5-
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.
5+
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.
66

77
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.
88
The `twist.angular` is calculated as `relative_rotation_vector / dt` for each field.

localization/pose2twist/launch/pose2twist.launch.xml localization/autoware_pose2twist/launch/pose2twist.launch.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<arg name="input_pose_topic" default="/localization/pose_estimator/pose" description=""/>
33
<arg name="output_twist_topic" default="/estimate_twist" description=""/>
44

5-
<node pkg="pose2twist" exec="pose2twist_node" output="both">
5+
<node pkg="autoware_pose2twist" exec="autoware_pose2twist_node" output="both">
66
<remap from="pose" to="$(var input_pose_topic)"/>
77
<remap from="twist" to="$(var output_twist_topic)"/>
88
</node>

localization/pose2twist/package.xml localization/autoware_pose2twist/package.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0"?>
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
4-
<name>pose2twist</name>
4+
<name>autoware_pose2twist</name>
55
<version>0.1.0</version>
6-
<description>The pose2twist package</description>
6+
<description>The autoware_pose2twist package</description>
77
<maintainer email="yamato.ando@tier4.jp">Yamato Ando</maintainer>
88
<maintainer email="masahiro.sakamoto@tier4.jp">Masahiro Sakamoto</maintainer>
99
<maintainer email="kento.yabuuchi.2@tier4.jp">Kento Yabuuchi</maintainer>

localization/pose2twist/src/pose2twist_core.cpp localization/autoware_pose2twist/src/pose2twist_core.cpp

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

15-
#include "pose2twist/pose2twist_core.hpp"
15+
#include "pose2twist_core.hpp"
1616

1717
#include <cmath>
1818
#include <cstddef>
1919
#include <functional>
2020

21+
namespace autoware::pose2twist
22+
{
2123
Pose2Twist::Pose2Twist(const rclcpp::NodeOptions & options) : rclcpp::Node("pose2twist", options)
2224
{
2325
using std::placeholders::_1;
@@ -113,6 +115,7 @@ void Pose2Twist::callback_pose(geometry_msgs::msg::PoseStamped::SharedPtr pose_m
113115
angular_z_msg.data = static_cast<float>(twist_msg.twist.angular.z);
114116
angular_z_pub_->publish(angular_z_msg);
115117
}
118+
} // namespace autoware::pose2twist
116119

117120
#include <rclcpp_components/register_node_macro.hpp>
118-
RCLCPP_COMPONENTS_REGISTER_NODE(Pose2Twist)
121+
RCLCPP_COMPONENTS_REGISTER_NODE(autoware::pose2twist::Pose2Twist)

localization/pose2twist/include/pose2twist/pose2twist_core.hpp localization/autoware_pose2twist/src/pose2twist_core.hpp

+6-3
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 POSE2TWIST__POSE2TWIST_CORE_HPP_
16-
#define POSE2TWIST__POSE2TWIST_CORE_HPP_
15+
#ifndef POSE2TWIST_CORE_HPP_
16+
#define POSE2TWIST_CORE_HPP_
1717

1818
#include <rclcpp/rclcpp.hpp>
1919

@@ -27,6 +27,8 @@
2727
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
2828
#endif
2929

30+
namespace autoware::pose2twist
31+
{
3032
// Compute the relative rotation of q2 from q1 as a rotation vector
3133
geometry_msgs::msg::Vector3 compute_relative_rotation_vector(
3234
const tf2::Quaternion & q1, const tf2::Quaternion & q2);
@@ -45,5 +47,6 @@ class Pose2Twist : public rclcpp::Node
4547
rclcpp::Publisher<tier4_debug_msgs::msg::Float32Stamped>::SharedPtr linear_x_pub_;
4648
rclcpp::Publisher<tier4_debug_msgs::msg::Float32Stamped>::SharedPtr angular_z_pub_;
4749
};
50+
} // namespace autoware::pose2twist
4851

49-
#endif // POSE2TWIST__POSE2TWIST_CORE_HPP_
52+
#endif // POSE2TWIST_CORE_HPP_

localization/pose2twist/test/test_angular_velocity.cpp localization/autoware_pose2twist/test/test_angular_velocity.cpp

+2-2
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 "pose2twist/pose2twist_core.hpp"
15+
#include "pose2twist_core.hpp"
1616

1717
#include <gtest/gtest.h>
1818

@@ -102,7 +102,7 @@ TEST(AngularVelocityFromQuaternion, CheckNumericalValidity)
102102

103103
// Calculate the relative rotation between the initial and final quaternion
104104
const geometry_msgs::msg::Vector3 rotation_vector =
105-
compute_relative_rotation_vector(initial_q, final_q);
105+
autoware::pose2twist::compute_relative_rotation_vector(initial_q, final_q);
106106

107107
EXPECT_NEAR(rotation_vector.x, expected_axis.x() * expected_angle, acceptable_error);
108108
EXPECT_NEAR(rotation_vector.y, expected_axis.y() * expected_angle, acceptable_error);

localization/autoware_twist2accel/src/twist2accel.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace autoware::twist2accel
4242
class Twist2Accel : public rclcpp::Node
4343
{
4444
public:
45-
explicit Twist2Accel(const rclcpp::NodeOptions & options);
45+
explicit Twist2Accel(const rclcpp::NodeOptions & node_options);
4646

4747
private:
4848
rclcpp::Publisher<geometry_msgs::msg::AccelWithCovarianceStamped>::SharedPtr

localization/ekf_localizer/include/ekf_localizer/ekf_localizer.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ class EKFLocalizer : public rclcpp::Node
239239

240240
autoware::universe_utils::StopWatch<std::chrono::milliseconds> stop_watch_;
241241

242+
/**
243+
* @brief last angular velocity for compensating rph with delay
244+
*/
245+
tf2::Vector3 last_angular_velocity_;
246+
242247
friend class EKFLocalizerTestSuite; // for test code
243248
};
244249
#endif // EKF_LOCALIZER__EKF_LOCALIZER_HPP_

localization/ekf_localizer/include/ekf_localizer/ekf_module.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include <geometry_msgs/msg/twist_stamped.hpp>
3030
#include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
3131

32+
#include <tf2/utils.h>
33+
3234
#include <memory>
3335
#include <vector>
3436

@@ -77,8 +79,8 @@ class EKFModule
7779
bool measurement_update_twist(
7880
const TwistWithCovariance & twist, const rclcpp::Time & t_curr,
7981
EKFDiagnosticInfo & twist_diag_info);
80-
geometry_msgs::msg::PoseWithCovarianceStamped compensate_pose_with_z_delay(
81-
const PoseWithCovariance & pose, const double delay_time);
82+
geometry_msgs::msg::PoseWithCovarianceStamped compensate_rph_with_delay(
83+
const PoseWithCovariance & pose, tf2::Vector3 last_angular_velocity, const double delay_time);
8284

8385
private:
8486
TimeDelayKalmanFilter kalman_filter_;

localization/ekf_localizer/src/ekf_localizer.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ EKFLocalizer::EKFLocalizer(const rclcpp::NodeOptions & node_options)
4747
params_(this),
4848
ekf_dt_(params_.ekf_dt),
4949
pose_queue_(params_.pose_smoothing_steps),
50-
twist_queue_(params_.twist_smoothing_steps)
50+
twist_queue_(params_.twist_smoothing_steps),
51+
last_angular_velocity_(0.0, 0.0, 0.0)
5152
{
5253
/* convert to continuous to discrete */
5354
proc_cov_vx_d_ = std::pow(params_.proc_stddev_vx_c * ekf_dt_, 2.0);
@@ -187,11 +188,13 @@ void EKFLocalizer::timer_callback()
187188
if (is_updated) {
188189
pose_is_updated = true;
189190

190-
// Update Simple 1D filter with considering change of z value due to measurement pose delay
191+
// Update Simple 1D filter with considering change of roll, pitch and height (position z)
192+
// values due to measurement pose delay
191193
const double delay_time =
192194
(current_time - pose->header.stamp).seconds() + params_.pose_additional_delay;
193-
const auto pose_with_z_delay = ekf_module_->compensate_pose_with_z_delay(*pose, delay_time);
194-
update_simple_1d_filters(pose_with_z_delay, params_.pose_smoothing_steps);
195+
auto pose_with_rph_delay_compensation =
196+
ekf_module_->compensate_rph_with_delay(*pose, last_angular_velocity_, delay_time);
197+
update_simple_1d_filters(pose_with_rph_delay_compensation, params_.pose_smoothing_steps);
195198
}
196199
}
197200
DEBUG_INFO(
@@ -222,6 +225,10 @@ void EKFLocalizer::timer_callback()
222225
ekf_module_->measurement_update_twist(*twist, current_time, twist_diag_info_);
223226
if (is_updated) {
224227
twist_is_updated = true;
228+
last_angular_velocity_ = tf2::Vector3(
229+
twist->twist.twist.angular.x, twist->twist.twist.angular.y, twist->twist.twist.angular.z);
230+
} else {
231+
last_angular_velocity_ = tf2::Vector3(0.0, 0.0, 0.0);
225232
}
226233
}
227234
DEBUG_INFO(

0 commit comments

Comments
 (0)