Skip to content

Commit

Permalink
fix check algorithm
Browse files Browse the repository at this point in the history
Signed-off-by: ismetatabay <ismet@leodrive.ai>

fix check algorithm

Signed-off-by: ismetatabay <ismet@leodrive.ai>
  • Loading branch information
ismetatabay committed Nov 24, 2022
1 parent 59e2c24 commit 4c1ccc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ class AvoidanceModule : public SceneModuleInterface
// for raw_shift_line registration
AvoidLineArray registered_raw_shift_lines_;
AvoidLineArray current_raw_shift_lines_;
AvoidLineArray init_raw_shift_lines_;
void registerRawShiftLines(const AvoidLineArray & future_registered);
void updateRegisteredRawShiftLines();

// -- for state management --
bool is_avoidance_maneuver_starts;
bool isAvoidanceManeuverRunning();
bool isAvoidancePlanRunning() const;
bool isAvoidanceManeuverRunning() const;

// -- for pre-processing --
void initVariables();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,13 @@ bool AvoidanceModule::isAvoidancePlanRunning() const
const bool has_shift_line = (path_shifter_.getShiftLinesSize() > 0);
return has_base_offset || has_shift_line;
}
bool AvoidanceModule::isAvoidanceManeuverRunning() const
bool AvoidanceModule::isAvoidanceManeuverRunning()
{
const auto path_idx = avoidance_data_.ego_closest_path_index;

for (const auto & al : init_raw_shift_lines_) {
if (path_idx > al.start_idx) {
for (const auto & al : registered_raw_shift_lines_) {
if (path_idx > al.start_idx || is_avoidance_maneuver_starts) {
is_avoidance_maneuver_starts = true;
return true;
}
}
Expand Down Expand Up @@ -546,7 +547,6 @@ void AvoidanceModule::registerRawShiftLines(const AvoidLineArray & future)
}
}

init_raw_shift_lines_ = registered_raw_shift_lines_;
DEBUG_PRINT("registered object size: %lu -> %lu", old_size, registered_raw_shift_lines_.size());
}

Expand Down Expand Up @@ -2683,6 +2683,7 @@ void AvoidanceModule::initVariables()
registered_raw_shift_lines_ = {};
current_raw_shift_lines_ = {};
original_unique_id = 0;
is_avoidance_maneuver_starts = false;
}

bool AvoidanceModule::isTargetObjectType(const PredictedObject & object) const
Expand Down

0 comments on commit 4c1ccc8

Please sign in to comment.