Skip to content

Commit

Permalink
Rework parameters of map_loader
Browse files Browse the repository at this point in the history
Signed-off-by: anhnv3991 <[email protected]>
  • Loading branch information
anhnv3991 committed Jan 29, 2024
1 parent f514bca commit 44a21b0
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 21 deletions.
17 changes: 3 additions & 14 deletions map/map_loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,7 @@ Please see [the description of `GetSelectedPointCloudMap.srv`](https://github.co

### Parameters

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

### Interfaces

Expand All @@ -144,7 +136,7 @@ Please see [tier4_autoware_msgs/msg/MapProjectorInfo.msg](https://github.com/tie

### How to run

`ros2 run map_loader lanelet2_map_loader --ros-args -p lanelet2_map_path:=path/to/map.osm`
`ros2 run map_loader lanelet2_map_loader`

### Subscribed Topics

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

### Parameters

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

---

Expand Down
1 change: 1 addition & 0 deletions map/map_loader/config/lanelet2_map_loader.param.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/**:
ros__parameters:
center_line_resolution: 5.0 # [m]
lanelet2_map_path: "" # The lanelet2 map path
2 changes: 2 additions & 0 deletions map/map_loader/config/pointcloud_map_loader.param.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@

# only used when downsample_whole_load enabled
leaf_size: 3.0 # downsample leaf size [m]
pcd_paths_or_directory: [] # Path to the pointcloud map file or directory
pcd_metadata_path: "" # Path to pointcloud metadata file
4 changes: 1 addition & 3 deletions map/map_loader/launch/lanelet2_map_loader.launch.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<launch>
<arg name="lanelet2_map_loader_param_path" default="$(find-pkg-share map_loader)/config/lanelet2_map_loader.param.yaml"/>
<arg name="lanelet2_map_path"/>
<arg name="lanelet2_map_topic" default="vector_map"/>
<arg name="lanelet2_map_marker_topic" default="vector_map_marker"/>

<node pkg="map_loader" exec="map_hash_generator" name="map_hash_generator">
<param name="lanelet2_map_path" value="$(var lanelet2_map_path)"/>
<param from="$(var lanelet2_map_loader_param_path)"/>
</node>

<node pkg="map_loader" exec="lanelet2_map_loader" name="lanelet2_map_loader">
<remap from="output/lanelet2_map" to="$(var lanelet2_map_topic)"/>
<param name="lanelet2_map_path" value="$(var lanelet2_map_path)"/>
<param from="$(var lanelet2_map_loader_param_path)"/>
</node>

Expand Down
4 changes: 0 additions & 4 deletions map/map_loader/launch/pointcloud_map_loader.launch.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<launch>
<arg name="pointcloud_map_path"/>
<arg name="pointcloud_map_metadata_path"/>
<arg name="pointcloud_map_loader_param_path" default="$(find-pkg-share map_loader)/config/pointcloud_map_loader.param.yaml"/>

<node pkg="map_loader" exec="pointcloud_map_loader" name="pointcloud_map_loader" output="screen">
<remap from="output/pointcloud_map" to="/map/pointcloud_map"/>
<remap from="service/get_partial_pcd_map" to="/map/get_partial_pointcloud_map"/>
<remap from="service/get_selected_pcd_map" to="/map/get_selected_pointcloud_map"/>
<param name="pcd_paths_or_directory" value="[$(var pointcloud_map_path)]"/>
<param name="pcd_metadata_path" value="$(var pcd_metadata_path)"/>
<param from="$(var pointcloud_map_loader_param_path)"/>
</node>
</launch>
42 changes: 42 additions & 0 deletions map/map_loader/schema/lanelet2_map_loader.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Parameters for lanelet2 map loader Node",
"type": "object",
"definitions": {
"lanelet2_map_loader": {
"type": "object",
"properties": {
"center_line_resolution": {
"type": "number",
"description": "Resolution of the Lanelet center line [m]",
"default": "5.0"
},
"lanelet2_map_path": {
"type": "string",
"description": "The lanelet2 map path pointing to the .osm file",
"default": ""
}
},
"required": [
"center_line_resolution",
"lanelet2_map_path"
],
"additionalProperties": false
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/lanelet2_map_loader"
}
},
"required": ["ros__parameters"],
"additionalProperties": false
}
},
"required": ["/**"],
"additionalProperties": false
}

72 changes: 72 additions & 0 deletions map/map_loader/schema/pointcloud_map_loader.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Parameters for point cloud map loader Node",
"type": "object",
"definitions": {
"pointcloud_map_loader": {
"type": "object",
"properties": {
"enable_whole_load": {
"type": "boolean",
"description": "Enable raw pointcloud map publishing",
"default": true
},
"enable_downsampled_whole_load": {
"type": "boolean",
"description": "Enable downsampled pointcloud map publishing",
"default": false
},
"enable_partial_load": {
"type": "boolean",
"description": "Enable partial pointcloud map server",
"default": true
},
"enable_selected_load": {
"type": "boolean",
"description": "Enable selected pointcloud map server",
"default": false
},
"leaf_size": {
"type": "number",
"description": "Downsampling leaf size (only used when enable_downsampled_whole_load is set true)",
"default": 3.0
},
"pcd_paths_or_directory": {
"type": "array",
"description": "Path(s) to pointcloud map file or directory",
"default": []
},
"pcd_metadata_path": {
"type": "string",
"description": "Path to pointcloud metadata file",
"default": ""
}
},
"required": [
"enable_whole_load",
"enable_downsampled_whole_load",
"enable_partial_load",
"enable_selected_load",
"leaf_size",
"pcd_paths_or_directory",
"pcd_metadata_path"
],
"additionalProperties": false
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/pointcloud_map_loader"
}
},
"required": ["ros__parameters"],
"additionalProperties": false
}
},
"required": ["/**"],
"additionalProperties": false
}

0 comments on commit 44a21b0

Please sign in to comment.