Skip to content

Commit

Permalink
feat(avoidance): suppress unnecessary avoidance path
Browse files Browse the repository at this point in the history
Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Oct 31, 2023
1 parent a2b114d commit c9ae8ef
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@
front_distance: 30.0 # [m]
behind_distance: 30.0 # [m]

# params for filtering objects that are in intersection
intersection:
yaw_deviation: 0.175 # [rad] (default: 10.0deg)

# For safety check
safety_check:
# safety check configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ struct AvoidanceParameters
double object_check_min_forward_distance{0.0};
double object_check_max_forward_distance{0.0};
double object_check_backward_distance{0.0};
double object_check_yaw_deviation{0.0};

// if the distance between object and goal position is less than this parameter, the module ignore
// the object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ bool isWithinIntersection(
bool isTargetObjectType(
const PredictedObject & object, const std::shared_ptr<AvoidanceParameters> & parameters);

bool isObjectOnRoadShoulder(
ObjectData & object, std::shared_ptr<RouteHandler> & route_handler,
std::shared_ptr<AvoidanceParameters> & parameters);

double calcShiftLength(
const bool & is_object_on_right, const double & overhang_dist, const double & avoid_margin);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2767,6 +2767,7 @@ void AvoidanceModule::updateDebugMarker(
addObjects(data.other_objects, std::string("NotNeedAvoidance"));
addObjects(data.other_objects, std::string("LessThanExecutionThreshold"));
addObjects(data.other_objects, std::string("TooNearToGoal"));
addObjects(data.other_objects, std::string("ParallelToEgoLane"));

Check warning on line 2770 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Large Method

AvoidanceModule::updateDebugMarker increases from 107 to 108 lines of code, 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.
}

// shift line pre-process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ AvoidanceModuleManager::AvoidanceModuleManager(
getOrDeclareParameter<double>(*node, ns + "object_check_shiftable_ratio");
p.object_check_min_road_shoulder_width =
getOrDeclareParameter<double>(*node, ns + "object_check_min_road_shoulder_width");
p.object_check_yaw_deviation =
getOrDeclareParameter<double>(*node, ns + "intersection.yaw_deviation");

Check warning on line 118 in planning/behavior_path_planner/src/scene_module/avoidance/manager.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

AvoidanceModuleManager::AvoidanceModuleManager already has high cyclomatic complexity, and now it increases in Lines of Code from 256 to 258. 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.
p.object_last_seen_threshold =
getOrDeclareParameter<double>(*node, ns + "object_last_seen_threshold");
}
Expand Down
Loading

0 comments on commit c9ae8ef

Please sign in to comment.