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

apply_joint_force: Simplified using ComponentDefault #2630

Open
wants to merge 1 commit into
base: gz-sim9
Choose a base branch
from

Conversation

peci1
Copy link
Contributor

@peci1 peci1 commented Sep 16, 2024

🦟 Bug fix

Summary

ComponentDefault has been added quite some time ago. I've noticed the JointForceCmd component tutorial still uses the cumbersome if (component == null) CreateComponent() approach.

This PR modernizes it to use ComponentDefault and modernizes the accompanying tutorial as well.

I've compile- and run-tested this change and it seems everything works as it should.

Checklist

  • Signed all commits for DCO
  • Added tests
  • 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: Martin Pecka <peci1@seznam.cz>
@@ -156,23 +156,14 @@ void ApplyJointForce::PreUpdate(const UpdateInfo &_info,

// Update joint force
//! [jointForceComponent]
auto force = _ecm.Component<components::JointForceCmd>(
this->dataPtr->jointEntity);
auto force = _ecm.ComponentDefault<components::JointForceCmd>(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather not make this kind of change in a code freeze. We can merge this after Ionic is released

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

2 participants