Skip to content

RSDK-10771: Constraint violation error too verbose #5069

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

e-ikwut
Copy link
Member

@e-ikwut e-ikwut commented Jun 18, 2025

This PR sets a cutoff of 10%, printing all errors if none exceed cutoff, otherwise only those above the cutoff.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Emiyare Ikwut-Ukwa seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Emiyare Ikwut-Ukwa seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jun 18, 2025
@raybjork raybjork removed the request for review from biotinker June 18, 2025 20:23
@@ -46,8 +46,13 @@ func newIKConstraintErr(failures map[string]int, constraintFailCnt int) error {

// build the error message
errMsg := errIKConstraint
cutoffPercent := 10.0
Copy link
Member

Choose a reason for hiding this comment

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

Const magic numbers like this should go at the top of the file

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 18, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 18, 2025
"self-collision constraint: violation between gripper-1:clamp and ur5e-modular:wrist_1_link geometries": 97,
}

//nolint:lll
Copy link
Member

Choose a reason for hiding this comment

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

we shouldn't ignore the linter unless its actually necessary. In this case we can break the long line up over multiple lines. We allow it to go up to 140 which should be plenty.

Same comment on line 30

Copy link
Member

Choose a reason for hiding this comment

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

I thought about making this comment but it occurred to me that this is a single error message string longer than 140, so to get rid of the nolint would require just splitting the string and +ing them which feels awkward and annoying just to avoid a nolint.

}

//nolint:lll
expectedError := errors.New("all IK solutions failed constraints. Failures: { self-collision constraint: violation between gripper-1:clamp and ur5e-modular:forearm_link geometries: 2.91% }, { self-collision constraint: violation between gripper-1:clamp and ur5e-modular:wrist_1_link geometries: 0.97% }, ")
Copy link
Member

Choose a reason for hiding this comment

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

This is less feedback on this particular PR and more good practice going forward: tests with very specific strings or floating point numbers end up being pretty fragile since small changes can cause them to fail. Typically I would try to write tests to be less hardcoded, but in this case what you are testing is there error itself. So I don't think theres any improvements you can make here

Copy link
Member

@raybjork raybjork left a comment

Choose a reason for hiding this comment

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

Lets not ignore the linter, otherwise looks good

Copy link
Member

@nfranczak nfranczak left a comment

Choose a reason for hiding this comment

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

🚀, just need to remove //nolint:lll and have CI pass.
Nice work!

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants