ros2_control icon indicating copy to clipboard operation
ros2_control copied to clipboard

[Interfaces] Make functionality of `get_name()` method clear.

Open destogl opened this issue 2 years ago β€’ 3 comments

Background

In hardware_interface/handle.hpp file we have three ways to get name of the interface, joint and full name. The naming of methods is a bit confusing:

  • get_name() - returns "joint" name
  • get_interface_name() - return interface name (OK)
  • get_full_name() - returns full name of the interfaces <joint_name>/<interface_name>

I find this a bit confusing and propose the following change:

  • get_name - returns full name of the interfaces <joint_name>/<interface_name>
  • get_prefix_name - returns "joint" name (better is to call this prefix instead of joint)

Tasks:

  • [ ] update functionality in handle.hpp file
  • [ ] update functionalities in loaned_*_interface.hpp files
  • [ ] update functionalities in tests (and write tests to check all three methods if those are missing)
  • [ ] update ros2_controllers repository if any of the methods is used.

Instructions

Hi, this is a good-first-issue issue. This means we've worked to make it more legible to people who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

We're interested in helping you take the first step, and can answer questions and help you out along the way. Note that we're especially interested in contributions from underrepresented groups!

We know that creating a pull request is the biggest barrier for new contributors. This issue is for you πŸ’

If you have contributed before, consider leaving this PR for someone new, and looking through our general bug issues. Thanks!

πŸ€” What you will need to know.

Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process.

πŸ“‹ Step by Step

  • [ ] πŸ™‹ Claim this issue: Comment below. If someone else has claimed it, ask if they've opened a pull request already and if they're stuck -- maybe you can help them solve a problem or move it along!

  • [ ] πŸ—„οΈ Create a local workspace for making your changes and testing following these instructions, for Step3 use "Download Source Code" section with these instructions.

  • [ ] 🍴 Fork the repository using the handy button at the top of the repository page and clone it into ~/ws_ros2_control/src/ros-controls/ros2_control, here is a guide that you can follow (You will have to remove or empty the existing ros2_control folder before cloning your own fork)

  • [ ] Checkout a new branch using git checkout -b <branch_name>

  • [ ] πŸ€– Apply pre-commit auto formatting, by running pip3 install pre-commit and running pre-commit install in the ros2_control repo.

  • [ ] πŸ’Ύ Commit and Push your changes

  • [ ] πŸ”€ Start a Pull Request to request to merge your code into master. There are two ways that you can start a pull request:

  1. If you are not familiar with GitHub or how to create a pull request, here is a guide you can follow on how GitHub works.
  • [ ] 🏁 Done Ask in comments for a review :)

Is someone else already working on this?

πŸ”—- We encourage contributors to link to the original issue in their pull request so all users can easily see if someone's already started on it.

πŸ‘₯- If someone seems stuck, offer them some help!

πŸ€”β“ Questions?

Don’t hesitate to ask questions or to get help if you feel like you are getting stuck. For example leave a comment below! Furthermore, you find helpful resources here:

Good luck with your first issue!

destogl avatar Mar 24 '22 11:03 destogl

Hello everyone, I would like to work on this one.

@destogl, just to make it clear, it is not necessary any changes in get_interface, right? Therefore, as a final result, we would have:

  • get_name() : returns full name of the interfaces <joint_name>/<interface_name>
  • get_interface_name() : returns interface name <interface_name>
  • get_prefix_name() : returns "joint" name (better is to call this prefix instead of joint) <joint_name>

Schulze18 avatar Apr 14 '22 21:04 Schulze18

Hello everyone, I would like to work on this one.

Yes, exactly, this should be the final solution. For the first implementation, we should probably deprecate get_full_name() method using get_name in the background.

@Schulze18 I will assign you for this than! Thanks! Please ask if you have any further questions!

destogl avatar Apr 20 '22 07:04 destogl

I have a few doubts. @destogl, to deprecate get_full_name(), I just made it return get_name() and replaced any occurrence to get_name(). Should I add any other comment or message to indicate it was deprecated?

Sorry, it is my first time going deep into the ros2 code. Do the classes ResourceStorage and ResourceManager inherit ReadOnlyHandle? There are many hardware.get_name() and component.get_name() that I am not sure if I need to change to .get_prefix_name().

Schulze18 avatar Apr 28 '22 21:04 Schulze18

@destogl , @bmagyar , can this issue be closed? Seems required codes are already in repo.

bailaC avatar Dec 21 '23 13:12 bailaC

Yup!

bmagyar avatar Dec 21 '23 19:12 bmagyar