Skip to content

Commit

Permalink
refactor(compare_map_segmentation)!: fix namespace and directory stru…
Browse files Browse the repository at this point in the history
…cture (#7910)

* feat: update namespace and directory structure for compare_map_segmentation code

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* refactor: update  directory structure

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* fix: add missing include

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* style(pre-commit): autofix

---------

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
technolojin and pre-commit-ci[bot] authored Jul 10, 2024
1 parent 73febbd commit ea0276a
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def create_compare_map_pipeline(self):
components.append(
ComposableNode(
package="compare_map_segmentation",
plugin="compare_map_segmentation::VoxelBasedCompareMapFilterComponent",
plugin="autoware::compare_map_segmentation::VoxelBasedCompareMapFilterComponent",
name="voxel_based_compare_map_filter",
remappings=[
("input", down_sample_topic),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def create_single_frame_outlier_filter_components(input_topic, output_topic, con
components.append(
ComposableNode(
package="compare_map_segmentation",
plugin="compare_map_segmentation::CompareElevationMapFilterComponent",
plugin="autoware::compare_map_segmentation::CompareElevationMapFilterComponent",
name="compare_elevation_map_filter",
namespace="elevation_map",
remappings=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,12 @@
<group if="$(var launch_compare_map_pipeline)">
<!-- use pointcloud container -->
<load_composable_node target="$(var pointcloud_container_name)">
<composable_node pkg="compare_map_segmentation" plugin="compare_map_segmentation::VoxelDistanceBasedCompareMapFilterComponent" name="voxel_distance_based_compare_map_filter_node" namespace="">
<composable_node
pkg="compare_map_segmentation"
plugin="autoware::compare_map_segmentation::VoxelDistanceBasedCompareMapFilterComponent"
name="voxel_distance_based_compare_map_filter_node"
namespace=""
>
<!-- topic remap -->
<remap from="map" to="$(var input_pointcloud_map_topic_name)"/>
<remap from="kinematic_state" to="/localization/kinematic_state"/>
Expand Down
42 changes: 21 additions & 21 deletions perception/compare_map_segmentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ include_directories(
${GRID_MAP_INCLUDE_DIR}
)

add_library(compare_map_segmentation SHARED
src/distance_based_compare_map_filter_nodelet.cpp
src/voxel_based_approximate_compare_map_filter_nodelet.cpp
src/voxel_based_compare_map_filter_nodelet.cpp
src/voxel_distance_based_compare_map_filter_nodelet.cpp
src/compare_elevation_map_filter_node.cpp
src/voxel_grid_map_loader.cpp
add_library(${PROJECT_NAME} SHARED
src/distance_based_compare_map_filter/node.cpp
src/voxel_based_approximate_compare_map_filter/node.cpp
src/voxel_based_compare_map_filter/node.cpp
src/voxel_distance_based_compare_map_filter/node.cpp
src/compare_elevation_map_filter/node.cpp
src/voxel_grid_map_loader/voxel_grid_map_loader.cpp
)

target_link_libraries(compare_map_segmentation
target_link_libraries(${PROJECT_NAME}
pointcloud_preprocessor::pointcloud_preprocessor_filter_base
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
${PCL_LIBRARIES}
)

ament_target_dependencies(compare_map_segmentation
ament_target_dependencies(${PROJECT_NAME}
grid_map_pcl
grid_map_ros
pcl_conversions
Expand All @@ -50,40 +50,40 @@ ament_target_dependencies(compare_map_segmentation
)

if(OPENMP_FOUND)
set_target_properties(compare_map_segmentation PROPERTIES
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_FLAGS ${OpenMP_CXX_FLAGS}
LINK_FLAGS ${OpenMP_CXX_FLAGS}
)
endif()

# ========== Compare Map Filter ==========
# -- Distance Based Compare Map Filter --
rclcpp_components_register_node(compare_map_segmentation
PLUGIN "compare_map_segmentation::DistanceBasedCompareMapFilterComponent"
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::compare_map_segmentation::DistanceBasedCompareMapFilterComponent"
EXECUTABLE distance_based_compare_map_filter_node)

# -- Voxel Based Approximate Compare Map Filter --
rclcpp_components_register_node(compare_map_segmentation
PLUGIN "compare_map_segmentation::VoxelBasedApproximateCompareMapFilterComponent"
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::compare_map_segmentation::VoxelBasedApproximateCompareMapFilterComponent"
EXECUTABLE voxel_based_approximate_compare_map_filter_node)

# -- Voxel Based Compare Map Filter --
rclcpp_components_register_node(compare_map_segmentation
PLUGIN "compare_map_segmentation::VoxelBasedCompareMapFilterComponent"
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::compare_map_segmentation::VoxelBasedCompareMapFilterComponent"
EXECUTABLE voxel_based_compare_map_filter_node)

# -- Voxel Distance Based Compare Map Filter --
rclcpp_components_register_node(compare_map_segmentation
PLUGIN "compare_map_segmentation::VoxelDistanceBasedCompareMapFilterComponent"
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::compare_map_segmentation::VoxelDistanceBasedCompareMapFilterComponent"
EXECUTABLE voxel_distance_based_compare_map_filter_node)

# -- Compare Elevation Map Filter --
rclcpp_components_register_node(compare_map_segmentation
PLUGIN "compare_map_segmentation::CompareElevationMapFilterComponent"
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::compare_map_segmentation::CompareElevationMapFilterComponent"
EXECUTABLE compare_elevation_map_filter_node)

install(
TARGETS compare_map_segmentation
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "compare_map_segmentation/compare_elevation_map_filter_node.hpp"
#include "node.hpp"

#include <grid_map_core/GridMap.hpp>
#include <grid_map_cv/GridMapCvConverter.hpp>
Expand All @@ -33,7 +33,7 @@
#include <string>
#include <utility>

namespace compare_map_segmentation
namespace autoware::compare_map_segmentation
{
CompareElevationMapFilterComponent::CompareElevationMapFilterComponent(
const rclcpp::NodeOptions & options)
Expand Down Expand Up @@ -94,7 +94,8 @@ void CompareElevationMapFilterComponent::filter(
output.header.stamp = input->header.stamp;
output.header.frame_id = output_frame;
}
} // namespace compare_map_segmentation
} // namespace autoware::compare_map_segmentation

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(compare_map_segmentation::CompareElevationMapFilterComponent)
RCLCPP_COMPONENTS_REGISTER_NODE(
autoware::compare_map_segmentation::CompareElevationMapFilterComponent)
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPARE_MAP_SEGMENTATION__COMPARE_ELEVATION_MAP_FILTER_NODE_HPP_
#define COMPARE_MAP_SEGMENTATION__COMPARE_ELEVATION_MAP_FILTER_NODE_HPP_
#ifndef COMPARE_ELEVATION_MAP_FILTER__NODE_HPP_
#define COMPARE_ELEVATION_MAP_FILTER__NODE_HPP_

#include "pointcloud_preprocessor/filter.hpp"

Expand All @@ -29,7 +29,7 @@
#include <mutex>
#include <string>
#include <vector>
namespace compare_map_segmentation
namespace autoware::compare_map_segmentation
{
class CompareElevationMapFilterComponent : public pointcloud_preprocessor::Filter
{
Expand All @@ -56,6 +56,6 @@ class CompareElevationMapFilterComponent : public pointcloud_preprocessor::Filte
PCL_MAKE_ALIGNED_OPERATOR_NEW
explicit CompareElevationMapFilterComponent(const rclcpp::NodeOptions & options);
};
} // namespace compare_map_segmentation
} // namespace autoware::compare_map_segmentation

#endif // COMPARE_MAP_SEGMENTATION__COMPARE_ELEVATION_MAP_FILTER_NODE_HPP_
#endif // COMPARE_ELEVATION_MAP_FILTER__NODE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "compare_map_segmentation/distance_based_compare_map_filter_nodelet.hpp"
#include "node.hpp"

#include "autoware/universe_utils/ros/debug_publisher.hpp"
#include "autoware/universe_utils/system/stop_watch.hpp"

#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/search/kdtree.h>
#include <pcl/segmentation/segment_differences.h>

#include <vector>

namespace compare_map_segmentation
namespace autoware::compare_map_segmentation
{

void DistanceBasedStaticMapLoader::onMapCallback(
Expand Down Expand Up @@ -176,7 +179,8 @@ void DistanceBasedCompareMapFilterComponent::filter(
}
}

} // namespace compare_map_segmentation
} // namespace autoware::compare_map_segmentation

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(compare_map_segmentation::DistanceBasedCompareMapFilterComponent)
RCLCPP_COMPONENTS_REGISTER_NODE(
autoware::compare_map_segmentation::DistanceBasedCompareMapFilterComponent)
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPARE_MAP_SEGMENTATION__DISTANCE_BASED_COMPARE_MAP_FILTER_NODELET_HPP_
#define COMPARE_MAP_SEGMENTATION__DISTANCE_BASED_COMPARE_MAP_FILTER_NODELET_HPP_
#ifndef DISTANCE_BASED_COMPARE_MAP_FILTER__NODE_HPP_
#define DISTANCE_BASED_COMPARE_MAP_FILTER__NODE_HPP_

#include "../voxel_grid_map_loader/voxel_grid_map_loader.hpp"
#include "pointcloud_preprocessor/filter.hpp"
#include "voxel_grid_map_loader.hpp"

#include <pcl/common/point_tests.h> // for pcl::isFinite
#include <pcl/filters/voxel_grid.h>
Expand All @@ -26,7 +26,7 @@
#include <string>
#include <vector>

namespace compare_map_segmentation
namespace autoware::compare_map_segmentation
{

typedef typename pcl::Filter<pcl::PointXYZ>::PointCloud PointCloud;
Expand Down Expand Up @@ -114,8 +114,8 @@ class DistanceBasedCompareMapFilterComponent : public pointcloud_preprocessor::F
PCL_MAKE_ALIGNED_OPERATOR_NEW
explicit DistanceBasedCompareMapFilterComponent(const rclcpp::NodeOptions & options);
};
} // namespace compare_map_segmentation
} // namespace autoware::compare_map_segmentation

// clang-format off
#endif // COMPARE_MAP_SEGMENTATION__DISTANCE_BASED_COMPARE_MAP_FILTER_NODELET_HPP_ // NOLINT
#endif // DISTANCE_BASED_COMPARE_MAP_FILTER__NODE_HPP_ // NOLINT
// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "compare_map_segmentation/voxel_based_approximate_compare_map_filter_nodelet.hpp"
#include "node.hpp"

#include "autoware/universe_utils/ros/debug_publisher.hpp"
#include "autoware/universe_utils/system/stop_watch.hpp"

#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/search/kdtree.h>
#include <pcl/segmentation/segment_differences.h>

#include <vector>

namespace compare_map_segmentation
namespace autoware::compare_map_segmentation
{

bool VoxelBasedApproximateStaticMapLoader::is_close_to_map(
Expand Down Expand Up @@ -145,8 +148,8 @@ void VoxelBasedApproximateCompareMapFilterComponent::filter(
}
}

} // namespace compare_map_segmentation
} // namespace autoware::compare_map_segmentation

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(
compare_map_segmentation::VoxelBasedApproximateCompareMapFilterComponent)
autoware::compare_map_segmentation::VoxelBasedApproximateCompareMapFilterComponent)
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPARE_MAP_SEGMENTATION__VOXEL_BASED_APPROXIMATE_COMPARE_MAP_FILTER_NODELET_HPP_ // NOLINT
#define COMPARE_MAP_SEGMENTATION__VOXEL_BASED_APPROXIMATE_COMPARE_MAP_FILTER_NODELET_HPP_ // NOLINT
#ifndef VOXEL_BASED_APPROXIMATE_COMPARE_MAP_FILTER__NODE_HPP_ // NOLINT
#define VOXEL_BASED_APPROXIMATE_COMPARE_MAP_FILTER__NODE_HPP_ // NOLINT

#include "../voxel_grid_map_loader/voxel_grid_map_loader.hpp"
#include "pointcloud_preprocessor/filter.hpp"
#include "voxel_grid_map_loader.hpp"

#include <pcl/filters/voxel_grid.h>
#include <pcl/search/pcl_search.h>
Expand All @@ -25,7 +25,7 @@
#include <string>
#include <vector>

namespace compare_map_segmentation
namespace autoware::compare_map_segmentation
{

class VoxelBasedApproximateStaticMapLoader : public VoxelGridStaticMapLoader
Expand Down Expand Up @@ -70,8 +70,8 @@ class VoxelBasedApproximateCompareMapFilterComponent : public pointcloud_preproc
PCL_MAKE_ALIGNED_OPERATOR_NEW
explicit VoxelBasedApproximateCompareMapFilterComponent(const rclcpp::NodeOptions & options);
};
} // namespace compare_map_segmentation
} // namespace autoware::compare_map_segmentation

// clang-format off
#endif // COMPARE_MAP_SEGMENTATION__VOXEL_BASED_APPROXIMATE_COMPARE_MAP_FILTER_NODELET_HPP_ // NOLINT
#endif // VOXEL_BASED_APPROXIMATE_COMPARE_MAP_FILTER__NODE_HPP_ // NOLINT
// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "compare_map_segmentation/voxel_based_compare_map_filter_nodelet.hpp"
#include "node.hpp"

#include "autoware/universe_utils/ros/debug_publisher.hpp"
#include "autoware/universe_utils/system/stop_watch.hpp"

#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/search/kdtree.h>
Expand All @@ -21,7 +24,7 @@
#include <string>
#include <vector>

namespace compare_map_segmentation
namespace autoware::compare_map_segmentation
{
using pointcloud_preprocessor::get_param;

Expand Down Expand Up @@ -106,7 +109,8 @@ void VoxelBasedCompareMapFilterComponent::filter(
}
}

} // namespace compare_map_segmentation
} // namespace autoware::compare_map_segmentation

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(compare_map_segmentation::VoxelBasedCompareMapFilterComponent)
RCLCPP_COMPONENTS_REGISTER_NODE(
autoware::compare_map_segmentation::VoxelBasedCompareMapFilterComponent)
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COMPARE_MAP_SEGMENTATION__VOXEL_BASED_COMPARE_MAP_FILTER_NODELET_HPP_
#define COMPARE_MAP_SEGMENTATION__VOXEL_BASED_COMPARE_MAP_FILTER_NODELET_HPP_
#ifndef VOXEL_BASED_COMPARE_MAP_FILTER__NODE_HPP_
#define VOXEL_BASED_COMPARE_MAP_FILTER__NODE_HPP_

#include "compare_map_segmentation/voxel_grid_map_loader.hpp"
#include "../voxel_grid_map_loader/voxel_grid_map_loader.hpp"
#include "pointcloud_preprocessor/filter.hpp"

#include <pcl/filters/voxel_grid.h>
Expand All @@ -24,7 +24,7 @@
#include <memory>
#include <vector>

namespace compare_map_segmentation
namespace autoware::compare_map_segmentation
{
class VoxelBasedCompareMapFilterComponent : public pointcloud_preprocessor::Filter
{
Expand All @@ -45,6 +45,6 @@ class VoxelBasedCompareMapFilterComponent : public pointcloud_preprocessor::Filt
PCL_MAKE_ALIGNED_OPERATOR_NEW
explicit VoxelBasedCompareMapFilterComponent(const rclcpp::NodeOptions & options);
};
} // namespace compare_map_segmentation
} // namespace autoware::compare_map_segmentation

#endif // COMPARE_MAP_SEGMENTATION__VOXEL_BASED_COMPARE_MAP_FILTER_NODELET_HPP_
#endif // VOXEL_BASED_COMPARE_MAP_FILTER__NODE_HPP_
Loading

0 comments on commit ea0276a

Please sign in to comment.