-
Notifications
You must be signed in to change notification settings - Fork 378
Use new handles API in ros2_controllers to fix deprecation warnings #1566
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
base: master
Are you sure you want to change the base?
Use new handles API in ros2_controllers to fix deprecation warnings #1566
Conversation
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.
Looks fine, thanks!
@christophfroehlich hi, one question - I have made progress on other controllers as well locally on my system. Can I push these changes into this PR as well (will update description), or should I wait for more reviews on current submitted PR ? |
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.
The changes already look good to me. I just forgot to comment.
@kumar-sanjeeev yes, please proceed with other packages as well
…sensor_broadcaster tests
…l, without failures
@saikishor and @christophfroehlich , one question, would you like me to complete all the controller packages first, and then you would review them of all together? Or would you prefer to first provide feedback on the commits that have already been pushed in this PR? |
apply the changes to all of them please |
Yes please |
Co-authored-by: Sai Kishor Kothakota <[email protected]>
…r/parallel_gripper_action_controller_impl.hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
…r/parallel_gripper_action_controller_impl.hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
…r/parallel_gripper_action_controller_impl.hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
Co-authored-by: Sai Kishor Kothakota <[email protected]>
Co-authored-by: Christoph Fröhlich <[email protected]>
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.
Thanks for your comments, and sorry for the late reply.
what should we do if setting a command fails? return or try to set the other commands? This is not consistent
In the current implementation, it always returns with a message. In some cases, I am setting the value to 0.0 but still returning with a message.
for filling the publisher with data: I'd suggest to resume and just leave the message field untouched (should be the old vale then if the msg struct is pre-allocated). what do you think?
Could you please explain this point with an example? I’m not able to understand the message clearly.
- I have marked some conversations as resolved, but for few others, I need guidance.
For example here:
The value is saved in |
If I understood correctly, this approach i.e., not return when get_value() fails, is only meant to be used in cases where the message structure is pre-allocated (for example, in a publisher). Am I right? If yes, then in such cases, can I proceed with the following fix? Or should I also skip printing any warning or debug message?
|
Exactly!
A debug message is fine, but I'd suggest no higher log level. |
thanks for explanation, I understood. I will make correction where it needs to be done. |
@christophfroehlich does my reply answer your question? In addition to my given answer, I have set the value to 0.0 in cases where it had already been done, before I made the modification for the deprecation fix. |
In these cases, it makes sense |
Hello @kumar-sanjeeev
In what cases are you setting the value to 0.0?. Can you please point me to the code?
Exactly, this part is perfect. |
Hello @saikishor , I have put comments where I have set value to 0.0. Let me know your thoughts. |
Thank you LGTM |
command_interfaces_map_.at(full_command_interface_name) | ||
.get() | ||
.set_value(gpio_commands.interface_values[gpio_index].values[command_interface_index]); | ||
if (!command_interfaces_map_.at(full_command_interface_name).get().set_value(command_value)) |
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.
It's okay
} | ||
|
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.
} | |
} | |
else | |
{ |
here you will continue and access .value(). Here you will need a else statement
state_msg_interface_value_op.value(); | ||
} |
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.
state_msg_interface_value_op.value(); | |
} | |
state_msg_interface_value_op.value(); | |
} | |
} |
...r_controller/include/parallel_gripper_controller/parallel_gripper_action_controller_impl.hpp
Show resolved
Hide resolved
{ | ||
RCLCPP_DEBUG(get_node()->get_logger(), "Unable to retrieve data of joint position"); | ||
} | ||
command_struct_.position_cmd_ = position_op.value(); |
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.
std::unique_lock<std::shared_mutex> lock(handle->get_mutex());
std::ignore = handle->set_value(lock, value);
Something like this
...r_controller/include/parallel_gripper_controller/parallel_gripper_action_controller_impl.hpp
Show resolved
Hide resolved
RCLCPP_DEBUG( | ||
get_node()->get_logger(), "Unable to retrieve the state interface value for %s", | ||
state_interfaces_[i].get_name().c_str()); | ||
return controller_interface::return_type::OK; |
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.
Sounds good
This PR applies the new API changes in the handles of ros2_control in following controllers in same fashion as #1565: