14
14
15
15
#include " static_centerline_generator_node.hpp"
16
16
17
- #include " autoware/interpolation/spline_interpolation_points_2d.hpp"
18
17
#include " autoware/map_loader/lanelet2_map_loader_node.hpp"
19
18
#include " autoware/map_projection_loader/load_info_from_lanelet2_map.hpp"
20
19
#include " autoware/map_projection_loader/map_projection_loader.hpp"
21
20
#include " autoware/motion_utils/resample/resample.hpp"
22
21
#include " autoware/motion_utils/trajectory/conversion.hpp"
22
+ #include " autoware/motion_utils/trajectory/trajectory.hpp"
23
23
#include " autoware/universe_utils/geometry/geometry.hpp"
24
+ #include " autoware/universe_utils/math/unit_conversion.hpp"
24
25
#include " autoware/universe_utils/ros/parameter.hpp"
25
26
#include " autoware_lanelet2_extension/utility/message_conversion.hpp"
26
27
#include " autoware_lanelet2_extension/utility/query.hpp"
59
60
60
61
#define RESET_TEXT " \x1B [0m"
61
62
#define RED_TEXT " \x1B [31m"
63
+ #define YELLOW_TEXT " \x1b [33m"
62
64
#define BOLD_TEXT " \x1B [1m"
63
65
64
66
namespace autoware ::static_centerline_generator
@@ -626,10 +628,8 @@ void StaticCenterlineGeneratorNode::validate()
626
628
}
627
629
628
630
// calculate curvature
629
- autoware::interpolation::SplineInterpolationPoints2d centerline_spline (centerline);
630
- const auto curvature_vec = centerline_spline.getSplineInterpolatedCurvatures ();
631
- const double curvature_threshold = vehicle_info_.calcCurvatureFromSteerAngle (
632
- vehicle_info_.max_steer_angle_rad - max_steer_angle_margin);
631
+ const auto curvature_vec = autoware::motion_utils::calcCurvature (centerline);
632
+ const double steer_angle_threshold = vehicle_info_.max_steer_angle_rad - max_steer_angle_margin;
633
633
634
634
// calculate the distance between footprint and right/left bounds
635
635
MarkerArray marker_array;
@@ -676,6 +676,7 @@ void StaticCenterlineGeneratorNode::validate()
676
676
max_curvature = std::abs (curvature);
677
677
}
678
678
}
679
+ const double max_steer_angle = vehicle_info_.calcSteerAngleFromCurvature (max_curvature);
679
680
680
681
// publish road boundaries
681
682
const auto left_bound = convertToGeometryPoints (lanelet_left_bound);
@@ -693,30 +694,36 @@ void StaticCenterlineGeneratorNode::validate()
693
694
std::cerr << " 1. Footprints inside Lanelets:" << std::endl;
694
695
if (dist_thresh_to_road_border < min_dist) {
695
696
std::cerr << " The generated centerline is inside the lanelet. (threshold:"
696
- << dist_thresh_to_road_border << " < actual:" << min_dist << " )" << std::endl
697
+ << dist_thresh_to_road_border << " [m] < actual:" << min_dist << " [m] )" << std::endl
697
698
<< " Passed." << std::endl;
698
699
return true ;
699
700
}
700
701
std::cerr << RED_TEXT
701
702
<< " The generated centerline is outside the lanelet. (actual:" << min_dist
702
- << " <= threshold:" << dist_thresh_to_road_border << " )" << std::endl
703
+ << " [m] <= threshold:" << dist_thresh_to_road_border << " [m] )" << std::endl
703
704
<< " Failed." << RESET_TEXT << std::endl;
704
705
return false ;
705
706
}();
706
707
// 2. centerline's curvature
707
- const bool is_curvature_low = [&]() {
708
- std::cerr << " 2. Curvature:" << std::endl;
709
- if (max_curvature < curvature_threshold) {
710
- std::cerr << " The generated centerline has no high curvature. (actual:" << max_curvature
711
- << " < threshold:" << curvature_threshold << " )"
712
- << " Passed." << std::endl;
713
- return true ;
714
- }
715
- std::cerr << RED_TEXT << " The generated centerline has a too high curvature. (threshold:"
716
- << curvature_threshold << " <= actual:" << max_curvature << " )"
717
- << " Failed." << RESET_TEXT << std::endl;
718
- return false ;
719
- }();
708
+ std::cerr << " 2. Curvature:" << std::endl;
709
+ const bool is_curvature_low =
710
+ true ; // always tre for now since the curvature is just estimated and not enough precise.
711
+ if (max_steer_angle < steer_angle_threshold) {
712
+ std::cerr << " The generated centerline has no high steer angle. (estimated:"
713
+ << autoware::universe_utils::rad2deg (max_steer_angle)
714
+ << " [deg] < threshold:" << autoware::universe_utils::rad2deg (steer_angle_threshold)
715
+ << " [deg])" << std::endl
716
+ << " Passed." << std::endl;
717
+ } else {
718
+ std::cerr << YELLOW_TEXT << " The generated centerline has a too high steer angle. (threshold:"
719
+ << autoware::universe_utils::rad2deg (steer_angle_threshold)
720
+ << " [deg] <= estimated:" << autoware::universe_utils::rad2deg (max_steer_angle)
721
+ << " [deg])" << std::endl
722
+ << " However, the estimated steer angle is not enough precise, so the result is "
723
+ " conditional pass."
724
+ << std::endl
725
+ << " Conditionally Passed." << RESET_TEXT << std::endl;
726
+ }
720
727
// 3. result
721
728
std::cerr << std::endl << BOLD_TEXT << " Result:" << RESET_TEXT << std::endl;
722
729
if (are_footprints_inside_lanelets && is_curvature_low) {
0 commit comments