Skip to content

Commit 5be3e19

Browse files
Add diff th param
Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
1 parent 95351eb commit 5be3e19

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/config/lane_change.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
# trajectory generation near terminal using frenet planner
3434
frenet:
3535
enable: true
36+
th_yaw_diff: 10.0 # [deg]
3637

3738
# safety check
3839
safety_check:

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

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ struct SafetyParameters
116116
struct FrenetPlannerParameters
117117
{
118118
bool enable{true};
119+
double th_yaw_diff_deg{10.0};
119120
};
120121

121122
struct TrajectoryParameters

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/utils/path.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ LaneChangePath get_candidate_path(
9595
* if the path fails any constraints.
9696
*/
9797
LaneChangePath construct_candidate_path(
98-
const LaneChangeInfo & lane_change_info, const PathWithLaneId & prepare_segment,
99-
const PathWithLaneId & target_lane_reference_path,
98+
const LaneChangeInfo & lane_change_info, const CommonDataPtr & common_data_ptr,
99+
const PathWithLaneId & prepare_segment, const PathWithLaneId & target_lane_reference_path,
100100
const std::vector<std::vector<int64_t>> & sorted_lane_ids);
101101

102102
/// @brief generate lane change candidate paths using the Frenet planner

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/manager.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ LCParamPtr LaneChangeModuleManager::set_params(rclcpp::Node * node, const std::s
212212
*node, parameter("delay_lane_change.th_parked_vehicle_shift_ratio"));
213213

214214
// trajectory generation near terminal using frenet planner
215-
p.frenet.enable =
216-
getOrDeclareParameter<bool>(*node, parameter("frenet.enable"));
215+
p.frenet.enable = getOrDeclareParameter<bool>(*node, parameter("frenet.enable"));
217216

218217
// lane change cancel
219218
p.cancel.enable_on_prepare_phase =

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/scene.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
#include <boost/geometry/algorithms/buffer.hpp>
4343

44-
#include <fmt/format.h>
4544
#include <lanelet2_core/geometry/Point.h>
4645
#include <lanelet2_core/geometry/Polygon.h>
4746
#include <lanelet2_core/primitives/LineString.h>

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

+13-10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <range/v3/numeric/accumulate.hpp>
2929
#include <range/v3/view.hpp>
3030

31+
#include <fmt/format.h>
32+
3133
#include <algorithm>
3234
#include <limits>
3335
#include <vector>
@@ -302,12 +304,12 @@ LaneChangePath get_candidate_path(
302304
}
303305

304306
return utils::lane_change::construct_candidate_path(
305-
lane_change_info, prep_segment, target_lane_reference_path, sorted_lane_ids);
307+
lane_change_info, common_data_ptr, prep_segment, target_lane_reference_path, sorted_lane_ids);
306308
}
307309

308310
LaneChangePath construct_candidate_path(
309-
const LaneChangeInfo & lane_change_info, const PathWithLaneId & prepare_segment,
310-
const PathWithLaneId & target_lane_reference_path,
311+
const LaneChangeInfo & lane_change_info, const CommonDataPtr & common_data_ptr,
312+
const PathWithLaneId & prepare_segment, const PathWithLaneId & target_lane_reference_path,
311313
const std::vector<std::vector<int64_t>> & sorted_lane_ids)
312314
{
313315
const auto & shift_line = lane_change_info.shift_line;
@@ -343,14 +345,15 @@ LaneChangePath construct_candidate_path(
343345
point.lane_ids = target_lane_reference_path.points.at(*nearest_idx).lane_ids;
344346
}
345347

346-
constexpr auto yaw_diff_th = autoware::universe_utils::deg2rad(5.0);
348+
const auto th_yaw_diff_deg = common_data_ptr->lc_param_ptr->frenet.th_yaw_diff_deg;
347349
if (
348-
const auto yaw_diff_opt =
349-
exceed_yaw_threshold(prepare_segment, shifted_path.path, yaw_diff_th)) {
350-
std::stringstream err_msg;
351-
err_msg << "Excessive yaw difference " << yaw_diff_opt.value() << " which exceeds the "
352-
<< yaw_diff_th << " radian threshold.";
353-
throw std::logic_error(err_msg.str());
350+
const auto yaw_diff_opt = exceed_yaw_threshold(
351+
prepare_segment, shifted_path.path, autoware::universe_utils::deg2rad(th_yaw_diff_deg))) {
352+
const auto yaw_diff_deg = autoware::universe_utils::rad2deg(yaw_diff_opt.value());
353+
const auto err_msg = fmt::format(
354+
"Excessive yaw difference {yaw_diff:2.2f}[deg]. The threshold is {th_yaw_diff:2.2f}[deg].",
355+
fmt::arg("yaw_diff", yaw_diff_deg), fmt::arg("th_yaw_diff", th_yaw_diff_deg));
356+
throw std::logic_error(err_msg);
354357
}
355358

356359
LaneChangePath candidate_path;

0 commit comments

Comments
 (0)