Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync upstream #328

Merged
merged 55 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9971be3
fix(avoidance): stop only when there is enough space to avoid (#3055)
satoshi-ota Mar 17, 2023
dd5c6ea
fix(system_error_monitor): fix dying node (#3103)
takayuki5168 Mar 17, 2023
104ebf7
fix(AEB): suppress build error (-Werror=pedantic) (#3108)
satoshi-ota Mar 17, 2023
a98e9e8
chore(ground_segmentation): add recheck ground cluster option param (…
badai-nguyen Mar 18, 2023
8501e13
fix(surround_obstacle_checker): remove unused include (#3084)
TakaHoribe Mar 19, 2023
4267add
build(autoware_testing): add missing dependencies (#3093)
esteve Mar 20, 2023
446e749
feat(traffic_light_classifier): add parameters to launch file for usi…
Zeysthingz Mar 20, 2023
8b95d2a
perf(motion_utils): improve performance of findNearestIndex (#3082)
TakanoTaiga Mar 20, 2023
14739a0
feat(elevation_map_loader): use polygon iterator to speed up (#2885)
miursh Mar 22, 2023
3d7ec33
feat(behavior_path_planner): visualize unavoidable target object (#3109)
takayuki5168 Mar 22, 2023
36bdca4
fix(planning_debug_tools): install perception_reproducer.py (#3105)
takayuki5168 Mar 22, 2023
61b9e1e
chore(ekf_localizer): move parameters to its dedicated yaml file (#3039)
VRichardJP Mar 22, 2023
9a2769e
fix(static_centerline_optimizer): avoid to call declear_parameter twi…
tkimura4 Mar 22, 2023
862b48a
feat(accel_brake_map_calibrator): add option to use actuation_cmd (#3…
tkimura4 Mar 22, 2023
6b436de
chore(tier4_localization_launch): add maintainer (#3133)
kminoda Mar 22, 2023
94073e9
feat(obstacle_avoidance_planner): visualize bounds (#3094)
takayuki5168 Mar 22, 2023
fcbb374
feat(lane change): support new framework external request (#3068)
zulfaqar-azmi-t4 Mar 23, 2023
de8cbdc
feat(planning_test_manager): add planning interface test manager for …
kyoichi-sugahara Mar 23, 2023
cf753f4
feat(rtc_manager_rviz_plugin): add avoidance by lc (#3118)
satoshi-ota Mar 23, 2023
731816b
feat(diagnostic_converter): apply regex for topic name (#3149)
takayuki5168 Mar 23, 2023
9a0a29d
fix(behavior_velocity_planner): fix detection area being ignored when…
mkuri Mar 23, 2023
aa2f265
feat(diagnostic_converter): remove unit and blank in the value (#3151)
takayuki5168 Mar 23, 2023
9d8c061
chore: update CODEOWNERS (#2976)
awf-autoware-bot[bot] Mar 23, 2023
1469f52
fix(static_centerline_optimizer): remove unnecessary files (#3154)
takayuki5168 Mar 23, 2023
7a72116
fix(behavior_path_planner): fix math formulation in doc (#3146)
takayuki5168 Mar 23, 2023
75f99c7
feat(tier4_control_launch): add check_external_emergency_heartbeat op…
takayuki5168 Mar 23, 2023
572f39e
feat(tier4_perception_rviz_plugin): add bicycle panel (#3157)
soblin Mar 23, 2023
9f58761
feat(behavior_path_planner): add distance explanation (#3158)
purewater0901 Mar 24, 2023
075b8f4
feat(blind_spot): revert 2279 and tighten detection condition (#3153)
soblin Mar 24, 2023
e0e2a60
chore(intersection): display intersection marker only when stopped (#…
soblin Mar 24, 2023
e6dfa18
feat(obstacle_avoidance_planner): consider behavior's drivable area v…
takayuki5168 Mar 24, 2023
84c72cd
fix(avoidance): fix shift line generation logic (#3099)
satoshi-ota Mar 24, 2023
8cc9e27
feat(tier4_simulator_launch): convert /diagnostics_err (#3152)
takayuki5168 Mar 24, 2023
319577a
chore: sync files (#2907)
awf-autoware-bot[bot] Mar 26, 2023
f5770cc
chore: sync files (#3163)
awf-autoware-bot[bot] Mar 27, 2023
d5d14af
refactor(mpc): remove unused file (#3164)
TakaHoribe Mar 27, 2023
49722f9
feat: add ByteTrack package (#3023)
manato Mar 27, 2023
b38eae6
refactor(mpc): remove old library dependency (#3165)
TakaHoribe Mar 27, 2023
efb43ab
refactor(pid_longitudinal_controller): remove unused dependency (#3167)
TakaHoribe Mar 27, 2023
d4708ce
feat(autonomous_emergency_braking): add maintainer (#3172)
purewater0901 Mar 27, 2023
798149a
chore: update CODEOWNERS (#3173)
awf-autoware-bot[bot] Mar 27, 2023
1e28f63
refactor(trajectory_follower_base): remove unused dependency (#3168)
TakaHoribe Mar 27, 2023
5a0a5bf
feat(autonomous_emergency_braking): add aeb document (#3171)
purewater0901 Mar 27, 2023
276f0f7
fix(mpc_lateral_controller): fix build error (#3178)
takayuki5168 Mar 27, 2023
b63806b
test(map_loader): add a ROS 2 test (#3170)
kminoda Mar 27, 2023
1a3b3f7
fix(lane_change): use previous module drivable lanes in drivable are …
satoshi-ota Mar 27, 2023
e00c636
feat(compare_map_segmentation): add dynamic map loading for voxel_bas…
badai-nguyen Mar 28, 2023
69c7cdc
fix(behavior_velocity_planner::intersection): show virtual wall when …
soblin Mar 28, 2023
1ef312b
fix(autonomous_emergency_braking): fix typo (#3186)
h-ohta Mar 28, 2023
1ed2648
fix(behavior_velocity_planner): fix invalid access (#3187)
takayuki5168 Mar 28, 2023
11e4fcb
chore: sync files (#3190)
awf-autoware-bot[bot] Mar 28, 2023
767d057
fix(map_loader): address deprecated warning for some environment (#3188)
kminoda Mar 28, 2023
763d1a2
chore(lidar_centerpoint): add a check between the model and config's …
knzo25 Mar 28, 2023
c1370ad
feat(motion_utils): add cropPoints function (#3176)
takayuki5168 Mar 28, 2023
07fa672
fix(behavior_path_planner): resample path in the route (#3179)
takayuki5168 Mar 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ common/rtc_manager_rviz_plugin/** [email protected] [email protected] @
common/signal_processing/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
common/tensorrt_common/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_api_utils/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_automatic_goal_rviz_plugin/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_autoware_utils/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_calibration_rviz_plugin/** [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_control_rviz_plugin/** [email protected] @autowarefoundation/autoware-global-codeowners
Expand All @@ -36,7 +37,7 @@ common/tier4_debug_rviz_plugin/** [email protected] @autowarefoundation/
common/tier4_debug_tools/** [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_localization_rviz_plugin/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_perception_rviz_plugin/** [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_planning_rviz_plugin/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_planning_rviz_plugin/** [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_screen_capture_rviz_plugin/** [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_simulated_clock_rviz_plugin/** [email protected] @autowarefoundation/autoware-global-codeowners
common/tier4_state_rviz_plugin/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
Expand All @@ -45,6 +46,7 @@ common/tier4_vehicle_rviz_plugin/** [email protected] @autowarefoundation/
common/time_utils/** [email protected] @autowarefoundation/autoware-global-codeowners
common/trtexec_vendor/** [email protected] @autowarefoundation/autoware-global-codeowners
common/tvm_utility/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
control/autonomous_emergency_braking/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
control/control_performance_analysis/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
control/external_cmd_selector/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
control/joy_controller/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
Expand All @@ -58,16 +60,18 @@ control/shift_decider/** [email protected] @autowarefoundation/autoware-g
control/trajectory_follower_base/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
control/trajectory_follower_node/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
control/vehicle_cmd_gate/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
evaluator/diagnostic_converter/** [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
evaluator/kinematic_evaluator/** [email protected] @autowarefoundation/autoware-global-codeowners
evaluator/localization_evaluator/** [email protected] @autowarefoundation/autoware-global-codeowners
evaluator/planning_evaluator/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_autoware_api_launch/** [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_control_launch/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_localization_launch/** [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_localization_launch/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_map_launch/** [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_perception_launch/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_planning_launch/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_sensing_launch/** [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_simulator_launch/** [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_simulator_launch/** [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_system_launch/** [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
launch/tier4_vehicle_launch/** [email protected] @autowarefoundation/autoware-global-codeowners
localization/ekf_localizer/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
Expand All @@ -83,6 +87,7 @@ map/map_height_fitter/** [email protected] [email protected] @autowarefou
map/map_loader/** [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
map/map_tf_generator/** [email protected] @autowarefoundation/autoware-global-codeowners
map/util/lanelet2_map_preprocessor/** [email protected] @autowarefoundation/autoware-global-codeowners
perception/bytetrack/** [email protected] @autowarefoundation/autoware-global-codeowners
perception/compare_map_segmentation/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
perception/crosswalk_traffic_light_estimator/** [email protected] @autowarefoundation/autoware-global-codeowners
perception/detected_object_feature_remover/** [email protected] @autowarefoundation/autoware-global-codeowners
Expand Down Expand Up @@ -112,22 +117,23 @@ perception/tensorrt_yolo/** [email protected] @autowarefoundation/auto
perception/tensorrt_yolox/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
perception/traffic_light_classifier/** [email protected] @autowarefoundation/autoware-global-codeowners
perception/traffic_light_map_based_detector/** [email protected] @autowarefoundation/autoware-global-codeowners
perception/traffic_light_selector/** [email protected] @autowarefoundation/autoware-global-codeowners
perception/traffic_light_ssd_fine_detector/** [email protected] @autowarefoundation/autoware-global-codeowners
perception/traffic_light_visualization/** [email protected] @autowarefoundation/autoware-global-codeowners
planning/behavior_path_planner/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/behavior_path_planner/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/behavior_velocity_planner/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/costmap_generator/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/external_velocity_limit_selector/** [email protected] [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/freespace_planner/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/freespace_planning_algorithms/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/mission_planner/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/motion_velocity_smoother/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/obstacle_avoidance_planner/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/obstacle_avoidance_planner/** [email protected] @autowarefoundation/autoware-global-codeowners
planning/obstacle_cruise_planner/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/obstacle_stop_planner/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/obstacle_velocity_limiter/** [email protected] @autowarefoundation/autoware-global-codeowners
planning/planning_debug_tools/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/planning_evaluator/** maxime.clement@tier4.jp @autowarefoundation/autoware-global-codeowners
planning/planning_test_utils/** kyoichi.sugahara@tier4.jp @autowarefoundation/autoware-global-codeowners
planning/planning_validator/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/route_handler/** [email protected] [email protected] [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
planning/rtc_auto_mode_manager/** [email protected] [email protected] @autowarefoundation/autoware-global-codeowners
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:

- name: Get modified files
id: get-modified-files
uses: tj-actions/changed-files@v34
uses: tj-actions/changed-files@v35
with:
files: |
**/*.cpp
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clang-tidy-pr-comments-manually.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
id: set-variables
run: |
echo ::set-output name=pr-id::"$(cat /tmp/clang-tidy-result/pr-id.txt)"
echo ::set-output name=pr-head-repo::"$(cat /tmp/clang-tidy-result/pr-head-repo.txt)"
echo ::set-output name=pr-head-ref::"$(cat /tmp/clang-tidy-result/pr-head-ref.txt)"
echo "pr-id=$(cat /tmp/clang-tidy-result/pr-id.txt)" >> $GITHUB_OUTPUT
echo "pr-head-repo=$(cat /tmp/clang-tidy-result/pr-head-repo.txt)" >> $GITHUB_OUTPUT
echo "pr-head-ref=$(cat /tmp/clang-tidy-result/pr-head-ref.txt)" >> $GITHUB_OUTPUT

- name: Check out PR head
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clang-tidy-pr-comments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
id: set-variables
run: |
echo ::set-output name=pr-id::"$(cat /tmp/clang-tidy-result/pr-id.txt)"
echo ::set-output name=pr-head-repo::"$(cat /tmp/clang-tidy-result/pr-head-repo.txt)"
echo ::set-output name=pr-head-ref::"$(cat /tmp/clang-tidy-result/pr-head-ref.txt)"
echo "pr-id=$(cat /tmp/clang-tidy-result/pr-id.txt)" >> $GITHUB_OUTPUT
echo "pr-head-repo=$(cat /tmp/clang-tidy-result/pr-head-repo.txt)" >> $GITHUB_OUTPUT
echo "pr-head-ref=$(cat /tmp/clang-tidy-result/pr-head-ref.txt)" >> $GITHUB_OUTPUT

- name: Check out PR head
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/github-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
REF_NAME="${{ github.ref_name }}"
fi

echo ::set-output name=ref-name::"$REF_NAME"
echo ::set-output name=tag-name::"${REF_NAME#beta/}"
echo "ref-name=$REF_NAME" >> $GITHUB_OUTPUT
echo "tag-name=${REF_NAME#beta/}" >> $GITHUB_OUTPUT"

- name: Check out repository
uses: actions/checkout@v3
Expand All @@ -39,7 +39,7 @@ jobs:
id: set-target-name
run: |
if [[ "${{ steps.set-tag-name.outputs.ref-name }}" =~ "beta/" ]]; then
echo ::set-output name=target-name::"${{ steps.set-tag-name.outputs.ref-name }}"
echo "target-name=${{ steps.set-tag-name.outputs.ref-name }}" >> $GITHUB_OUTPUT
fi

- name: Create a local tag for beta branches
Expand All @@ -62,7 +62,7 @@ jobs:
verb=edit
fi

echo ::set-output name=verb::"$verb"
echo "verb=$verb" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config-optional.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/tcort/markdown-link-check
rev: v3.10.3
rev: v3.11.0
hooks:
- id: markdown-link-check
args: [--config=.markdown-link-check.json]
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ repos:
args: [-c, .markdownlint.yaml, --fix]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
rev: v3.0.0-alpha.6
hooks:
- id: prettier

- repo: https://github.com/adrienverge/yamllint
rev: v1.29.0
rev: v1.30.0
hooks:
- id: yamllint

Expand All @@ -49,7 +49,7 @@ repos:
- id: shellcheck

- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.6.0-1
rev: v3.6.0-2
hooks:
- id: shfmt
args: [-w, -s, -i=4]
Expand All @@ -66,7 +66,7 @@ repos:
args: [--line-length=100]

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
rev: v16.0.0
hooks:
- id: clang-format
types_or: [c++, c, cuda]
Expand Down
2 changes: 2 additions & 0 deletions common/autoware_testing/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

<build_depend>autoware_cmake</build_depend>

<buildtool_export_depend>ros_testing</buildtool_export_depend>

<test_depend>ament_cmake_core</test_depend>
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
82 changes: 77 additions & 5 deletions common/motion_utils/include/motion_utils/trajectory/trajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ boost::optional<size_t> findNearestIndex(

for (size_t i = 0; i < points.size(); ++i) {
const auto squared_dist = tier4_autoware_utils::calcSquaredDistance2d(points.at(i), pose);
if (squared_dist > max_squared_dist) {
if (squared_dist > max_squared_dist || squared_dist >= min_squared_dist) {
continue;
}

Expand All @@ -283,10 +283,6 @@ boost::optional<size_t> findNearestIndex(
continue;
}

if (squared_dist >= min_squared_dist) {
continue;
}

min_squared_dist = squared_dist;
min_idx = i;
is_nearest_found = true;
Expand Down Expand Up @@ -1536,6 +1532,82 @@ boost::optional<double> calcDistanceToForwardStopPoint(

return std::max(0.0, closest_stop_dist);
}

// NOTE: Points after forward length from the point will be cropped
// forward_length is assumed to be positive.
template <typename T>
T cropForwardPoints(
const T & points, const geometry_msgs::msg::Point & target_pos, const size_t target_seg_idx,
const double forward_length)
{
if (points.empty()) {
return T{};
}

double sum_length =
-motion_utils::calcLongitudinalOffsetToSegment(points, target_seg_idx, target_pos);
for (size_t i = target_seg_idx + 1; i < points.size(); ++i) {
sum_length += tier4_autoware_utils::calcDistance2d(points.at(i), points.at(i - 1));
if (forward_length < sum_length) {
const size_t end_idx = i;
return T{points.begin(), points.begin() + end_idx};
}
}

return points;
}

// NOTE: Points before backward length from the point will be cropped
// backward_length is assumed to be positive.
template <typename T>
T cropBackwardPoints(
const T & points, const geometry_msgs::msg::Point & target_pos, const size_t target_seg_idx,
const double backward_length)
{
if (points.empty()) {
return T{};
}

double sum_length =
-motion_utils::calcLongitudinalOffsetToSegment(points, target_seg_idx, target_pos);
for (int i = target_seg_idx; 0 < i; --i) {
sum_length -= tier4_autoware_utils::calcDistance2d(points.at(i), points.at(i - 1));
if (sum_length < -backward_length) {
const size_t begin_idx = i;
return T{points.begin() + begin_idx, points.end()};
}
}

return points;
}

template <typename T>
T cropPoints(
const T & points, const geometry_msgs::msg::Point & target_pos, const size_t target_seg_idx,
const double forward_length, const double backward_length)
{
if (points.empty()) {
return T{};
}

// NOTE: Cropping forward must be done first in order to keep target_seg_idx.
const auto cropped_forward_points =
cropForwardPoints(points, target_pos, target_seg_idx, forward_length);

const size_t modified_target_seg_idx =
std::min(target_seg_idx, cropped_forward_points.size() - 2);
const auto cropped_points = cropBackwardPoints(
cropped_forward_points, target_pos, modified_target_seg_idx, backward_length);

if (cropped_points.size() < 2) {
RCLCPP_ERROR(
rclcpp::get_logger("obstacle_avoidance_planner.trajectory_utils"),
". Return original points since cropped_points size is less than 2.");
return points;
}

return cropped_points;
}
} // namespace motion_utils

#endif // MOTION_UTILS__TRAJECTORY__TRAJECTORY_HPP_
Loading