Skip to content

Commit

Permalink
Move all parameters of point cloud divider to launch xml file
Browse files Browse the repository at this point in the history
Signed-off-by: Anh Nguyen <[email protected]>
  • Loading branch information
anhnv3991 committed Feb 24, 2025
1 parent d7885bb commit 65282e1
Show file tree
Hide file tree
Showing 9 changed files with 1,018 additions and 0 deletions.
26 changes: 26 additions & 0 deletions map/autoware_tp_collector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.5)
project(autoware_tp_manager)

find_package(autoware_cmake REQUIRED)
autoware_package()

# Enable support for C++17
if (${CMAKE_VERSION} VERSION_LESS "3.1.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
else ()
set(CMAKE_CXX_STANDARD 17)
endif ()

# Find packages
find_package(yaml-cpp REQUIRED)
find_package(PCL REQUIRED)

install(PROGRAMS
scripts/tp_collector.py
scripts/tp_checker.py
scripts/tp_visualizer.py
DESTINATION lib/${PROJECT_NAME}
)

# ament_auto_package(INSTALL_TO_SHARE launch config)
ament_auto_package()
28 changes: 28 additions & 0 deletions map/autoware_tp_collector/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2023, MAP IV

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 changes: 48 additions & 0 deletions map/autoware_tp_collector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# autoware_pointcloud_merger

This is a tool for processing pcd files, and it can perform the following functions:

- Merging multiple PCD files to a single PCD file
- Downsampling point clouds

## Supported Data Format

**Currently, only `pcl::PointXYZ` and `pcl::PointXYZI` are supported. Any PCD will be loaded as those two types .**

This tool can be used with files that have data fields other than `XYZI` (e.g., `XYZRGB`) and files that only contain `XYZ`.

- Data fields other than `XYZI` are ignored during loading.
- When loading `XYZ`-only data, the `intensity` field is assigned 0.

## Installation

```bash
cd <PATH_TO_pilot-auto.*> # OR <PATH_TO_autoware>
cd src/
git clone [email protected]:autowarefoundation/autoware_tools.git
cd ..
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --catkin-skip-building-tests --symlink-install --packages-up-to autoware_pointcloud_merger
```

## Usage

- Merger all PCD files from the input directory into a single output PCD

```bash
ros2 launch autoware_pointcloud_merger pointcloud_merger.launch.xml input_pcd_dir:=<INPUT_DIR> output_pcd:=<OUTPUT_PCD>
```

| Name | Description |
| ---------- | ------------------------------------------- |
| INPUT_DIR | Directory that contains all input PCD files |
| OUTPUT_PCD | Name of the output PCD file |

`INPUT_DIR` and `OUTPUT_PCD` should be specified as **absolute paths**.

## Parameter

{{ json_to_markdown("map/autoware_pointcloud_merger/schema/pointcloud_merger.schema.json") }}

## LICENSE

Parts of files pcd_merger.hpp, and pcd_merger.cpp are copied from [MapIV's pointcloud_divider](https://github.com/MapIV/pointcloud_divider) and are under [BSD-3-Clauses](LICENSE) license. The remaining code are under [Apache License 2.0](../../LICENSE)
23 changes: 23 additions & 0 deletions map/autoware_tp_collector/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>autoware_tp_manager</name>
<version>0.1.0</version>
<description>A package for checking TP scores of NDT matching</description>
<maintainer email="[email protected]">Anh Nguyen</maintainer>
<license>Apache License 2.0</license>

<author email="[email protected]">Anh Nguyen</author>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>
<buildtool_depend>tier4_debug_msgs</buildtool_depend>

<depend>libpcl-all-dev</depend>
<depend>yaml-cpp</depend>
<depend>tier4_debug_msgs</depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
48 changes: 48 additions & 0 deletions map/autoware_tp_collector/schema/pointcloud_merger.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Parameters for autoware point cloud merger node",
"type": "object",
"definitions": {
"autoware_pointcloud_merger": {
"type": "object",
"properties": {
"leaf_size": {
"type": "number",
"description": "Resolution in meter for downsampling the output PCD. Setting to negative to get the raw output PCD.",
"default": "-0.1"
},
"input_pcd_dir": {
"type": "string",
"description": "The path to the folder containing the input PCD files",
"default": ""
},
"output_pcd": {
"type": "string",
"description": "The path to the merged PCD file",
"default": ""
},
"point_type": {
"type": "string",
"description": "Type of the point when processing PCD files. Could be point_xyz or point_xyzi",
"default": "point_xyzi"
}
},
"required": ["input_pcd_dir", "output_pcd"],
"additionalProperties": false
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/autoware_pointcloud_merger"
}
},
"required": ["ros__parameters"],
"additionalProperties": false
}
},
"required": ["/**"],
"additionalProperties": false
}
Loading

0 comments on commit 65282e1

Please sign in to comment.