Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(lanelet2_map_preprocessor): rework parameter #6218

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions map/util/lanelet2_map_preprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ if(BUILD_TESTING)
endif()

ament_auto_package(INSTALL_TO_SHARE
config
launch
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**:
ros__parameters:
llt_map_path: $(var llt_map_path)
pcd_map_path: $(var pcd_map_path)
llt_output_path: $(var llt_output_path)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**:
ros__parameters:
llt_map_path: $(var llt_map_path)
pcd_map_path: $(var pcd_map_path)
llt_output_path: $(var llt_output_path)
pcd_output_path: $(var pcd_output_path)
x: 0.0
y: 0.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 0.0
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="llt_map_path" default=""/>
<arg name="pcd_map_path" default=""/>
<arg name="llt_output_path" default=""/>

<node pkg="lanelet2_map_preprocessor" exec="fix_z_value_by_pcd" name="fix_z_value_by_pcd" output="screen">
<param name="llt_map_path" value="$(var llt_map_path)"/>
<param name="pcd_map_path" value="$(var pcd_map_path)"/>
<param name="llt_output_path" value="$(var llt_output_path)"/>
<param from="$(find-pkg-share lanelet2_map_preprocessor)/config/fix_z_value_by_pcd.param.yaml" allow_substs="true"/>
</node>
</launch>
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="llt_map_path" default=""/>
<arg name="pcd_map_path" default=""/>
<arg name="llt_output_path" default=""/>
<arg name="pcd_output_path" default=""/>
<arg name="x" default="0.0"/>
<arg name="y" default="0.0"/>
<arg name="z" default="0.0"/>
<arg name="roll" default="0.0"/>
<arg name="pitch" default="0.0"/>
<arg name="yaw" default="0.0"/>

<node pkg="lanelet2_map_preprocessor" exec="transform_maps" name="transform_maps" output="screen">
<param name="llt_map_path" value="$(var llt_map_path)"/>
<param name="pcd_map_path" value="$(var pcd_map_path)"/>
<param name="llt_output_path" value="$(var llt_output_path)"/>
<param name="pcd_output_path" value="$(var pcd_output_path)"/>
<param name="x" value="$(var x)"/>
<param name="y" value="$(var y)"/>
<param name="z" value="$(var z)"/>
<param name="roll" value="$(var roll)"/>
<param name="pitch" value="$(var pitch)"/>
<param name="yaw" value="$(var yaw)"/>
<param from="$(find-pkg-share lanelet2_map_preprocessor)/config/transform_maps.param.yaml" allow_substs="true"/>
</node>
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Parameters for Transforming Maps",
"type": "object",
"definitions": {
"transform_maps": {
"type": "object",
"properties": {
"llt_map_path": {
"type": "string",
"description": "Path pointing to the input lanelet2 file",
"default": ""
},
"pcd_map_path": {
"type": "string",
"description": "Path pointing to the input point cloud file",
"default": ""
},
"llt_output_path": {
"type": "string",
"description": "Path pointing to the output lanelet2 file",
"default": ""
},
"pcd_output_path": {
"type": "string",
"description": "Path pointing to the output point cloud file",
"default": ""
},
"x": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be schema for map paths as well:

        "llt_map_path": {
          "type": "string",
          "description": "Path pointing to the input lanelet2 file",
          "default": ""
        },
        "pcd_map_path": {
          "type": "string",
          "description": "Path pointing to the input point cloud file",
          "default": ""
        },
        "llt_output_path": {
          "type": "string",
          "description": "Path pointing to the output lanelet2 file",
          "default": ""
        },
        "pcd_output_path": {
          "type": "string",
          "description": "Path pointing to the output point cloud file",
          "default": ""
        },

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've modified it as you said. Thank you.

"type": "number",
"default": 0.0,
"description": "x factor of Translation vector for transforming maps [m]"
},
"y": {
"type": "number",
"default": 0.0,
"description": "y factor of Translation vector for transforming maps [m]"
},
"z": {
"type": "number",
"default": 0.0,
"description": "z factor of Translation vector for transforming maps [m]"
},
"roll": {
"type": "number",
"default": 0.0,
"description": "roll factor of Rotation vector for transforming maps [rad]"
},
"pitch": {
"type": "number",
"default": 0.0,
"description": "pitch factor of Rotation vector for transforming maps [rad]"
},
"yaw": {
"type": "number",
"default": 0.0,
"description": "yaw factor of Rotation vector for transforming maps [rad]"
}
},
"required": ["x", "y", "z", "roll", "pitch", "yaw"]
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/transform_maps"
}
},
"required": ["ros__parameters"]
}
},
"required": ["/**"]
}
12 changes: 6 additions & 6 deletions map/util/lanelet2_map_preprocessor/src/transform_maps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@
const auto pcd_map_path = node->declare_parameter<std::string>("pcd_map_path");
const auto llt_output_path = node->declare_parameter<std::string>("llt_output_path");
const auto pcd_output_path = node->declare_parameter<std::string>("pcd_output_path");
const auto x = node->declare_parameter<double>("x", 0.0);
const auto y = node->declare_parameter<double>("y", 0.0);
const auto z = node->declare_parameter<double>("z", 0.0);
const auto roll = node->declare_parameter<double>("roll", 0.0);
const auto pitch = node->declare_parameter<double>("pitch", 0.0);
const auto yaw = node->declare_parameter<double>("yaw", 0.0);
const auto x = node->declare_parameter<double>("x");
const auto y = node->declare_parameter<double>("y");
const auto z = node->declare_parameter<double>("z");
const auto roll = node->declare_parameter<double>("roll");
const auto pitch = node->declare_parameter<double>("pitch");
const auto yaw = node->declare_parameter<double>("yaw");

Check warning on line 115 in map/util/lanelet2_map_preprocessor/src/transform_maps.cpp

View check run for this annotation

Codecov / codecov/patch

map/util/lanelet2_map_preprocessor/src/transform_maps.cpp#L110-L115

Added lines #L110 - L115 were not covered by tests

std::cout << "transforming maps with following parameters" << std::endl
<< "x " << x << std::endl
Expand Down
Loading