Skip to content

Commit e54b3e1

Browse files
authored
Merge branch 'main' into RT1-8920-revise-current-lane-objects-filtering
2 parents 400eecf + d4ced2a commit e54b3e1

File tree

23 files changed

+80
-86
lines changed

23 files changed

+80
-86
lines changed

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/base_class.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "autoware/behavior_path_lane_change_module/structs/debug.hpp"
1919
#include "autoware/behavior_path_lane_change_module/structs/path.hpp"
2020
#include "autoware/behavior_path_lane_change_module/utils/utils.hpp"
21+
#include "autoware/behavior_path_planner_common/data_manager.hpp"
2122
#include "autoware/behavior_path_planner_common/interface/scene_module_interface.hpp"
2223
#include "autoware/behavior_path_planner_common/turn_signal_decider.hpp"
2324
#include "autoware/behavior_path_planner_common/utils/path_shifter/path_shifter.hpp"
@@ -38,6 +39,7 @@
3839
class TestNormalLaneChange;
3940
namespace autoware::behavior_path_planner
4041
{
42+
using autoware::behavior_path_planner::PoseWithDetailOpt;
4143
using autoware::route_handler::Direction;
4244
using autoware::universe_utils::StopWatch;
4345
using geometry_msgs::msg::Point;
@@ -222,7 +224,7 @@ class LaneChangeBase
222224
return direction_;
223225
}
224226

225-
std::optional<Pose> getStopPose() const { return lane_change_stop_pose_; }
227+
PoseWithDetailOpt getStopPose() const { return lane_change_stop_pose_; }
226228

227229
void resetStopPose() { lane_change_stop_pose_ = std::nullopt; }
228230

@@ -282,7 +284,7 @@ class LaneChangeBase
282284
lane_change::CommonDataPtr common_data_ptr_;
283285
FilteredLanesObjects filtered_objects_{};
284286
BehaviorModuleOutput prev_module_output_{};
285-
std::optional<Pose> lane_change_stop_pose_{std::nullopt};
287+
PoseWithDetailOpt lane_change_stop_pose_{std::nullopt};
286288

287289
PathWithLaneId prev_approved_path_;
288290

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/scene.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "autoware/behavior_path_lane_change_module/structs/data.hpp"
1919

2020
#include <memory>
21+
#include <string>
2122
#include <utility>
2223
#include <vector>
2324

@@ -157,7 +158,8 @@ class NormalLaneChange : public LaneChangeBase
157158

158159
bool check_prepare_phase() const;
159160

160-
void set_stop_pose(const double arc_length_to_stop_pose, PathWithLaneId & path);
161+
void set_stop_pose(
162+
const double arc_length_to_stop_pose, PathWithLaneId & path, const std::string & reason = "");
161163

162164
void updateStopTime();
163165

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/structs/debug.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct Debug
4545
double distance_to_end_of_current_lane{std::numeric_limits<double>::max()};
4646
double distance_to_lane_change_finished{std::numeric_limits<double>::max()};
4747
double distance_to_abort_finished{std::numeric_limits<double>::max()};
48-
bool is_able_to_return_to_current_lane{false};
48+
bool is_able_to_return_to_current_lane{true};
4949
bool is_stuck{false};
5050
bool is_abort{false};
5151

@@ -69,7 +69,7 @@ struct Debug
6969
distance_to_end_of_current_lane = std::numeric_limits<double>::max();
7070
distance_to_lane_change_finished = std::numeric_limits<double>::max();
7171
distance_to_abort_finished = std::numeric_limits<double>::max();
72-
is_able_to_return_to_current_lane = false;
72+
is_able_to_return_to_current_lane = true;
7373
is_stuck = false;
7474
is_abort = false;
7575
}

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<depend>autoware_motion_utils</depend>
2727
<depend>autoware_rtc_interface</depend>
2828
<depend>autoware_universe_utils</depend>
29+
<depend>fmt</depend>
2930
<depend>pluginlib</depend>
3031
<depend>range-v3</depend>
3132
<depend>rclcpp</depend>

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/interface.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ BehaviorModuleOutput LaneChangeInterface::plan()
111111
path_reference_ = std::make_shared<PathWithLaneId>(output.reference_path);
112112
*prev_approved_path_ = getPreviousModuleOutput().path;
113113

114-
const auto stop_pose_opt = module_type_->getStopPose();
115-
stop_pose_ = stop_pose_opt.has_value() ? PoseWithDetailOpt(PoseWithDetail(stop_pose_opt.value()))
116-
: PoseWithDetailOpt();
114+
stop_pose_ = module_type_->getStopPose();
117115

118116
const auto & lane_change_debug = module_type_->getDebugData();
119117
for (const auto & [uuid, data] : lane_change_debug.collision_check_objects_after_approval) {
@@ -171,9 +169,7 @@ BehaviorModuleOutput LaneChangeInterface::planWaitingApproval()
171169
}
172170

173171
path_reference_ = std::make_shared<PathWithLaneId>(out.reference_path);
174-
const auto stop_pose_opt = module_type_->getStopPose();
175-
stop_pose_ = stop_pose_opt.has_value() ? PoseWithDetailOpt(PoseWithDetail(stop_pose_opt.value()))
176-
: PoseWithDetailOpt();
172+
stop_pose_ = module_type_->getStopPose();
177173

178174
if (!module_type_->isValidPath()) {
179175
path_candidate_ = std::make_shared<PathWithLaneId>();

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/scene.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ BehaviorModuleOutput NormalLaneChange::generateOutput()
408408
output.path.points, output.path.points.front().point.pose.position, getEgoPosition());
409409
const auto stop_dist =
410410
-(current_velocity * current_velocity / (2.0 * planner_data_->parameters.min_acc));
411-
set_stop_pose(stop_dist + current_dist, output.path);
411+
set_stop_pose(stop_dist + current_dist, output.path, "incoming rear object");
412412
} else {
413413
insert_stop_point(get_target_lanes(), output.path);
414414
}
@@ -471,7 +471,7 @@ void NormalLaneChange::insert_stop_point(
471471
if (!is_current_lane) {
472472
const auto arc_length_to_stop_pose = motion_utils::calcArcLength(path.points) -
473473
common_data_ptr_->transient_data.next_dist_buffer.min;
474-
set_stop_pose(arc_length_to_stop_pose, path);
474+
set_stop_pose(arc_length_to_stop_pose, path, "next lc terminal");
475475
return;
476476
}
477477

@@ -514,10 +514,11 @@ void NormalLaneChange::insert_stop_point_on_current_lanes(PathWithLaneId & path)
514514

515515
const auto dist_to_terminal_stop = std::min(dist_to_terminal_start, distance_to_last_fit_width);
516516

517+
const auto terminal_stop_reason = status_.is_valid_path ? "no safe path" : "no valid path";
517518
if (
518519
filtered_objects_.current_lane.empty() ||
519520
!lane_change_parameters_->enable_stopped_vehicle_buffer) {
520-
set_stop_pose(dist_to_terminal_stop, path);
521+
set_stop_pose(dist_to_terminal_stop, path, terminal_stop_reason);
521522
return;
522523
}
523524

@@ -543,12 +544,12 @@ void NormalLaneChange::insert_stop_point_on_current_lanes(PathWithLaneId & path)
543544
const auto stop_arc_length_behind_obj = arc_length_to_current_obj - stop_margin;
544545

545546
if (stop_arc_length_behind_obj < dist_to_target_lane_start) {
546-
set_stop_pose(dist_to_target_lane_start, path);
547+
set_stop_pose(dist_to_target_lane_start, path, "maintain distance to front object");
547548
return;
548549
}
549550

550551
if (stop_arc_length_behind_obj > dist_to_terminal_stop) {
551-
set_stop_pose(dist_to_terminal_stop, path);
552+
set_stop_pose(dist_to_terminal_stop, path, terminal_stop_reason);
552553
return;
553554
}
554555

@@ -564,11 +565,11 @@ void NormalLaneChange::insert_stop_point_on_current_lanes(PathWithLaneId & path)
564565
filtered_objects_.target_lane_leading, stop_arc_length_behind_obj, path);
565566

566567
if (has_blocking_target_lane_obj || stop_arc_length_behind_obj <= 0.0) {
567-
set_stop_pose(dist_to_terminal_stop, path);
568+
set_stop_pose(dist_to_terminal_stop, path, terminal_stop_reason);
568569
return;
569570
}
570571

571-
set_stop_pose(stop_arc_length_behind_obj, path);
572+
set_stop_pose(stop_arc_length_behind_obj, path, "maintain distance to front object");
572573
}
573574

574575
PathWithLaneId NormalLaneChange::getReferencePath() const
@@ -1684,10 +1685,11 @@ bool NormalLaneChange::is_ego_stuck() const
16841685
return has_object_blocking;
16851686
}
16861687

