Skip to content

Commit 76b8de0

Browse files
buildable, passed integration test, but the unit tests didn't cuz they still rely on the old version, will update em in step 3
1 parent e9064f8 commit 76b8de0

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

perception/autoware_ground_filter/src/ground_filter.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <cstring>
2424
#include <memory>
25+
#include <string>
2526
#include <utility>
2627
#include <vector>
2728

@@ -48,6 +49,8 @@ GroundFilter::GroundFilter(const GroundFilterParameter & param) : param_(param)
4849

4950
// Init grid if elevation mode is enabled
5051
if (param_.elevation_grid_mode) {
52+
grid_ptr_ = std::make_unique<Grid>(virtual_lidar_x_, virtual_lidar_y_, virtual_lidar_z_);
53+
5154
grid_ptr_ = std::make_unique<Grid>(
5255
param_.grid_size_m, param_.radial_divider_angle_rad, param_.grid_mode_switch_radius);
5356
}
@@ -747,13 +750,14 @@ tl::expected<sensor_msgs::msg::PointCloud2, std::string> GroundFilter::filter(
747750
!is_data_layout_compatible_with_point_xyzircaedt(*in_cloud) &&
748751
!is_data_layout_compatible_with_point_xyzirc(*in_cloud)) {
749752
return tl::unexpected(
750-
"The pointcloud layout is not compatible with PointXYZIRCAEDT or PointXYZIRC. Aborting");
753+
std::string(
754+
"The pointcloud layout is not compatible with PointXYZIRCAEDT or PointXYZIRC. Aborting"));
751755
}
752756
if (in_cloud->data.empty() || in_cloud->width * in_cloud->height == 0) {
753-
return tl::unexpected("Received empty PointCloud.");
757+
return tl::unexpected(std::string("Received empty PointCloud."));
754758
}
755759
if (in_cloud->width * in_cloud->height * in_cloud->point_step != in_cloud->data.size()) {
756-
return tl::unexpected("Invalid PointCloud memory layout.");
760+
return tl::unexpected(std::string("Invalid PointCloud memory layout."));
757761
}
758762

759763
setDataAccessor(in_cloud);

perception/autoware_ground_filter/src/ground_filter.hpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,8 @@ struct GroundFilterParameter
159159
class GroundFilter
160160
{
161161
public:
162-
explicit GroundFilter(GroundFilterParameter & param) : param_(param)
163-
{
164-
// calculate derived parameters
165-
param_.global_slope_max_ratio = std::tan(param_.global_slope_max_angle_rad);
166-
167-
// initialize grid pointer
168-
grid_ptr_ = std::make_unique<Grid>(
169-
param_.virtual_lidar_x, param_.virtual_lidar_y, param_.virtual_lidar_z);
170-
grid_ptr_->initialize(
171-
param_.grid_size_m, param_.radial_divider_angle_rad, param_.grid_mode_switch_radius);
172-
}
162+
explicit GroundFilter(const GroundFilterParameter & param);
163+
173164
~GroundFilter() = default;
174165

175166
void setTimeKeeper(std::shared_ptr<autoware_utils_debug::TimeKeeper> time_keeper_ptr)

perception/autoware_ground_filter/test/test_ground_filter.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class GroundFilterTest : public ::testing::Test
3030
protected:
3131
void SetUp() override
3232
{
33+
param_.elevation_grid_mode = true;
34+
3335
// Initialize parameter structure
3436
param_.global_slope_max_angle_rad = 0.26f; // ~15 degrees
3537
param_.local_slope_max_angle_rad = 0.26f; // ~15 degrees
@@ -41,9 +43,15 @@ class GroundFilterTest : public ::testing::Test
4143
param_.grid_size_m = 0.5f;
4244
param_.grid_mode_switch_radius = 20.0f;
4345
param_.ground_grid_buffer_size = 3;
44-
param_.virtual_lidar_x = 1.4f;
45-
param_.virtual_lidar_y = 0.0f;
46-
param_.virtual_lidar_z = 1.9f;
46+
47+
// So here previously we had virtual lidar origin params:
48+
// - param_.virtual_lidar_x = 1.4f;
49+
// - param_.virtual_lidar_y = 0.0f;
50+
// - param_.virtual_lidar_z = 1.9f;
51+
// But now we gonna use vehicle's intuitive info to set these values:
52+
param_.wheel_base_m = 2.8f; // 2.8 / 2 = 1.4 for the X origin
53+
param_.center_pcl_shift = 0.0f;
54+
param_.vehicle_height_m = 1.9f; // Directly maps to the Z origin
4755

4856
// Create filter
4957
ground_filter_ = std::make_unique<autoware::ground_filter::GroundFilter>(param_);

0 commit comments

Comments
 (0)