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

Fix interactive markers not visible in motion planning plugin #299

Merged
merged 5 commits into from
Nov 20, 2020

Conversation

JafarAbdi
Copy link
Member

Description

Please explain the changes you made, including a reference to the related issue if applicable

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

@codecov
Copy link

codecov bot commented Oct 26, 2020

Codecov Report

Merging #299 (a53c1e3) into main (56505bd) will increase coverage by 0.06%.
The diff coverage is 65.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #299      +/-   ##
==========================================
+ Coverage   47.94%   48.00%   +0.06%     
==========================================
  Files         157      157              
  Lines       14840    14843       +3     
==========================================
+ Hits         7114     7124      +10     
+ Misses       7726     7719       -7     
Impacted Files Coverage Δ
...ics_plugin_loader/src/kinematics_plugin_loader.cpp 30.83% <65.39%> (+6.35%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56505bd...a53c1e3. Read the comment docs.

// read the list of plugin names for possible kinematics solvers
for (const srdf::Model::Group& known_group : known_groups)
{
std::string base_param_name = known_group.name_;
std::string ksolver_param_name = base_param_name + ".kinematics_solver";
RCLCPP_DEBUG(LOGGER, "Looking for param %s ", ksolver_param_name.c_str());
bool found = node_->has_parameter(ksolver_param_name);
if (!found)
rclcpp::Parameter ksolver_param = declare_parameter(node_, ksolver_param_name);
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need these additional checks? Are we running multiple IK solver instances in the same node namespace? Otherwise, just calling Node::declare_parameter() should be sufficient.

double ksolver_timeout;
rclcpp::Parameter parameter = node_->get_parameter(ksolver_timeout_param_name);
if (parameter.get_type() == rclcpp::ParameterType::PARAMETER_DOUBLE)
if (ksolver_timeout_param.get_type() == rclcpp::ParameterType::PARAMETER_DOUBLE)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we just declare the parameter as double? That way we don't have to check the different cases

Copy link
Member Author

Choose a reason for hiding this comment

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

It will throw the following exception rclcpp::exceptions::InvalidParameterTypeException if the loaded parameter is integer

@JafarAbdi
Copy link
Member Author

I reverted the last commit because the function with one parameter will throw an exception if the parameter is declared and not set https://github.com/ros2/rclcpp/blob/master/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp#L680, this's why the tests were throwing exceptions

@henningkayser
Copy link
Member

This still seems overly complicated to me. A whole lot of code just for loading 4 parameters. But this is an issue that affects a lot of our classes currently. I'll merge this for now as it fixes the interactive marker, but we should still simplify and refactor parameter usage overall.

@henningkayser henningkayser merged commit 8458d33 into moveit:main Nov 20, 2020
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.

2 participants