Skip to content

Commit 4f629b1

Browse files
Motsu-sanpre-commit-ci[bot]
authored andcommitted
refactor(lanelet2_map_preprocessor): rework parameter (autowarefoundation#6218)
* refactor: Create .yaml file for default parameters of transform_maps.launch.xml Signed-off-by: Motsu-san <masahiro.sakamoto@tier4.jp> * refactor: Create JSON Schema file of transform_maps Signed-off-by: Motsu-san <masahiro.sakamoto@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: Motsu-san <masahiro.sakamoto@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 42fcd71 commit 4f629b1

7 files changed

+101
-34
lines changed

map/util/lanelet2_map_preprocessor/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ if(BUILD_TESTING)
2929
endif()
3030

3131
ament_auto_package(INSTALL_TO_SHARE
32+
config
3233
launch
3334
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**:
2+
ros__parameters:
3+
llt_map_path: $(var llt_map_path)
4+
pcd_map_path: $(var pcd_map_path)
5+
llt_output_path: $(var llt_output_path)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**:
2+
ros__parameters:
3+
llt_map_path: $(var llt_map_path)
4+
pcd_map_path: $(var pcd_map_path)
5+
llt_output_path: $(var llt_output_path)
6+
pcd_output_path: $(var pcd_output_path)
7+
x: 0.0
8+
y: 0.0
9+
z: 0.0
10+
roll: 0.0
11+
pitch: 0.0
12+
yaw: 0.0
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<launch>
3-
<arg name="llt_map_path" default=""/>
4-
<arg name="pcd_map_path" default=""/>
5-
<arg name="llt_output_path" default=""/>
6-
73
<node pkg="lanelet2_map_preprocessor" exec="fix_z_value_by_pcd" name="fix_z_value_by_pcd" output="screen">
8-
<param name="llt_map_path" value="$(var llt_map_path)"/>
9-
<param name="pcd_map_path" value="$(var pcd_map_path)"/>
10-
<param name="llt_output_path" value="$(var llt_output_path)"/>
4+
<param from="$(find-pkg-share lanelet2_map_preprocessor)/config/fix_z_value_by_pcd.param.yaml" allow_substs="true"/>
115
</node>
126
</launch>
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<launch>
3-
<arg name="llt_map_path" default=""/>
4-
<arg name="pcd_map_path" default=""/>
5-
<arg name="llt_output_path" default=""/>
6-
<arg name="pcd_output_path" default=""/>
7-
<arg name="x" default="0.0"/>
8-
<arg name="y" default="0.0"/>
9-
<arg name="z" default="0.0"/>
10-
<arg name="roll" default="0.0"/>
11-
<arg name="pitch" default="0.0"/>
12-
<arg name="yaw" default="0.0"/>
13-
143
<node pkg="lanelet2_map_preprocessor" exec="transform_maps" name="transform_maps" output="screen">
15-
<param name="llt_map_path" value="$(var llt_map_path)"/>
16-
<param name="pcd_map_path" value="$(var pcd_map_path)"/>
17-
<param name="llt_output_path" value="$(var llt_output_path)"/>
18-
<param name="pcd_output_path" value="$(var pcd_output_path)"/>
19-
<param name="x" value="$(var x)"/>
20-
<param name="y" value="$(var y)"/>
21-
<param name="z" value="$(var z)"/>
22-
<param name="roll" value="$(var roll)"/>
23-
<param name="pitch" value="$(var pitch)"/>
24-
<param name="yaw" value="$(var yaw)"/>
4+
<param from="$(find-pkg-share lanelet2_map_preprocessor)/config/transform_maps.param.yaml" allow_substs="true"/>
255
</node>
266
</launch>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Parameters for Transforming Maps",
4+
"type": "object",
5+
"definitions": {
6+
"transform_maps": {
7+
"type": "object",
8+
"properties": {
9+
"llt_map_path": {
10+
"type": "string",
11+
"description": "Path pointing to the input lanelet2 file",
12+
"default": ""
13+
},
14+
"pcd_map_path": {
15+
"type": "string",
16+
"description": "Path pointing to the input point cloud file",
17+
"default": ""
18+
},
19+
"llt_output_path": {
20+
"type": "string",
21+
"description": "Path pointing to the output lanelet2 file",
22+
"default": ""
23+
},
24+
"pcd_output_path": {
25+
"type": "string",
26+
"description": "Path pointing to the output point cloud file",
27+
"default": ""
28+
},
29+
"x": {
30+
"type": "number",
31+
"default": 0.0,
32+
"description": "x factor of Translation vector for transforming maps [m]"
33+
},
34+
"y": {
35+
"type": "number",
36+
"default": 0.0,
37+
"description": "y factor of Translation vector for transforming maps [m]"
38+
},
39+
"z": {
40+
"type": "number",
41+
"default": 0.0,
42+
"description": "z factor of Translation vector for transforming maps [m]"
43+
},
44+
"roll": {
45+
"type": "number",
46+
"default": 0.0,
47+
"description": "roll factor of Rotation vector for transforming maps [rad]"
48+
},
49+
"pitch": {
50+
"type": "number",
51+
"default": 0.0,
52+
"description": "pitch factor of Rotation vector for transforming maps [rad]"
53+
},
54+
"yaw": {
55+
"type": "number",
56+
"default": 0.0,
57+
"description": "yaw factor of Rotation vector for transforming maps [rad]"
58+
}
59+
},
60+
"required": ["x", "y", "z", "roll", "pitch", "yaw"]
61+
}
62+
},
63+
"properties": {
64+
"/**": {
65+
"type": "object",
66+
"properties": {
67+
"ros__parameters": {
68+
"$ref": "#/definitions/transform_maps"
69+
}
70+
},
71+
"required": ["ros__parameters"]
72+
}
73+
},
74+
"required": ["/**"]
75+
}

map/util/lanelet2_map_preprocessor/src/transform_maps.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ int main(int argc, char * argv[])
107107
const auto pcd_map_path = node->declare_parameter<std::string>("pcd_map_path");
108108
const auto llt_output_path = node->declare_parameter<std::string>("llt_output_path");
109109
const auto pcd_output_path = node->declare_parameter<std::string>("pcd_output_path");
110-
const auto x = node->declare_parameter<double>("x", 0.0);
111-
const auto y = node->declare_parameter<double>("y", 0.0);
112-
const auto z = node->declare_parameter<double>("z", 0.0);
113-
const auto roll = node->declare_parameter<double>("roll", 0.0);
114-
const auto pitch = node->declare_parameter<double>("pitch", 0.0);
115-
const auto yaw = node->declare_parameter<double>("yaw", 0.0);
110+
const auto x = node->declare_parameter<double>("x");
111+
const auto y = node->declare_parameter<double>("y");
112+
const auto z = node->declare_parameter<double>("z");
113+
const auto roll = node->declare_parameter<double>("roll");
114+
const auto pitch = node->declare_parameter<double>("pitch");
115+
const auto yaw = node->declare_parameter<double>("yaw");
116116

117117
std::cout << "transforming maps with following parameters" << std::endl
118118
<< "x " << x << std::endl

0 commit comments

Comments
 (0)