Skip to content

Commit 8680662

Browse files
committed
tmp save.
1 parent e3f4a49 commit 8680662

File tree

6 files changed

+122
-3
lines changed

6 files changed

+122
-3
lines changed

Diff for: evaluator/autoware_planning_evaluator/config/planning_evaluator.param.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
- modified_goal_longitudinal_deviation
2525
- modified_goal_lateral_deviation
2626
- modified_goal_yaw_deviation
27+
28+
selected_counters:
29+
- stop_count
30+
- abnormal_stop_count
2731

2832
trajectory:
2933
min_point_dist_m: 0.1 # [m] minimum distance between two successive points to use for angle calculation
@@ -34,3 +38,49 @@
3438

3539
obstacle:
3640
dist_thr_m: 1.0 # [m] distance between ego and the obstacle below which a collision is considered
41+
42+
planning_factor_counters:
43+
topic_prefix: /planning/planning_factors/
44+
stop_count:
45+
time_threshold_s: 5.0 # [s] time threshold for a stop to be considered as the new one
46+
dist_threshold_m: 5.0 # [m] distance threshold for a stop to be considered as the new one
47+
abnormal_deceleration_threshold: 2.0 # [m/s^2] deceleration threshold for a stop to be considered as abnormal
48+
module_list: # list of modules to be checked for stop deciation.
49+
- avoidance_by_lane_change
50+
- behavior_path_planner
51+
- blind_spot
52+
- crosswalk
53+
- detection_area
54+
- dynamic_obstacle_avoidance
55+
- dynamic_obstacle_stop
56+
- goal_planner
57+
- intersection
58+
- lane_change_left
59+
- lane_change_right
60+
- motion_velocity_planner
61+
- merge_from_private
62+
- no_drivable_lane
63+
- no_stopping_area
64+
- obstacle_cruise
65+
- obstacle_cruise_planner
66+
- obstacle_slow_down
67+
- obstacle_stop
68+
- obstacle_stop_planner
69+
- occlusion_spot
70+
- out_of_lane
71+
- run_out
72+
- side_shift
73+
- start_planner
74+
- static_obstacle_avoidance
75+
- stop_line
76+
- surround_obstacle_checker
77+
- traffic_light
78+
- virtual_traffic_light
79+
- walkway
80+
81+
# TODO:
82+
# 用一个metrics_counter.cpp/hpp,写一个大类,包含各种validate(或者自己counter,返回有效和无效即可)和所需参数。
83+
# 在metrics_counter中为所有类以及两种stop,制造两个列表:一个列表:里面是structure保存上一个stop的时间地点和计数值。另一个列表是int,保存计数值。
84+
85+
# 写一个onPlanningFactor的类,收集各factor并用metrics_counter验证记入成功或失败。
86+
# ?是否需要publish当前的counter?或者publish counter成功/失败?

Diff for: evaluator/autoware_planning_evaluator/include/autoware/planning_evaluator/metrics/metric.hpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ enum class Metric {
4747
modified_goal_longitudinal_deviation,
4848
modified_goal_lateral_deviation,
4949
modified_goal_yaw_deviation,
50+
stop_count,
51+
abnormal_stop_count,
5052
SIZE,
5153
};
5254

@@ -74,7 +76,10 @@ static const std::unordered_map<std::string, Metric> str_to_metric = {
7476
{"obstacle_ttc", Metric::obstacle_ttc},
7577
{"modified_goal_longitudinal_deviation", Metric::modified_goal_longitudinal_deviation},
7678
{"modified_goal_lateral_deviation", Metric::modified_goal_lateral_deviation},
77-
{"modified_goal_yaw_deviation", Metric::modified_goal_yaw_deviation}};
79+
{"modified_goal_yaw_deviation", Metric::modified_goal_yaw_deviation},
80+
{"stop_count", Metric::stop_count},
81+
{"abnormal_stop_count", Metric::abnormal_stop_count}
82+
};
7883

7984
static const std::unordered_map<Metric, std::string> metric_to_str = {
8085
{Metric::curvature, "curvature"},
@@ -97,7 +102,10 @@ static const std::unordered_map<Metric, std::string> metric_to_str = {
97102
{Metric::obstacle_ttc, "obstacle_ttc"},
98103
{Metric::modified_goal_longitudinal_deviation, "modified_goal_longitudinal_deviation"},
99104
{Metric::modified_goal_lateral_deviation, "modified_goal_lateral_deviation"},
100-
{Metric::modified_goal_yaw_deviation, "modified_goal_yaw_deviation"}};
105+
{Metric::modified_goal_yaw_deviation, "modified_goal_yaw_deviation"},
106+
{Metric::stop_count, "stop_count"},
107+
{Metric::abnormal_stop_count, "abnormal_stop_count"}
108+
};
101109

