-
Notifications
You must be signed in to change notification settings - Fork 286
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
Joint can't recover from position limits in servo mode #1683
Comments
Hello @jslee02!, is anyone working on this? I can start working on this if no one is on it. |
Also posted to gazebosim/gz-sim#1684 (comment) The following patch diff --git a/dart/constraint/JointConstraint.cpp b/dart/constraint/JointConstraint.cpp
index faa072d8f21a..bf032f0ffb2a 100644
--- a/dart/constraint/JointConstraint.cpp
+++ b/dart/constraint/JointConstraint.cpp
@@ -238,7 +238,7 @@ void JointConstraint::update()
// the position error.
const double C1 = mErrorAllowance * A1;
- double bouncing_vel = -std::max(B1, C1) / timeStep;
+ double bouncing_vel = -std::min(B1, C1) / timeStep;
assert(bouncing_vel >= 0);
bouncing_vel = std::min(bouncing_vel, mMaxErrorReductionVelocity);
@@ -280,7 +280,7 @@ void JointConstraint::update()
// the position error.
const double C2 = mErrorAllowance * A2;
- double bouncing_vel = -std::min(B2, C2) / timeStep;
+ double bouncing_vel = -std::max(B2, C2) / timeStep;
assert(bouncing_vel <= 0);
bouncing_vel = std::max(bouncing_vel, -mMaxErrorReductionVelocity);
Without this change |
Thank you for the fix, @azeey! Feel free to submit a PR when you have a chance. Alternatively, I could make one as well. Either way works for me. |
The CI tests have passed. I'm going to assume that the change doesn't have a negative impact and will resolve this issue, so I'm closing it. Feel free to reopen if necessary. Thanks! |
Bug Report
Environment
DART version: 6.13 - main branch built from source on commit 189e24d
OS name and version name(or number): Ubuntu 22.04
Compiler name and version number: GCC 11.3.0
Description
I still experience similar problem to #1583 when the axis of rotation is z (e.g.
<xyz>0 0 1</xyz>
).The problem is that the joint, once hits the limit and then can't recover from it.
Related issues and PRs:
I changed the sdf a bit (
/home/lovro/tmp/dart/data/sdf/test/test.sdf
):Testing example:
If I change the axis of the revolute joint to
<xyz>0 1 0</xyz>
or<xyz>1 0 0</xyz>
I get good results:When I use
<xyz>0 0 1</xyz>
z axis as rotation axis of the joint I get following:I also played with changing the gravity direction, and as I move gravity from z to y axis, both of them stop working. If I move gravity to x axis, then the example can't recover from the joint limits on any axis.
The text was updated successfully, but these errors were encountered: