-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(behavior_path_planner): add goal planner
Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
- Loading branch information
Showing
8 changed files
with
219 additions
and
46 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
42 changes: 42 additions & 0 deletions
42
...path_planner/include/behavior_path_planner/utils/pull_over/default_fixed_goal_planner.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,42 @@ | ||
// Copyright 2023 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_PLANNER__UTILS__PULL_OVER__DEFAULT_FIXED_GOAL_PLANNER_HPP_ | ||
#define BEHAVIOR_PATH_PLANNER__UTILS__PULL_OVER__DEFAULT_FIXED_GOAL_PLANNER_HPP_ | ||
|
||
#include "behavior_path_planner/utils/pull_over/fixed_goal_planner_base.hpp" | ||
|
||
#include <autoware_auto_planning_msgs/msg/path_with_lane_id.hpp> | ||
|
||
#include <memory> | ||
#include <vector> | ||
|
||
namespace behavior_path_planner | ||
{ | ||
|
||
class DefaultFixedGoalPlanner : public FixedGoalPlannerBase | ||
{ | ||
public: | ||
DefaultFixedGoalPlanner() = default; | ||
BehaviorModuleOutput plan(const std::shared_ptr<const PlannerData> & planner_data) const override; | ||
|
||
protected: | ||
BehaviorModuleOutput getReferencePath( | ||
const std::shared_ptr<const PlannerData> & planner_data) const; | ||
PathWithLaneId modifyPathForSmoothGoalConnection( | ||
const PathWithLaneId & path, const std::shared_ptr<const PlannerData> & planner_data) const; | ||
}; | ||
} // namespace behavior_path_planner | ||
|
||
#endif // BEHAVIOR_PATH_PLANNER__UTILS__PULL_OVER__DEFAULT_FIXED_GOAL_PLANNER_HPP_ |
45 changes: 45 additions & 0 deletions
45
...or_path_planner/include/behavior_path_planner/utils/pull_over/fixed_goal_planner_base.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,45 @@ | ||
// Copyright 2023 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_PLANNER__UTILS__PULL_OVER__FIXED_GOAL_PLANNER_BASE_HPP_ | ||
#define BEHAVIOR_PATH_PLANNER__UTILS__PULL_OVER__FIXED_GOAL_PLANNER_BASE_HPP_ | ||
|
||
#include "behavior_path_planner/data_manager.hpp" | ||
#include "behavior_path_planner/parameters.hpp" | ||
|
||
#include <autoware_auto_planning_msgs/msg/path_with_lane_id.hpp> | ||
#include <geometry_msgs/msg/pose_stamped.hpp> | ||
|
||
#include <memory> | ||
#include <vector> | ||
|
||
using autoware_auto_planning_msgs::msg::PathWithLaneId; | ||
using geometry_msgs::msg::Pose; | ||
using tier4_autoware_utils::LinearRing2d; | ||
|
||
namespace behavior_path_planner | ||
{ | ||
|
||
class FixedGoalPlannerBase | ||
{ | ||
public: | ||
FixedGoalPlannerBase() = default; | ||
virtual ~FixedGoalPlannerBase() = default; | ||
|
||
virtual BehaviorModuleOutput plan( | ||
const std::shared_ptr<const PlannerData> & planner_data) const = 0; | ||
}; | ||
} // namespace behavior_path_planner | ||
|
||
#endif // BEHAVIOR_PATH_PLANNER__UTILS__PULL_OVER__FIXED_GOAL_PLANNER_BASE_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
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
83 changes: 83 additions & 0 deletions
83
planning/behavior_path_planner/src/utils/pull_over/default_fixed_goal_planner.cpp
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,83 @@ | ||
// Copyright 2023 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. | ||
|
||
#include "behavior_path_planner/utils/pull_over/default_fixed_goal_planner.hpp" | ||
|
||
#include "behavior_path_planner/utils/path_utils.hpp" | ||
#include "behavior_path_planner/utils/pull_over/util.hpp" | ||
|
||
#include <lanelet2_extension/utility/query.hpp> | ||
#include <lanelet2_extension/utility/utilities.hpp> | ||
|
||
#include <memory> | ||
#include <vector> | ||
|
||
namespace behavior_path_planner | ||
{ | ||
|
||
// DefaultFixedGoalPlanner::DefaultFixedGoalPlanner(){} | ||
|
||
BehaviorModuleOutput DefaultFixedGoalPlanner::plan( | ||
const std::shared_ptr<const PlannerData> & planner_data) const | ||
{ | ||
BehaviorModuleOutput output = getReferencePath(planner_data); | ||
const PathWithLaneId smoothed_path = | ||
modifyPathForSmoothGoalConnection(*(output.path), planner_data); | ||
|
||
output.path = std::make_shared<PathWithLaneId>(smoothed_path); | ||
output.reference_path = std::make_shared<PathWithLaneId>(smoothed_path); | ||
return output; | ||
} | ||
|
||
BehaviorModuleOutput DefaultFixedGoalPlanner::getReferencePath( | ||
const std::shared_ptr<const PlannerData> & planner_data) const | ||
{ | ||
const auto & route_handler = planner_data->route_handler; | ||
const auto current_pose = planner_data->self_odometry->pose.pose; | ||
const double dist_threshold = planner_data->parameters.ego_nearest_dist_threshold; | ||
const double yaw_threshold = planner_data->parameters.ego_nearest_yaw_threshold; | ||
|
||
lanelet::ConstLanelet current_lane{}; | ||
if (!route_handler->getClosestLaneletWithConstrainsWithinRoute( | ||
current_pose, ¤t_lane, dist_threshold, yaw_threshold)) { | ||
return {}; // TODO(Horibe) | ||
} | ||
|
||
return utils::getReferencePath(current_lane, planner_data); | ||
} | ||
|
||
PathWithLaneId DefaultFixedGoalPlanner::modifyPathForSmoothGoalConnection( | ||
const PathWithLaneId & path, const std::shared_ptr<const PlannerData> & planner_data) const | ||
{ | ||
const auto goal = planner_data->route_handler->getGoalPose(); | ||
const auto goal_lane_id = planner_data->route_handler->getGoalLaneId(); | ||
|
||
Pose refined_goal{}; | ||
{ | ||
lanelet::ConstLanelet goal_lanelet; | ||
if (planner_data->route_handler->getGoalLanelet(&goal_lanelet)) { | ||
refined_goal = utils::refineGoal(goal, goal_lanelet); | ||
} else { | ||
refined_goal = goal; | ||
} | ||
} | ||
|
||
auto refined_path = utils::refinePathForGoal( | ||
planner_data->parameters.refine_goal_search_radius_range, M_PI * 0.5, path, refined_goal, | ||
goal_lane_id); | ||
|
||
return refined_path; | ||
} | ||
|
||
} // namespace behavior_path_planner |