Skip to content

Fix 6DOF arm example #804

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

Merged
merged 5 commits into from
May 18, 2025

Conversation

sea-bass
Copy link
Contributor

@sea-bass sea-bass commented May 11, 2025

Thanks to debugging by @catarina-p and myself, we found issues with the 6DOF arm example.

Turns out the controller kept extrapolating forever past the final point, meaning that instead of slowing down from positive to zero velocity, the velocities kept going negative further and further.

Before this fix:
https://github.com/user-attachments/assets/af815279-818a-4922-837d-94b0208035cc

After this fix:
https://github.com/user-attachments/assets/70f4796e-38e1-4ba5-b2f2-5e402c324f2c

I also did some cleanup of the trajectory time calculations since the final point's time was not exactly 3.0 as expected.

Edit: As a side note, I am somewhat surprised that this example doesn't just use the regular joint trajectory controller that is already available in ros2_control. Although it's a nice example for people writing their own controllers.

@sea-bass
Copy link
Contributor Author

@mikelikesrobots did you run into this in your recent tutorial BTW? This is how we found this issue...

Copy link
Contributor

@mikelikesrobots mikelikesrobots left a comment

Choose a reason for hiding this comment

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

The changes to the trajectory controller make sense, and the code to set the time I think is simpler. Nice!

@mikelikesrobots
Copy link
Contributor

@mikelikesrobots did you run into this in your recent tutorial BTW? This is how we found this issue...

I didn't run into this at all! The issue I had was that it didn't always receive the trajectory, or it ignored it. When it did receive the trajectory, it did a perfect circle. Your code changes do point out an issue, though.

@sea-bass
Copy link
Contributor Author

sea-bass commented May 17, 2025

The issue I had was that it didn't always receive the trajectory, or it ignored it. When it did receive the trajectory, it did a perfect circle. Your code changes do point out an issue, though.

... and I didn't see that myself. I am using Cyclone DDS instead of the default. Maybe give this a quick try on your end to see if that could be the difference?

@sea-bass sea-bass requested a review from mikelikesrobots May 17, 2025 13:56
Copy link
Contributor

@mikelikesrobots mikelikesrobots left a comment

Choose a reason for hiding this comment

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

Only 1 nit, LGTM. Ofc I'm not a maintainer so my approval doesn't actually help you!

@christophfroehlich
Copy link
Contributor

Only 1 nit, LGTM. Ofc I'm not a maintainer so my approval doesn't actually help you!

it does ;)

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

The changes LGTM

Thank you for the changes @sea-bass
Thanks for your review and follow-up @mikelikesrobots

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

The changes LGTM. I had problems in my local dev environment (see #805), but @saikishor confirmed that it works so let's go ahead

@christophfroehlich christophfroehlich merged commit 1dc20c1 into ros-controls:master May 18, 2025
11 of 13 checks passed
mergify bot pushed a commit that referenced this pull request May 18, 2025
(cherry picked from commit 1dc20c1)

# Conflicts:
#	example_7/controller/r6bot_controller.cpp
#	example_7/reference_generator/send_trajectory.cpp
christophfroehlich pushed a commit that referenced this pull request May 18, 2025
christophfroehlich added a commit that referenced this pull request May 18, 2025
* Backport changes from #623

* Backport changes from #753

* Fix 6DOF arm example (#804)

* Revert changes to handles

---------

Co-authored-by: Christoph Froehlich <[email protected]>
Co-authored-by: Sebastian Castro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants