forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(lane_change): add helper class to deal with checks
Signed-off-by: Muhammad Zulfaqar Azmi <[email protected]>
- Loading branch information
1 parent
edc7878
commit 04c6592
Showing
9 changed files
with
253 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...ehavior_path_lane_change_module/include/behavior_path_lane_change_module/utils/helper.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#ifndef BEHAVIOR_PATH_LANE_CHANGE_MODULE__UTILS__HELPER_HPP_ | ||
#define BEHAVIOR_PATH_LANE_CHANGE_MODULE__UTILS__HELPER_HPP_ | ||
|
||
#include "behavior_path_lane_change_module/utils/data_structs.hpp" | ||
#include "behavior_path_lane_change_module/utils/debug_structs.hpp" | ||
#include "behavior_path_planner_common/data_manager.hpp" | ||
|
||
#include <memory> | ||
#include <vector> | ||
|
||
namespace behavior_path_planner::helper::lane_change | ||
{ | ||
using nav_msgs::msg::Odometry; | ||
using route_handler::Direction; | ||
class Helper | ||
{ | ||
public: | ||
Helper() = default; | ||
explicit Helper(const std::shared_ptr<LaneChangeParameters> & lc_params); | ||
Helper(const Helper &) = delete; | ||
Helper(Helper &&) = delete; | ||
Helper & operator=(const Helper &) = delete; | ||
Helper & operator=(Helper &&) = delete; | ||
|
||
~Helper() = default; | ||
|
||
void set_data(const std::shared_ptr<const PlannerData> &); | ||
void set_lanes( | ||
const lanelet::ConstLanelets & current_lanes, const lanelet::ConstLanelets & target_lanes); | ||
|
||
double calc_min_lane_change_length(const std::vector<double> & shift_intervals) const; | ||
|
||
double calc_min_lane_change_length( | ||
const lanelet::ConstLanelets & lanes, Direction direction = Direction::NONE) const; | ||
|
||
[[nodiscard]] bool is_near_end_of_current_lanes() const; | ||
|
||
[[nodiscard]] bool has_enough_length_to_retry( | ||
const double abort_return_dist, Direction direction) const; | ||
|
||
private: | ||
std::shared_ptr<RouteHandler> route_handler_; | ||
Odometry::ConstSharedPtr self_odometry_; | ||
BehaviorPathPlannerParameters common_params_; | ||
std::shared_ptr<LaneChangeParameters> lc_params_; | ||
|
||
[[nodiscard]] Pose get_ego_pose() const; | ||
double get_signed_distance_from_current_pose(const lanelet::ConstLanelets & lanes) const; | ||
|
||
lanelet::ConstLanelets current_lanes_; | ||
lanelet::ConstLanelets target_lanes_; | ||
rclcpp::Logger logger_{rclcpp::get_logger("lane_change.helper")}; | ||
|
||
mutable data::lane_change::Debug debug_; | ||
}; | ||
} // namespace behavior_path_planner::helper::lane_change | ||
|
||
#endif // BEHAVIOR_PATH_LANE_CHANGE_MODULE__UTILS__HELPER_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.