Skip to content

Commit

Permalink
feat(lane_change): use external velocity limit in safety check (autow…
Browse files Browse the repository at this point in the history
…arefoundation#6760)

* feat(lane_change): use external velocity limit in safety check

Signed-off-by: Muhammad Zulfaqar <zulfaqar.azmi@tier4.jp>

* style(pre-commit): autofix

* Minor refactoring

Signed-off-by: Muhammad Zulfaqar <zulfaqar.azmi@tier4.jp>

* Fix spell check and remove headers

Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>

* Add warning

Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>

---------

Signed-off-by: Muhammad Zulfaqar <zulfaqar.azmi@tier4.jp>
Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
zulfaqar-azmi-t4 and pre-commit-ci[bot] authored Apr 9, 2024
1 parent 3c28a15 commit 232d882
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <nav_msgs/msg/occupancy_grid.hpp>
#include <nav_msgs/msg/odometry.hpp>
#include <tier4_planning_msgs/msg/detail/velocity_limit__struct.hpp>
#include <tier4_planning_msgs/msg/lateral_offset.hpp>

#include <limits>
Expand Down Expand Up @@ -65,6 +66,7 @@ using route_handler::RouteHandler;
using tier4_planning_msgs::msg::LateralOffset;
using PlanResult = PathWithLaneId::SharedPtr;
using lanelet::TrafficLight;
using tier4_planning_msgs::msg::VelocityLimit;
using unique_identifier_msgs::msg::UUID;

struct TrafficSignalStamped
Expand Down Expand Up @@ -161,6 +163,7 @@ struct PlannerData
std::map<int64_t, TrafficSignalStamped> traffic_light_id_map;
BehaviorPathPlannerParameters parameters{};
drivable_area_expansion::DrivableAreaExpansionParameters drivable_area_expansion_parameters{};
VelocityLimit::ConstSharedPtr external_limit_max_velocity{};

mutable std::vector<geometry_msgs::msg::Pose> drivable_area_expansion_prev_path_poses{};
mutable std::vector<double> drivable_area_expansion_prev_curvatures{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ std::vector<Polygon2d> getCollidedPolygons(
const ExtendedPredictedObject & target_object,
const PredictedPathWithPolygon & target_object_path,
const BehaviorPathPlannerParameters & common_parameters, const RSSparams & rss_parameters,
const double hysteresis_factor, CollisionCheckDebug & debug);
const double hysteresis_factor, const double max_velocity_limit, CollisionCheckDebug & debug);

bool checkPolygonsIntersects(
const std::vector<Polygon2d> & polys_1, const std::vector<Polygon2d> & polys_2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <boost/geometry/algorithms/union.hpp>
#include <boost/geometry/strategies/strategies.hpp>

#include <limits>

namespace behavior_path_planner::utils::path_safety_checker
{

Expand Down Expand Up @@ -560,7 +562,7 @@ bool checkCollision(
{
const auto collided_polygons = getCollidedPolygons(
planned_path, predicted_ego_path, target_object, target_object_path, common_parameters,
rss_parameters, hysteresis_factor, debug);
rss_parameters, hysteresis_factor, std::numeric_limits<double>::max(), debug);
return collided_polygons.empty();
}

Expand All @@ -570,7 +572,7 @@ std::vector<Polygon2d> getCollidedPolygons(
const ExtendedPredictedObject & target_object,
const PredictedPathWithPolygon & target_object_path,
const BehaviorPathPlannerParameters & common_parameters, const RSSparams & rss_parameters,
double hysteresis_factor, CollisionCheckDebug & debug)
double hysteresis_factor, const double max_velocity_limit, CollisionCheckDebug & debug)
{
{
debug.ego_predicted_path = predicted_ego_path;
Expand All @@ -586,7 +588,7 @@ std::vector<Polygon2d> getCollidedPolygons(
// get object information at current time
const auto & obj_pose = obj_pose_with_poly.pose;
const auto & obj_polygon = obj_pose_with_poly.poly;
const auto & object_velocity = obj_pose_with_poly.velocity;
const auto object_velocity = obj_pose_with_poly.velocity;

// get ego information at current time
// Note: we can create these polygons in advance. However, it can decrease the readability and
Expand All @@ -599,7 +601,7 @@ std::vector<Polygon2d> getCollidedPolygons(
}
const auto & ego_pose = interpolated_data->pose;
const auto & ego_polygon = interpolated_data->poly;
const auto & ego_velocity = interpolated_data->velocity;
const auto ego_velocity = std::min(interpolated_data->velocity, max_velocity_limit);

// check overlap
if (boost::geometry::overlaps(ego_polygon, obj_polygon)) {
Expand Down

0 comments on commit 232d882

Please sign in to comment.