Skip to content

Commit

Permalink
fix engage obstacle clear and stop threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
Shigekazu Fukuta committed Dec 19, 2023
1 parent 87ef309 commit 809b85e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ class ObstacleStopPlannerNode : public rclcpp::Node
void publishDebugData(
const PlannerData & planner_data, const double current_acc, const double current_vel);

void updateObstacleHistory(const rclcpp::Time & now)
void updateObstacleHistory(const rclcpp::Time & now, const double chattering_threshold)
{
for (auto itr = obstacle_history_.begin(); itr != obstacle_history_.end();) {
const auto expired = (now - itr->detection_time).seconds() > node_param_.chattering_threshold;
const auto expired = (now - itr->detection_time).seconds() > chattering_threshold;

if (expired) {
itr = obstacle_history_.erase(itr);
Expand Down
7 changes: 3 additions & 4 deletions planning/obstacle_stop_planner/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,9 @@ void ObstacleStopPlannerNode::searchObstacle(
}

const auto now = this->now();

if (std::fabs(current_velocity_ptr->twist.twist.linear.x) < 1e-9) {
updateObstacleHistory(now);
}
const bool is_stopping = (std::fabs(current_velocity_ptr->twist.twist.linear.x) < 0.001);
const double history_erase_sec = (is_stopping) ? node_param_.chattering_threshold : 0.0;
updateObstacleHistory(now, history_erase_sec);

for (size_t i = 0; i < decimate_trajectory.size() - 1; ++i) {
// create one step circle center for vehicle
Expand Down

0 comments on commit 809b85e

Please sign in to comment.