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

How to add button states? #3

Closed
CarlDegio opened this issue Jan 10, 2023 · 4 comments
Closed

How to add button states? #3

CarlDegio opened this issue Jan 10, 2023 · 4 comments

Comments

@CarlDegio
Copy link
Contributor

I want to use Omega button states to switch movement boundary. I tried some way but still don't work. I would like to ask if you have a better method.

Attached my attempts:

  1. Initially, I want to put button states under current ros2 control framework by treating it as fourth joint. Add a button joint in urdf, and add it in fd_controllers.yaml. Read hardware data in fd_effort_hi.cpp. Publish button joint position in state interface of ee_pose_broadcaster.cpp. However, the problem occured at load joints. [ERROR] joint 'button' don't have effort command. I found changing fd.r2c_hardware.xacro may be helpful. But this could destroy the command dimension so I decide to seek another way. But in the end this might be the way to get close to the truth

  2. I design another node to read button data. But the function dhdOpen() seems can't be executed twice.

@mcbed
Copy link
Member

mcbed commented Jan 27, 2023

Hi @CarlDegio , the cleanest and I think most efficient way of doing so is to set up a GPIO component in ros2_control that will handle the button and add it into the hardware. By doing so you just need to add it to the ros2_control urdf and you can read from it either using the joint_state_broadcaster on the /dynamic_joint_states topic or by creating you dedicated broadcaster.

If you need some help to do it, juste create a PR and I can give you a hand.

@CarlDegio
Copy link
Contributor Author

Thank you! I just know the GPIO type of ros2_control. I will try it and seek for help if there are problems。

@CarlDegio
Copy link
Contributor Author

I add GPIO states successfully. But I only have Omega.3 device, which only has one button, so I only add id 0 button in code. My change at: #4

@tpoignonec
Copy link
Member

tpoignonec commented Jan 8, 2024

FYI, this code has been added to the main branch (humble), see PR #15.

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

No branches or pull requests

3 participants