102110
// Metrics descriptions
103111
static const std::unordered_map<Metric, std::string> metric_descriptions = {
@@ -121,7 +129,10 @@ static const std::unordered_map<Metric, std::string> metric_descriptions = {
121129
{Metric::obstacle_ttc, "Obstacle_time_to_collision[s]"},
122130
{Metric::modified_goal_longitudinal_deviation, "Modified_goal_longitudinal_deviation[m]"},
123131
{Metric::modified_goal_lateral_deviation, "Modified_goal_lateral_deviation[m]"},
124-
{Metric::modified_goal_yaw_deviation, "Modified_goal_yaw_deviation[rad]"}};
132+
{Metric::modified_goal_yaw_deviation, "Modified_goal_yaw_deviation[rad]"},
133+
{Metric::stop_count, "Count of stop decisions made by each module"},
134+
{Metric::abnormal_stop_count, "Count of abnormal stop decisions made by each module"}
135+
};
125136

126137
namespace details
127138
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2025 Tier IV, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef AUTOWARE__PLANNING_EVALUATOR__METRICS_COUNTER_HPP_
16+
#define AUTOWARE__PLANNING_EVALUATOR__METRICS_COUNTER_HPP_
17+
#include "autoware/planning_evaluator/metrics/metric.hpp"
18+
#include "autoware/planning_evaluator/parameters.hpp"
19+
#include "autoware_utils/math/accumulator.hpp"
20+
21+
namespace planning_diagnostics
22+
{
23+
using autoware_utils::Accumulator;
24+
25+
class MetricsCounter
26+
{
27+
}
28+
29+
} // namespace planning_diagnostics
30+
31+
#endif // AUTOWARE__PLANNING_EVALUATOR__METRICS_COUNTER_HPP_

Diff for: evaluator/autoware_planning_evaluator/include/autoware/planning_evaluator/planning_evaluator_node.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "geometry_msgs/msg/accel_with_covariance_stamped.hpp"
3434
#include "nav_msgs/msg/odometry.hpp"
3535
#include <autoware_internal_debug_msgs/msg/float64_stamped.hpp>
36+
#include <autoware_internal_planning_msgs/msg/planning_factor.hpp>
37+
#include <autoware_internal_planning_msgs/msg/planning_factor_array.hpp>
3638
#include <autoware_planning_msgs/msg/lanelet_route.hpp>
3739
#include <tier4_metric_msgs/msg/metric.hpp>
3840
#include <tier4_metric_msgs/msg/metric_array.hpp>
@@ -41,6 +43,8 @@
4143
#include <deque>
4244
#include <memory>
4345
#include <string>
46+
#include <unordered_map>
47+
#include <unordered_set>
4448
#include <vector>
4549
namespace planning_diagnostics
4650
{
@@ -54,6 +58,8 @@ using MetricMsg = tier4_metric_msgs::msg::Metric;
5458
using MetricArrayMsg = tier4_metric_msgs::msg::MetricArray;
5559
using nav_msgs::msg::Odometry;
5660
using LaneletMapBin = autoware_map_msgs::msg::LaneletMapBin;
61+
using autoware_internal_planning_msgs::msg::PlanningFactor;
62+
using autoware_internal_planning_msgs::msg::PlanningFactorArray;
5763
using autoware_planning_msgs::msg::LaneletRoute;
5864
using geometry_msgs::msg::AccelWithCovarianceStamped;
5965
/**
@@ -114,6 +120,10 @@ class PlanningEvaluatorNode : public rclcpp::Node
114120
void AddKinematicStateMetricMsg(
115121
const AccelWithCovarianceStamped & accel_stamped, const Odometry::ConstSharedPtr ego_state_ptr);
116122

123+
void AddStopCountMetricMsg(
124+
const PlanningFactorArray::ConstSharedPtr & planning_factors,
125+
const Odometry::ConstSharedPtr ego_state_ptr, const std::string & module_name);
126+
117127
private:
118128
static bool isFinite(const TrajectoryPoint & p);
119129

Diff for: evaluator/autoware_planning_evaluator/package.xml

+2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
<buildtool_depend>ament_cmake_auto</buildtool_depend>
1515
<buildtool_depend>autoware_cmake</buildtool_depend>
1616

17+
<depend>autoware_internal_planning_msgs</depend>
1718
<depend>autoware_motion_utils</depend>
1819
<depend>autoware_perception_msgs</depend>
1920
<depend>autoware_planning_msgs</depend>
21+
<depend>autoware_planning_factor_interface</depend>
2022
<depend>autoware_route_handler</depend>
2123
<depend>autoware_utils</depend>
2224
<depend>autoware_vehicle_info_utils</depend>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2025 Tier IV, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "autoware/planning_evaluator/metrics_counter.hpp"

0 commit comments

Comments
 (0)