Skip to content

Commit f9044f7

Browse files
authored
Merge branch 'main' into refactor/image_projection_based_fusion/rename_template_argument
2 parents 7aca16d + 4747e74 commit f9044f7

File tree

47 files changed

+772
-4728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+772
-4728
lines changed

control/lane_departure_checker/include/lane_departure_checker/lane_departure_checker.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class LaneDepartureChecker
121121
std::vector<std::pair<double, lanelet::Lanelet>> getLaneletsFromPath(
122122
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const;
123123

124-
std::optional<lanelet::BasicPolygon2d> getFusedLaneletPolygonForPath(
124+
std::optional<tier4_autoware_utils::Polygon2d> getFusedLaneletPolygonForPath(
125125
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const;
126126

127127
bool checkPathWillLeaveLane(

control/lane_departure_checker/src/lane_departure_checker_node/lane_departure_checker.cpp

+25-19
Original file line numberDiff line numberDiff line change
@@ -321,33 +321,39 @@ std::vector<std::pair<double, lanelet::Lanelet>> LaneDepartureChecker::getLanele
321321
lanelet_map_ptr->laneletLayer, footprint_hull_basic_polygon, 0.0);
322322
}
323323

324-
std::optional<lanelet::BasicPolygon2d> LaneDepartureChecker::getFusedLaneletPolygonForPath(
324+
std::optional<tier4_autoware_utils::Polygon2d> LaneDepartureChecker::getFusedLaneletPolygonForPath(
325325
const lanelet::LaneletMapPtr lanelet_map_ptr, const PathWithLaneId & path) const
326326
{
327327
const auto lanelets_distance_pair = getLaneletsFromPath(lanelet_map_ptr, path);
328+
auto to_polygon2d = [](const lanelet::BasicPolygon2d & poly) -> tier4_autoware_utils::Polygon2d {
329+
tier4_autoware_utils::Polygon2d p;
330+
auto & outer = p.outer();
331+
332+
for (const auto & p : poly) {
333+
tier4_autoware_utils::Point2d p2d(p.x(), p.y());
334+
outer.push_back(p2d);
335+
}
336+
boost::geometry::correct(p);
337+
return p;
338+
};
339+
328340
// Fuse lanelets into a single BasicPolygon2d
329-
auto fused_lanelets = [&lanelets_distance_pair]() -> std::optional<lanelet::BasicPolygon2d> {
341+
auto fused_lanelets = [&]() -> std::optional<tier4_autoware_utils::Polygon2d> {
330342
if (lanelets_distance_pair.empty()) return std::nullopt;
331-
if (lanelets_distance_pair.size() == 1)
332-
return lanelets_distance_pair.at(0).second.polygon2d().basicPolygon();
343+
tier4_autoware_utils::MultiPolygon2d lanelet_unions;
344+
tier4_autoware_utils::MultiPolygon2d result;
333345

334-
lanelet::BasicPolygon2d merged_polygon =
335-
lanelets_distance_pair.at(0).second.polygon2d().basicPolygon();
336-
for (size_t i = 1; i < lanelets_distance_pair.size(); ++i) {
346+
for (size_t i = 0; i < lanelets_distance_pair.size(); ++i) {
337347
const auto & route_lanelet = lanelets_distance_pair.at(i).second;
338-
const auto & poly = route_lanelet.polygon2d().basicPolygon();
339-
340-
std::vector<lanelet::BasicPolygon2d> lanelet_union_temp;
341-
boost::geometry::union_(poly, merged_polygon, lanelet_union_temp);
342-
343-
// Update merged_polygon by accumulating all merged results
344-
merged_polygon.clear();
345-
for (const auto & temp_poly : lanelet_union_temp) {
346-
merged_polygon.insert(merged_polygon.end(), temp_poly.begin(), temp_poly.end());
347-
}
348+
const auto & p = route_lanelet.polygon2d().basicPolygon();
349+
tier4_autoware_utils::Polygon2d poly = to_polygon2d(p);
350+
boost::geometry::union_(lanelet_unions, poly, result);
351+
lanelet_unions = result;
352+
result.clear();
348353
}
349-
if (merged_polygon.empty()) return std::nullopt;
350-
return merged_polygon;
354+
355+
if (lanelet_unions.empty()) return std::nullopt;
356+
return lanelet_unions.front();
351357
}();
352358

353359
return fused_lanelets;

evaluator/perception_online_evaluator/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<depend>diagnostic_msgs</depend>
2222
<depend>eigen</depend>
2323
<depend>geometry_msgs</depend>
24+
<depend>lanelet2_extension</depend>
2425
<depend>libgoogle-glog-dev</depend>
2526
<depend>motion_utils</depend>
2627
<depend>nav_msgs</depend>

evaluator/perception_online_evaluator/test/test_perception_online_evaluator_node.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ class EvalTest : public ::testing::Test
7979

8080
marker_sub_ = rclcpp::create_subscription<MarkerArray>(
8181
eval_node, "perception_online_evaluator/markers", 10,
82-
[this]([[maybe_unused]] const MarkerArray::SharedPtr msg) { has_received_marker_ = true; });
82+
[this]([[maybe_unused]] const MarkerArray::ConstSharedPtr msg) {
83+
has_received_marker_ = true;
84+
});
8385
uuid_ = generateUUID();
8486
}
8587

localization/localization_util/src/smart_pose_buffer.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ std::optional<SmartPoseBuffer::InterpolateResult> SmartPoseBuffer::interpolate(
4040
const rclcpp::Time time_last = pose_buffer_.back()->header.stamp;
4141

4242
if (target_ros_time < time_first) {
43+
RCLCPP_INFO(logger_, "Mismatch between pose timestamp and current timestamp");
4344
return std::nullopt;
4445
}
4546

localization/localization_util/src/util_func.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void output_pose_with_cov_to_log(
241241
rpy.y = rpy.y * 180.0 / M_PI;
242242
rpy.z = rpy.z * 180.0 / M_PI;
243243

244-
RCLCPP_INFO_STREAM(
244+
RCLCPP_DEBUG_STREAM(
245245
logger, std::fixed << prefix << "," << pose.position.x << "," << pose.position.y << ","
246246
<< pose.position.z << "," << pose.orientation.x << "," << pose.orientation.y
247247
<< "," << pose.orientation.z << "," << pose.orientation.w << "," << rpy.x

localization/ndt_scan_matcher/src/map_update_module.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ bool MapUpdateModule::update_ndt(const geometry_msgs::msg::Point & position, Ndt
182182
const auto duration_micro_sec =
183183
std::chrono::duration_cast<std::chrono::microseconds>(exe_end_time - exe_start_time).count();
184184
const auto exe_time = static_cast<double>(duration_micro_sec) / 1000.0;
185-
RCLCPP_INFO(logger_, "Time duration for creating new ndt_ptr: %lf [ms]", exe_time);
185+
RCLCPP_DEBUG(logger_, "Time duration for creating new ndt_ptr: %lf [ms]", exe_time);
186186
return true; // Updated
187187
}
188188

localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ geometry_msgs::msg::PoseWithCovarianceStamped NDTScanMatcher::align_pose(
992992
result_pose_with_cov_msg.pose.pose = best_particle_ptr->result_pose;
993993

994994
output_pose_with_cov_to_log(get_logger(), "align_pose_output", result_pose_with_cov_msg);
995-
RCLCPP_INFO_STREAM(get_logger(), "best_score," << best_particle_ptr->score);
995+
RCLCPP_DEBUG_STREAM(get_logger(), "best_score," << best_particle_ptr->score);
996996

997997
return result_pose_with_cov_msg;
998998
}

localization/pose_initializer/src/pose_initializer/ndt_module.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ PoseWithCovarianceStamped NdtModule::align_pose(const PoseWithCovarianceStamped
4040
RCLCPP_INFO(logger_, "Call NDT align server.");
4141
const auto res = cli_align_->async_send_request(req).get();
4242
if (!res->success) {
43-
RCLCPP_INFO(logger_, "NDT align server failed.");
4443
throw ServiceException(
4544
Initialize::Service::Response::ERROR_ESTIMATION, "NDT align server failed.");
4645
}

perception/detection_by_tracker/include/detection_by_tracker/debugger.hpp

+23
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <euclidean_cluster/voxel_grid_based_euclidean_cluster.hpp>
2121
#include <rclcpp/rclcpp.hpp>
2222
#include <shape_estimation/shape_estimator.hpp>
23+
#include <tier4_autoware_utils/ros/debug_publisher.hpp>
24+
#include <tier4_autoware_utils/system/stop_watch.hpp>
2325

2426
#include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
2527
#include <autoware_auto_perception_msgs/msg/tracked_objects.hpp>
@@ -61,6 +63,11 @@ class Debugger
6163
divided_objects_pub_ =
6264
node->create_publisher<autoware_auto_perception_msgs::msg::DetectedObjects>(
6365
"debug/divided_objects", 1);
66+
processing_time_publisher_ =
67+
std::make_unique<tier4_autoware_utils::DebugPublisher>(node, "detection_by_tracker");
68+
stop_watch_ptr_ =
69+
std::make_unique<tier4_autoware_utils::StopWatch<std::chrono::milliseconds>>();
70+
this->startStopWatch();
6471
}
6572

6673
~Debugger() {}
@@ -80,6 +87,19 @@ class Debugger
8087
{
8188
divided_objects_pub_->publish(removeFeature(input));
8289
}
90+
void startStopWatch()
91+
{
92+
stop_watch_ptr_->tic("cyclic_time");
93+
stop_watch_ptr_->tic("processing_time");
94+
}
95+
void startMeasureProcessingTime() { stop_watch_ptr_->tic("processing_time"); }
96+
void publishProcessingTime()
97+
{
98+
processing_time_publisher_->publish<tier4_debug_msgs::msg::Float64Stamped>(
99+
"debug/cyclic_time_ms", stop_watch_ptr_->toc("cyclic_time", true));
100+
processing_time_publisher_->publish<tier4_debug_msgs::msg::Float64Stamped>(
101+
"debug/processing_time_ms", stop_watch_ptr_->toc("processing_time", true));
102+
}
83103

84104
private:
85105
rclcpp::Publisher<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr
@@ -90,6 +110,9 @@ class Debugger
90110
merged_objects_pub_;
91111
rclcpp::Publisher<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr
92112
divided_objects_pub_;
113+
// debug publisher
114+
std::unique_ptr<tier4_autoware_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_;
115+
std::unique_ptr<tier4_autoware_utils::DebugPublisher> processing_time_publisher_;
93116

94117
autoware_auto_perception_msgs::msg::DetectedObjects removeFeature(
95118
const tier4_perception_msgs::msg::DetectedObjectsWithFeature & input)

perception/detection_by_tracker/src/detection_by_tracker_core.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ void DetectionByTracker::setMaxSearchRange()
206206
void DetectionByTracker::onObjects(
207207
const tier4_perception_msgs::msg::DetectedObjectsWithFeature::ConstSharedPtr input_msg)
208208
{
209+
debugger_->startMeasureProcessingTime();
209210
autoware_auto_perception_msgs::msg::DetectedObjects detected_objects;
210211
detected_objects.header = input_msg->header;
211212

@@ -250,6 +251,7 @@ void DetectionByTracker::onObjects(
250251
}
251252

252253
objects_pub_->publish(detected_objects);
254+
debugger_->publishProcessingTime();
253255
}
254256

255257
void DetectionByTracker::divideUnderSegmentedObjects(

perception/ground_segmentation/include/ground_segmentation/scan_ground_filter_nodelet.hpp

+57-29
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define GROUND_SEGMENTATION__SCAN_GROUND_FILTER_NODELET_HPP_
1717

1818
#include "pointcloud_preprocessor/filter.hpp"
19+
#include "pointcloud_preprocessor/transform_info.hpp"
1920

2021
#include <vehicle_info_util/vehicle_info.hpp>
2122

@@ -50,7 +51,7 @@ class ScanGroundFilterComponent : public pointcloud_preprocessor::Filter
5051
// classified point label
5152
// (0: not classified, 1: ground, 2: not ground, 3: follow previous point,
5253
// 4: unkown(currently not used), 5: virtual ground)
53-
enum class PointLabel {
54+
enum class PointLabel : uint16_t {
5455
INIT = 0,
5556
GROUND,
5657
NON_GROUND,
@@ -59,19 +60,15 @@ class ScanGroundFilterComponent : public pointcloud_preprocessor::Filter
5960
VIRTUAL_GROUND,
6061
OUT_OF_RANGE
6162
};
62-
struct PointRef
63+
64+
struct PointData
6365
{
64-
float grid_size; // radius of grid
65-
uint16_t grid_id; // id of grid in vertical
66-
float radius; // cylindrical coords on XY Plane
67-
float theta; // angle deg on XY plane
68-
size_t radial_div; // index of the radial division to which this point belongs to
66+
float radius; // cylindrical coords on XY Plane
6967
PointLabel point_state{PointLabel::INIT};
70-
68+
uint16_t grid_id; // id of grid in vertical
7169
size_t orig_index; // index of this point in the source pointcloud
72-
pcl::PointXYZ * orig_point;
7370
};
74-
using PointCloudRefVector = std::vector<PointRef>;
71+
using PointCloudVector = std::vector<PointData>;
7572

7673
struct GridCenter
7774
{
@@ -144,33 +141,57 @@ class ScanGroundFilterComponent : public pointcloud_preprocessor::Filter
144141

145142
pcl::PointIndices getIndices() { return pcl_indices; }
146143
std::vector<float> getHeightList() { return height_list; }
144+
145+
pcl::PointIndices & getIndicesRef() { return pcl_indices; }
146+
std::vector<float> & getHeightListRef() { return height_list; }
147147
};
148148

149149
void filter(
150150
const PointCloud2ConstPtr & input, const IndicesPtr & indices, PointCloud2 & output) override;
151151

152+
// TODO(taisa1): Temporary Implementation: Remove this interface when all the filter nodes
153+
// conform to new API
154+
virtual void faster_filter(
155+
const PointCloud2ConstPtr & input, const IndicesPtr & indices, PointCloud2 & output,
156+
const pointcloud_preprocessor::TransformInfo & transform_info);
157+
152158
tf2_ros::Buffer tf_buffer_{get_clock()};
153159
tf2_ros::TransformListener tf_listener_{tf_buffer_};
154160

161+
int x_offset_;
162+
int y_offset_;
163+
int z_offset_;
164+
int intensity_offset_;
165+
bool offset_initialized_;
166+
167+
void set_field_offsets(const PointCloud2ConstPtr & input);
168+
169+
void get_point_from_global_offset(
170+
const PointCloud2ConstPtr & input, pcl::PointXYZ & point, size_t global_offset);
171+
155172
const uint16_t gnd_grid_continual_thresh_ = 3;
156173
bool elevation_grid_mode_;
157174
float non_ground_height_threshold_;
158175
float grid_size_rad_;
176+
float tan_grid_size_rad_;
159177
float grid_size_m_;
160178
float low_priority_region_x_;
161179
uint16_t gnd_grid_buffer_size_;
162180
float grid_mode_switch_grid_id_;
163181
float grid_mode_switch_angle_rad_;
164182
float virtual_lidar_z_;
165183
float detection_range_z_max_;
166-
float center_pcl_shift_; // virtual center of pcl to center mass
167-
float grid_mode_switch_radius_; // non linear grid size switching distance
168-
double global_slope_max_angle_rad_; // radians
169-
double local_slope_max_angle_rad_; // radians
184+
float center_pcl_shift_; // virtual center of pcl to center mass
185+
float grid_mode_switch_radius_; // non linear grid size switching distance
186+
double global_slope_max_angle_rad_; // radians
187+
double local_slope_max_angle_rad_; // radians
188+
double global_slope_max_ratio_;
189+
double local_slope_max_ratio_;
170190
double radial_divider_angle_rad_; // distance in rads between dividers
171191
double split_points_distance_tolerance_; // distance in meters between concentric divisions
172-
double // minimum height threshold regardless the slope,
173-
split_height_distance_; // useful for close points
192+
double split_points_distance_tolerance_square_;
193+
double // minimum height threshold regardless the slope,
194+
split_height_distance_; // useful for close points
174195
bool use_virtual_ground_point_;
175196
bool use_recheck_ground_cluster_; // to enable recheck ground cluster
176197
size_t radial_dividers_num_;
@@ -186,23 +207,25 @@ class ScanGroundFilterComponent : public pointcloud_preprocessor::Filter
186207
*/
187208

188209
/*!
189-
* Convert pcl::PointCloud to sorted PointCloudRefVector
210+
* Convert sensor_msgs::msg::PointCloud2 to sorted PointCloudVector
190211
* @param[in] in_cloud Input Point Cloud to be organized in radial segments
191212
* @param[out] out_radial_ordered_points_manager Vector of Points Clouds,
192213
* each element will contain the points ordered
193214
*/
194215
void convertPointcloud(
195-
const pcl::PointCloud<pcl::PointXYZ>::Ptr in_cloud,
196-
std::vector<PointCloudRefVector> & out_radial_ordered_points_manager);
216+
const PointCloud2ConstPtr & in_cloud,
217+
std::vector<PointCloudVector> & out_radial_ordered_points_manager);
197218
void convertPointcloudGridScan(
198-
const pcl::PointCloud<pcl::PointXYZ>::Ptr in_cloud,
199-
std::vector<PointCloudRefVector> & out_radial_ordered_points_manager);
219+
const PointCloud2ConstPtr & in_cloud,
220+
std::vector<PointCloudVector> & out_radial_ordered_points_manager);
200221
/*!
201222
* Output ground center of front wheels as the virtual ground point
202223
* @param[out] point Virtual ground origin point
203224
*/
204225
void calcVirtualGroundOrigin(pcl::PointXYZ & point);
205226

227+
float calcGridSize(const PointData & p);
228+
206229
/*!
207230
* Classifies Points in the PointCloud as Ground and Not Ground
208231
* @param in_radial_ordered_clouds Vector of an Ordered PointsCloud
@@ -214,14 +237,19 @@ class ScanGroundFilterComponent : public pointcloud_preprocessor::Filter
214237
void initializeFirstGndGrids(
215238
const float h, const float r, const uint16_t id, std::vector<GridCenter> & gnd_grids);
216239

217-
void checkContinuousGndGrid(PointRef & p, const std::vector<GridCenter> & gnd_grids_list);
218-
void checkDiscontinuousGndGrid(PointRef & p, const std::vector<GridCenter> & gnd_grids_list);
219-
void checkBreakGndGrid(PointRef & p, const std::vector<GridCenter> & gnd_grids_list);
240+
void checkContinuousGndGrid(
241+
PointData & p, pcl::PointXYZ & p_orig_point, const std::vector<GridCenter> & gnd_grids_list);
242+
void checkDiscontinuousGndGrid(
243+
PointData & p, pcl::PointXYZ & p_orig_point, const std::vector<GridCenter> & gnd_grids_list);
244+
void checkBreakGndGrid(
245+
PointData & p, pcl::PointXYZ & p_orig_point, const std::vector<GridCenter> & gnd_grids_list);
220246
void classifyPointCloud(
221-
std::vector<PointCloudRefVector> & in_radial_ordered_clouds,
247+
const PointCloud2ConstPtr & in_cloud_ptr,
248+
std::vector<PointCloudVector> & in_radial_ordered_clouds,
222249
pcl::PointIndices & out_no_ground_indices);
223250
void classifyPointCloudGridScan(
224-
std::vector<PointCloudRefVector> & in_radial_ordered_clouds,
251+
const PointCloud2ConstPtr & in_cloud_ptr,
252+
std::vector<PointCloudVector> & in_radial_ordered_clouds,
225253
pcl::PointIndices & out_no_ground_indices);
226254
/*!
227255
* Re-classifies point of ground cluster based on their height
@@ -237,11 +265,11 @@ class ScanGroundFilterComponent : public pointcloud_preprocessor::Filter
237265
* and the other removed as indicated in the indices
238266
* @param in_cloud_ptr Input PointCloud to which the extraction will be performed
239267
* @param in_indices Indices of the points to be both removed and kept
240-
* @param out_object_cloud_ptr Resulting PointCloud with the indices kept
268+
* @param out_object_cloud Resulting PointCloud with the indices kept
241269
*/
242270
void extractObjectPoints(
243-
const pcl::PointCloud<pcl::PointXYZ>::Ptr in_cloud_ptr, const pcl::PointIndices & in_indices,
244-
pcl::PointCloud<pcl::PointXYZ>::Ptr out_object_cloud_ptr);
271+
const PointCloud2ConstPtr & in_cloud_ptr, const pcl::PointIndices & in_indices,
272+
PointCloud2 & out_object_cloud);
245273

246274
/** \brief Parameter service callback result : needed to be hold */
247275
OnSetParametersCallbackHandle::SharedPtr set_param_res_;

0 commit comments

Comments
 (0)