gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
719 stars 272 forks source link

apply_joint_force: Simplified using ComponentDefault #2630

Open peci1 opened 2 months ago

peci1 commented 2 months ago

🦟 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

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.