Skip to content

Commit 295ed1d

Browse files
TaikiYamada4pre-commit-ci[bot]HansRobo
authored
refactor(map_projection_loader): rework parameters (#6253)
* Extract all params in map_projection_loader to map_projection_loader.param.yaml Added launch argument map_projection_loader_param_path to map.launch.xml Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * Added map_projection_loader.schema.json. Modified README.md of map_projection_loader to read the schema.json file to construct the table of parameters Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> * style(pre-commit): autofix * Fixed typo Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> --------- Signed-off-by: TaikiYamada4 <taiki.yamada@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Kotaro Yoshimoto <pythagora.yoshimoto@gmail.com>
1 parent 8e97bd1 commit 295ed1d

File tree

6 files changed

+52
-7
lines changed

6 files changed

+52
-7
lines changed

launch/tier4_map_launch/launch/map.launch.xml

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<!-- Parameter files -->
99
<arg name="pointcloud_map_loader_param_path"/>
1010
<arg name="lanelet2_map_loader_param_path"/>
11+
<arg name="map_projection_loader_param_path"/>
1112

1213
<!-- whether use intra-process -->
1314
<arg name="use_intra_process" default="false"/>
@@ -59,6 +60,7 @@
5960
</node>
6061

6162
<include file="$(find-pkg-share map_projection_loader)/launch/map_projection_loader.launch.xml">
63+
<arg name="param_path" value="$(var map_projection_loader_param_path)"/>
6264
<arg name="map_projector_info_path" value="$(var map_projector_info_path)"/>
6365
<arg name="lanelet2_map_path" value="$(var lanelet2_map_path)"/>
6466
</include>

map/map_projection_loader/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ endif()
5959

6060
ament_auto_package(INSTALL_TO_SHARE
6161
launch
62+
config
6263
)

map/map_projection_loader/README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,10 @@ map_origin:
8282
8383
## Published Topics
8484
85-
- ~/map_projector_info (tier4_map_msgs/MapProjectorInfo) : Topic for defining map projector information
85+
- `~/map_projector_info` (tier4_map_msgs/MapProjectorInfo) : This topic shows the definition of map projector information
8686

8787
## Parameters
8888

89-
| Name | Type | Description |
90-
| :---------------------- | :---------- | :------------------------------------------------------------------------------- |
91-
| map_projector_info_path | std::string | A path to map_projector_info.yaml (used by default) |
92-
| lanelet2_map_path | std::string | A path to lanelet2 map (used only when `map_projector_info_path` does not exist) |
89+
Note that these parameters are assumed to be passed from launch arguments, and it is not recommended to directly write them in `map_projection_loader.param.yaml`.
90+
91+
{{ json_to_markdown("map/map_projection_loader/schema/map_projection_loader.schema.json") }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**:
2+
ros__parameters:
3+
map_projector_info_path: $(var map_projector_info_path)
4+
lanelet2_map_path: $(var lanelet2_map_path)
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<launch>
2+
<arg name="param_path" default="$(find-pkg-share map_projection_loader)/config/map_projection_loader.param.yaml"/>
3+
24
<arg name="map_projector_info_path" description="Path to the yaml file"/>
35
<arg name="lanelet2_map_path" description="Path to the lanelet2 map file"/>
46

57
<node pkg="map_projection_loader" exec="map_projection_loader" name="map_projection_loader" output="screen">
6-
<param name="map_projector_info_path" value="$(var map_projector_info_path)"/>
7-
<param name="lanelet2_map_path" value="$(var lanelet2_map_path)"/>
8+
<param from="$(var param_path)" allow_substs="true"/>
89
</node>
910
</launch>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Parameters for map_projection_loader",
4+
"type": "object",
5+
"definitions": {
6+
"map_projection_loader": {
7+
"type": "object",
8+
"properties": {
9+
"map_projector_info_path": {
10+
"type": "string",
11+
"description": "The path where map_projector_info.yaml is located",
12+
"default": "$(var map_projector_info_path)"
13+
},
14+
"lanelet2_map_path": {
15+
"type": "string",
16+
"description": "The path where the lanelet2 map file (.osm) is located",
17+
"default": "$(var lanelet2_map_path)"
18+
}
19+
},
20+
"required": ["map_projector_info_path", "lanelet2_map_path"],
21+
"additionalProperties": false
22+
}
23+
},
24+
"properties": {
25+
"/**": {
26+
"type": "object",
27+
"properties": {
28+
"ros__parameters": {
29+
"$ref": "#/definitions/map_projection_loader"
30+
}
31+
},
32+
"required": ["ros__parameters"],
33+
"additionalProperties": false
34+
}
35+
},
36+
"required": ["/**"],
37+
"additionalProperties": false
38+
}

0 commit comments

Comments
 (0)