|
17 | 17 | #include "ekf_localizer/diagnostics.hpp"
|
18 | 18 | #include "ekf_localizer/string.hpp"
|
19 | 19 | #include "ekf_localizer/warning_message.hpp"
|
| 20 | +#include "localization_util/covariance_ellipse.hpp" |
20 | 21 |
|
21 | 22 | #include <autoware/universe_utils/geometry/geometry.hpp>
|
22 | 23 | #include <autoware/universe_utils/math/unit_conversion.hpp>
|
@@ -148,7 +149,7 @@ void EKFLocalizer::timer_callback()
|
148 | 149 | if (!is_activated_) {
|
149 | 150 | warning_->warn_throttle(
|
150 | 151 | "The node is not activated. Provide initial pose to pose_initializer", 2000);
|
151 |
| - publish_diagnostics(current_time); |
| 152 | + publish_diagnostics(geometry_msgs::msg::PoseStamped{}, current_time); |
152 | 153 | return;
|
153 | 154 | }
|
154 | 155 |
|
@@ -241,7 +242,7 @@ void EKFLocalizer::timer_callback()
|
241 | 242 |
|
242 | 243 | /* publish ekf result */
|
243 | 244 | publish_estimate_result(current_ekf_pose, current_biased_ekf_pose, current_ekf_twist);
|
244 |
| - publish_diagnostics(current_time); |
| 245 | + publish_diagnostics(current_ekf_pose, current_time); |
245 | 246 | }
|
246 | 247 |
|
247 | 248 | /*
|
@@ -390,7 +391,8 @@ void EKFLocalizer::publish_estimate_result(
|
390 | 391 | pub_odom_->publish(odometry);
|
391 | 392 | }
|
392 | 393 |
|
393 |
| -void EKFLocalizer::publish_diagnostics(const rclcpp::Time & current_time) |
| 394 | +void EKFLocalizer::publish_diagnostics( |
| 395 | + const geometry_msgs::msg::PoseStamped & current_ekf_pose, const rclcpp::Time & current_time) |
394 | 396 | {
|
395 | 397 | std::vector<diagnostic_msgs::msg::DiagnosticStatus> diag_status_array;
|
396 | 398 |
|
@@ -418,6 +420,18 @@ void EKFLocalizer::publish_diagnostics(const rclcpp::Time & current_time)
|
418 | 420 | diag_status_array.push_back(check_measurement_mahalanobis_gate(
|
419 | 421 | "twist", twist_diag_info_.is_passed_mahalanobis_gate, twist_diag_info_.mahalanobis_distance,
|
420 | 422 | params_.twist_gate_dist));
|
| 423 | + |
| 424 | + geometry_msgs::msg::PoseWithCovariance pose_cov; |
| 425 | + pose_cov.pose = current_ekf_pose.pose; |
| 426 | + pose_cov.covariance = ekf_module_->get_current_pose_covariance(); |
| 427 | + const autoware::localization_util::Ellipse ellipse = |
| 428 | + autoware::localization_util::calculate_xy_ellipse(pose_cov, params_.ellipse_scale); |
| 429 | + diag_status_array.push_back(check_covariance_ellipse( |
| 430 | + "cov_ellipse_long_axis", ellipse.long_radius, params_.warn_ellipse_size, |
| 431 | + params_.error_ellipse_size)); |
| 432 | + diag_status_array.push_back(check_covariance_ellipse( |
| 433 | + "cov_ellipse_lateral_direction", ellipse.size_lateral_direction, |
| 434 | + params_.warn_ellipse_size_lateral_direction, params_.error_ellipse_size_lateral_direction)); |
421 | 435 | }
|
422 | 436 |
|
423 | 437 | diagnostic_msgs::msg::DiagnosticStatus diag_merged_status;
|
|
0 commit comments