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

Allow re-attaching detached joint #1687

Merged
merged 27 commits into from
Jun 5, 2023
Merged

Allow re-attaching detached joint #1687

merged 27 commits into from
Jun 5, 2023

Conversation

liamhan0905
Copy link
Collaborator

@liamhan0905 liamhan0905 commented Sep 3, 2022

Signed-off-by: Liam Han liam@openrobotics.org
🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

🎉 New feature

Summary

Extending the feature for detachable_joint plugin to support re-attaching the joint again. By publishing to a topic, the child link can be easily reattached with a fixed joint to its parent link. The demo below shows detaching and reattaching B1 and B2 models.

This PR needs to be addressed after this current PR

re-attach.webm

Once detached, it can be useful to move the child model to a desired position through a service call and then reattach the joint. The demo below shows detaching the B1 model, moving to a desired location, and then re-attaching the joint.

attach+reset.webm

Test it

checkout this branch and build it. To run the test, run the following command in gz workspace.

./build/ignition-gazebo6/bin/INTEGRATION_detachable_joint

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: Liam Han <liam@openrobotics.org>
Signed-off-by: Liam Han <liam@openrobotics.org>
@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Sep 3, 2022
@liamhan0905 liamhan0905 changed the title Liam/add attachable Allow re-attaching detached joint Sep 3, 2022
@liamhan0905 liamhan0905 added the enhancement New feature or request label Sep 3, 2022
Signed-off-by: Liam Han <liam@openrobotics.org>
@codecov
Copy link

codecov bot commented Sep 3, 2022

Codecov Report

Merging #1687 (87764b9) into ign-gazebo6 (e37ff8f) will decrease coverage by 0.02%.
The diff coverage is 66.66%.

❗ Current head 87764b9 differs from pull request most recent head 5bf2a93. Consider uploading reports for the commit 5bf2a93 to get more accurate results

@@               Coverage Diff               @@
##           ign-gazebo6    #1687      +/-   ##
===============================================
- Coverage        65.38%   65.37%   -0.02%     
===============================================
  Files              327      327              
  Lines            26932    26996      +64     
===============================================
+ Hits             17610    17649      +39     
- Misses            9322     9347      +25     
Impacted Files Coverage Δ
src/systems/detachable_joint/DetachableJoint.hh 100.00% <ø> (ø)
src/systems/detachable_joint/DetachableJoint.cc 66.18% <66.66%> (-4.48%) ⬇️

... and 2 files with indirect coverage changes

Signed-off-by: Liam Han <liam@openrobotics.org>
test/integration/detachable_joint.cc Outdated Show resolved Hide resolved
…ment

Signed-off-by: Liam Han <liam@openrobotics.org>
@bperseghetti
Copy link
Member

This looks like a really great new feature add.

…ment.

Signed-off-by: Liam Han <liam@openrobotics.org>
Signed-off-by: Liam Han <liam@openrobotics.org>
Signed-off-by: Liam Han <liam@openrobotics.org>
Signed-off-by: Liam Han <liam@openrobotics.org>
… detachable joint plugin in a single model requires detach_topic, attach_topic, and output_topic to control invididual child model

Signed-off-by: Liam Han <liam@openrobotics.org>
…etached respectively

Signed-off-by: Liam Han <liam@openrobotics.org>
Signed-off-by: Liam Han <liam@openrobotics.org>
… README

Signed-off-by: Liam Han <liam@openrobotics.org>
@liamhan0905
Copy link
Collaborator Author

liamhan0905 commented Oct 4, 2022

[STATUS]

  • ready for review
  • created a new PR that changes the <topic> tag to <detach_topic> tag

[QUESTIONS]

  • currently I'm using ingition.msgs.StringMsg to publish the state of the joint, e.g. whether it is detached or attached. These states can be useful to subscribe. I wanted to initially use ignition.msgs.Boolean but since false value can't be used, I decided to use StringMsg type. Let me know if you have any good suggestions

Signed-off-by: Liam Han <liam@openrobotics.org>
ahcorde
ahcorde previously requested changes Oct 5, 2022
src/systems/detachable_joint/DetachableJoint.hh Outdated Show resolved Hide resolved
@liamhan0905
Copy link
Collaborator Author

@ahcorde thanks for the feedback. Left some comments and addressed other things

  • rename ignition -> gazebo
  • consolidated the other minor PR into this PR
    ready for another review

…on->gazebo

Signed-off-by: Liam Han <liam@openrobotics.org>
@liamhan0905
Copy link
Collaborator Author

liamhan0905 commented Nov 11, 2022

Note to self:

Just occurred to me that this will potentially have a backwards compatibility issue with <topic> tag being switched to <detach_topic> tag. I'll address this by 11/14/22

Update:
Addressed

…updated <detach_topic> tag.

Signed-off-by: Liam Han <liam@openrobotics.org>
@azeey azeey requested a review from ahcorde November 21, 2022 20:00
@azeey azeey self-requested a review February 13, 2023 19:50
@jrutgeer
Copy link
Contributor

@liamhan0905

I wanted to initially use ignition.msgs.Boolean but since false value can't be used, I decided to use StringMsg type.

What do you mean with "false can't be used"?

@liamhan0905
Copy link
Collaborator Author

liamhan0905 commented Apr 6, 2023

@jrutgeer
If you check this link, it states

Note that for scalar message fields, once a message is parsed there’s no way of telling whether a field was explicitly set to the default value (for example whether a boolean was set to false) or just not set at all: you should bear this in mind when defining your message types. For example, don’t have a boolean that switches on some behavior when set to false if you don’t want that behavior to also happen by default. Also note that if a scalar message field is set to its default, the value will not be serialized on the wire.

Hence, the boolean false can't be used to check the state. That's why I resorted to using stringMsg type. But there's probably a better way of tackling things like this. Open for suggestions!

Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

This looks great! I just have a few minor comments. The main issue is what we should do about <topic>.

src/systems/detachable_joint/DetachableJoint.cc Outdated Show resolved Hide resolved
src/systems/detachable_joint/DetachableJoint.cc Outdated Show resolved Hide resolved
src/systems/detachable_joint/DetachableJoint.cc Outdated Show resolved Hide resolved
src/systems/detachable_joint/DetachableJoint.cc Outdated Show resolved Hide resolved
src/systems/detachable_joint/DetachableJoint.cc Outdated Show resolved Hide resolved
src/systems/detachable_joint/DetachableJoint.hh Outdated Show resolved Hide resolved
test/integration/detachable_joint.cc Outdated Show resolved Hide resolved
@liamhan0905

This comment was marked as resolved.

Signed-off-by: Liam Han <liamhan0905@gmail.com>
Signed-off-by: Liam Han <liamhan0905@gmail.com>
Signed-off-by: Liam Han <liamhan0905@gmail.com>
…any warnings in this version

Signed-off-by: Liam Han <liamhan0905@gmail.com>
Signed-off-by: Liam Han <liamhan0905@gmail.com>
Signed-off-by: Liam Han <liamhan0905@gmail.com>
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Just minor comments. The tutorial mentions that objects should not be in contact in their initial (attached) state. I think we should emphasize this more now that we allow attaching detached joints. In the detachable_joint.sdf example, if you do the following in sequence you will get a crash:

ign topic -t "/model/vehicle_blue/cmd_vel" -m ignition.msgs.Twist -p "linear: {x: -0.25}"
ign topic -t "/B1/detach" -m ignition.msgs.Empty -p "unused: true"
# wait a couple seconds until the vehicle starts dragging B1.
ign topic -t "/B1/attach" -m ignition.msgs.Empty -p "unused: true"

examples/worlds/detachable_joint.sdf Outdated Show resolved Hide resolved
tutorials/detachable_joints.md Show resolved Hide resolved
@liamhan0905
Copy link
Collaborator Author

liamhan0905 commented May 24, 2023

I added some comments regarding reattaching while the child and parent models are in contact but let me know if you'd prefer more explanation or any clarification shown here. I didn't try this before so this was a mild surprise haha

Signed-off-by: Liam Han <liamhan0905@gmail.com>
@azeey
Copy link
Contributor

azeey commented May 24, 2023

This looks ready to me. @ahcorde any remaining issues?

@azeey azeey dismissed ahcorde’s stale review June 5, 2023 17:46

All comments have been addressed

@azeey azeey merged commit 568c026 into ign-gazebo6 Jun 5, 2023
@azeey azeey deleted the liam/add-attachable branch June 5, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🏯 fortress Ignition Fortress
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants