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

1.10/joint.sdf: better default limit values #1112

Merged
merged 3 commits into from
Aug 17, 2022

Conversation

scpeters
Copy link
Member

🦟 Bug fix

Part of #169.

Summary

  • Use ±inf instead of ±1e16 for position limits
  • Use inf instead of -1 for effort, velocity limits

This will require a small change in gz-physics, as illustrated by the test failure in gazebosim/gz-physics#401.

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.

* Use `±inf` instead of `±1e16` for position limits
* Use `inf` instead of `-1` for effort, velocity limits

Signed-off-by: Steve Peters <[email protected]>
@codecov
Copy link

codecov bot commented Aug 16, 2022

Codecov Report

Merging #1112 (8223118) into sdf13 (12e9c1f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 8223118 differs from pull request most recent head 95b3963. Consider uploading reports for the commit 95b3963 to get more accurate results

@@           Coverage Diff           @@
##            sdf13    #1112   +/-   ##
=======================================
  Coverage   86.70%   86.71%           
=======================================
  Files         125      125           
  Lines       15890    15892    +2     
=======================================
+ Hits        13778    13781    +3     
+ Misses       2112     2111    -1     
Impacted Files Coverage Δ
src/JointAxis.cc 96.20% <100.00%> (+0.68%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

src/JointAxis.cc Outdated
this->dataPtr->upper = limitElement->Get<double>("upper", 1e16).first;
this->dataPtr->effort = limitElement->Get<double>("effort", -1).first;
const double kInf = std::numeric_limits<double>::infinity();
this->dataPtr->lower = limitElement->Get<double>("lower", -kInf).first;
Copy link
Contributor

Choose a reason for hiding this comment

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

You could pass the variable itself here as the default value, so if it ever changes again, it only needs to be changed on line 64, i.e.

Suggested change
this->dataPtr->lower = limitElement->Get<double>("lower", -kInf).first;
this->dataPtr->lower = limitElement->Get<double>("lower", this->dataPtr->lower).first;

Copy link
Member Author

Choose a reason for hiding this comment

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

I've deduplicated the default values used in JointAxis::Load in c7feca9

Signed-off-by: Steve Peters <[email protected]>
The use_parent_model_frame element has already been deprecated
and removed, so we can remove the internal variable.

Signed-off-by: Steve Peters <[email protected]>
@scpeters
Copy link
Member Author

while deduplicating some default value constants, I noticed an unused variable corresponding to the deprecated and removed use_parent_model_frame element, so I removed that as well in 95b3963

<description>Specifies the upper joint limit (radians for revolute joints, meters for prismatic joints). Omit if joint is continuous.</description>
</element>
<element name="effort" type="double" default="-1" required="0">
<element name="effort" type="double" default="inf" required="0">
Copy link
Collaborator

Choose a reason for hiding this comment

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

The description says "Limit is not enforced if value is negative". Something to
keep in mind when updating gz-physics.

Copy link
Member Author

Choose a reason for hiding this comment

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

this was already part of the behavior of the DOM object as of #357

@azeey
Copy link
Collaborator

azeey commented Aug 17, 2022

We'll also need to update sdformat-mjcf https://github.com/gazebosim/gz-mujoco/blob/fd5dec325052b0db93fadc88e667987d27bf378b/sdformat_mjcf/src/sdformat_mjcf/sdformat_to_mjcf/converters/joint.py#L29

@scpeters scpeters merged commit 1af61c9 into sdf13 Aug 17, 2022
@scpeters scpeters deleted the scpeters/joint_limit_better_defaults branch August 17, 2022 21:17
scpeters added a commit to gazebosim/gz-mujoco that referenced this pull request Aug 17, 2022
Follow up to gazebosim/sdformat#1112

Signed-off-by: Steve Peters <[email protected]>
@scpeters
Copy link
Member Author

azeey pushed a commit to gazebosim/gz-mujoco that referenced this pull request Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants