Skip to content

Commit

Permalink
chore(map_loader): rework parameters of map_loader (#6199)
Browse files Browse the repository at this point in the history
* Rework parameters of map_loader

Signed-off-by: anhnv3991 <[email protected]>

* style(pre-commit): autofix

* Fixed typo in name of map_based_pediction.schema.json, which cause json-schema-check failed

Signed-off-by: anhnv3991 <[email protected]>

* Move path variables back to launch files

Signed-off-by: anhnv3991 <[email protected]>

* Update README.md

Signed-off-by: anhnv3991 <[email protected]>

* Undo the change in perception

Signed-off-by: anhnv3991 <[email protected]>

* Remove default values of declare_parameter from map_loader

Signed-off-by: anhnv3991 <[email protected]>

---------

Signed-off-by: anhnv3991 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
anhnv3991 and pre-commit-ci[bot] authored Feb 7, 2024
1 parent 3a10282 commit 9df0ff9
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 23 deletions.
15 changes: 2 additions & 13 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 Down Expand Up @@ -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: $(var 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: [$(var pcd_paths_or_directory)] # Path to the pointcloud map file or directory
pcd_metadata_path: $(var pcd_metadata_path) # Path to pointcloud metadata file
5 changes: 2 additions & 3 deletions map/map_loader/launch/lanelet2_map_loader.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
<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)" allow_substs="true"/>
</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)"/>
<param from="$(var lanelet2_map_loader_param_path)" allow_substs="true"/>
</node>

<node pkg="map_loader" exec="lanelet2_map_visualization" name="lanelet2_map_visualization">
Expand Down
4 changes: 1 addition & 3 deletions map/map_loader/launch/pointcloud_map_loader.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<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)"/>
<param from="$(var pointcloud_map_loader_param_path)" allow_substs="true"/>
</node>
</launch>
38 changes: 38 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,38 @@
{
"$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
}
71 changes: 71 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,71 @@
{
"$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
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Lanelet2MapLoaderNode::Lanelet2MapLoaderNode(const rclcpp::NodeOptions & options
sub_map_projector_info_,
[this](const MapProjectorInfo::Message::ConstSharedPtr msg) { on_map_projector_info(msg); });

declare_parameter("lanelet2_map_path", "");
declare_parameter("center_line_resolution", 5.0);
declare_parameter<std::string>("lanelet2_map_path");
declare_parameter<double>("center_line_resolution");
}

void Lanelet2MapLoaderNode::on_map_projector_info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Lanelet2MapVisualizationNode::Lanelet2MapVisualizationNode(const rclcpp::NodeOpt
{
using std::placeholders::_1;

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

sub_map_bin_ = this->create_subscription<autoware_auto_mapping_msgs::msg::HADMapBin>(
"input/lanelet2_map", rclcpp::QoS{1}.transient_local(),
Expand Down
2 changes: 1 addition & 1 deletion map/map_loader/test/lanelet2_map_loader_launch.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def generate_test_description():
lanelet2_map_loader = Node(
package="map_loader",
executable="lanelet2_map_loader",
parameters=[{"lanelet2_map_path": lanelet2_map_path}],
parameters=[{"lanelet2_map_path": lanelet2_map_path, "center_line_resolution": 5.0}],
)

context = {}
Expand Down

0 comments on commit 9df0ff9

Please sign in to comment.