19
19
#include " object_recognition_utils/predicted_path_utils.hpp"
20
20
#include " signal_processing/lowpass_filter_1d.hpp"
21
21
#include " tier4_autoware_utils/geometry/boost_polygon_utils.hpp"
22
- #include " tier4_autoware_utils/ros/msg_covariance.hpp"
23
22
24
- #include < lanelet2_extension/utility/message_conversion.hpp>
25
23
#include < lanelet2_extension/utility/utilities.hpp>
26
24
27
25
#include < boost/geometry/algorithms/buffer.hpp>
28
26
#include < boost/geometry/algorithms/convex_hull.hpp>
29
27
#include < boost/geometry/algorithms/correct.hpp>
30
28
#include < boost/geometry/algorithms/difference.hpp>
31
29
#include < boost/geometry/algorithms/union.hpp>
32
- #include < boost/geometry/strategies/agnostic/buffer_distance_symmetric.hpp>
33
- #include < boost/geometry/strategies/cartesian/buffer_end_flat.hpp>
34
- #include < boost/geometry/strategies/cartesian/buffer_join_round.hpp>
35
- #include < boost/geometry/strategies/cartesian/buffer_point_circle.hpp>
36
- #include < boost/geometry/strategies/cartesian/buffer_side_straight.hpp>
37
30
38
31
#include < lanelet2_core/geometry/Point.h>
39
32
#include < lanelet2_core/geometry/Polygon.h>
@@ -401,7 +394,7 @@ BehaviorModuleOutput DynamicAvoidanceModule::plan()
401
394
throw std::runtime_error (" input path is empty" );
402
395
}
403
396
404
- const auto ego_path_reserve_poly = calcEgoPathPreservePoly (input_path);
397
+ const auto ego_path_reserve_poly = calcEgoPathReservePoly (input_path);
405
398
406
399
// create obstacles to avoid (= extract from the drivable area)
407
400
std::vector<DrivableAreaInfo::Obstacle> obstacles_for_drivable_area;
@@ -413,8 +406,8 @@ BehaviorModuleOutput DynamicAvoidanceModule::plan()
413
406
414
407
if (parameters_->polygon_generation_method == PolygonGenerationMethod::EGO_PATH_BASE) {
415
408
return calcEgoPathBasedDynamicObstaclePolygon (object);
416
- } else if (
417
- parameters_->polygon_generation_method == PolygonGenerationMethod::OBJECT_PATH_BASE) {
409
+ }
410
+ if ( parameters_->polygon_generation_method == PolygonGenerationMethod::OBJECT_PATH_BASE) {
418
411
return calcObjectPathBasedDynamicObstaclePolygon (object);
419
412
}
420
413
throw std::logic_error (" The polygon_generation_method's string is invalid." );
@@ -1676,7 +1669,7 @@ DynamicAvoidanceModule::calcEgoPathBasedDynamicObstaclePolygon(
1676
1669
return obj_poly;
1677
1670
}
1678
1671
1679
- // TODO (takagi): replace by another function?
1672
+ // TODO (takagi): replace by the nother function?
1680
1673
std::optional<tier4_autoware_utils::Polygon2d>
1681
1674
DynamicAvoidanceModule::calcObjectPathBasedDynamicObstaclePolygon (
1682
1675
const DynamicAvoidanceObject & object) const
@@ -1740,20 +1733,20 @@ std::optional<tier4_autoware_utils::Polygon2d>
1740
1733
DynamicAvoidanceModule::calcPredictedPathBasedDynamicObstaclePolygon (
1741
1734
const DynamicAvoidanceObject & object, const EgoPathReservePoly & ego_path_poly) const
1742
1735
{
1743
- std::vector<geometry_msgs::msg::Pose> candidate_poses ;
1736
+ std::vector<geometry_msgs::msg::Pose> obj_poses ;
1744
1737
for (const auto & predicted_path : object.predicted_paths ) {
1745
1738
if (predicted_path.confidence < parameters_->threshold_confidence ) continue ;
1746
1739
1747
1740
double time_count = 0.0 ;
1748
1741
for (const auto & pose : predicted_path.path ) {
1749
- candidate_poses .push_back (pose);
1742
+ obj_poses .push_back (pose);
1750
1743
time_count += predicted_path.time_step .sec + predicted_path.time_step .nanosec * 1e-9 ;
1751
1744
if (time_count > parameters_->end_time_to_consider + 1e-3 ) break ;
1752
1745
}
1753
1746
}
1754
1747
1755
1748
tier4_autoware_utils::Polygon2d obj_points_as_poly;
1756
- for (const auto pose : candidate_poses ) {
1749
+ for (const auto pose : obj_poses ) {
1757
1750
boost::geometry::append (
1758
1751
obj_points_as_poly, tier4_autoware_utils::toFootprint (
1759
1752
pose, object.shape .dimensions .x * 0.5 , object.shape .dimensions .x * 0.5 ,
@@ -1798,7 +1791,7 @@ DynamicAvoidanceModule::calcPredictedPathBasedDynamicObstaclePolygon(
1798
1791
// Calculate the driving area required to ensure the safety of the own vehicle.
1799
1792
// It is assumed that this area will not be clipped.
1800
1793
// input: ego's reference path, ego's pose, ego's speed, and some global params
1801
- DynamicAvoidanceModule::EgoPathReservePoly DynamicAvoidanceModule::calcEgoPathPreservePoly (
1794
+ DynamicAvoidanceModule::EgoPathReservePoly DynamicAvoidanceModule::calcEgoPathReservePoly (
1802
1795
const PathWithLaneId & ego_path) const
1803
1796
{
1804
1797
// This function require almost 0.5 ms. Should be refactored in the future
@@ -1818,22 +1811,25 @@ DynamicAvoidanceModule::EgoPathReservePoly DynamicAvoidanceModule::calcEgoPathPr
1818
1811
[&ego_path_lines](
1819
1812
strategy::distance_asymmetric<double > path_expand_strategy,
1820
1813
strategy::distance_asymmetric<double > steer_expand_strategy,
1821
- std::vector<geometry_msgs::msg::Point > steer_outer_path) -> tier4_autoware_utils::Polygon2d {
1814
+ std::vector<geometry_msgs::msg::Point > outer_body_path) -> tier4_autoware_utils::Polygon2d {
1815
+ // reserve area based on the reference path
1822
1816
tier4_autoware_utils::MultiPolygon2d path_poly;
1823
1817
boost::geometry::buffer (
1824
1818
ego_path_lines, path_poly, path_expand_strategy, strategy::side_straight (),
1825
1819
strategy::join_round (), strategy::end_flat (), strategy::point_circle ());
1826
1820
1821
+ // reserve area steer to the avoidance path
1827
1822
tier4_autoware_utils::LineString2d steer_lines;
1828
- for (const auto & point : steer_outer_path ) {
1823
+ for (const auto & point : outer_body_path ) {
1829
1824
const auto bg_point = tier4_autoware_utils::fromMsg (point).to_2d ();
1830
1825
if (boost::geometry::within (bg_point, path_poly)) {
1831
1826
if (steer_lines.size () != 0 ) {
1832
- boost::geometry::append (steer_lines, bg_point);
1827
+ ;
1828
+ // boost::geometry::append(steer_lines, bg_point);
1833
1829
}
1834
1830
break ;
1835
1831
}
1836
- boost::geometry::append (steer_lines, bg_point);
1832
+ // boost::geometry::append(steer_lines, bg_point);
1837
1833
}
1838
1834
tier4_autoware_utils::MultiPolygon2d steer_poly;
1839
1835
boost::geometry::buffer (
0 commit comments