Skip to content

Commit f3259f8

Browse files
committed
feat(avoidance): check object pose covariance
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent b108380 commit f3259f8

File tree

7 files changed

+37
-0
lines changed

7 files changed

+37
-0
lines changed

planning/behavior_path_avoidance_module/config/avoidance.param.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
object_check_return_pose_distance: 20.0 # [m]
119119
# lost object compensation
120120
max_compensation_time: 2.0
121+
# filtering unstable detection result
122+
th_error_eclipse_long_radius: 2.0 # [m]
121123

122124
# detection area generation parameters
123125
detection_area:

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/data_structs.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ enum class ObjectInfo {
4242
NONE = 0,
4343
// ignore reasons
4444
OUT_OF_TARGET_AREA,
45+
HUGE_COVARIANCE,
4546
FURTHER_THAN_THRESHOLD,
4647
FURTHER_THAN_GOAL,
4748
IS_NOT_TARGET_OBJECT,
@@ -218,6 +219,9 @@ struct AvoidanceParameters
218219
// parameters for collision check.
219220
bool check_all_predicted_path{false};
220221

222+
// filtering unstable detection result
223+
double th_error_eclipse_long_radius{0.0};
224+
221225
// find adjacent lane vehicles
222226
double safety_check_backward_distance{0.0};
223227

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/parameter_helper.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ AvoidanceParameters getParameter(rclcpp::Node * node)
119119
getOrDeclareParameter<double>(*node, ns + "intersection.yaw_deviation");
120120
p.object_last_seen_threshold =
121121
getOrDeclareParameter<double>(*node, ns + "max_compensation_time");
122+
p.th_error_eclipse_long_radius =
123+
getOrDeclareParameter<double>(*node, ns + "th_error_eclipse_long_radius");
122124
}
123125

124126
{

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/type_alias.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ using autoware_auto_planning_msgs::msg::PathWithLaneId;
4141
// ROS 2 general msgs
4242
using geometry_msgs::msg::Point;
4343
using geometry_msgs::msg::Pose;
44+
using geometry_msgs::msg::PoseWithCovariance;
4445
using geometry_msgs::msg::TransformStamped;
4546
using geometry_msgs::msg::Vector3;
4647
using std_msgs::msg::ColorRGBA;

planning/behavior_path_avoidance_module/src/debug.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ MarkerArray createDebugMarkerArray(
554554
addObjects(data.other_objects, ObjectInfo::IS_NOT_TARGET_OBJECT);
555555
addObjects(data.other_objects, ObjectInfo::FURTHER_THAN_GOAL);
556556
addObjects(data.other_objects, ObjectInfo::TOO_NEAR_TO_CENTERLINE);
557+
addObjects(data.other_objects, ObjectInfo::HUGE_COVARIANCE);
557558
addObjects(data.other_objects, ObjectInfo::IS_NOT_PARKING_OBJECT);
558559
addObjects(data.other_objects, ObjectInfo::MOVING_OBJECT);
559560
addObjects(data.other_objects, ObjectInfo::CROSSWALK_USER);

planning/behavior_path_avoidance_module/src/manager.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ void AvoidanceModuleManager::updateModuleParams(const std::vector<rclcpp::Parame
103103
updateParam<double>(
104104
parameters, ns + "object_check_return_pose_distance", p->object_check_return_pose_distance);
105105
updateParam<double>(parameters, ns + "max_compensation_time", p->object_last_seen_threshold);
106+
updateParam<double>(
107+
parameters, ns + "th_error_eclipse_long_radius", p->th_error_eclipse_long_radius);
106108
}
107109

108110
{

planning/behavior_path_avoidance_module/src/utils.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "behavior_path_planner_common/utils/path_utils.hpp"
2222
#include "behavior_path_planner_common/utils/traffic_light_utils.hpp"
2323

24+
#include <Eigen/Dense>
2425
#include <lanelet2_extension/utility/message_conversion.hpp>
2526

2627
#include <boost/geometry/algorithms/buffer.hpp>
@@ -337,6 +338,24 @@ bool isWithinIntersection(
337338
object_polygon, utils::toPolygon2d(lanelet::utils::to2D(polygon.basicPolygon())));
338339
}
339340

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+
340359
bool isOnEgoLane(const ObjectData & object, const std::shared_ptr<RouteHandler> & route_handler)
341360
{
342361
const auto & object_pos = object.object.kinematics.initial_pose_with_covariance.pose.position;
@@ -737,6 +756,12 @@ bool isSatisfiedWithCommonCondition(
737756
return false;
738757
}
739758

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+
740765
// Step3. filtered by longitudinal distance.
741766
const auto & ego_pos = planner_data->self_odometry->pose.pose.position;
742767
fillLongitudinalAndLengthByClosestEnvelopeFootprint(data.reference_path_rough, ego_pos, object);

0 commit comments

Comments
 (0)