Skip to content

Commit 9df0ff9

Browse files
chore(map_loader): rework parameters of map_loader (#6199)
* Rework parameters of map_loader Signed-off-by: anhnv3991 <anh.nguyen.2@tier4.jp> * style(pre-commit): autofix * Fixed typo in name of map_based_pediction.schema.json, which cause json-schema-check failed Signed-off-by: anhnv3991 <anh.nguyen.2@tier4.jp> * Move path variables back to launch files Signed-off-by: anhnv3991 <anh.nguyen.2@tier4.jp> * Update README.md Signed-off-by: anhnv3991 <anh.nguyen.2@tier4.jp> * Undo the change in perception Signed-off-by: anhnv3991 <anh.nguyen.2@tier4.jp> * Remove default values of declare_parameter from map_loader Signed-off-by: anhnv3991 <anh.nguyen.2@tier4.jp> --------- Signed-off-by: anhnv3991 <anh.nguyen.2@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 3a10282 commit 9df0ff9

10 files changed

+121
-23
lines changed

map/map_loader/README.md

+2-13
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,7 @@ Please see [the description of `GetSelectedPointCloudMap.srv`](https://github.co
111111

112112
### Parameters
113113

114-
| Name | Type | Description | Default value |
115-
| :---------------------------- | :---------- | :-------------------------------------------------------------------------------- | :------------ |
116-
| enable_whole_load | bool | A flag to enable raw pointcloud map publishing | true |
117-
| enable_downsampled_whole_load | bool | A flag to enable downsampled pointcloud map publishing | false |
118-
| enable_partial_load | bool | A flag to enable partial pointcloud map server | false |
119-
| enable_selected_load | bool | A flag to enable selected pointcloud map server | false |
120-
| leaf_size | float | Downsampling leaf size (only used when enable_downsampled_whole_load is set true) | 3.0 |
121-
| pcd_paths_or_directory | std::string | Path(s) to pointcloud map file or directory | |
122-
| pcd_metadata_path | std::string | Path to pointcloud metadata file | |
114+
{{ json_to_markdown("map/map_loader/schema/pointcloud_map_loader.schema.json") }}
123115

124116
### Interfaces
125117

@@ -156,10 +148,7 @@ Please see [tier4_autoware_msgs/msg/MapProjectorInfo.msg](https://github.com/tie
156148

157149
### Parameters
158150

159-
| Name | Type | Description | Default value |
160-
| :--------------------- | :---------- | :----------------------------------------------- | :------------ |
161-
| center_line_resolution | double | Define the resolution of the lanelet center line | 5.0 |
162-
| lanelet2_map_path | std::string | The lanelet2 map path | None |
151+
{{ json_to_markdown("map/map_loader/schema/lanelet2_map_loader.schema.json") }}
163152

164153
---
165154

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/**:
22
ros__parameters:
33
center_line_resolution: 5.0 # [m]
4+
lanelet2_map_path: $(var lanelet2_map_path) # The lanelet2 map path

map/map_loader/config/pointcloud_map_loader.param.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77

88
# only used when downsample_whole_load enabled
99
leaf_size: 3.0 # downsample leaf size [m]
10+
pcd_paths_or_directory: [$(var pcd_paths_or_directory)] # Path to the pointcloud map file or directory
11+
pcd_metadata_path: $(var pcd_metadata_path) # Path to pointcloud metadata file

map/map_loader/launch/lanelet2_map_loader.launch.xml

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
<arg name="lanelet2_map_marker_topic" default="vector_map_marker"/>
66

77
<node pkg="map_loader" exec="map_hash_generator" name="map_hash_generator">
8-
<param name="lanelet2_map_path" value="$(var lanelet2_map_path)"/>
8+
<param from="$(var lanelet2_map_loader_param_path)" allow_substs="true"/>
99
</node>
1010

1111
<node pkg="map_loader" exec="lanelet2_map_loader" name="lanelet2_map_loader">
1212
<remap from="output/lanelet2_map" to="$(var lanelet2_map_topic)"/>
13-
<param name="lanelet2_map_path" value="$(var lanelet2_map_path)"/>
14-
<param from="$(var lanelet2_map_loader_param_path)"/>
13+
<param from="$(var lanelet2_map_loader_param_path)" allow_substs="true"/>
1514
</node>
1615

1716
<node pkg="map_loader" exec="lanelet2_map_visualization" name="lanelet2_map_visualization">

map/map_loader/launch/pointcloud_map_loader.launch.xml

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
<remap from="output/pointcloud_map" to="/map/pointcloud_map"/>
88
<remap from="service/get_partial_pcd_map" to="/map/get_partial_pointcloud_map"/>
99
<remap from="service/get_selected_pcd_map" to="/map/get_selected_pointcloud_map"/>
10-
<param name="pcd_paths_or_directory" value="[$(var pointcloud_map_path)]"/>
11-
<param name="pcd_metadata_path" value="$(var pcd_metadata_path)"/>
12-
<param from="$(var pointcloud_map_loader_param_path)"/>
10+
<param from="$(var pointcloud_map_loader_param_path)" allow_substs="true"/>
1311
</node>
1412
</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 lanelet2 map loader Node",
4+
"type": "object",
5+
"definitions": {
6+
"lanelet2_map_loader": {
7+
"type": "object",
8+
"properties": {
9+
"center_line_resolution": {
10+
"type": "number",
11+
"description": "Resolution of the Lanelet center line [m]",
12+
"default": "5.0"
13+
},
14+
"lanelet2_map_path": {
15+
"type": "string",
16+
"description": "The lanelet2 map path pointing to the .osm file",
17+
"default": ""
18+
}
19+
},
20+
"required": ["center_line_resolution", "lanelet2_map_path"],
21+
"additionalProperties": false
22+
}
23+
},
24+
"properties": {
25+
"/**": {
26+
"type": "object",
27+
"properties": {
28+
"ros__parameters": {
29+
"$ref": "#/definitions/lanelet2_map_loader"
30+
}
31+
},
32+
"required": ["ros__parameters"],
33+
"additionalProperties": false
34+
}
35+
},
36+
"required": ["/**"],
37+
"additionalProperties": false
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Parameters for point cloud map loader Node",
4+
"type": "object",
5+
"definitions": {
6+
"pointcloud_map_loader": {
7+
"type": "object",
8+
"properties": {
9+
"enable_whole_load": {
10+
"type": "boolean",
11+
"description": "Enable raw pointcloud map publishing",
12+
"default": true
13+
},
14+
"enable_downsampled_whole_load": {
15+
"type": "boolean",
16+
"description": "Enable downsampled pointcloud map publishing",
17+
"default": false
18+
},
19+
"enable_partial_load": {
20+
"type": "boolean",
21+
"description": "Enable partial pointcloud map server",
22+
"default": true
23+
},
24+
"enable_selected_load": {
25+
"type": "boolean",
26+
"description": "Enable selected pointcloud map server",
27+
"default": false
28+
},
29+
"leaf_size": {
30+
"type": "number",
31+
"description": "Downsampling leaf size (only used when enable_downsampled_whole_load is set true)",
32+
"default": 3.0
33+
},
34+
"pcd_paths_or_directory": {
35+
"type": "array",
36+
"description": "Path(s) to pointcloud map file or directory",
37+
"default": []
38+
},
39+
"pcd_metadata_path": {
40+
"type": "string",
41+
"description": "Path to pointcloud metadata file",
42+
"default": ""
43+
}
44+
},
45+
"required": [
46+
"enable_whole_load",
47+
"enable_downsampled_whole_load",
48+
"enable_partial_load",
49+
"enable_selected_load",
50+
"leaf_size",
51+
"pcd_paths_or_directory",
52+
"pcd_metadata_path"
53+
],
54+
"additionalProperties": false
55+
}
56+
},
57+
"properties": {
58+
"/**": {
59+
"type": "object",
60+
"properties": {
61+
"ros__parameters": {
62+
"$ref": "#/definitions/pointcloud_map_loader"
63+
}
64+
},
65+
"required": ["ros__parameters"],
66+
"additionalProperties": false
67+
}
68+
},
69+
"required": ["/**"],
70+
"additionalProperties": false
71+
}

map/map_loader/src/lanelet2_map_loader/lanelet2_map_loader_node.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ Lanelet2MapLoaderNode::Lanelet2MapLoaderNode(const rclcpp::NodeOptions & options
6161
sub_map_projector_info_,
6262
[this](const MapProjectorInfo::Message::ConstSharedPtr msg) { on_map_projector_info(msg); });
6363

64-
declare_parameter("lanelet2_map_path", "");
65-
declare_parameter("center_line_resolution", 5.0);
64+
declare_parameter<std::string>("lanelet2_map_path");
65+
declare_parameter<double>("center_line_resolution");
6666
}
6767

6868
void Lanelet2MapLoaderNode::on_map_projector_info(

map/map_loader/src/lanelet2_map_loader/lanelet2_map_visualization_node.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Lanelet2MapVisualizationNode::Lanelet2MapVisualizationNode(const rclcpp::NodeOpt
7171
{
7272
using std::placeholders::_1;
7373

74-
viz_lanelets_centerline_ = this->declare_parameter("viz_lanelets_centerline", true);
74+
viz_lanelets_centerline_ = true;
7575

7676
sub_map_bin_ = this->create_subscription<autoware_auto_mapping_msgs::msg::HADMapBin>(
7777
"input/lanelet2_map", rclcpp::QoS{1}.transient_local(),

map/map_loader/test/lanelet2_map_loader_launch.test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def generate_test_description():
3434
lanelet2_map_loader = Node(
3535
package="map_loader",
3636
executable="lanelet2_map_loader",
37-
parameters=[{"lanelet2_map_path": lanelet2_map_path}],
37+
parameters=[{"lanelet2_map_path": lanelet2_map_path, "center_line_resolution": 5.0}],
3838
)
3939

4040
context = {}

0 commit comments

Comments
 (0)