Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Port kinematics_base submodule moveit_core #8
Port kinematics_base submodule moveit_core #8
Changes from 8 commits
54e0542
791fee9
066b300
d5a108c
50ea822
7469781
504df6d
09512ba
a415ab5
43a77cf
ff1966e
5984c03
8b4f35c
8257334
10fe1c1
a8a03c3
7f706b5
b2d436f
82b1bf4
887f05e
339c4f9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto
is nice where the type is obvious but in cases like this it's more confusing then helpful.Especially since the following for loops are using
auto
as well this type should be made explicit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the
SyncParametersClient
class contains the functionshas_param()
andget_parameter()
which can be used to replacehasParam()
andparam()
directly. This way we don't have to loop and compare the results as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partially complied with your request @henningkayser at b2d436f.
Please make a suggestion if you require further changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_parameters()
is meant to be used for multiple parameters but here it's always called with only a single entry. In this case it's much more straightforward to query every parameter like in the sample code below:No need to create a parameter vector or loop over the results and also we can use the node directly and don't need to cast it to
rclcpp::SyncParametersClient
.Since
lookupParam()
does in fact query multiple parameters in different locations we can absolutely useNode::get_parameters()
but in that case including all parameter names:I actually prefer the second implementation.
Please also note that your current implementation calls
value_to_string()
on all parameters butlookupParam()
is a template function that supports all parameter types. Theget_value()
function takes care of using the correct type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already made some changes (on planning_scene_monitor) related to this:
https://github.com/AcutronicRobotics/moveit2/blob/5a8ad535e33548434b02e5e9e735ab614465f5a5/moveit_ros/planning/planning_scene_monitor/src/planning_scene_monitor.cpp#L1472-L1516
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anasarrak this looks much better. However, each if/else block can be implemented in a single line using
node->get_parameter_or(param, val, default_val)
.