Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(build): only include forward declaration of lanelet stuff in route_handler header files #4996

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <nav_msgs/msg/odometry.hpp>
#include <tier4_planning_msgs/msg/lateral_offset.hpp>

#include <lanelet2_core/geometry/Lanelet.h>
#include <lanelet2_core/primitives/Lanelet.h>

#include <limits>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
#include <geometry_msgs/msg/polygon.hpp>
#include <visualization_msgs/msg/marker_array.hpp>

#include <lanelet2_core/LaneletMap.h>
#include <lanelet2_routing/RoutingGraph.h>
#include <lanelet2_core/Forward.h>

#include <string>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
#include "behavior_path_planner/utils/path_safety_checker/path_safety_checker_parameters.hpp"
#include "behavior_path_planner/utils/path_shifter/path_shifter.hpp"

#include <tier4_autoware_utils/geometry/boost_geometry.hpp>

#include <autoware_auto_perception_msgs/msg/predicted_objects.hpp>
#include <autoware_auto_perception_msgs/msg/predicted_path.hpp>
#include <autoware_auto_planning_msgs/msg/path_with_lane_id.hpp>
#include <geometry_msgs/msg/polygon.hpp>
#include <visualization_msgs/msg/marker_array.hpp>

#include <lanelet2_core/geometry/Lanelet.h>
#include <lanelet2_core/Forward.h>

#include <string>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
#include "behavior_path_planner/utils/lane_following/module_data.hpp"
#include "tier4_autoware_utils/system/stop_watch.hpp"

#include <lanelet2_extension/utility/utilities.hpp>
#include <rclcpp/rclcpp.hpp>

#include <autoware_auto_planning_msgs/msg/path_with_lane_id.hpp>
#include <tier4_planning_msgs/msg/stop_reason_array.hpp>

#include <lanelet2_core/primitives/Lanelet.h>

#include <algorithm>
#include <limits>
#include <memory>
Expand Down Expand Up @@ -279,32 +280,7 @@ class PlannerManager
* @param planner data.
* @return reference path.
*/
BehaviorModuleOutput getReferencePath(const std::shared_ptr<PlannerData> & data) const
{
const auto & route_handler = data->route_handler;
const auto & pose = data->self_odometry->pose.pose;
const auto p = data->parameters;

constexpr double extra_margin = 10.0;
const auto backward_length =
std::max(p.backward_path_length, p.backward_path_length + extra_margin);

const auto lanelet_sequence = route_handler->getLaneletSequence(
root_lanelet_.get(), pose, backward_length, std::numeric_limits<double>::max());

lanelet::ConstLanelet closest_lane{};
if (lanelet::utils::query::getClosestLaneletWithConstrains(
lanelet_sequence, pose, &closest_lane, p.ego_nearest_dist_threshold,
p.ego_nearest_yaw_threshold)) {
return utils::getReferencePath(closest_lane, data);
}

if (lanelet::utils::query::getClosestLanelet(lanelet_sequence, pose, &closest_lane)) {
return utils::getReferencePath(closest_lane, data);
}

return {}; // something wrong.
}
BehaviorModuleOutput getReferencePath(const std::shared_ptr<PlannerData> & data) const;

