|
21 | 21 | #include "behavior_path_planner_common/utils/path_utils.hpp"
|
22 | 22 | #include "behavior_path_planner_common/utils/traffic_light_utils.hpp"
|
23 | 23 |
|
| 24 | +#include <Eigen/Dense> |
24 | 25 | #include <lanelet2_extension/utility/message_conversion.hpp>
|
25 | 26 |
|
26 | 27 | #include <boost/geometry/algorithms/buffer.hpp>
|
@@ -337,6 +338,24 @@ bool isWithinIntersection(
|
337 | 338 | object_polygon, utils::toPolygon2d(lanelet::utils::to2D(polygon.basicPolygon())));
|
338 | 339 | }
|
339 | 340 |
|
| 341 | +bool hasHugePoseCovariance( |
| 342 | + const PoseWithCovariance & pose, const std::shared_ptr<AvoidanceParameters> & parameters) |
| 343 | +{ |
| 344 | + // create xy covariance (2x2 matrix) |
| 345 | + // input geometry_msgs::PoseWithCovariance contain 6x6 matrix |
| 346 | + Eigen::Matrix2d xy_covariance; |
| 347 | + const auto cov = pose.covariance; |
| 348 | + xy_covariance(0, 0) = cov[0 * 6 + 0]; |
| 349 | + xy_covariance(0, 1) = cov[0 * 6 + 1]; |
| 350 | + xy_covariance(1, 0) = cov[1 * 6 + 0]; |
| 351 | + xy_covariance(1, 1) = cov[1 * 6 + 1]; |
| 352 | + |
| 353 | + Eigen::SelfAdjointEigenSolver<Eigen::Matrix2d> eigensolver(xy_covariance); |
| 354 | + |
| 355 | + // eigen values and vectors are sorted in ascending order |
| 356 | + return std::sqrt(eigensolver.eigenvalues()(1)) > parameters->th_error_eclipse_long_radius; |
| 357 | +} |
| 358 | + |
340 | 359 | bool isOnEgoLane(const ObjectData & object, const std::shared_ptr<RouteHandler> & route_handler)
|
341 | 360 | {
|
342 | 361 | const auto & object_pos = object.object.kinematics.initial_pose_with_covariance.pose.position;
|
@@ -737,6 +756,12 @@ bool isSatisfiedWithCommonCondition(
|
737 | 756 | return false;
|
738 | 757 | }
|
739 | 758 |
|
| 759 | + if (filtering_utils::hasHugePoseCovariance( |
| 760 | + object.object.kinematics.initial_pose_with_covariance, parameters)) { |
| 761 | + object.info = ObjectInfo::HUGE_COVARIANCE; |
| 762 | + return false; |
| 763 | + } |
| 764 | + |
740 | 765 | // Step3. filtered by longitudinal distance.
|
741 | 766 | const auto & ego_pos = planner_data->self_odometry->pose.pose.position;
|
742 | 767 | fillLongitudinalAndLengthByClosestEnvelopeFootprint(data.reference_path_rough, ego_pos, object);
|
|
0 commit comments