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

Conversation

Motsu-san
Copy link
Contributor

@Motsu-san Motsu-san commented Jan 29, 2024

Description

Implement the ROS Node configuration layout described in https://github.com/orgs/autowarefoundation/discussions/3371.

  • Remove the default value from the source code in order to ensure all parameter values are passed from the parameter files.
    • This PR.
  • Create the yaml configs in this package and the autoware_launch repository.
    • This PR.
  • Create the schema.
    • This PR.
  • Update Parameters chapter in the readme file.
    • N/A

Tests performed

Check if the parameters set

ros2 launch lanelet2_map_preprocessor transform_maps.launch.xml llt_map_path:="$HOME/autoware_map/sample-map-rosbag/lanelet2_map.osm" pcd_map_path:="$HOME/autoware_map/sample-map-rosbag/pointcloud_map.pcd" llt_output_path:=lanelet2_map_tr.osm pcd_output_path:=pointcloud_map_tr.pcd z:=0.0
[INFO] [launch]: All log files can be found below /home/[your home dir]/.ros/log/2024-02-01-15-47-32-339799-dpc2302001-43645
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [transform_maps-1]: process started with pid [43646]
[transform_maps-1] transforming maps with following parameters
[transform_maps-1] x 0
[transform_maps-1] y 0
[transform_maps-1] z 0
[transform_maps-1] roll 0
[transform_maps-1] pitch 0
[transform_maps-1] yaw 0
[transform_maps-1] Loaded Lanelet2 map
[transform_maps-1] Loaded 326867 data points.
[transform_maps-1] using mgrs grid: 54SUE
[INFO] [transform_maps-1]: process has finished cleanly [pid 43646]

Check if json schema works

  1. Confirm if check-jsonschema is installed.
pip3 install -U check-jsonschema
  1. Command below
cd [Your Autoware.universe dir]/map/util/lanelet2_map_preprocessor
find -wholename '*/schema/*.schema.json' -printf '%p: ' -execdir bash -c 'check-jsonschema -v --schemafile "$1" ../config/"${1:2:-12}"*.param.yaml' bash '{}' +

result

map/util/lanelet2_map_preprocessor$ find -wholename '*/schema/*.schema.json' -printf '%p: ' -execdir bash -c 'check-jsonschema -v --schemafile "$1" ../config/"${1:2:-12}"*.param.yaml' bash '{}' +
./schema/transform_maps.schema.json: ok -- validation done
The following files were checked:
  ../config/transform_maps.param.yaml

Effects on system behavior

Not applicable.

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

Summary by CodeRabbit

  • New Feature: Added support for installing YAML configuration files along with the package.
  • Bug Fix: Removed default values for parameters in the launch file and source code, allowing all parameter values to be passed from YAML configuration files.
  • Refactor: Improved modularity and maintainability by separating configuration files from the codebase.
  • Documentation: Updated release notes to provide a summary of changes made to the package.

@github-actions github-actions bot added the component:map Map creation, storage, and loading. (auto-assigned) label Jan 29, 2024
@Motsu-san Motsu-san force-pushed the refactor/rework_parameter_lanelet2_map_preprocessor branch 2 times, most recently from 30c4c85 to 1020192 Compare February 1, 2024 06:48
@Motsu-san Motsu-san self-assigned this Feb 1, 2024
@Motsu-san Motsu-san marked this pull request as ready for review February 1, 2024 06:53
@Motsu-san Motsu-san force-pushed the refactor/rework_parameter_lanelet2_map_preprocessor branch from 1020192 to a032de4 Compare February 1, 2024 06:53
@Motsu-san Motsu-san enabled auto-merge (squash) February 1, 2024 06:53
@mitsudome-r mitsudome-r force-pushed the refactor/rework_parameter_lanelet2_map_preprocessor branch from a032de4 to 5e6123a Compare February 1, 2024 07:05
@mitsudome-r mitsudome-r added tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) tag:openai-pr-reviewer labels Feb 1, 2024
Copy link

github-actions bot commented Feb 1, 2024

Image description CodeRabbit

Walkthrough

The changes in this pull request introduce a new directory called config to the package and include it in the installation. This allows YAML configuration files to be installed along with the package. Additionally, the default values for parameters in the launch file and source code have been removed. Instead, a new parameter param_file has been introduced, which points to a YAML configuration file. The parameter values are now read from this file, allowing all parameter values to be passed from the parameter files rather than being hardcoded in the source code.