1687-
void NormalLaneChange::set_stop_pose(const double arc_length_to_stop_pose, PathWithLaneId & path)
1688+
void NormalLaneChange::set_stop_pose(
1689+
const double arc_length_to_stop_pose, PathWithLaneId & path, const std::string & reason)
16881690
{
16891691
const auto stop_point = utils::insertStopPoint(arc_length_to_stop_pose, path);
1690-
lane_change_stop_pose_ = stop_point.point.pose;
1692+
lane_change_stop_pose_ = PoseWithDetailOpt(PoseWithDetail(stop_point.point.pose, reason));
16911693
}
16921694

16931695
void NormalLaneChange::updateStopTime()

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/utils/markers.cpp

+19-35
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
#include <visualization_msgs/msg/detail/marker__struct.hpp>
2626
#include <visualization_msgs/msg/detail/marker_array__struct.hpp>
2727

28+
#include <fmt/format.h>
29+
2830
#include <algorithm>
2931
#include <cstdint>
3032
#include <cstdlib>
31-
#include <sstream>
3233
#include <string>
3334
#include <vector>
3435

@@ -52,27 +53,6 @@ MarkerArray showAllValidLaneChangePath(
5253
const auto loop_size = std::min(lane_change_paths.size(), colors.size());
5354
marker_array.markers.reserve(loop_size);
5455

55-
const auto info_prep_to_string =
56-
[](const autoware::behavior_path_planner::lane_change::Info & info) -> std::string {
57-
std::ostringstream ss_text;
58-
ss_text << std::setprecision(3) << "vel: " << info.velocity.prepare
59-
<< "[m/s] | lon_acc: " << info.longitudinal_acceleration.prepare
60-
<< "[m/s2] | t: " << info.duration.prepare << "[s] | L: " << info.length.prepare
61-
<< "[m]";
62-
return ss_text.str();
63-
};
64-
65-
const auto info_lc_to_string =
66-
[](const autoware::behavior_path_planner::lane_change::Info & info) -> std::string {
67-
std::ostringstream ss_text;
68-
ss_text << std::setprecision(3) << "vel: " << info.velocity.lane_changing
69-
<< "[m/s] | lon_acc: " << info.longitudinal_acceleration.lane_changing
70-
<< "[m/s2] | lat_acc: " << info.lateral_acceleration
71-
<< "[m/s2] | t: " << info.duration.lane_changing
72-
<< "[s] | L: " << info.length.lane_changing << "[m]";
73-
return ss_text.str();
74-
};
75-
7656
for (std::size_t idx = 0; idx < loop_size; ++idx) {
7757
int32_t id{0};
7858
const auto & lc_path = lane_change_paths.at(idx);
@@ -91,19 +71,30 @@ MarkerArray showAllValidLaneChangePath(
9171
marker.points.push_back(point.point.pose.position);
9272
}
9373

74+
const auto & info = lc_path.info;
9475
auto text_marker = createDefaultMarker(
9576
"map", current_time, ns_with_idx, ++id, visualization_msgs::msg::Marker::TEXT_VIEW_FACING,
9677
createMarkerScale(0.1, 0.1, 0.8), colors::yellow());
9778
const auto prep_idx = points.size() / 4;
9879
text_marker.pose = points.at(prep_idx).point.pose;
9980
text_marker.pose.position.z += 2.0;
100-
text_marker.text = info_prep_to_string(lc_path.info);
81+
text_marker.text = fmt::format(
82+
"vel: {vel:.3f}[m/s] | lon_acc: {lon_acc:.3f}[m/s2] | t: {time:.3f}[s] | L: {length:.3f}[m]",
83+
fmt::arg("vel", info.velocity.prepare),
84+
fmt::arg("lon_acc", info.longitudinal_acceleration.prepare),
85+
fmt::arg("time", info.duration.prepare), fmt::arg("length", info.length.prepare));
10186
marker_array.markers.push_back(text_marker);
10287

10388
const auto lc_idx = points.size() / 2;
10489
text_marker.id = ++id;
10590
text_marker.pose = points.at(lc_idx).point.pose;
106-
text_marker.text = info_lc_to_string(lc_path.info);
91+
text_marker.text = fmt::format(
92+
"vel: {vel:.3f}[m/s] | lon_acc: {lon_acc:.3f}[m/s2] | lat_acc: {lat_acc:.3f}[m/s2] | t: "
93+
"{time:.3f}[s] | L: {length:.3f}[m]",
94+
fmt::arg("vel", info.velocity.lane_changing),
95+
fmt::arg("lon_acc", info.longitudinal_acceleration.lane_changing),
96+
fmt::arg("lat_acc", info.lateral_acceleration), fmt::arg("time", info.duration.lane_changing),
97+
fmt::arg("length", info.length.lane_changing));
10798
marker_array.markers.push_back(text_marker);
10899

109100
marker_array.markers.push_back(marker);
@@ -186,17 +177,10 @@ MarkerArray showExecutionInfo(const Debug & debug_data, const geometry_msgs::msg
186177
safety_check_info_text.pose = ego_pose;
187178
safety_check_info_text.pose.position.z += 4.0;
188179

189-
std::ostringstream ss;
190-
191-
ss << "\nDistToEndOfCurrentLane: " << std::setprecision(5)
192-
<< debug_data.distance_to_end_of_current_lane
193-
<< "\nDistToLaneChangeFinished: " << debug_data.distance_to_lane_change_finished
194-
<< (debug_data.is_stuck ? "\nVehicleStuck" : "")
195-
<< (debug_data.is_able_to_return_to_current_lane ? "\nAbleToReturnToCurrentLane" : "")
196-
<< (debug_data.is_abort ? "\nAborting" : "")
197-
<< "\nDistanceToAbortFinished: " << debug_data.distance_to_abort_finished;
198-
199-
safety_check_info_text.text = ss.str();
180+
safety_check_info_text.text = fmt::format(
181+
"{stuck} | {return_lane} | {abort}", fmt::arg("stuck", debug_data.is_stuck ? "is stuck" : ""),
182+
fmt::arg("return_lane", debug_data.is_able_to_return_to_current_lane ? "" : "can't return"),
183+
fmt::arg("abort", debug_data.is_abort ? "aborting" : ""));
200184
marker_array.markers.push_back(safety_check_info_text);
201185
return marker_array;
202186
}

planning/behavior_velocity_planner/autoware_behavior_velocity_crosswalk_module/package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
<depend>autoware_behavior_velocity_planner_common</depend>
2525
<depend>autoware_grid_map_utils</depend>
26+
<depend>autoware_internal_debug_msgs</depend>
2627
<depend>autoware_interpolation</depend>
2728
<depend>autoware_lanelet2_extension</depend>
2829
<depend>autoware_motion_utils</depend>
@@ -41,7 +42,6 @@
4142
<depend>pluginlib</depend>
4243
<depend>rclcpp</depend>
4344
<depend>sensor_msgs</depend>
44-
<depend>tier4_debug_msgs</depend>
4545
<depend>visualization_msgs</depend>
4646

4747
<test_depend>ament_cmake_ros</test_depend>

planning/behavior_velocity_planner/autoware_behavior_velocity_crosswalk_module/scripts/time_to_collision_plotter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
from copy import deepcopy
2020

2121
from ament_index_python.packages import get_package_share_directory
22+
from autoware_internal_debug_msgs.msg import StringStamped
2223
import matplotlib.pyplot as plt
2324
import rclpy
2425
from rclpy.node import Node
25-
from tier4_debug_msgs.msg import StringStamped
2626
import yaml
2727

2828

planning/behavior_velocity_planner/autoware_behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ StopFactor createStopFactor(
153153
return stop_factor;
154154
}
155155

156-
tier4_debug_msgs::msg::StringStamped createStringStampedMessage(
156+
autoware_internal_debug_msgs::msg::StringStamped createStringStampedMessage(
157157
const rclcpp::Time & now, const int64_t module_id_,
158158
const std::vector<std::tuple<std::string, CollisionPoint, CollisionState>> & collision_points)
159159
{
160-
tier4_debug_msgs::msg::StringStamped msg;
160+
autoware_internal_debug_msgs::msg::StringStamped msg;
161161
msg.stamp = now;
162162
for (const auto & collision_point : collision_points) {
163163
std::stringstream ss;
@@ -199,8 +199,8 @@ CrosswalkModule::CrosswalkModule(
199199

200200
road_ = lanelet_map_ptr->laneletLayer.get(lane_id);
201201

202-
collision_info_pub_ =
203-
node.create_publisher<tier4_debug_msgs::msg::StringStamped>("~/debug/collision_info", 1);
202+
collision_info_pub_ = node.create_publisher<autoware_internal_debug_msgs::msg::StringStamped>(
203+
"~/debug/collision_info", 1);
204204
}
205205

206206
bool CrosswalkModule::modifyPathVelocity(PathWithLaneId * path)

planning/behavior_velocity_planner/autoware_behavior_velocity_crosswalk_module/src/scene_crosswalk.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
#include <autoware_lanelet2_extension/regulatory_elements/crosswalk.hpp>
2424
#include <rclcpp/rclcpp.hpp>
2525

26+
#include <autoware_internal_debug_msgs/msg/string_stamped.hpp>
2627
#include <autoware_perception_msgs/msg/predicted_objects.hpp>
2728
#include <sensor_msgs/msg/point_cloud2.hpp>
28-
#include <tier4_debug_msgs/msg/string_stamped.hpp>
2929

3030
#include <boost/assert.hpp>
3131
#include <boost/assign/list_of.hpp>
@@ -456,7 +456,8 @@ class CrosswalkModule : public SceneModuleInterface
456456

457457
const int64_t module_id_;
458458

459-
rclcpp::Publisher<tier4_debug_msgs::msg::StringStamped>::SharedPtr collision_info_pub_;
459+
rclcpp::Publisher<autoware_internal_debug_msgs::msg::StringStamped>::SharedPtr
460+
collision_info_pub_;
460461

461462
lanelet::ConstLanelet crosswalk_;
462463

planning/behavior_velocity_planner/autoware_behavior_velocity_intersection_module/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<buildtool_depend>autoware_cmake</buildtool_depend>
2121

2222
<depend>autoware_behavior_velocity_planner_common</depend>
23+
<depend>autoware_internal_debug_msgs</depend>
2324
<depend>autoware_interpolation</depend>
2425
<depend>autoware_lanelet2_extension</depend>
2526
<depend>autoware_motion_utils</depend>

planning/behavior_velocity_planner/autoware_behavior_velocity_intersection_module/scripts/ttc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
import time
2323

2424
from PIL import Image
25+
from autoware_internal_debug_msgs.msg import Float64MultiArrayStamped
2526
import imageio
2627
import matplotlib
2728
import matplotlib.pyplot as plt
2829
import numpy as np
2930
import rclpy
3031
from rclpy.node import Node
31-
from tier4_debug_msgs.msg import Float64MultiArrayStamped
3232

3333
matplotlib.use("TKAgg")
3434

planning/behavior_velocity_planner/autoware_behavior_velocity_intersection_module/src/scene_intersection.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ IntersectionModule::IntersectionModule(
8888
static_occlusion_timeout_state_machine_.setState(StateMachine::State::STOP);
8989
}
9090

91-
ego_ttc_pub_ = node.create_publisher<tier4_debug_msgs::msg::Float64MultiArrayStamped>(
91+
ego_ttc_pub_ = node.create_publisher<autoware_internal_debug_msgs::msg::Float64MultiArrayStamped>(
9292
"~/debug/intersection/ego_ttc", 1);
93-
object_ttc_pub_ = node.create_publisher<tier4_debug_msgs::msg::Float64MultiArrayStamped>(
94-
"~/debug/intersection/object_ttc", 1);
93+
object_ttc_pub_ =
94+
node.create_publisher<autoware_internal_debug_msgs::msg::Float64MultiArrayStamped>(
95+
"~/debug/intersection/object_ttc", 1);
9596
}
9697

9798
bool IntersectionModule::modifyPathVelocity(PathWithLaneId * path)
@@ -231,7 +232,7 @@ DecisionResult IntersectionModule::modifyPathVelocityDetail(PathWithLaneId * pat
231232
// calculate the expected vehicle speed and obtain the spatiotemporal profile of ego to the
232233
// exit of intersection
233234
// ==========================================================================================
234-
tier4_debug_msgs::msg::Float64MultiArrayStamped ego_ttc_time_array;
235+
autoware_internal_debug_msgs::msg::Float64MultiArrayStamped ego_ttc_time_array;
235236
const auto time_distance_array =
236237
calcIntersectionPassingTime(*path, is_prioritized, intersection_stoplines, &ego_ttc_time_array);
237238

@@ -240,7 +241,7 @@ DecisionResult IntersectionModule::modifyPathVelocityDetail(PathWithLaneId * pat
240241
// passed each pass judge line for the first time, save current collision status for late
241242
// diagnosis
242243
// ==========================================================================================
243-
tier4_debug_msgs::msg::Float64MultiArrayStamped object_ttc_time_array;
244+
autoware_internal_debug_msgs::msg::Float64MultiArrayStamped object_ttc_time_array;
244245
updateObjectInfoManagerCollision(
245246
path_lanelets, time_distance_array, traffic_prioritized_level, safely_passed_1st_judge_line,
246247
safely_passed_2nd_judge_line, &object_ttc_time_array);

0 commit comments

Comments
 (0)