Skip to content

Commit

Permalink
chore: minor fix
Browse files Browse the repository at this point in the history
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
  • Loading branch information
taikitanaka3 committed Jan 13, 2022
1 parent c6fb966 commit 2323643
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ void buildSlices(
const double ratio_dist_increment = std::min(1.0, slice_width / std::abs(range.max_distance));
lanelet::BasicPolygon2d poly;
const int num_step = static_cast<int>(slice_length / resolution);
const int loop_num = static_cast<int>(inner_bounds.size()) - 1 - num_step;
for (int s = 0; s < loop_num; s += num_step) {
const int max_index = static_cast<int>(inner_bounds.size());
for (int s = 0; s < max_index; s += num_step) {
const double length = s * slice_length;
const double next_length = (s + num_step) * resolution;
for (int d = 0; d < num_lateral_slice; d++) {
Expand All @@ -82,6 +82,7 @@ void buildSlices(
BasicLineString2d outer_polygons;
// build interpolated polygon for lateral
for (int i = 0; i <= num_step; i++) {
if (s + i >= max_index) continue;
inner_polygons.emplace_back(
lerp(inner_bounds.at(s + i), outer_bounds.at(s + i), ratio_dist));
outer_polygons.emplace_back(
Expand Down Expand Up @@ -110,13 +111,15 @@ void buildSidewalkSlices(
const double longitudinal_max_dist = lg::length2d(path_lanelet);
SliceRange left_slice_range = {
longitudinal_offset, longitudinal_max_dist, lateral_offset, lateral_offset + lateral_max_dist};
const double slice_length = 2.0 * slice_size;
// in most case lateral distance is much more effective for velocity planning
const double ratio_w_h = 2.0;
const double slice_length = ratio_w_h * slice_size;
const double slice_width = slice_size;
buildSlices(left_slices, path_lanelet, left_slice_range, slice_length, slice_width, 0.5);
buildSlices(left_slices, path_lanelet, left_slice_range, slice_length, slice_width, 1.0);
SliceRange right_slice_range = {
longitudinal_offset, longitudinal_max_dist, -lateral_offset,
-lateral_offset - lateral_max_dist};
buildSlices(right_slices, path_lanelet, right_slice_range, slice_length, slice_width, 0.5);
buildSlices(right_slices, path_lanelet, right_slice_range, slice_length, slice_width, 1.0);
// Properly order lanelets from closest to furthest
slices = left_slices;
slices.insert(slices.end(), right_slices.begin(), right_slices.end());
Expand Down

0 comments on commit 2323643

Please sign in to comment.