Changes

File Summary
map/util/lanelet2_map_preprocessor/CMakeLists.txt Adds a new directory called config to the package and includes it in the installation.
map/util/lanelet2_map_preprocessor/launch/transform_maps.launch.xml Removes default values for parameters and introduces a new parameter param_file to read parameter values from a YAML configuration file.
map/util/lanelet2_map_preprocessor/src/transform_maps.cpp Removes default values from the source code and retrieves parameter values directly from the parameter files.

"Config files now dance,
Parameters have a chance.
Hardcoding no more,
Flexibility we adore.
With YAML in our hands,
Our code gracefully expands."


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 0262c68 and 5e6123a commits.
Files selected (3)
  • map/util/lanelet2_map_preprocessor/CMakeLists.txt (1)
  • map/util/lanelet2_map_preprocessor/launch/transform_maps.launch.xml (1)
  • map/util/lanelet2_map_preprocessor/src/transform_maps.cpp (1)
Files ignored due to filter (2)
  • map/util/lanelet2_map_preprocessor/config/transform_maps.param.yaml
  • map/util/lanelet2_map_preprocessor/schema/transform_maps.schema.json
Files skipped from review due to trivial changes (1)
  • map/util/lanelet2_map_preprocessor/CMakeLists.txt
Review comments generated (2)
  • Review: 1
  • LGTM: 1

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@mitsudome-r mitsudome-r added tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) and removed tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) labels Feb 1, 2024
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (78eea31) 14.84% compared to head (5a710cc) 14.84%.

Files Patch % Lines
...l/lanelet2_map_preprocessor/src/transform_maps.cpp 0.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6218   +/-   ##
=======================================
  Coverage   14.84%   14.84%           
=======================================
  Files        1838     1838           
  Lines      126712   126712           
  Branches    37976    37976           
=======================================
  Hits        18816    18816           
  Misses      86649    86649           
  Partials    21247    21247           
Flag Coverage Δ *Carryforward flag
differential 0.00% <0.00%> (?)
total 14.85% <ø> (+<0.01%) ⬆️ Carriedforward from 78eea31

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Motsu-san Motsu-san requested a review from mitsudome-r February 2, 2024 12:38
@Motsu-san Motsu-san force-pushed the refactor/rework_parameter_lanelet2_map_preprocessor branch from e36b018 to 5ba1b87 Compare February 6, 2024 04:26
@Motsu-san
Copy link
Contributor Author

@mitsudome-r Could you review this pull-request again?

@Motsu-san
Copy link
Contributor Author

@mitsudome-r Friendly ping.

"transform_maps": {
"type": "object",
"properties": {
"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.

@Motsu-san Motsu-san force-pushed the refactor/rework_parameter_lanelet2_map_preprocessor branch from 5ba1b87 to fbef4e1 Compare February 14, 2024 07:24
@Motsu-san
Copy link
Contributor Author

@mitsudome-r I've modified it to be reviewed. Could you review this pull-request again?

@Motsu-san Motsu-san merged commit f7dcc4e into autowarefoundation:main Feb 20, 2024
23 of 26 checks passed
@Motsu-san Motsu-san deleted the refactor/rework_parameter_lanelet2_map_preprocessor branch February 21, 2024 10:30
StepTurtle pushed a commit to StepTurtle/autoware.universe that referenced this pull request Feb 28, 2024
…tion#6218)

* refactor: Create .yaml file for default parameters of transform_maps.launch.xml

Signed-off-by: Motsu-san <[email protected]>

* refactor: Create JSON Schema file of transform_maps

Signed-off-by: Motsu-san <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Motsu-san <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
HansRobo pushed a commit that referenced this pull request Mar 12, 2024
* refactor: Create .yaml file for default parameters of transform_maps.launch.xml

Signed-off-by: Motsu-san <[email protected]>

* refactor: Create JSON Schema file of transform_maps

Signed-off-by: Motsu-san <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Motsu-san <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: Kotaro Yoshimoto <[email protected]>
karishma1911 pushed a commit to Interplai/autoware.universe that referenced this pull request Jun 3, 2024
…tion#6218)

* refactor: Create .yaml file for default parameters of transform_maps.launch.xml

Signed-off-by: Motsu-san <[email protected]>

* refactor: Create JSON Schema file of transform_maps

Signed-off-by: Motsu-san <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Motsu-san <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:map Map creation, storage, and loading. (auto-assigned) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants