Stop link transform drift on repeated SetDOFValues with bodyTransform#1555
Stop link transform drift on repeated SetDOFValues with bodyTransform#1555Puttichai wants to merge 5 commits into
Conversation
…sform (cherry picked from commit e1882aa)
| // tapply to every link (including link[0]) lets link[0] absorb the same epsilon, so the next | ||
| // call's tapply is approximately (identity - epsilon) and the drift cancels rather than | ||
| // compounds. For DOF>0 bodies the subsequent SetDOFValues recomputes link transforms via FK | ||
| // and overwrites this loop's output, so the change only affects 0-DOF multi-link bodies. |
There was a problem hiding this comment.
// For DOF>0 bodies the subsequent SetDOFValues recomputes link transforms via FK and overwrites this loop's output, so the change only affects 0-DOF multi-link bodies.
I think "the change" may make sense in the PR context where we are seeing old and new code side-by-side. However, once merged into production, this comment may not be clear what "the cahnge" refers to. Can you rephrase to something which makes sense without knowing the old code?
There was a problem hiding this comment.
Thank you for checking. I updated the comment.
|
Thanks, looks good to me. |
|
To tell you the truth, it looks like |
|
@rdiankov Yes, and that's also noted in the description.
Yes. You can find an example on the issue page https://tiny.mujin.co.jp/iqggf |
Summary
KinBody::SetDOFValues(joints, bodyTransform, checklimits)previously setlink[0]tobaseLinkTransformdirectly and then propagated a relativetbase = baseLinkTransform * link[0].inverse()tolink[i > 0]. Becauselink[0]was always exact,tbasecarried the same FP epsilon on every call and that epsilon was re-applied tolink[i > 0]each time, so link transforms drift on repeated identical calls, including the no-op case where the same values are passed back in.This affects callers that round-trip configuration values for a body, notably
SetConfigurationValuesand any environment-synchronization path that mirrors a body's state into a clone every cycle. The drift is small per call but compounds.The fix delegates to
_SetTransformNoPostProcess, which applies the sametapplyto all links includinglink[0].Link[0]then absorbs the same epsilon as the other links, so on the next calltapply ~ I − epsilonand the drift cancels rather than compounds.Notes
DOF > 0bodies,link[0]is no longer set tobaseLinkTransformexactly (it now goes throughtapply * link[0]_old, picking up one ULP). The error is bounded (that is, it does not compound) and the subsequentSetDOFValues(vJointValues, checklimits)recomputeslink[i>0]via forward kinematics.Related links