/**
* @brief stop and unregister the module from manager.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include "behavior_path_planner/utils/utils.hpp"

#include <lane_departure_checker/lane_departure_checker.hpp>
#include <lanelet2_extension/utility/message_conversion.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <vehicle_info_util/vehicle_info.hpp>
#include <vehicle_info_util/vehicle_info_util.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <autoware_auto_vehicle_msgs/msg/hazard_lights_command.hpp>
#include <autoware_auto_vehicle_msgs/msg/turn_indicators_command.hpp>

#include <lanelet2_core/LaneletMap.h>
#include <lanelet2_core/Forward.h>

#include <limits>
#include <map>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#include <geometry_msgs/msg/transform_stamped.hpp>
#include <tier4_planning_msgs/msg/avoidance_debug_msg_array.hpp>

#include <lanelet2_core/geometry/Lanelet.h>
#include <lanelet2_core/primitives/Lanelet.h>
#include <lanelet2_core/primitives/LineString.h>

#include <limits>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#include <geometry_msgs/msg/pose_array.hpp>
#include <visualization_msgs/msg/marker_array.hpp>

#include <lanelet2_core/LaneletMap.h>
#include <lanelet2_routing/RoutingGraph.h>
#include <lanelet2_core/Forward.h>

#include <algorithm>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <geometry_msgs/msg/twist_stamped.hpp>

#include <lanelet2_core/primitives/Primitive.h>
#include <lanelet2_core/Forward.h>

#include <memory>
#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include "autoware_auto_planning_msgs/msg/path_point_with_lane_id.hpp"

#include <lanelet2_core/primitives/Lanelet.h>

#include <memory>
#include <string>
#include <unordered_map>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <geometry_msgs/msg/twist_stamped.hpp>

#include <lanelet2_core/primitives/Primitive.h>
#include <lanelet2_core/Forward.h>

#include <memory>
#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <autoware_auto_vehicle_msgs/msg/turn_indicators_command.hpp>
#include <geometry_msgs/msg/point.hpp>

#include <lanelet2_core/geometry/Lanelet.h>
#include <lanelet2_core/Forward.h>

#include <limits>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <geometry_msgs/msg/pose.hpp>
#include <geometry_msgs/msg/twist.hpp>

#include <lanelet2_core/primitives/Primitive.h>
#include <lanelet2_core/Forward.h>

#include <memory>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
#include <geometry_msgs/msg/pose.hpp>
#include <geometry_msgs/msg/pose_array.hpp>

#include <lanelet2_core/geometry/Lanelet.h>
#include <lanelet2_routing/RoutingGraphContainer.h>
#include <lanelet2_core/Forward.h>
#include <tf2/utils.h>

#ifdef ROS_DISTRO_GALACTIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <magic_enum.hpp>

#include <lanelet2_core/primitives/LineString.h>
#include <tf2/utils.h>

#include <string>
Expand Down
6 changes: 5 additions & 1 deletion planning/behavior_path_planner/src/marker_utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
#include "behavior_path_planner/utils/path_utils.hpp"
#include "behavior_path_planner/utils/utils.hpp"

#include <tier4_autoware_utils/geometry/geometry.hpp>
#include <tier4_autoware_utils/ros/marker_helper.hpp>
#include <tier4_autoware_utils/ros/uuid_helper.hpp>

#include <lanelet2_core/primitives/CompoundPolygon.h>
#include <lanelet2_core/primitives/Lanelet.h>
#include <lanelet2_core/primitives/LineString.h>

namespace marker_utils
{
using behavior_path_planner::ShiftLine;
Expand Down
30 changes: 29 additions & 1 deletion planning/behavior_path_planner/src/planner_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "behavior_path_planner/utils/utils.hpp"
#include "tier4_autoware_utils/system/stop_watch.hpp"

#include <lanelet2_extension/utility/utilities.hpp>
#include <lanelet2_extension/utility/query.hpp>
#include <magic_enum.hpp>

#include <boost/format.hpp>
Expand Down Expand Up @@ -342,6 +342,34 @@ std::vector<SceneModulePtr> PlannerManager::getRequestModules(
return request_modules;
}

BehaviorModuleOutput PlannerManager::getReferencePath(
const std::shared_ptr<PlannerData> & data) const
{
const auto & route_handler = data->route_handler;
const auto & pose = data->self_odometry->pose.pose;
const auto p = data->parameters;

constexpr double extra_margin = 10.0;
const auto backward_length =
std::max(p.backward_path_length, p.backward_path_length + extra_margin);

const auto lanelet_sequence = route_handler->getLaneletSequence(
root_lanelet_.get(), pose, backward_length, std::numeric_limits<double>::max());

lanelet::ConstLanelet closest_lane{};
if (lanelet::utils::query::getClosestLaneletWithConstrains(
lanelet_sequence, pose, &closest_lane, p.ego_nearest_dist_threshold,
p.ego_nearest_yaw_threshold)) {
return utils::getReferencePath(closest_lane, data);
}

if (lanelet::utils::query::getClosestLanelet(lanelet_sequence, pose, &closest_lane)) {
return utils::getReferencePath(closest_lane, data);
}

return {}; // something wrong.
}

SceneModulePtr PlannerManager::selectHighestPriorityModule(
std::vector<SceneModulePtr> & request_modules) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#include <tier4_planning_msgs/msg/avoidance_debug_msg.hpp>
#include <tier4_planning_msgs/msg/avoidance_debug_msg_array.hpp>

#include <boost/geometry/algorithms/centroid.hpp>
#include <boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp>

#include <algorithm>
#include <limits>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include <lanelet2_extension/utility/utilities.hpp>
#include <tier4_autoware_utils/geometry/boost_polygon_utils.hpp>

#include <lanelet2_core/geometry/Point.h>
#include <lanelet2_core/geometry/Polygon.h>

#include <algorithm>
#include <limits>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "tier4_autoware_utils/math/unit_conversion.hpp"

#include <lanelet2_extension/utility/message_conversion.hpp>
#include <lanelet2_extension/utility/query.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <magic_enum.hpp>
#include <rclcpp/rclcpp.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include "behavior_path_planner/utils/path_utils.hpp"

#include <lanelet2_extension/utility/utilities.hpp>
#include <tier4_autoware_utils/geometry/boost_geometry.hpp>

#include <boost/geometry/algorithms/centroid.hpp>
#include <boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp>

#include <utility>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include <lanelet2_extension/utility/utilities.hpp>
#include <tier4_autoware_utils/geometry/boost_polygon_utils.hpp>

#include <lanelet2_core/geometry/Point.h>
#include <lanelet2_core/geometry/Polygon.h>

#include <algorithm>
#include <limits>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@
#include "behavior_path_planner/utils/start_planner/util.hpp"
#include "motion_utils/trajectory/trajectory.hpp"

#include <lanelet2_extension/utility/query.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <magic_enum.hpp>
#include <rclcpp/rclcpp.hpp>

#include <boost/geometry/algorithms/within.hpp>

#include <lanelet2_core/geometry/Lanelet.h>

#include <algorithm>
#include <memory>
#include <string>
Expand Down
1 change: 1 addition & 0 deletions planning/behavior_path_planner/src/turn_signal_decider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <tier4_autoware_utils/math/unit_conversion.hpp>

#include <limits>
#include <queue>
#include <string>
#include <utility>

Expand Down
2 changes: 2 additions & 0 deletions planning/behavior_path_planner/src/utils/avoidance/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <tier4_planning_msgs/msg/avoidance_debug_factor.hpp>

#include <lanelet2_routing/RoutingGraphContainer.h>

#include <algorithm>
#include <limits>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "tier4_autoware_utils/math/unit_conversion.hpp"

#include <interpolation/spline_interpolation.hpp>
#include <lanelet2_extension/utility/message_conversion.hpp>
#include <lanelet2_extension/utility/utilities.hpp>

#ifdef ROS_DISTRO_GALACTIC
Expand All @@ -32,8 +31,12 @@
#include <tf2_eigen/tf2_eigen.hpp>

#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>

#include <lanelet2_core/geometry/Polygon.h>
#endif

#include <boost/geometry/algorithms/within.hpp>

#include <limits>
#include <string>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
#include "behavior_path_planner/utils/goal_planner/util.hpp"
#include "behavior_path_planner/utils/path_safety_checker/objects_filtering.hpp"
#include "behavior_path_planner/utils/path_utils.hpp"
#include "lanelet2_extension/regulatory_elements/no_parking_area.hpp"
#include "lanelet2_extension/regulatory_elements/no_stopping_area.hpp"
#include "lanelet2_extension/utility/utilities.hpp"
#include "motion_utils/trajectory/path_with_lane_id.hpp"

#include <boost/geometry/algorithms/union.hpp>
#include <boost/optional.hpp>

#include <lanelet2_core/geometry/Polygon.h>

#include <memory>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#include <lanelet2_extension/utility/query.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <rclcpp/rclcpp.hpp>
#include <tier4_autoware_utils/geometry/boost_geometry.hpp>

#include <boost/geometry/algorithms/dispatch/distance.hpp>

#include <lanelet2_core/LaneletMap.h>
#include <lanelet2_core/primitives/Lanelet.h>
#include <tf2/utils.h>
#include <tf2_ros/transform_listener.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "behavior_path_planner/utils/path_utils.hpp"
#include "behavior_path_planner/utils/utils.hpp"

#include <lanelet2_extension/utility/message_conversion.hpp>
#include <lanelet2_extension/utility/query.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <motion_utils/trajectory/interpolation.hpp>
Expand All @@ -32,6 +31,9 @@
#include <tier4_autoware_utils/geometry/boost_polygon_utils.hpp>

#include <lanelet2_core/LaneletMap.h>
#include <lanelet2_core/geometry/LineString.h>
#include <lanelet2_core/geometry/Point.h>
#include <lanelet2_core/geometry/Polygon.h>
#include <tf2/utils.h>
#include <tf2_ros/transform_listener.h>

Expand Down
Loading