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

feat(map_loader): make some functions static #2014

Merged
merged 2 commits into from
Oct 5, 2022

Conversation

takayuki5168
Copy link
Contributor

@takayuki5168 takayuki5168 commented Oct 4, 2022

Signed-off-by: Takayuki Murooka takayuki5168@gmail.com

Description

In order to make a static path planner with optimization as follows,
#1942
I made some functions of map_loader required in the static planner static.

The usage in the static planner is like this

// load map
lanelet::LaneletMapPtr map_ptr;
map_ptr = Lanelet2MapLoaderNode::load_map(node, lanelet2_file_name, "MGRS");
if (!map_ptr) {
return nullptr;
}
// create map bin msg
const auto map_bin_msg =
Lanelet2MapLoaderNode::create_map_bin_msg(map_ptr, lanelet2_file_name, current_time);

Related links

Tests performed

Notes for reviewers

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.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

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.
  • The PR is ready for merge.

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

@takayuki5168 takayuki5168 marked this pull request as ready for review October 4, 2022 08:59
@takayuki5168
Copy link
Contributor Author

@TakaHoribe Could you review this PR.

@TakaHoribe
Copy link
Contributor

@takayuki5168 How about having two functions with different arguments? (It seems a little odd to me that all methods are static.)

HADMapBin create_map_bin_msg(
  const lanelet::LaneletMapPtr map, const std::string & lanelet2_filename) {
  return create_map_bin_msg(map, lanelet2_filename, now());
}

static HADMapBin create_map_bin_msg(
  const lanelet::LaneletMapPtr map, const std::string & lanelet2_filename,
  const rclcpp::Time & now);

@codecov
Copy link

codecov bot commented Oct 4, 2022

Codecov Report

Base: 10.38% // Head: 10.38% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (aa384ab) compared to base (ee4f381).
Patch coverage: 24.77% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2014      +/-   ##
==========================================
- Coverage   10.38%   10.38%   -0.01%     
==========================================
  Files        1163     1163              
  Lines       82840    82849       +9     
  Branches    19287    19287              
==========================================
  Hits         8604     8604              
- Misses      64968    64977       +9     
  Partials     9268     9268              
Flag Coverage Δ *Carryforward flag
differential 0.00% <0.00%> (?)
total 10.36% <25.00%> (ø) Carriedforward from ee4f381

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

Impacted Files Coverage Δ
...c/lanelet2_map_loader/lanelet2_map_loader_node.cpp 0.00% <0.00%> (ø)
common/motion_utils/src/resample/resample.cpp 30.97% <12.12%> (ø)
...n/motion_utils/test/src/resample/test_resample.cpp 25.93% <26.75%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@takayuki5168
Copy link
Contributor Author

@TakaHoribe
To me, your idea looks redundant since there is no reason to define two types of functions.

@kenji-miyake What do you think.

(It seems a little odd to me that all methods are static.)

I made the functions only required in the static path planner static. (If I do my best, I can split the static and non-static part more specifically)

@kenji-miyake
Copy link
Contributor

To me, your idea looks redundant since there is no reason to define two types of functions.
@kenji-miyake What do you think.

I also think it's redundant in this case.

But since it seems class-independent, I feel it might be better to make these functions normal functions (like libraries), not class functions.
Are there any reasons to define these in the class?

@takayuki5168
Copy link
Contributor Author

Are there any reasons to define these in the class?

Not a big reason, but I just wanted to apply the minimum changes to map_loader and there are only two small functions which I feel exaggerated to make them a library.

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
@takayuki5168 takayuki5168 force-pushed the feat/static-map-loader branch from 8770e91 to aa384ab Compare October 5, 2022 03:07
@takayuki5168 takayuki5168 enabled auto-merge (squash) October 5, 2022 03:09
@takayuki5168 takayuki5168 merged commit a6b4a86 into autowarefoundation:main Oct 5, 2022
@takayuki5168 takayuki5168 deleted the feat/static-map-loader branch October 5, 2022 03:20
boyali pushed a commit to boyali/autoware.universe that referenced this pull request Oct 19, 2022
* feat(map_loader): make some functions static

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* make publisher alive after constructor

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
h-ohta pushed a commit to tier4/autoware.universe that referenced this pull request Jan 26, 2023
* feat(map_loader): make some functions static

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

* make publisher alive after constructor

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants