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

feat(map_based_prediction): use obstacle acceleration for map prediction #6072

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 42 additions & 6 deletions perception/map_based_prediction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ See paper [2] for more details.

`lateral_control_time_horizon` parameter supports the tuning of the lateral path shape. This parameter is used to calculate the time to reach the reference path. The smaller the value, the more the path will be generated to reach the reference path quickly. (Mostly the center of the lane.)

#### Pruning predicted paths with lateral acceleration constraint
#### Pruning predicted paths with lateral acceleration constraint (for vehicle obstacles)

It is possible to apply a maximum lateral acceleration constraint to generated vehicle paths. This check verifies if it is possible for the vehicle to perform the predicted path without surpassing a lateral acceleration threshold `max_lateral_accel` when taking a curve. If it is not possible, it checks if the vehicle can slow down on time to take the curve with a deceleration of `min_acceleration_before_curve` and comply with the constraint. If that is also not possible, the path is eliminated.

Expand All @@ -136,11 +136,47 @@ Currently we provide three parameters to tune the lateral acceleration constrain

You can change these parameters in rosparam in the table below.

| param name | default value |
| ----------------------------------------- | -------------- |
| `check_lateral_acceleration_constraints_` | `false` [bool] |
| `max_lateral_accel` | `2.0` [m/s^2] |
| `min_acceleration_before_curve` | `-2.0` [m/s^2] |
| param name | default value |
| ---------------------------------------- | -------------- |
| `check_lateral_acceleration_constraints` | `false` [bool] |
| `max_lateral_accel` | `2.0` [m/s^2] |
| `min_acceleration_before_curve` | `-2.0` [m/s^2] |

## Using Vehicle Acceleration for Path Prediction (for Vehicle Obstacles)

By default, the `map_based_prediction` module uses the current obstacle's velocity to compute its predicted path length. However, it is possible to use the obstacle's current acceleration to calculate its predicted path's length.

### Decaying Acceleration Model

Since this module tries to predict the vehicle's path several seconds into the future, it is not practical to consider the current vehicle's acceleration as constant (it is not assumed the vehicle will be accelerating for `prediction_time_horizon` seconds after detection). Instead, a decaying acceleration model is used. With the decaying acceleration model, a vehicle's acceleration is modeled as:

$\ a(t) = a\_{t0} \cdot e^{-\lambda \cdot t} $

where $\ a\_{t0} $ is the vehicle acceleration at the time of detection $\ t0 $, and $\ \lambda $ is the decay constant $\ \lambda = \ln(2) / hl $ and $\ hl $ is the exponential's half life.

Furthermore, the integration of $\ a(t) $ over time gives us equations for velocity, $\ v(t) $ and distance $\ x(t) $ as:

$\ v(t) = v*{t0} + a*{t0} \* (1/\lambda) \cdot (1 - e^{-\lambda \cdot t}) $

and

$\ x(t) = x*{t0} + (v*{t0} + a*{t0} \* (1/\lambda)) \cdot t + a*{t0}(1/λ^2)(e^{-\lambda \cdot t} - 1) $

With this model, the influence of the vehicle's detected instantaneous acceleration on the predicted path's length is diminished but still considered. This feature also considers that the obstacle might not accelerate past its road's speed limit (multiplied by a tunable factor).

Currently, we provide three parameters to tune the use of obstacle acceleration for path prediction:

- `use_vehicle_acceleration`: to enable the feature.
- `acceleration_exponential_half_life`: The decaying acceleration model considers that the current vehicle acceleration will be halved after this many seconds.
- `speed_limit_multiplier`: Set the vehicle type obstacle's maximum predicted speed as the legal speed limit in that lanelet times this value. This value should be at least equal or greater than 1.0.

You can change these parameters in `rosparam` in the table below.

| Param Name | Default Value |
| ------------------------------------ | -------------- |
| `use_vehicle_acceleration` | `false` [bool] |
| `acceleration_exponential_half_life` | `2.5` [s] |
| `speed_limit_multiplier` | `1.5` [] |

### Path prediction for crosswalk users

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
check_lateral_acceleration_constraints: false # whether to check if the predicted path complies with lateral acceleration constraints
max_lateral_accel: 2.0 # [m/ss] max acceptable lateral acceleration for predicted vehicle paths
min_acceleration_before_curve: -2.0 # [m/ss] min acceleration a vehicle might take to decelerate before a curve
use_vehicle_acceleration: false # whether to consider current vehicle acceleration when predicting paths or not
speed_limit_multiplier: 1.5 # When using vehicle acceleration. Set vehicle's maximum predicted speed as the legal speed limit in that lanelet times this value
acceleration_exponential_half_life: 2.5 # [s] When using vehicle acceleration. The decaying acceleration model considers that the current vehicle acceleration will be halved after this many seconds
# parameter for shoulder lane prediction
prediction_time_horizon_rate_for_validate_shoulder_lane_length: 0.8

Expand All @@ -32,6 +35,6 @@
diff_dist_threshold_to_left_bound: 0.29 #[m]
diff_dist_threshold_to_right_bound: -0.29 #[m]
num_continuous_state_transition: 3
consider_only_routable_neighbours: false

Check warning on line 38 in perception/map_based_prediction/config/map_based_prediction.param.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (routable)

reference_path_resolution: 0.5 #[m]
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <rclcpp/rclcpp.hpp>
#include <tier4_autoware_utils/ros/transform_listener.hpp>
#include <tier4_autoware_utils/ros/uuid_helper.hpp>
#include <tier4_autoware_utils/system/stop_watch.hpp>

#include "autoware_auto_planning_msgs/msg/trajectory_point.hpp"
Expand Down Expand Up @@ -89,6 +90,7 @@ struct LaneletData
struct PredictedRefPath
{
float probability;
double speed_limit;
PosePath path;
Maneuver maneuver;
};
Expand Down Expand Up @@ -175,6 +177,10 @@ class MapBasedPredictionNode : public rclcpp::Node
double max_lateral_accel_;
double min_acceleration_before_curve_;

bool use_vehicle_acceleration_;
double speed_limit_multiplier_;
double acceleration_exponential_half_life_;

// Stop watch
StopWatch<std::chrono::milliseconds> stop_watch_;

Expand Down Expand Up @@ -231,7 +237,8 @@ class MapBasedPredictionNode : public rclcpp::Node
void addReferencePaths(
const TrackedObject & object, const lanelet::routing::LaneletPaths & candidate_paths,
const float path_probability, const ManeuverProbability & maneuver_probability,
const Maneuver & maneuver, std::vector<PredictedRefPath> & reference_paths);
const Maneuver & maneuver, std::vector<PredictedRefPath> & reference_paths,
const double speed_limit = 0.0);
std::vector<PosePath> convertPathType(const lanelet::routing::LaneletPaths & paths);

void updateFuturePossibleLanelets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,38 @@
PredictedPath generatePathForOffLaneVehicle(const TrackedObject & object);

PredictedPath generatePathForOnLaneVehicle(
const TrackedObject & object, const PosePath & ref_paths);
const TrackedObject & object, const PosePath & ref_paths, const double speed_limit = 0.0);

PredictedPath generatePathForCrosswalkUser(
const TrackedObject & object, const CrosswalkEdgePoints & reachable_crosswalk) const;

PredictedPath generatePathToTargetPoint(
const TrackedObject & object, const Eigen::Vector2d & point) const;

void setUseVehicleAcceleration(const bool use_vehicle_acceleration)
{
use_vehicle_acceleration_ = use_vehicle_acceleration;

Check warning on line 104 in perception/map_based_prediction/include/map_based_prediction/path_generator.hpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/include/map_based_prediction/path_generator.hpp#L104

Added line #L104 was not covered by tests
}

void setAccelerationHalfLife(const double acceleration_exponential_half_life)
{
acceleration_exponential_half_life_ = acceleration_exponential_half_life;

Check warning on line 109 in perception/map_based_prediction/include/map_based_prediction/path_generator.hpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/include/map_based_prediction/path_generator.hpp#L109

Added line #L109 was not covered by tests
}

private:
// Parameters
double time_horizon_;
double lateral_time_horizon_;
double sampling_time_interval_;
double min_crosswalk_user_velocity_;
bool use_vehicle_acceleration_;
double acceleration_exponential_half_life_;

// Member functions
PredictedPath generateStraightPath(const TrackedObject & object) const;

PredictedPath generatePolynomialPath(const TrackedObject & object, const PosePath & ref_path);
PredictedPath generatePolynomialPath(
const TrackedObject & object, const PosePath & ref_path, const double speed_limit = 0.0);

FrenetPath generateFrenetPath(
const FrenetPoint & current_point, const FrenetPoint & target_point, const double max_length);
Expand All @@ -125,7 +138,8 @@
const TrackedObject & object, const FrenetPath & frenet_predicted_path,
const PosePath & ref_path);

FrenetPoint getFrenetPoint(const TrackedObject & object, const PosePath & ref_path);
FrenetPoint getFrenetPoint(
const TrackedObject & object, const PosePath & ref_path, const double speed_limit = 0.0);
};
} // namespace map_based_prediction

Expand Down
86 changes: 74 additions & 12 deletions perception/map_based_prediction/src/map_based_prediction_node.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Tier IV, Inc.

Check notice on line 1 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Lines of Code in a Single File

The lines of code increases from 1595 to 1643, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.

Check notice on line 1 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 6.31 to 6.39, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,6 @@
#include <tier4_autoware_utils/math/constants.hpp>
#include <tier4_autoware_utils/math/normalization.hpp>
#include <tier4_autoware_utils/math/unit_conversion.hpp>
#include <tier4_autoware_utils/ros/uuid_helper.hpp>

#include <autoware_auto_perception_msgs/msg/detected_objects.hpp>

