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

Document behaviour changes introduced #1784 #1888

Merged
merged 3 commits into from
Feb 18, 2023

Conversation

arjo129
Copy link
Contributor

@arjo129 arjo129 commented Feb 9, 2023

🦟 Bug fix

Summary

The PR in #1784 claimed not to introduce behavior changes, but actually ended up introducing behavior changes. Specifically, it would break a lot of marine simulation code that runs on our tools. The issue in question is a matter of naming parameters. In the past <xUU> used to refer to the quadratic drag term in the diagonal axis. This term would be multiplied by the absolute velocity. After #1784 this term was multiplied by the velocity (no absolute). An equivalent term of <xUabsU> This behavior change likely breaks all previous maritime simulations that rely on our hydrodynamics plugin.

There are several options:

  1. Revert Adds support for hydrodynamic cross terms #1784
  2. Make <xUU> mirror <xUabsU>
  3. Document the change and mark it as breaking.

This PR goes with option 3 as there are already code bases using <xUabsU> nota tion instead of <xUU>. We also add a warning if someone does use the <xUU> term that points to this PR for details.

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.

@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Feb 9, 2023
@arjo129 arjo129 force-pushed the arjo/fix/HydrodynamicConventions branch from 7428125 to 1a94320 Compare February 9, 2023 02:24
@Sleipnir164
Copy link

Thank you, I changed xUU to xUabsU , same for y and z and everything behaves as it used to!

@ejalaa12
Copy link
Contributor

This is an important and good thing to document quickly.
I had to find (through the source code) that the new parameter to use are instead of .

This also begs the question: in which scenario would you need ? Basically, it would make the drag dependent on the direction of the movement. For example, in a forward movement, the drag slows down the link, but in a backward movement it would accelerate it. Which is weird, no?

Shouldn't the quadratic term always be multiplied the absolute velocity?

@arjo129
Copy link
Contributor Author

arjo129 commented Feb 17, 2023

@quarkytale @mabelzhang pinging again for ✔️ . We also should investigate why the tests didn't catch this (that can be a separate PR). To test simply run the example AUV world.

@quarkytale
Copy link
Contributor

I think tests aren't accounting for the range of weight typically the use-cases have. Lower weights might be preventing large translations.

@arjo129
Copy link
Contributor Author

arjo129 commented Feb 17, 2023

Lower weights might be preventing large translations

Doesn't quite make sense. Since F = ma won't smaller m lead to bigger a?

This also begs the question: in which scenario would you need ? Basically, it would make the drag dependent on the direction of the movement. For example, in a forward movement, the drag slows down the link, but in a backward movement it would accelerate it. Which is weird, no?

For diagonal terms this is true. Cross terms add forces due to motion in one axis along another axis.

@quarkytale
Copy link
Contributor

Well you are right. Refining that, the range of added mass and drag terms. The sim crashed for me when I had those values in range of 10^3 and more, less than that kept the sim running (but incorrect behavior of accelerating in backward motion). In the test's world we should probably have another model with higher values.

Copy link
Contributor

@quarkytale quarkytale left a comment

Choose a reason for hiding this comment

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

LGTM after minor formatting

src/systems/hydrodynamics/Hydrodynamics.cc Outdated Show resolved Hide resolved
Arjo Chakravarty and others added 3 commits February 17, 2023 23:52
The PR in #1784 claimed not to introduce behaviour changes,
but actually ended up introducing behaviour changes. Specifically,
it would break a lot of marine simulation code that runs on our tools.
The issue in question is a matter of naming parameters. In the past
`<xUU>` used to refer to the quadratic drag term in the diagonal axis.
This term would be multiplied by the absolute velocity. After #1784 this term
was multiplied by the velocity (no absolute). An equivalent term of `<xUabsU>`
This behaviour change likely breaks all previous maritime simulations that rely on our hydrodynamics plugin.

There are several options:
1. Revert #1784
2. Make `<xUU>` mirror `<xUabsU>`
3. Document the change and mark it as breaking.

This PR goes with option 3 as there are already code bases using `<xUabsU>` nota
tion instead of `<xUU>`. We also add a warning if someone does use the `<xUU>`
term that points to this PR for details.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@arjo129 arjo129 force-pushed the arjo/fix/HydrodynamicConventions branch from b48416a to 78e9e32 Compare February 17, 2023 23:53
@arjo129
Copy link
Contributor Author

arjo129 commented Feb 17, 2023

BTW Might be worth adding an assertion on the following line to check direction of motion.

EXPECT_LE(sphere1Vels[i].Z(), sphere2Vels[i].Z());

@arjo129 arjo129 enabled auto-merge (squash) February 18, 2023 00:49
@arjo129 arjo129 merged commit 29c13bf into ign-gazebo6 Feb 18, 2023
@arjo129 arjo129 deleted the arjo/fix/HydrodynamicConventions branch February 18, 2023 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants