Skip to content

Commit

Permalink
fix(obstacle_avoidance_planner): fix bug of lerp when points' size = 1 (
Browse files Browse the repository at this point in the history
tier4#664)

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
  • Loading branch information
takayuki5168 authored and boyali committed Oct 3, 2022
1 parent 0dde480 commit cd61bf1
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ template <typename T>
double lerpTwistX(
const T & points, const geometry_msgs::msg::Point & target_pos, const size_t closest_seg_idx)
{
if (points.size() == 1) {
return points.at(0).longitudinal_velocity_mps;
}

constexpr double epsilon = 1e-6;

const double closest_to_target_dist =
Expand All @@ -70,6 +74,10 @@ template <typename T>
double lerpPoseZ(
const T & points, const geometry_msgs::msg::Point & target_pos, const size_t closest_seg_idx)
{
if (points.size() == 1) {
return points.at(0).pose.position.z;
}

constexpr double epsilon = 1e-6;

const double closest_to_target_dist =
Expand Down

0 comments on commit cd61bf1

Please sign in to comment.