Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tools to collect TP values of PCD map segments #211

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
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 ()
Comment on lines +7 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And since the main scripts are Python, is it needed?


# 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
21 changes: 21 additions & 0 deletions map/autoware_tp_collector/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is convenient to add some Localization&Mapping members as maintainers.

<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>

<depend>libpcl-all-dev</depend>
<depend>yaml-cpp</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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

point cloud merger?

"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
Loading