Skip to content

Commit

Permalink
refactor(lane_change): replace any code that can use transient data (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#8999)

* RT1-8004 replace hasEnoughLength

Signed-off-by: Zulfaqar Azmi <[email protected]>

* RT1-8004 Removed isNearEndOfCurrentLanes

Signed-off-by: Zulfaqar Azmi <[email protected]>

* RT1-8004 refactor sample longitudinal acc values

Signed-off-by: Zulfaqar Azmi <[email protected]>

* remove calc maximum lane change length

Signed-off-by: Zulfaqar Azmi <[email protected]>

* Revert "remove calc maximum lane change length"

This reverts commit e9cc386.

* Revert "RT1-8004 refactor sample longitudinal acc values"

This reverts commit 775bcdb.

* replace generateCenterLinePath

Signed-off-by: Zulfaqar Azmi <[email protected]>

* RT1-8004 simplify stuck detection

Signed-off-by: Zulfaqar Azmi <[email protected]>

* swap call to update filtered_objects and update transient data

Signed-off-by: Zulfaqar Azmi <[email protected]>

* RT1-8004 fix conflict

Signed-off-by: Zulfaqar Azmi <[email protected]>

* RT1-8004 Rename isVehicleStuck to is_ego_stuck()

Signed-off-by: Zulfaqar Azmi <[email protected]>

* RT1-8004 change calcPrepareDuration to snake case

Signed-off-by: Zulfaqar Azmi <[email protected]>

---------

Signed-off-by: Zulfaqar Azmi <[email protected]>
Signed-off-by: prakash-kannaiah <[email protected]>
  • Loading branch information
zulfaqar-azmi-t4 authored and prakash-kannaiah committed Oct 9, 2024
1 parent db2aade commit ee377f9
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ if (max_lane_change_length > ego's distance to the end of the current lanes.) t
stop
endif
if (isVehicleStuck(current_lanes)) then (yes)
if ego is stuck in the current lanes then (yes)
:Return **sampled acceleration values**;
stop
else (no)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ class NormalLaneChange : public LaneChangeBase

bool isRequiredStop(const bool is_trailing_object) override;

bool isNearEndOfCurrentLanes(
const lanelet::ConstLanelets & current_lanes, const lanelet::ConstLanelets & target_lanes,
const double threshold) const override;

bool hasFinishedLaneChange() const override;

bool isAbleToReturnCurrentLane() const override;
Expand Down Expand Up @@ -127,9 +123,7 @@ class NormalLaneChange : public LaneChangeBase
const lanelet::ConstLanelets & current_lanes,
const lanelet::ConstLanelets & target_lanes) const;

std::vector<double> calcPrepareDuration(
const lanelet::ConstLanelets & current_lanes,
const lanelet::ConstLanelets & target_lanes) const;
std::vector<double> calc_prepare_durations() const;

lane_change::TargetObjects getTargetObjects(
const FilteredByLanesExtendedObjects & predicted_objects,
Expand All @@ -150,10 +144,6 @@ class NormalLaneChange : public LaneChangeBase
const double target_lane_length, const double lane_changing_length,
const double lane_changing_velocity, const double buffer_for_next_lane_change) const;

bool hasEnoughLength(
const LaneChangePath & path, const lanelet::ConstLanelets & current_lanes,
const lanelet::ConstLanelets & target_lanes, const Direction direction = Direction::NONE) const;

std::vector<LaneChangePhaseMetrics> get_prepare_metrics() const;
std::vector<LaneChangePhaseMetrics> get_lane_changing_metrics(
const PathWithLaneId & prep_segment, const LaneChangePhaseMetrics & prep_metrics,
Expand All @@ -167,8 +157,7 @@ class NormalLaneChange : public LaneChangeBase
const Pose & lc_start_pose, const double shift_length) const;

bool check_candidate_path_safety(
const LaneChangePath & candidate_path, const lane_change::TargetObjects & target_objects,
const bool is_stuck) const;
const LaneChangePath & candidate_path, const lane_change::TargetObjects & target_objects) const;

std::optional<LaneChangePath> calcTerminalLaneChangePath(
const lanelet::ConstLanelets & current_lanes,
Expand All @@ -192,15 +181,9 @@ class NormalLaneChange : public LaneChangeBase
const std::vector<PoseWithVelocityStamped> & ego_predicted_path,
const RSSparams & selected_rss_param, CollisionCheckDebugMap & debug_data) const;

//! @brief Check if the ego vehicle is in stuck by a stationary obstacle.
//! @param obstacle_check_distance Distance to check ahead for any objects that might be
//! obstructing ego path. It makes sense to use values like the maximum lane change distance.
bool isVehicleStuck(
const lanelet::ConstLanelets & current_lanes, const double obstacle_check_distance) const;

double get_max_velocity_for_safety_check() const;

bool isVehicleStuck(const lanelet::ConstLanelets & current_lanes) const;
bool is_ego_stuck() const;

/**
* @brief Checks if the given pose is a valid starting point for a lane change.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ class LaneChangeBase
virtual PathSafetyStatus evaluateApprovedPathWithUnsafeHysteresis(
PathSafetyStatus approve_path_safety_status) = 0;

virtual bool isNearEndOfCurrentLanes(
const lanelet::ConstLanelets & current_lanes, const lanelet::ConstLanelets & target_lanes,
const double threshold) const = 0;

virtual bool isStoppedAtRedTrafficLight() const = 0;

virtual bool calcAbortPath() = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ struct TransientData
lanelet::ArcCoordinates target_lanes_ego_arc; // arc coordinates of ego pose along target lanes

bool is_ego_near_current_terminal_start{false};
bool is_ego_stuck{false};
};

using RouteHandlerPtr = std::shared_ptr<RouteHandler>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ void LaneChangeInterface::updateData()
universe_utils::ScopedTimeTrack st(__func__, *getTimeKeeper());
module_type_->setPreviousModuleOutput(getPreviousModuleOutput());
module_type_->update_lanes(getCurrentStatus() == ModuleStatus::RUNNING);
module_type_->update_transient_data();
module_type_->update_filtered_objects();
module_type_->update_transient_data();
module_type_->updateSpecialData();

if (isWaitingApproval() || module_type_->isAbortState()) {
Expand Down
Loading

0 comments on commit ee377f9

Please sign in to comment.