Expand Down Expand Up @@ -385,11 +384,7 @@
const TrackedObject & object, const lanelet::LaneletMapPtr & lanelet_map_ptr,
const bool use_yaw_information = false)
{
using Point = boost::geometry::model::d2::point_xy<double>;

const auto & obj_pos = object.kinematics.pose_with_covariance.pose.position;
const Point p_object{obj_pos.x, obj_pos.y};

lanelet::BasicPoint2d search_point(obj_pos.x, obj_pos.y);
// nearest lanelet
constexpr double search_radius = 10.0; // [m]
Expand Down Expand Up @@ -788,10 +783,18 @@
prediction_time_horizon_rate_for_validate_lane_length_ =
declare_parameter<double>("prediction_time_horizon_rate_for_validate_shoulder_lane_length");

use_vehicle_acceleration_ = declare_parameter<bool>("use_vehicle_acceleration");
speed_limit_multiplier_ = declare_parameter<double>("speed_limit_multiplier");
acceleration_exponential_half_life_ =
declare_parameter<double>("acceleration_exponential_half_life");

Check warning on line 789 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L786-L789

Added lines #L786 - L789 were not covered by tests

path_generator_ = std::make_shared<PathGenerator>(
prediction_time_horizon_, lateral_control_time_horizon_, prediction_sampling_time_interval_,
min_crosswalk_user_velocity_);

path_generator_->setUseVehicleAcceleration(use_vehicle_acceleration_);
path_generator_->setAccelerationHalfLife(acceleration_exponential_half_life_);

Check warning on line 796 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L795-L796

Added lines #L795 - L796 were not covered by tests

Check warning on line 797 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Large Method

MapBasedPredictionNode::MapBasedPredictionNode has 74 lines, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
sub_objects_ = this->create_subscription<TrackedObjects>(
"~/input/objects", 1,
std::bind(&MapBasedPredictionNode::objectsCallback, this, std::placeholders::_1));
Expand All @@ -817,6 +820,13 @@
updateParam(parameters, "min_acceleration_before_curve", min_acceleration_before_curve_);
updateParam(
parameters, "check_lateral_acceleration_constraints", check_lateral_acceleration_constraints_);
updateParam(parameters, "use_vehicle_acceleration", use_vehicle_acceleration_);
updateParam(parameters, "speed_limit_multiplier", speed_limit_multiplier_);
updateParam(
parameters, "acceleration_exponential_half_life", acceleration_exponential_half_life_);

Check warning on line 826 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L823-L826

Added lines #L823 - L826 were not covered by tests

path_generator_->setUseVehicleAcceleration(use_vehicle_acceleration_);
path_generator_->setAccelerationHalfLife(acceleration_exponential_half_life_);

Check warning on line 829 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L828-L829

Added lines #L828 - L829 were not covered by tests

rcl_interfaces::msg::SetParametersResult result;
result.successful = true;
Expand Down Expand Up @@ -1010,7 +1020,7 @@

for (const auto & ref_path : ref_paths) {
PredictedPath predicted_path = path_generator_->generatePathForOnLaneVehicle(
yaw_fixed_transformed_object, ref_path.path);
yaw_fixed_transformed_object, ref_path.path, ref_path.speed_limit);

Check warning on line 1023 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1023

Added line #L1023 was not covered by tests
if (predicted_path.path.empty()) continue;

if (!check_lateral_acceleration_constraints_) {
Expand Down Expand Up @@ -1555,14 +1565,63 @@
object.kinematics.twist_with_covariance.twist.linear.x,
object.kinematics.twist_with_covariance.twist.linear.y);

// Using a decaying acceleration model. Consult the README for more information about the model.
const double obj_acc = (use_vehicle_acceleration_)
? std::hypot(
object.kinematics.acceleration_with_covariance.accel.linear.x,
object.kinematics.acceleration_with_covariance.accel.linear.y)
: 0.0;
const double t_h = prediction_time_horizon_;
const double λ = std::log(2) / acceleration_exponential_half_life_;

Check warning on line 1575 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1569-L1575

Added lines #L1569 - L1575 were not covered by tests

auto get_search_distance_with_decaying_acc = [&]() -> double {

Check warning on line 1577 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1577

Added line #L1577 was not covered by tests
const double acceleration_distance =
obj_acc * (1.0 / λ) * t_h + obj_acc * (1.0 / std::pow(λ, 2)) * (std::exp(-λ * t_h) - 1);
double search_dist = acceleration_distance + obj_vel * t_h;
return search_dist;
};

Check warning on line 1582 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1579-L1582

Added lines #L1579 - L1582 were not covered by tests

auto get_search_distance_with_partial_acc = [&](const double final_speed) -> double {

Check warning on line 1584 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1584

Added line #L1584 was not covered by tests
constexpr double epsilon = 1E-5;
if (std::abs(obj_acc) < epsilon) {

Check warning on line 1586 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1586

Added line #L1586 was not covered by tests
// Assume constant speed
return obj_vel * t_h;

Check warning on line 1588 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1588

Added line #L1588 was not covered by tests
}
// Time to reach final speed
const double t_f = (-1.0 / λ) * std::log(1 - ((final_speed - obj_vel) * λ) / obj_acc);

Check warning on line 1591 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1591

Added line #L1591 was not covered by tests
// It is assumed the vehicle accelerates until final_speed is reached and
// then continues at constant speed for the rest of the time horizon
const double search_dist =
// Distance covered while accelerating
obj_acc * (1.0 / λ) * t_f + obj_acc * (1.0 / std::pow(λ, 2)) * (std::exp(-λ * t_f) - 1) +
obj_vel * t_f +

Check warning on line 1597 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1596-L1597

Added lines #L1596 - L1597 were not covered by tests
// Distance covered at constant speed
final_speed * (t_h - t_f);
return search_dist;
};

Check warning on line 1601 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1599-L1601

Added lines #L1599 - L1601 were not covered by tests

std::vector<PredictedRefPath> all_ref_paths;

for (const auto & current_lanelet_data : current_lanelets_data) {
// parameter for lanelet::routing::PossiblePathsParams
const double search_dist = prediction_time_horizon_ * obj_vel +
lanelet::utils::getLaneletLength3d(current_lanelet_data.lanelet);
const lanelet::traffic_rules::SpeedLimitInformation limit =
traffic_rules_ptr_->speedLimit(current_lanelet_data.lanelet);
const double legal_speed_limit = static_cast<double>(limit.speedLimit.value());

Check warning on line 1608 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1607-L1608

Added lines #L1607 - L1608 were not covered by tests

double final_speed_after_acceleration =
obj_vel + obj_acc * (1.0 / λ) * (1.0 - std::exp(-λ * t_h));

Check warning on line 1611 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1611

Added line #L1611 was not covered by tests

const double final_speed_limit = legal_speed_limit * speed_limit_multiplier_;
const bool final_speed_surpasses_limit = final_speed_after_acceleration > final_speed_limit;
const bool object_has_surpassed_limit_already = obj_vel > final_speed_limit;

Check warning on line 1615 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1613-L1615

Added lines #L1613 - L1615 were not covered by tests

double search_dist = (final_speed_surpasses_limit && !object_has_surpassed_limit_already)
? get_search_distance_with_partial_acc(final_speed_limit)
: get_search_distance_with_decaying_acc();
search_dist += lanelet::utils::getLaneletLength3d(current_lanelet_data.lanelet);

Check warning on line 1620 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1617-L1620

Added lines #L1617 - L1620 were not covered by tests

lanelet::routing::PossiblePathsParams possible_params{search_dist, {}, 0, false, true};
const double validate_time_horizon =
prediction_time_horizon_ * prediction_time_horizon_rate_for_validate_lane_length_;
t_h * prediction_time_horizon_rate_for_validate_lane_length_;

Check warning on line 1624 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1624

Added line #L1624 was not covered by tests

// lambda function to get possible paths for isolated lanelet
// isolated is often caused by lanelet with no connection e.g. shoulder-lane
Expand Down Expand Up @@ -1644,7 +1703,8 @@
// Step4. add candidate reference paths to the all_ref_paths
const float path_prob = current_lanelet_data.probability;
const auto addReferencePathsLocal = [&](const auto & paths, const auto & maneuver) {
addReferencePaths(object, paths, path_prob, maneuver_prob, maneuver, all_ref_paths);
addReferencePaths(
object, paths, path_prob, maneuver_prob, maneuver, all_ref_paths, final_speed_limit);

Check warning on line 1707 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

MapBasedPredictionNode::getPredictedReferencePath increases in cyclomatic complexity from 17 to 21, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 1707 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L1706-L1707

Added lines #L1706 - L1707 were not covered by tests
};
addReferencePathsLocal(left_paths, Maneuver::LEFT_LANE_CHANGE);
addReferencePathsLocal(right_paths, Maneuver::RIGHT_LANE_CHANGE);
Expand Down Expand Up @@ -1966,16 +2026,18 @@
void MapBasedPredictionNode::addReferencePaths(
const TrackedObject & object, const lanelet::routing::LaneletPaths & candidate_paths,
const float path_probability, const ManeuverProbability & maneuver_probability,
const Maneuver & maneuver, std::vector<PredictedRefPath> & reference_paths)
const Maneuver & maneuver, std::vector<PredictedRefPath> & reference_paths,
const double speed_limit)
{
if (!candidate_paths.empty()) {
updateFuturePossibleLanelets(object, candidate_paths);
const auto converted_paths = convertPathType(candidate_paths);
for (const auto & converted_path : converted_paths) {
PredictedRefPath predicted_path;
predicted_path.probability = maneuver_probability.at(maneuver) * path_probability;
predicted_path.path = converted_path;
predicted_path.maneuver = maneuver;
predicted_path.speed_limit = speed_limit;

Check notice on line 2040 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Excess Number of Function Arguments

MapBasedPredictionNode::addReferencePaths increases from 6 to 7 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 2040 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L2040

Added line #L2040 was not covered by tests
reference_paths.push_back(predicted_path);
}
}
Expand Down
Loading
Loading